From d194ab8b602982d60f48c529518856b8a831acdc Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 2 Jan 2023 17:53:26 +0300 Subject: [PATCH 001/110] Remove `NonFungibleAddress` derivations --- docs-examples-generator/src/examples.rs | 113 +++++++++--------- docs-examples-generator/src/main.rs | 4 +- ...ungible_address_from_public_key_request.rs | 84 ------------- .../derive_non_fungible_address_request.rs | 87 -------------- radix-engine-toolkit-core/src/requests/mod.rs | 4 - radix-engine-toolkit-jni/src/lib.rs | 5 - radix-engine-toolkit-native/src/lib.rs | 5 - radix-engine-toolkit-wasm/src/lib.rs | 5 - .../tests/transaction_library.rs | 2 - 9 files changed, 57 insertions(+), 252 deletions(-) delete mode 100644 radix-engine-toolkit-core/src/requests/derive_non_fungible_address_from_public_key_request.rs delete mode 100644 radix-engine-toolkit-core/src/requests/derive_non_fungible_address_request.rs diff --git a/docs-examples-generator/src/examples.rs b/docs-examples-generator/src/examples.rs index 0541297e..cc0e1f18 100644 --- a/docs-examples-generator/src/examples.rs +++ b/docs-examples-generator/src/examples.rs @@ -1,5 +1,5 @@ use radix_engine_toolkit_core::{ - model::{Bech32Coder, Value, ValueKind, NetworkAwareResourceAddress}, + model::{Bech32Coder, Value, ValueKind}, requests::*, traits::{Request, TryIntoWithContext, Validate}, }; @@ -197,7 +197,16 @@ where } fn example_request() -> Self { - Self { transaction_intent: NOTARIZED_TRANSACTION.signed_intent.intent.clone().try_into_with_context(radix_engine_toolkit_core::model::ManifestInstructionsKind::String).unwrap() } + Self { + transaction_intent: NOTARIZED_TRANSACTION + .signed_intent + .intent + .clone() + .try_into_with_context( + radix_engine_toolkit_core::model::ManifestInstructionsKind::String, + ) + .unwrap(), + } } } @@ -211,10 +220,12 @@ where } fn example_request() -> Self { - let compiled_transaction_intent = scrypto_encode(&NOTARIZED_TRANSACTION.signed_intent.intent).unwrap(); + let compiled_transaction_intent = + scrypto_encode(&NOTARIZED_TRANSACTION.signed_intent.intent).unwrap(); Self { compiled_intent: compiled_transaction_intent, - manifest_instructions_output_format: radix_engine_toolkit_core::model::ManifestInstructionsKind::JSON + manifest_instructions_output_format: + radix_engine_toolkit_core::model::ManifestInstructionsKind::JSON, } } } @@ -229,7 +240,15 @@ where } fn example_request() -> Self { - Self { signed_intent: NOTARIZED_TRANSACTION.signed_intent.clone().try_into_with_context(radix_engine_toolkit_core::model::ManifestInstructionsKind::String).unwrap() } + Self { + signed_intent: NOTARIZED_TRANSACTION + .signed_intent + .clone() + .try_into_with_context( + radix_engine_toolkit_core::model::ManifestInstructionsKind::String, + ) + .unwrap(), + } } } @@ -243,10 +262,12 @@ where } fn example_request() -> Self { - let compiled_transaction_intent = scrypto_encode(&NOTARIZED_TRANSACTION.signed_intent).unwrap(); + let compiled_transaction_intent = + scrypto_encode(&NOTARIZED_TRANSACTION.signed_intent).unwrap(); Self { compiled_signed_intent: compiled_transaction_intent, - manifest_instructions_output_format: radix_engine_toolkit_core::model::ManifestInstructionsKind::JSON + manifest_instructions_output_format: + radix_engine_toolkit_core::model::ManifestInstructionsKind::JSON, } } } @@ -261,7 +282,14 @@ where } fn example_request() -> Self { - Self { notarized_transaction: NOTARIZED_TRANSACTION.clone().try_into_with_context(radix_engine_toolkit_core::model::ManifestInstructionsKind::String).unwrap() } + Self { + notarized_transaction: NOTARIZED_TRANSACTION + .clone() + .try_into_with_context( + radix_engine_toolkit_core::model::ManifestInstructionsKind::String, + ) + .unwrap(), + } } } @@ -278,7 +306,8 @@ where let compiled_transaction_intent = scrypto_encode(&*NOTARIZED_TRANSACTION).unwrap(); Self { compiled_notarized_intent: compiled_transaction_intent, - manifest_instructions_output_format: radix_engine_toolkit_core::model::ManifestInstructionsKind::JSON + manifest_instructions_output_format: + radix_engine_toolkit_core::model::ManifestInstructionsKind::JSON, } } } @@ -296,7 +325,8 @@ where let compiled_transaction_intent = scrypto_encode(&*NOTARIZED_TRANSACTION).unwrap(); Self { compiled_unknown_intent: compiled_transaction_intent, - manifest_instructions_output_format: radix_engine_toolkit_core::model::ManifestInstructionsKind::JSON + manifest_instructions_output_format: + radix_engine_toolkit_core::model::ManifestInstructionsKind::JSON, } } } @@ -311,9 +341,11 @@ where } fn example_request() -> Self { - Self { - 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 + Self { + 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, } } } @@ -328,8 +360,8 @@ where } fn example_request() -> Self { - Self { - address: "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqd60rqz".into() + Self { + address: "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqd60rqz".into(), } } } @@ -344,8 +376,8 @@ where } fn example_request() -> Self { - Self { - value: (*VALUE).clone() + Self { + value: (*VALUE).clone(), } } } @@ -362,44 +394,7 @@ where fn example_request() -> Self { Self { encoded_value: (*VALUE).encode().unwrap(), - network_id: 0xf2 - } - } -} - -impl<'a, R> RequestExample<'a, R> for DeriveNonFungibleAddressFromPublicKeyRequest -where - DeriveNonFungibleAddressFromPublicKeyRequest: Request<'a, R>, - R: Serialize + Validate, -{ - fn description() -> String { - r#"This function derives the `NonFungibleAddress` of the virtual badge associated with a given public key."#.to_owned() - } - - fn example_request() -> Self { - Self { - public_key: NOTARY_PRIVATE_KEY.public_key().into(), - network_id: 0xf2 - } - } -} - -impl<'a, R> RequestExample<'a, R> for DeriveNonFungibleAddressRequest -where - DeriveNonFungibleAddressRequest: Request<'a, R>, - R: Serialize + Validate, -{ - fn description() -> String { - r#"Given a ResourceAddress and a NonFungibleId, this function is able to derive the NonFungibleAddress corresponding to a specific NonFungible."#.to_owned() - } - - fn example_request() -> Self { - Self { - resource_address: NetworkAwareResourceAddress { - address: RADIX_TOKEN, - network_id: 0xf2 - }, - non_fungible_id: NonFungibleId::U64(192) + network_id: 0xf2, } } } @@ -410,10 +405,14 @@ where R: Serialize + Validate, { fn description() -> String { - r#"Derives the virtual account component address given a public key and a network id."#.to_owned() + r#"Derives the virtual account component address given a public key and a network id."# + .to_owned() } fn example_request() -> Self { - Self { network_id: 0xf2, public_key: NOTARY_PRIVATE_KEY.public_key().into() } + Self { + network_id: 0xf2, + public_key: NOTARY_PRIVATE_KEY.public_key().into(), + } } } diff --git a/docs-examples-generator/src/main.rs b/docs-examples-generator/src/main.rs index 1f038199..12150bca 100644 --- a/docs-examples-generator/src/main.rs +++ b/docs-examples-generator/src/main.rs @@ -1,8 +1,8 @@ #![macro_use] extern crate lazy_static; -mod examples_builder; mod examples; +mod examples_builder; use std::fs; @@ -23,8 +23,6 @@ fn main() { .add_example::<'_, DecodeAddressRequest, DecodeAddressResponse>() .add_example::<'_, SBOREncodeRequest, SBOREncodeResponse>() .add_example::<'_, SBORDecodeRequest, SBORDecodeResponse>() - .add_example::<'_, DeriveNonFungibleAddressRequest, DeriveNonFungibleAddressResponse>() - .add_example::<'_, DeriveNonFungibleAddressFromPublicKeyRequest, DeriveNonFungibleAddressFromPublicKeyResponse>() .add_example::<'_, DeriveVirtualAccountAddressRequest, DeriveVirtualAccountAddressResponse>() .build(); fs::write("./request-examples.md", examples).unwrap(); diff --git a/radix-engine-toolkit-core/src/requests/derive_non_fungible_address_from_public_key_request.rs b/radix-engine-toolkit-core/src/requests/derive_non_fungible_address_from_public_key_request.rs deleted file mode 100644 index b00878a0..00000000 --- a/radix-engine-toolkit-core/src/requests/derive_non_fungible_address_from_public_key_request.rs +++ /dev/null @@ -1,84 +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::helper::ValueSerializationProxy; -use crate::model::NonFungibleAddress; -use crate::traits::{Request, Validate}; - -use scrypto::prelude::PublicKey; -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -// ========================== -// Request & Response Models -// ========================== - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DeriveNonFungibleAddressFromPublicKeyRequest { - pub public_key: PublicKey, - pub network_id: u8, -} - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DeriveNonFungibleAddressFromPublicKeyResponse { - #[serde_as(as = "ValueSerializationProxy")] - pub non_fungible_address: NonFungibleAddress, -} - -// =========== -// Validation -// =========== - -impl Validate for DeriveNonFungibleAddressFromPublicKeyRequest { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -impl Validate for DeriveNonFungibleAddressFromPublicKeyResponse { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, DeriveNonFungibleAddressFromPublicKeyResponse> - for DeriveNonFungibleAddressFromPublicKeyRequest -{ - fn handle_request(self) -> Result { - let non_fungible_address = - NonFungibleAddress::from_public_key(&self.public_key, self.network_id); - - Ok(DeriveNonFungibleAddressFromPublicKeyResponse { - non_fungible_address, - }) - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - // TODO: Unit tests for this request type -} diff --git a/radix-engine-toolkit-core/src/requests/derive_non_fungible_address_request.rs b/radix-engine-toolkit-core/src/requests/derive_non_fungible_address_request.rs deleted file mode 100644 index 163d25a7..00000000 --- a/radix-engine-toolkit-core/src/requests/derive_non_fungible_address_request.rs +++ /dev/null @@ -1,87 +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::NetworkAwareResourceAddress; -use crate::model::helper::ValueSerializationProxy; -use crate::model::NonFungibleAddress; -use crate::traits::{Request, Validate}; - -use scrypto::prelude::NonFungibleId; -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -// ========================== -// Request & Response Models -// ========================== - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DeriveNonFungibleAddressRequest { - #[serde_as(as = "ValueSerializationProxy")] - pub resource_address: NetworkAwareResourceAddress, - - #[serde_as(as = "ValueSerializationProxy")] - pub non_fungible_id: NonFungibleId, -} - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DeriveNonFungibleAddressResponse { - #[serde_as(as = "ValueSerializationProxy")] - pub non_fungible_address: NonFungibleAddress, -} - -// =========== -// Validation -// =========== - -impl Validate for DeriveNonFungibleAddressRequest { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -impl Validate for DeriveNonFungibleAddressResponse { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, DeriveNonFungibleAddressResponse> for DeriveNonFungibleAddressRequest { - fn handle_request(self) -> Result { - let non_fungible_address = - NonFungibleAddress::new(self.resource_address, self.non_fungible_id); - - Ok(DeriveNonFungibleAddressResponse { - non_fungible_address, - }) - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - // TODO: Unit tests for this request type -} diff --git a/radix-engine-toolkit-core/src/requests/mod.rs b/radix-engine-toolkit-core/src/requests/mod.rs index 2f69059f..5c711b61 100644 --- a/radix-engine-toolkit-core/src/requests/mod.rs +++ b/radix-engine-toolkit-core/src/requests/mod.rs @@ -36,8 +36,6 @@ pub mod encode_address_request; pub mod sbor_decode_request; pub mod sbor_encode_request; -pub mod derive_non_fungible_address_from_public_key_request; -pub mod derive_non_fungible_address_request; pub mod derive_virtual_account_address; pub use compile_notarized_transaction_intent_request::*; @@ -49,8 +47,6 @@ pub use decompile_notarized_transaction_intent_request::*; pub use decompile_signed_transaction_intent_request::*; pub use decompile_transaction_intent_request::*; pub use decompile_unknown_transaction_intent_request::*; -pub use derive_non_fungible_address_from_public_key_request::*; -pub use derive_non_fungible_address_request::*; pub use derive_virtual_account_address::*; pub use encode_address_request::*; pub use information_request::*; diff --git a/radix-engine-toolkit-jni/src/lib.rs b/radix-engine-toolkit-jni/src/lib.rs index 024b1543..2d0dd640 100644 --- a/radix-engine-toolkit-jni/src/lib.rs +++ b/radix-engine-toolkit-jni/src/lib.rs @@ -81,11 +81,6 @@ export_request!(DecompileSignedTransactionIntentRequest as decompileSignedTransa export_request!(DecompileNotarizedTransactionIntentRequest as decompileNotarizedTransactionIntent); export_request!(DecompileUnknownTransactionIntentRequest as decompileUnknownTransactionIntent); -export_request!(DeriveNonFungibleAddressRequest as deriveNonFungibleAddress); -export_request!( - DeriveNonFungibleAddressFromPublicKeyRequest as deriveNonFungibleAddressFromPublicKey -); - export_request!(DeriveVirtualAccountAddressRequest as deriveVirtualAccountAddress); export_request!(EncodeAddressRequest as encodeAddress); diff --git a/radix-engine-toolkit-native/src/lib.rs b/radix-engine-toolkit-native/src/lib.rs index ba5fa523..f3196a2a 100644 --- a/radix-engine-toolkit-native/src/lib.rs +++ b/radix-engine-toolkit-native/src/lib.rs @@ -78,11 +78,6 @@ export_request!( ); export_request!(DecompileUnknownTransactionIntentRequest as decompile_unknown_transaction_intent); -export_request!(DeriveNonFungibleAddressRequest as derive_non_fungible_address); -export_request!( - DeriveNonFungibleAddressFromPublicKeyRequest as derive_non_fungible_address_from_public_key -); - export_request!(DeriveVirtualAccountAddressRequest as derive_virtual_account_address); export_request!(EncodeAddressRequest as encode_address); diff --git a/radix-engine-toolkit-wasm/src/lib.rs b/radix-engine-toolkit-wasm/src/lib.rs index 66103672..5a53c373 100644 --- a/radix-engine-toolkit-wasm/src/lib.rs +++ b/radix-engine-toolkit-wasm/src/lib.rs @@ -80,11 +80,6 @@ export_request!( ); export_request!(DecompileUnknownTransactionIntentRequest as decompile_unknown_transaction_intent); -export_request!(DeriveNonFungibleAddressRequest as derive_non_fungible_address); -export_request!( - DeriveNonFungibleAddressFromPublicKeyRequest as derive_non_fungible_address_from_public_key -); - export_request!(DeriveVirtualAccountAddressRequest as derive_virtual_account_address); export_request!(EncodeAddressRequest as encode_address); diff --git a/radix-engine-toolkit-wasm/tests/transaction_library.rs b/radix-engine-toolkit-wasm/tests/transaction_library.rs index 5fde45a6..f46e7bc3 100644 --- a/radix-engine-toolkit-wasm/tests/transaction_library.rs +++ b/radix-engine-toolkit-wasm/tests/transaction_library.rs @@ -164,8 +164,6 @@ impl RadixEngineToolkit { 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! {DeriveNonFungibleAddressFromPublicKeyRequest, DeriveNonFungibleAddressFromPublicKeyResponse, derive_non_fungible_address_from_public_key} - crate::define_request_function! {DeriveNonFungibleAddressRequest, DeriveNonFungibleAddressResponse, derive_non_fungible_address} crate::define_request_function! {DeriveVirtualAccountAddressRequest, DeriveVirtualAccountAddressResponse, derive_virtual_account_address} /// Calls a function in the WASM instance with a given request From 2a7f7e0d75737f70f38a0bb1b068b52526d094bc Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 2 Jan 2023 18:37:04 +0300 Subject: [PATCH 002/110] Known entity addresses derivations --- docs-examples-generator/request-examples.md | 132 +++++++---------- docs-examples-generator/src/examples.rs | 17 +++ docs-examples-generator/src/main.rs | 1 + radix-engine-toolkit-core/src/memory.rs | 5 +- .../src/model/identifier.rs | 2 +- radix-engine-toolkit-core/src/model/value.rs | 1 + .../src/requests/known_entity_addresses.rs | 135 ++++++++++++++++++ radix-engine-toolkit-core/src/requests/mod.rs | 3 + .../tests/test_vector/manifest/mod.rs | 68 ++++----- radix-engine-toolkit-jni/src/lib.rs | 2 + radix-engine-toolkit-native/src/lib.rs | 2 + radix-engine-toolkit-wasm/src/lib.rs | 2 + 12 files changed, 254 insertions(+), 116 deletions(-) create mode 100644 radix-engine-toolkit-core/src/requests/known_entity_addresses.rs diff --git a/docs-examples-generator/request-examples.md b/docs-examples-generator/request-examples.md index 44094b94..54b680ed 100644 --- a/docs-examples-generator/request-examples.md +++ b/docs-examples-generator/request-examples.md @@ -1942,73 +1942,25 @@ This document contains examples and descriptions of the different requests and r ``` -## Derive Non Fungible Address - -| Function Name | `derive_non_fungible_address` | -| ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_deriveNonFungibleAddress` | -| Functionality | Given a ResourceAddress and a NonFungibleId, this function is able to derive the NonFungibleAddress corresponding to a specific NonFungible. | -| Request Type | `DeriveNonFungibleAddressRequest` | -| Response Type | `DeriveNonFungibleAddressResponse` | - -
- Request Example - -```json -{ - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qzkcyv5dwq3r6kawy6pxpvcythx8rh8ntum6ws62p95sqjjpwr" - }, - "non_fungible_id": { - "type": "NonFungibleId", - "variant": "U64", - "value": "192" - } -} -``` -
- -
- Response Example - -```json -{ - "non_fungible_address": { - "type": "NonFungibleAddress", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qzkcyv5dwq3r6kawy6pxpvcythx8rh8ntum6ws62p95sqjjpwr" - }, - "non_fungible_id": { - "type": "NonFungibleId", - "variant": "U64", - "value": "192" - } - } -} -``` -
- -## Derive Non Fungible Address From Public Key +## Derive Virtual Account Address -| Function Name | `derive_non_fungible_address_from_public_key` | +| Function Name | `derive_virtual_account_address` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_deriveNonFungibleAddressFromPublicKey` | -| Functionality | This function derives the `NonFungibleAddress` of the virtual badge associated with a given public key. | -| Request Type | `DeriveNonFungibleAddressFromPublicKeyRequest` | -| Response Type | `DeriveNonFungibleAddressFromPublicKeyResponse` | +| JNI Function Name | `Java_RadixEngineToolkitFFI_deriveVirtualAccountAddress` | +| Functionality | Derives the virtual account component address given a public key and a network id. | +| Request Type | `DeriveVirtualAccountAddressRequest` | +| Response Type | `DeriveVirtualAccountAddressResponse` |
Request Example ```json { + "network_id": 242, "public_key": { "type": "EcdsaSecp256k1", "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" - }, - "network_id": 242 + } } ```
@@ -2018,41 +1970,29 @@ This document contains examples and descriptions of the different requests and r ```json { - "non_fungible_address": { - "type": "NonFungibleAddress", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qzu3wdlw3fx7t82fmt2qme2kpet4g3n2epx02sew49wsyz7uhu" - }, - "non_fungible_id": { - "type": "NonFungibleId", - "variant": "Bytes", - "value": "02cc806dddfd673d994986293a997a50e8c10d95443beb52b06e" - } + "virtual_account_address": { + "type": "ComponentAddress", + "address": "account_sim1qcpveqrdmh7kw0vefxrzjw5e0fgw3sgdj4zrh66jkphqqc62xd" } } ``` -## Derive Virtual Account Address +## Known Entity Addresses -| Function Name | `derive_virtual_account_address` | +| Function Name | `known_entity_addresses` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_deriveVirtualAccountAddress` | -| Functionality | Derives the virtual account component address given a public key and a network id. | -| Request Type | `DeriveVirtualAccountAddressRequest` | -| Response Type | `DeriveVirtualAccountAddressResponse` | +| 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). | +| Request Type | `KnownEntityAddressesRequest` | +| Response Type | `KnownEntityAddressesResponse` |
Request Example ```json { - "network_id": 242, - "public_key": { - "type": "EcdsaSecp256k1", - "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" - } + "network_id": 1 } ```
@@ -2062,9 +2002,41 @@ This document contains examples and descriptions of the different requests and r ```json { - "virtual_account_address": { + "faucet_component_address": { "type": "ComponentAddress", - "address": "account_sim1qcpveqrdmh7kw0vefxrzjw5e0fgw3sgdj4zrh66jkphqqc62xd" + "address": "component_rdx1qftacppvmr9ezmekxqpq58en0nk954x0a7jv2zz0hc7qp7wydu" + }, + "faucet_package_address": { + "type": "PackageAddress", + "address": "package_rdx1qyqzcexvnyg60z7lnlwauh66nhzg3m8tch2j8wc0e70qsxg0vu" + }, + "account_package_address": { + "type": "PackageAddress", + "address": "package_rdx1qy4hrp8a9apxldp5cazvxgwdj80cxad4u8cpkaqqnhlsmn6s2x" + }, + "xrd_resource_address": { + "type": "ResourceAddress", + "address": "resource_rdx1qzkcyv5dwq3r6kawy6pxpvcythx8rh8ntum6ws62p95sxshc9u" + }, + "system_token_resource_address": { + "type": "ResourceAddress", + "address": "resource_rdx1qzfzxp4x6ya0vwrxk6yvjyphr8gyk9xqvz7y3xdxzw6sfg0scu" + }, + "ecdsa_secp256k1_token_resource_address": { + "type": "ResourceAddress", + "address": "resource_rdx1qzu3wdlw3fx7t82fmt2qme2kpet4g3n2epx02sew49wszqm9ur" + }, + "eddsa_ed25519_token_resource_address": { + "type": "ResourceAddress", + "address": "resource_rdx1qq8cays25704xdyap2vhgmshkkfyr023uxdtk59ddd4qk9a6ln" + }, + "epoch_manager_system_address": { + "type": "SystemAddress", + "address": "system_rdx1qne8qu4seyvzfgd94p3z8rjcdl3v0nfhv84judpum2lqcysr6t" + }, + "clock_system_address": { + "type": "SystemAddress", + "address": "system_rdx1qhrvq0wjqnnzcwwm8jhzxw2ctd3t4aqql0a56a9mu5nsq4wurk" } } ``` diff --git a/docs-examples-generator/src/examples.rs b/docs-examples-generator/src/examples.rs index cc0e1f18..6fa98c71 100644 --- a/docs-examples-generator/src/examples.rs +++ b/docs-examples-generator/src/examples.rs @@ -416,3 +416,20 @@ where } } } + +impl<'a, R> RequestExample<'a, R> for KnownEntityAddressesRequest +where + KnownEntityAddressesRequest: Request<'a, R>, + R: Serialize + Validate, +{ + 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() -> Self { + Self { network_id: 0x01 } + } +} diff --git a/docs-examples-generator/src/main.rs b/docs-examples-generator/src/main.rs index 12150bca..c8c0ab2a 100644 --- a/docs-examples-generator/src/main.rs +++ b/docs-examples-generator/src/main.rs @@ -24,6 +24,7 @@ fn main() { .add_example::<'_, SBOREncodeRequest, SBOREncodeResponse>() .add_example::<'_, SBORDecodeRequest, SBORDecodeResponse>() .add_example::<'_, DeriveVirtualAccountAddressRequest, DeriveVirtualAccountAddressResponse>() + .add_example::<'_, KnownEntityAddressesRequest, KnownEntityAddressesResponse>() .build(); fs::write("./request-examples.md", examples).unwrap(); } diff --git a/radix-engine-toolkit-core/src/memory.rs b/radix-engine-toolkit-core/src/memory.rs index ec7c54f4..a60bf8d8 100644 --- a/radix-engine-toolkit-core/src/memory.rs +++ b/radix-engine-toolkit-core/src/memory.rs @@ -160,6 +160,9 @@ where let byte_count = object_bytes.len() + 1; let pointer = toolkit_alloc(byte_count); - pointer.copy_from([object_bytes, &[0]].concat().as_ptr() as Pointer, byte_count); + pointer.copy_from( + [object_bytes, &[0]].concat().as_ptr() as Pointer, + byte_count, + ); Ok(pointer) } diff --git a/radix-engine-toolkit-core/src/model/identifier.rs b/radix-engine-toolkit-core/src/model/identifier.rs index fc7135a9..76d65b9c 100644 --- a/radix-engine-toolkit-core/src/model/identifier.rs +++ b/radix-engine-toolkit-core/src/model/identifier.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -use std::{str::FromStr, convert::Infallible}; +use std::{convert::Infallible, str::FromStr}; use serde::{Deserialize, Serialize}; diff --git a/radix-engine-toolkit-core/src/model/value.rs b/radix-engine-toolkit-core/src/model/value.rs index 42b4f4a5..26d4b860 100644 --- a/radix-engine-toolkit-core/src/model/value.rs +++ b/radix-engine-toolkit-core/src/model/value.rs @@ -1738,6 +1738,7 @@ impl_from_and_try_from_value! {Proof, ProofId, identifier} impl_from_and_try_from_value! {Bucket, BucketId, identifier} impl_from_and_try_from_value! {NonFungibleId, NonFungibleId, value} impl_from_and_try_from_value! {NonFungibleAddress, NonFungibleAddress, address} +impl_from_and_try_from_value! {SystemAddress, NetworkAwareSystemAddress, address} impl_from_and_try_from_value! {PackageAddress, NetworkAwarePackageAddress, address} impl_from_and_try_from_value! {ResourceAddress, NetworkAwareResourceAddress, address} impl_from_and_try_from_value! {ComponentAddress, NetworkAwareComponentAddress, address} diff --git a/radix-engine-toolkit-core/src/requests/known_entity_addresses.rs b/radix-engine-toolkit-core/src/requests/known_entity_addresses.rs new file mode 100644 index 00000000..ee5e1249 --- /dev/null +++ b/radix-engine-toolkit-core/src/requests/known_entity_addresses.rs @@ -0,0 +1,135 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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::helper::ValueSerializationProxy; +use crate::model::{ + NetworkAwareComponentAddress, NetworkAwarePackageAddress, NetworkAwareResourceAddress, + NetworkAwareSystemAddress, +}; +use crate::traits::{Request, Validate}; +use scrypto::prelude::{ + ACCOUNT_PACKAGE, CLOCK, ECDSA_SECP256K1_TOKEN, EDDSA_ED25519_TOKEN, EPOCH_MANAGER, + FAUCET_COMPONENT, FAUCET_PACKAGE, RADIX_TOKEN, SYSTEM_TOKEN, +}; +use serde::{Deserialize, Serialize}; +use serde_with::serde_as; + +// ========================== +// Request & Response Models +// ========================== + +#[serde_as] +#[derive(Serialize, Deserialize, Clone, Debug)] +pub struct KnownEntityAddressesRequest { + pub network_id: u8, +} + +#[serde_as] +#[derive(Serialize, Deserialize, Clone, Debug)] +pub struct KnownEntityAddressesResponse { + #[serde_as(as = "ValueSerializationProxy")] + faucet_component_address: NetworkAwareComponentAddress, + + #[serde_as(as = "ValueSerializationProxy")] + faucet_package_address: NetworkAwarePackageAddress, + + #[serde_as(as = "ValueSerializationProxy")] + account_package_address: NetworkAwarePackageAddress, + + #[serde_as(as = "ValueSerializationProxy")] + xrd_resource_address: NetworkAwareResourceAddress, + + #[serde_as(as = "ValueSerializationProxy")] + system_token_resource_address: NetworkAwareResourceAddress, + + #[serde_as(as = "ValueSerializationProxy")] + ecdsa_secp256k1_token_resource_address: NetworkAwareResourceAddress, + + #[serde_as(as = "ValueSerializationProxy")] + eddsa_ed25519_token_resource_address: NetworkAwareResourceAddress, + + #[serde_as(as = "ValueSerializationProxy")] + epoch_manager_system_address: NetworkAwareSystemAddress, + + #[serde_as(as = "ValueSerializationProxy")] + clock_system_address: NetworkAwareSystemAddress, +} + +// =========== +// Validation +// =========== + +impl Validate for KnownEntityAddressesRequest { + fn validate(&self) -> Result<(), Error> { + Ok(()) + } +} + +impl Validate for KnownEntityAddressesResponse { + fn validate(&self) -> Result<(), Error> { + Ok(()) + } +} + +// ======================= +// Request Implementation +// ======================= + +impl<'r> Request<'r, KnownEntityAddressesResponse> for KnownEntityAddressesRequest { + fn handle_request(self) -> Result { + let network_id = self.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, + }, + epoch_manager_system_address: NetworkAwareSystemAddress { + address: EPOCH_MANAGER, + network_id, + }, + clock_system_address: NetworkAwareSystemAddress { + address: CLOCK, + network_id, + }, + }) + } +} diff --git a/radix-engine-toolkit-core/src/requests/mod.rs b/radix-engine-toolkit-core/src/requests/mod.rs index 5c711b61..ab2e2df0 100644 --- a/radix-engine-toolkit-core/src/requests/mod.rs +++ b/radix-engine-toolkit-core/src/requests/mod.rs @@ -38,6 +38,8 @@ pub mod sbor_encode_request; pub mod derive_virtual_account_address; +pub mod known_entity_addresses; + pub use compile_notarized_transaction_intent_request::*; pub use compile_signed_transaction_intent_request::*; pub use compile_transaction_intent_request::*; @@ -50,5 +52,6 @@ pub use decompile_unknown_transaction_intent_request::*; pub use derive_virtual_account_address::*; pub use encode_address_request::*; pub use information_request::*; +pub use known_entity_addresses::*; pub use sbor_decode_request::*; pub use sbor_encode_request::*; diff --git a/radix-engine-toolkit-core/tests/test_vector/manifest/mod.rs b/radix-engine-toolkit-core/tests/test_vector/manifest/mod.rs index 2b843f9b..663ffe82 100644 --- a/radix-engine-toolkit-core/tests/test_vector/manifest/mod.rs +++ b/radix-engine-toolkit-core/tests/test_vector/manifest/mod.rs @@ -379,7 +379,7 @@ lazy_static::lazy_static! { Value::Array { element_type: ValueKind::U8, elements: [5u8, 10u8, 255u8].iter().map(|x| Value::U8 { value: *x }).collect() }, ]) }, - + CallMethod { component_address: ScryptoReceiver::ComponentAddress(parse!("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum")), method_name: parse!("with_all_types"), @@ -400,41 +400,41 @@ lazy_static::lazy_static! { // Other interpreted types Value::Expression { value: Expression::new("ALL_WORKTOP_RESOURCES") }, Value::Blob { hash: parse!("36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618") }, - Value::NonFungibleAddress { address: NonFungibleAddress { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - non_fungible_id: NonFungibleId::String(parse!("value")) + Value::NonFungibleAddress { address: NonFungibleAddress { + resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), + non_fungible_id: NonFungibleId::String(parse!("value")) }}, - Value::NonFungibleAddress { address: NonFungibleAddress { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), + Value::NonFungibleAddress { address: NonFungibleAddress { + resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), non_fungible_id: NonFungibleId::U32(123) }}, - Value::NonFungibleAddress { address: NonFungibleAddress { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), + Value::NonFungibleAddress { address: NonFungibleAddress { + resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), non_fungible_id: NonFungibleId::U64(456) }}, - Value::NonFungibleAddress { address: NonFungibleAddress { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), + Value::NonFungibleAddress { address: NonFungibleAddress { + resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), non_fungible_id: NonFungibleId::Bytes(hex::decode("031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f").unwrap()) }}, - Value::NonFungibleAddress { address: NonFungibleAddress { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), + Value::NonFungibleAddress { address: NonFungibleAddress { + resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), non_fungible_id: NonFungibleId::UUID(1234567890) }}, // Uninterpreted - Value::Hash { + Value::Hash { value: parse!("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824") }, - Value::EcdsaSecp256k1PublicKey { + Value::EcdsaSecp256k1PublicKey { public_key: parse!("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798") }, - Value::EcdsaSecp256k1Signature { + Value::EcdsaSecp256k1Signature { signature: parse!("0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e") }, - Value::EddsaEd25519PublicKey { + Value::EddsaEd25519PublicKey { public_key: parse!("4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29") }, - Value::EddsaEd25519Signature { + Value::EddsaEd25519Signature { signature: parse!("ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09") }, Value::Decimal { value: parse!("1.2") }, @@ -455,34 +455,34 @@ lazy_static::lazy_static! { TransactionManifestTestVector::new( include_str!("./non_fungible_ids_canonical.rtm"), &[], - TransactionManifest { + TransactionManifest { instructions: ManifestInstructions::JSON(vec![ - TakeFromWorktopByIds { - ids: HashSet::from([NonFungibleId::U32(12)]), - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), + TakeFromWorktopByIds { + ids: HashSet::from([NonFungibleId::U32(12)]), + resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), into_bucket: Identifier::String(parse!("bucket1")).into() }, - TakeFromWorktopByIds { - ids: HashSet::from([NonFungibleId::U64(19)]), - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), + TakeFromWorktopByIds { + ids: HashSet::from([NonFungibleId::U64(19)]), + resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), into_bucket: Identifier::String(parse!("bucket2")).into() }, - TakeFromWorktopByIds { - ids: HashSet::from([NonFungibleId::String(parse!("HelloWorld"))]), - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), + TakeFromWorktopByIds { + ids: HashSet::from([NonFungibleId::String(parse!("HelloWorld"))]), + resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), into_bucket: Identifier::String(parse!("bucket3")).into() }, - TakeFromWorktopByIds { - ids: HashSet::from([NonFungibleId::Bytes(hex::decode("121922ff03").unwrap())]), - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), + TakeFromWorktopByIds { + ids: HashSet::from([NonFungibleId::Bytes(hex::decode("121922ff03").unwrap())]), + resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), into_bucket: Identifier::String(parse!("bucket4")).into() }, - TakeFromWorktopByIds { - ids: HashSet::from([NonFungibleId::UUID(1922931322)]), - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), + TakeFromWorktopByIds { + ids: HashSet::from([NonFungibleId::UUID(1922931322)]), + resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), into_bucket: Identifier::String(parse!("bucket5")).into() }, - ]), + ]), blobs: vec![] } ), diff --git a/radix-engine-toolkit-jni/src/lib.rs b/radix-engine-toolkit-jni/src/lib.rs index 2d0dd640..26b47e55 100644 --- a/radix-engine-toolkit-jni/src/lib.rs +++ b/radix-engine-toolkit-jni/src/lib.rs @@ -88,3 +88,5 @@ export_request!(DecodeAddressRequest as decodeAddress); export_request!(SBOREncodeRequest as sborEncode); export_request!(SBORDecodeRequest as sborDecode); + +export_request!(KnownEntityAddressesRequest as KnownEntityAddresses); diff --git a/radix-engine-toolkit-native/src/lib.rs b/radix-engine-toolkit-native/src/lib.rs index f3196a2a..23e8f09d 100644 --- a/radix-engine-toolkit-native/src/lib.rs +++ b/radix-engine-toolkit-native/src/lib.rs @@ -85,3 +85,5 @@ export_request!(DecodeAddressRequest as decode_address); export_request!(SBOREncodeRequest as sbor_encode); export_request!(SBORDecodeRequest as sbor_decode); + +export_request!(KnownEntityAddressesRequest as known_entity_addresses); diff --git a/radix-engine-toolkit-wasm/src/lib.rs b/radix-engine-toolkit-wasm/src/lib.rs index 5a53c373..494d2c86 100644 --- a/radix-engine-toolkit-wasm/src/lib.rs +++ b/radix-engine-toolkit-wasm/src/lib.rs @@ -87,3 +87,5 @@ export_request!(DecodeAddressRequest as decode_address); export_request!(SBOREncodeRequest as sbor_encode); export_request!(SBORDecodeRequest as sbor_decode); + +export_request!(KnownEntityAddressesRequest as known_entity_addresses); From d53aef1f87f32c48ea1e7cdd1bd15217a725dcff Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 2 Jan 2023 20:15:30 +0300 Subject: [PATCH 003/110] Static validation of transactions --- docs-examples-generator/request-examples.md | 38 ++++++++ docs-examples-generator/src/examples.rs | 29 +++++- .../src/examples_builder.rs | 13 ++- docs-examples-generator/src/main.rs | 1 + .../src/model/helper/mod.rs | 2 + .../model/helper/validation_config_proxy.rs | 68 ++++++++++++++ ...s.rs => known_entity_addresses_request.rs} | 0 radix-engine-toolkit-core/src/requests/mod.rs | 7 +- ...statically_validate_transaction_request.rs | 91 +++++++++++++++++++ 9 files changed, 242 insertions(+), 7 deletions(-) create mode 100644 radix-engine-toolkit-core/src/model/helper/validation_config_proxy.rs rename radix-engine-toolkit-core/src/requests/{known_entity_addresses.rs => known_entity_addresses_request.rs} (100%) create mode 100644 radix-engine-toolkit-core/src/requests/statically_validate_transaction_request.rs diff --git a/docs-examples-generator/request-examples.md b/docs-examples-generator/request-examples.md index 54b680ed..4a4d627d 100644 --- a/docs-examples-generator/request-examples.md +++ b/docs-examples-generator/request-examples.md @@ -2041,3 +2041,41 @@ This document contains examples and descriptions of the different requests and r } ``` + +## Statically Validate Transaction + +| Function Name | `statically_validate_transaction` | +| ----------------- | :----------------- | +| JNI Function Name | `Java_RadixEngineToolkitFFI_staticallyValidateTransaction` | +| Functionality | Performs static validation on the given notarized transaction. | +| Request Type | `StaticallyValidateTransactionRequest` | +| Response Type | `StaticallyValidateTransactionResponse` | + +
+ Request Example + +```json +{ + "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000110e4563647361536563703235366b3101b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505070021022011140a43616c6c4d6574686f640221021106476c6f62616c018103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000041754616b6546726f6d576f726b746f704279416d6f756e7402b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040a43616c6c4d6574686f640221021106476c6f62616c01810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c210192000200001d417373657274576f726b746f70436f6e7461696e734279416d6f756e7402b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000415417373657274576f726b746f70436f6e7461696e73018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510f54616b6546726f6d576f726b746f7001820000000000000000000000000000000000000000000000000000041543726561746550726f6f6646726f6d4275636b65740109010200000a436c6f6e6550726f6f660109020200000944726f7050726f6f660109020200000944726f7050726f6f660109030200000a43616c6c4d6574686f640221021106476c6f62616c018103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040f506f7046726f6d417574685a6f6e65000944726f7050726f6f660109040200000f52657475726e546f576f726b746f700109010200001454616b6546726f6d576f726b746f7042794964730220b701255c200721031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f820000000000000000000000000000000000000000000000000000041243616c6c4e617469766546756e6374696f6e0221020c0f5265736f757263654d616e616765720c066372656174652007495c2104110846756e6769626c650107002021002021001104536f6d6501110846756e6769626c6501b5000064a7b3b6e00d0000000000000000000000000000000000000000000000000a43616c6c4d6574686f640221021106476c6f62616c018103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007135c2101a00e454e544952455f574f524b544f500d44726f70416c6c50726f6f6673000a43616c6c4d6574686f640221021106476c6f62616c01810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c12636f6d706c6963617465645f6d6574686f642007655c2102b5000064a7b3b6e00d000000000000000000000000000000000000000000000000b60000000000000000023ed47ec9da71dcda2f4fb5e9f37fd2079e3000000000000000000000000000000000000000000000000000000000000000000000000000175075626c6973685061636b616765576974684f776e657203a136dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618a115e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5da2400000000000000000000000000000000000000000000000000000045c200721031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f20200207d20110020000003007c00000000061736d010000000405017001010105030100100619037f01418080c0000b7f00418080c0000b7f00418080c0000b072503066d656d6f727902000a5f5f646174615f656e6403010b5f5f686561705f6261736503020019046e616d65071201000f5f5f737461636b5f706f696e746572004d0970726f64756365727302086c616e6775616765010452757374000c70726f6365737365642d6279010572757374631d312e35392e30202839643162323130366520323032322d30322d323329320c10000000000707320c10000000002011060e4563647361536563703235366b3101b201f74e7ec78fc77d1d7bae5ca9c3aa3596680d5ac883f188742bc29ef335b3e7de4902806c811ccad3c75230bbd22a1645aa3825c492c3e834ecbbab3eb966209f0e4563647361536563703235366b3101b2019db1de979763680b1d82fb2bc377c2d22aae44b68758acd1add4b3fe2a703788369562549f3ac2074777d086ed2cb70154d45a5ed004fcd015b9e5613415775f0e4563647361536563703235366b3101b2018a49c93437ad33f2cc169d30c01c3a5bcc09c800a221922f5d7e1e16f9f9c64e33bebe61d07373d15ed48e5193d2d1cbbbab5e89f80e0bdaf8fc57f08700ddff0c45646473614564323535313902b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b4afa51548f560636d80b8d16fba359cd3a2d0d214584adc137e53e9570c28deb4982a2a255912f7062ef4746965f196637294a119e43f5715e8c77bcaf8554a010c45646473614564323535313902b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b46e1bdd9ae346c4c44c5b38e797d07c31003b59fabffa1c5dfcf150bb2d3d4ea7f225401928c855261617dc49ef0fba13097b96e463a6a78976d0c95067e8830a0c45646473614564323535313902b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4089d5005906640a2f56348deb8442be2e1ce344267c11f089dff08c96fdeb71a06fdb456cdd25b2a8eb0a6bc0f0d9e7948dcbf842a74ddced6af54be26035705110e4563647361536563703235366b3101b201f74e7ec78fc77d1d7bae5ca9c3aa3596680d5ac883f188742bc29ef335b3e7de4902806c811ccad3c75230bbd22a1645aa3825c492c3e834ecbbab3eb966209f", + "validation_config": { + "network_id": "242", + "min_cost_unit_limit": "1000000", + "max_cost_unit_limit": "100000000", + "min_tip_percentage": "0", + "max_tip_percentage": "255", + "max_epoch_range": "100" + } +} +``` +
+ +
+ Response Example + +```json +{ + "validity": "Invalid", + "error": "SignatureValidationError(InvalidNotarySignature)" +} +``` +
diff --git a/docs-examples-generator/src/examples.rs b/docs-examples-generator/src/examples.rs index 6fa98c71..1ef4e84a 100644 --- a/docs-examples-generator/src/examples.rs +++ b/docs-examples-generator/src/examples.rs @@ -3,10 +3,10 @@ use radix_engine_toolkit_core::{ requests::*, traits::{Request, TryIntoWithContext, Validate}, }; -use transaction::builder::TransactionBuilder; use transaction::manifest::compile; use transaction::model::{NotarizedTransaction, TransactionHeader}; use transaction::signing::{EcdsaSecp256k1PrivateKey, EddsaEd25519PrivateKey}; +use transaction::{builder::TransactionBuilder, validation::ValidationConfig}; use scrypto::{prelude::*, radix_engine_interface::core::NetworkDefinition}; use serde::Serialize; @@ -433,3 +433,30 @@ where Self { network_id: 0x01 } } } + +impl<'a, R> RequestExample<'a, R> for StaticallyValidateTransactionRequest +where + StaticallyValidateTransactionRequest: Request<'a, R>, + R: Serialize + Validate, +{ + fn description() -> String { + r#"Performs static validation on the given notarized transaction."#.to_owned() + } + + fn example_request() -> Self { + // Making the notarized transaction invalid + let notarized_transaction = { + let mut transaction = NOTARIZED_TRANSACTION.clone(); + transaction.notary_signature = + transaction.signed_intent.intent_signatures[0].signature(); + transaction + }; + + let compiled_transaction_intent = scrypto_encode(¬arized_transaction).unwrap(); + let validation_config = ValidationConfig::default(0x0f2); + Self { + compiled_notarized_intent: compiled_transaction_intent, + validation_config, + } + } +} diff --git a/docs-examples-generator/src/examples_builder.rs b/docs-examples-generator/src/examples_builder.rs index 7d06e374..15597f18 100644 --- a/docs-examples-generator/src/examples_builder.rs +++ b/docs-examples-generator/src/examples_builder.rs @@ -1,5 +1,5 @@ -use radix_engine_toolkit_core::traits::Validate; use convert_case::{Case, Casing}; +use radix_engine_toolkit_core::traits::Validate; use serde::Serialize; use crate::examples::{Example, RequestExample}; @@ -10,7 +10,9 @@ pub struct InMemoryExamplesBuilder { impl InMemoryExamplesBuilder { pub fn new() -> Self { - Self { examples: Vec::new() } + Self { + examples: Vec::new(), + } } pub fn add_example<'a, T, R>(mut self) -> Self @@ -30,8 +32,11 @@ impl InMemoryExamplesBuilder { 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 jni_function_name = format!( + "Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_{}", + request_cleaned_name.to_case(Case::Camel) + ); + let example_string = format!( r#"## {} diff --git a/docs-examples-generator/src/main.rs b/docs-examples-generator/src/main.rs index c8c0ab2a..f02312e4 100644 --- a/docs-examples-generator/src/main.rs +++ b/docs-examples-generator/src/main.rs @@ -25,6 +25,7 @@ fn main() { .add_example::<'_, SBORDecodeRequest, SBORDecodeResponse>() .add_example::<'_, DeriveVirtualAccountAddressRequest, DeriveVirtualAccountAddressResponse>() .add_example::<'_, KnownEntityAddressesRequest, KnownEntityAddressesResponse>() + .add_example::<'_, StaticallyValidateTransactionRequest, StaticallyValidateTransactionResponse>() .build(); fs::write("./request-examples.md", examples).unwrap(); } diff --git a/radix-engine-toolkit-core/src/model/helper/mod.rs b/radix-engine-toolkit-core/src/model/helper/mod.rs index 6b16abf5..e8066397 100644 --- a/radix-engine-toolkit-core/src/model/helper/mod.rs +++ b/radix-engine-toolkit-core/src/model/helper/mod.rs @@ -20,6 +20,7 @@ pub mod non_fungible_address; pub mod non_fungible_id_proxy; pub mod option_proxy; pub mod result_proxy; +pub mod validation_config_proxy; pub mod value_proxy; pub use call_method_receiver::*; @@ -27,4 +28,5 @@ pub use non_fungible_address::*; pub use non_fungible_id_proxy::*; pub use option_proxy::*; pub use result_proxy::*; +pub use validation_config_proxy::*; pub use value_proxy::*; diff --git a/radix-engine-toolkit-core/src/model/helper/validation_config_proxy.rs b/radix-engine-toolkit-core/src/model/helper/validation_config_proxy.rs new file mode 100644 index 00000000..7f51ab10 --- /dev/null +++ b/radix-engine-toolkit-core/src/model/helper/validation_config_proxy.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 radix_transaction::validation::ValidationConfig; +use serde::{Deserialize, Serialize}; +use serde_with::{serde_as, DisplayFromStr}; + +#[serde_as] +#[derive(Serialize, Deserialize)] +pub struct ValidationConfigProxy { + #[serde_as(as = "DisplayFromStr")] + pub network_id: u8, + + #[serde_as(as = "DisplayFromStr")] + pub min_cost_unit_limit: u32, + + #[serde_as(as = "DisplayFromStr")] + pub max_cost_unit_limit: u32, + + #[serde_as(as = "DisplayFromStr")] + pub min_tip_percentage: u8, + + #[serde_as(as = "DisplayFromStr")] + pub max_tip_percentage: u8, + + #[serde_as(as = "DisplayFromStr")] + pub max_epoch_range: u64, +} + +impl From for ValidationConfigProxy { + 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, + } + } +} + +impl From for ValidationConfig { + fn from(value: ValidationConfigProxy) -> 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-core/src/requests/known_entity_addresses.rs b/radix-engine-toolkit-core/src/requests/known_entity_addresses_request.rs similarity index 100% rename from radix-engine-toolkit-core/src/requests/known_entity_addresses.rs rename to radix-engine-toolkit-core/src/requests/known_entity_addresses_request.rs diff --git a/radix-engine-toolkit-core/src/requests/mod.rs b/radix-engine-toolkit-core/src/requests/mod.rs index ab2e2df0..bfaabe27 100644 --- a/radix-engine-toolkit-core/src/requests/mod.rs +++ b/radix-engine-toolkit-core/src/requests/mod.rs @@ -38,7 +38,9 @@ pub mod sbor_encode_request; pub mod derive_virtual_account_address; -pub mod known_entity_addresses; +pub mod known_entity_addresses_request; + +pub mod statically_validate_transaction_request; pub use compile_notarized_transaction_intent_request::*; pub use compile_signed_transaction_intent_request::*; @@ -52,6 +54,7 @@ pub use decompile_unknown_transaction_intent_request::*; pub use derive_virtual_account_address::*; pub use encode_address_request::*; pub use information_request::*; -pub use known_entity_addresses::*; +pub use known_entity_addresses_request::*; pub use sbor_decode_request::*; pub use sbor_encode_request::*; +pub use statically_validate_transaction_request::*; diff --git a/radix-engine-toolkit-core/src/requests/statically_validate_transaction_request.rs b/radix-engine-toolkit-core/src/requests/statically_validate_transaction_request.rs new file mode 100644 index 00000000..44a8a962 --- /dev/null +++ b/radix-engine-toolkit-core/src/requests/statically_validate_transaction_request.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 crate::error::Error; +use crate::model::{ManifestInstructionsKind, NotarizedTransaction, ValidationConfigProxy}; +use crate::traits::{CompilableIntent, Request, Validate}; + +use radix_transaction::validation::{ + NotarizedTransactionValidator, TestIntentHashManager, TransactionValidator, ValidationConfig, +}; +use serde::{Deserialize, Serialize}; +use serde_with::{serde_as, FromInto}; + +// ========================== +// Request & Response Models +// ========================== + +#[serde_as] +#[derive(Serialize, Deserialize, Clone, Debug)] +pub struct StaticallyValidateTransactionRequest { + #[serde_as(as = "serde_with::hex::Hex")] + pub compiled_notarized_intent: Vec, + + #[serde_as(as = "FromInto")] + pub validation_config: ValidationConfig, +} + +#[serde_as] +#[derive(Serialize, Deserialize, Clone, Debug)] +#[serde(tag = "validity")] +pub enum StaticallyValidateTransactionResponse { + Valid, + Invalid { error: String }, +} + +// =========== +// Validation +// =========== + +impl Validate for StaticallyValidateTransactionRequest { + fn validate(&self) -> Result<(), Error> { + Ok(()) + } +} + +impl Validate for StaticallyValidateTransactionResponse { + fn validate(&self) -> Result<(), Error> { + Ok(()) + } +} + +// ======================= +// Request Implementation +// ======================= + +impl<'r> Request<'r, StaticallyValidateTransactionResponse> + for StaticallyValidateTransactionRequest +{ + fn handle_request(self) -> Result { + let notarized_transaction = NotarizedTransaction::decompile( + &self.compiled_notarized_intent, + ManifestInstructionsKind::String, + )?; + + let intent_hash_manager = TestIntentHashManager::new(); + + if let Err(ref error) = NotarizedTransactionValidator::new(self.validation_config) + .validate(¬arized_transaction.try_into()?, &intent_hash_manager) + { + Ok(StaticallyValidateTransactionResponse::Invalid { + error: format!("{:?}", error), + }) + } else { + Ok(StaticallyValidateTransactionResponse::Valid) + } + } +} From 86c3b8854726263a332a841f43fd2d5cd3f8c1ed Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 2 Jan 2023 20:25:28 +0300 Subject: [PATCH 004/110] Fix tests --- docs-examples-generator/request-examples.md | 30 +++++++++---------- radix-engine-toolkit-jni/src/lib.rs | 3 +- radix-engine-toolkit-native/src/lib.rs | 1 + radix-engine-toolkit-wasm/src/lib.rs | 1 + .../tests/transaction_library.rs | 8 +++-- 5 files changed, 24 insertions(+), 19 deletions(-) diff --git a/docs-examples-generator/request-examples.md b/docs-examples-generator/request-examples.md index 4a4d627d..0d011d67 100644 --- a/docs-examples-generator/request-examples.md +++ b/docs-examples-generator/request-examples.md @@ -7,7 +7,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `information` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_information` | +| JNI Function Name | `Java_com_radixdlt_toolkit_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. | | Request Type | `InformationRequest` | | Response Type | `InformationResponse` | @@ -34,7 +34,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `convert_manifest` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_convertManifest` | +| JNI Function Name | `Java_com_radixdlt_toolkit_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 JSON format for transaction manifests which clients can use when wanting to read and interrogate their transaction manifests in code. The transaction manifest JSON 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 JSON format as well.

This function allows the client the convert their manifest between the two supported manifest types: string and JSON. | | Request Type | `ConvertManifestRequest` | | Response Type | `ConvertManifestResponse` | @@ -362,7 +362,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `compile_transaction_intent` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_compileTransactionIntent` | +| JNI Function Name | `Java_com_radixdlt_toolkit_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. | | Request Type | `CompileTransactionIntentRequest` | | Response Type | `CompileTransactionIntentResponse` | @@ -414,7 +414,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `decompile_transaction_intent` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_decompileTransactionIntent` | +| JNI Function Name | `Java_com_radixdlt_toolkit_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. | | Request Type | `DecompileTransactionIntentRequest` | | Response Type | `DecompileTransactionIntentResponse` | @@ -747,7 +747,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `compile_signed_transaction_intent` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_compileSignedTransactionIntent` | +| JNI Function Name | `Java_com_radixdlt_toolkit_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. | | Request Type | `CompileSignedTransactionIntentRequest` | | Response Type | `CompileSignedTransactionIntentResponse` | @@ -830,7 +830,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `decompile_signed_transaction_intent` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_decompileSignedTransactionIntent` | +| JNI Function Name | `Java_com_radixdlt_toolkit_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. | | Request Type | `DecompileSignedTransactionIntentRequest` | | Response Type | `DecompileSignedTransactionIntentResponse` | @@ -1194,7 +1194,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `compile_notarized_transaction_intent` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_compileNotarizedTransactionIntent` | +| JNI Function Name | `Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_compileNotarizedTransactionIntent` | | 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 | | Request Type | `CompileNotarizedTransactionIntentRequest` | | Response Type | `CompileNotarizedTransactionIntentResponse` | @@ -1283,7 +1283,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `decompile_notarized_transaction_intent` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_decompileNotarizedTransactionIntent` | +| JNI Function Name | `Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_decompileNotarizedTransactionIntent` | | Functionality | 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. | | Request Type | `DecompileNotarizedTransactionIntentRequest` | | Response Type | `DecompileNotarizedTransactionIntentResponse` | @@ -1653,7 +1653,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `encode_address` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_encodeAddress` | +| JNI Function Name | `Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_encodeAddress` | | Functionality | This function can be used when we have a byte array which we wish to do Bech32m encoding on. In this case, the HRP to use will be determined through the entity byte of the passed address hex string. | | Request Type | `EncodeAddressRequest` | | Response Type | `EncodeAddressResponse` | @@ -1684,7 +1684,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `decode_address` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_decodeAddress` | +| JNI Function Name | `Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_decodeAddress` | | Functionality | This function can be used to decode a Bech32m encoded address string into its equivalent hrp and data. In addition to that, this function provides other useful information on the address such as the network id and name that it is used for, and the entity type of the address. | | Request Type | `DecodeAddressRequest` | | Response Type | `DecodeAddressResponse` | @@ -1721,7 +1721,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `sbor_encode` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_sborEncode` | +| JNI Function Name | `Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_sborEncode` | | Functionality | This function takes in a Value and encodes it in SBOR. | | Request Type | `SBOREncodeRequest` | | Response Type | `SBOREncodeResponse` | @@ -1833,7 +1833,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `sbor_decode` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_sborDecode` | +| JNI Function Name | `Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_sborDecode` | | Functionality | This function takes in a hex string and attemps to decode it into a Value. | | Request Type | `SBORDecodeRequest` | | Response Type | `SBORDecodeResponse` | @@ -1946,7 +1946,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `derive_virtual_account_address` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_deriveVirtualAccountAddress` | +| JNI Function Name | `Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_deriveVirtualAccountAddress` | | Functionality | Derives the virtual account component address given a public key and a network id. | | Request Type | `DeriveVirtualAccountAddressRequest` | | Response Type | `DeriveVirtualAccountAddressResponse` | @@ -1982,7 +1982,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `known_entity_addresses` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_knownEntityAddresses` | +| JNI Function Name | `Java_com_radixdlt_toolkit_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). | | Request Type | `KnownEntityAddressesRequest` | | Response Type | `KnownEntityAddressesResponse` | @@ -2046,7 +2046,7 @@ This document contains examples and descriptions of the different requests and r | Function Name | `statically_validate_transaction` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_staticallyValidateTransaction` | +| JNI Function Name | `Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_staticallyValidateTransaction` | | Functionality | Performs static validation on the given notarized transaction. | | Request Type | `StaticallyValidateTransactionRequest` | | Response Type | `StaticallyValidateTransactionResponse` | diff --git a/radix-engine-toolkit-jni/src/lib.rs b/radix-engine-toolkit-jni/src/lib.rs index 26b47e55..064656f3 100644 --- a/radix-engine-toolkit-jni/src/lib.rs +++ b/radix-engine-toolkit-jni/src/lib.rs @@ -89,4 +89,5 @@ export_request!(DecodeAddressRequest as decodeAddress); export_request!(SBOREncodeRequest as sborEncode); export_request!(SBORDecodeRequest as sborDecode); -export_request!(KnownEntityAddressesRequest as KnownEntityAddresses); +export_request!(KnownEntityAddressesRequest as knownEntityAddresses); +export_request!(StaticallyValidateTransactionRequest as staticallyValidateTransaction); diff --git a/radix-engine-toolkit-native/src/lib.rs b/radix-engine-toolkit-native/src/lib.rs index 23e8f09d..4814a374 100644 --- a/radix-engine-toolkit-native/src/lib.rs +++ b/radix-engine-toolkit-native/src/lib.rs @@ -87,3 +87,4 @@ export_request!(SBOREncodeRequest as sbor_encode); export_request!(SBORDecodeRequest as sbor_decode); export_request!(KnownEntityAddressesRequest as known_entity_addresses); +export_request!(StaticallyValidateTransactionRequest as statically_validate_transaction); diff --git a/radix-engine-toolkit-wasm/src/lib.rs b/radix-engine-toolkit-wasm/src/lib.rs index 494d2c86..2b6799d2 100644 --- a/radix-engine-toolkit-wasm/src/lib.rs +++ b/radix-engine-toolkit-wasm/src/lib.rs @@ -89,3 +89,4 @@ export_request!(SBOREncodeRequest as sbor_encode); export_request!(SBORDecodeRequest as sbor_decode); export_request!(KnownEntityAddressesRequest as known_entity_addresses); +export_request!(StaticallyValidateTransactionRequest as statically_validate_transaction); diff --git a/radix-engine-toolkit-wasm/tests/transaction_library.rs b/radix-engine-toolkit-wasm/tests/transaction_library.rs index f46e7bc3..5ec1feec 100644 --- a/radix-engine-toolkit-wasm/tests/transaction_library.rs +++ b/radix-engine-toolkit-wasm/tests/transaction_library.rs @@ -165,6 +165,8 @@ impl RadixEngineToolkit { 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} + crate::define_request_function! {KnownEntityAddressesRequest, KnownEntityAddressesResponse, known_entity_addresses} + crate::define_request_function! {StaticallyValidateTransactionRequest, StaticallyValidateTransactionResponse, statically_validate_transaction} /// Calls a function in the WASM instance with a given request /// @@ -437,11 +439,11 @@ crate::define_function_store! { pub encode_address: TypedFunc, pub decode_address: TypedFunc, - pub derive_non_fungible_address_from_public_key: TypedFunc, - pub derive_non_fungible_address: TypedFunc, - pub derive_virtual_account_address: TypedFunc, + pub known_entity_addresses: TypedFunc, + pub statically_validate_transaction: TypedFunc, + pub toolkit_alloc: TypedFunc, pub toolkit_free_c_string: TypedFunc } From dfadda50dc5229851417d0f6a2333b927cbc4e84 Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 4 Jan 2023 14:00:44 +0300 Subject: [PATCH 005/110] pull request template --- .github/workflows/pull_request_template.md | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/pull_request_template.md diff --git a/.github/workflows/pull_request_template.md b/.github/workflows/pull_request_template.md new file mode 100644 index 00000000..031c05f3 --- /dev/null +++ b/.github/workflows/pull_request_template.md @@ -0,0 +1,53 @@ +# 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 From 88d8b43c64b0a2ed965c9b8fb430657f0ff16639 Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 4 Jan 2023 14:02:51 +0300 Subject: [PATCH 006/110] Remove template --- .github/workflows/pull_request_template.md | 53 ---------------------- 1 file changed, 53 deletions(-) delete mode 100644 .github/workflows/pull_request_template.md diff --git a/.github/workflows/pull_request_template.md b/.github/workflows/pull_request_template.md deleted file mode 100644 index 031c05f3..00000000 --- a/.github/workflows/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 From c651caf5af5db3a63945d5be3672797fbc974891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=81abu=C5=9B?= Date: Thu, 5 Jan 2023 16:51:42 +0100 Subject: [PATCH 007/110] Added CSharp (dotnet) interops --- .github/workflows/publish-native-packages.yml | 49 +++++++++++++++++++ .../RadixDlt.RadixEngineToolkit.Native.nuspec | 21 ++++++++ ...RadixDlt.RadixEngineToolkit.Native.targets | 44 +++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 .github/workflows/publish-native-packages.yml create mode 100644 interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec create mode 100644 interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets diff --git a/.github/workflows/publish-native-packages.yml b/.github/workflows/publish-native-packages.yml new file mode 100644 index 00000000..ac6368bd --- /dev/null +++ b/.github/workflows/publish-native-packages.yml @@ -0,0 +1,49 @@ +name: Publish Native Packages + +on: + push: + branches: + - main + - develop + +jobs: + publish-csharp-nuget: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Download Artifacts + uses: dawidd6/action-download-artifact@v2 + with: + github_token: ${{secrets.GITHUB_TOKEN}} + workflow: build.yml + path: artifacts + - name: Extract Artifacts + working-directory: artifacts + run: | + for f in *.tar; do + mkdir $(basename "$f" .tar); + tar -xvf "$f" --directory=$(basename "$f" .tar); + done + - name: Setup .NET SDK + uses: actions/setup-dotnet@5a3fa01c67e60dba8f95e2878436c7151c4b5f01 + with: + dotnet-version: 7.0.x + - name: Configure Version # TODO missing support for stable packages on releases (where VERSION_SUFFIX should not be appended) + run: | + GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's/\//-/g') + GIT_COMMIT=$(git log -1 --format=%h ) + CORE_VERSION=$(cat radix-engine-toolkit-core/Cargo.toml| grep -e '^version' | cut -d'"' -f 2) + VERSION_SUFFIX=${GIT_BRANCH}-${GIT_COMMIT} + VERSION=${CORE_VERSION}-${VERSION_SUFFIX} + + sed -i "s/\(\)[^<>]*\(<\/version>\)/\1$VERSION\2/g" interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec + + echo "Configured Version: VERSION" + - name: NuGet Pack + working-directory: interop/csharp + run: nuget pack + - name: Publish Packages + run: dotnet nuget push RadixDlt.RadixEngineToolkit.Native.*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ORG_API_KEY }} + + diff --git a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec new file mode 100644 index 00000000..6cd19792 --- /dev/null +++ b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec @@ -0,0 +1,21 @@ + + + + RadixDlt.RadixEngineToolkit.Native + 0.0.0 + Radix Publishing + 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 + + + + + + + + + \ No newline at end of file diff --git a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets new file mode 100644 index 00000000..dbf4e902 --- /dev/null +++ b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets @@ -0,0 +1,44 @@ + + + + + true + PreserveNewest + native\win-x64\radix_engine_toolkit.dll + true + false + + + true + PreserveNewest + native\linux-x64\libradix_engine_toolkit.so + true + false + + + true + PreserveNewest + native\osx-x64\libradix_engine_toolkit.dylib + true + false + + + true + PreserveNewest + native\osx-arm64\libradix_engine_toolkit.dylib + true + false + + + + + + \ No newline at end of file From 3763646fe92f2eedcfb11475cf3179c4d0886bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=81abu=C5=9B?= Date: Thu, 5 Jan 2023 17:02:15 +0100 Subject: [PATCH 008/110] Attempt to fix publish-native-packages GitHub workflow --- .github/workflows/publish-native-packages.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-native-packages.yml b/.github/workflows/publish-native-packages.yml index ac6368bd..c905913e 100644 --- a/.github/workflows/publish-native-packages.yml +++ b/.github/workflows/publish-native-packages.yml @@ -21,9 +21,9 @@ jobs: - name: Extract Artifacts working-directory: artifacts run: | - for f in *.tar; do - mkdir $(basename "$f" .tar); - tar -xvf "$f" --directory=$(basename "$f" .tar); + for f in *.tar.gz; do + mkdir $(basename "$f" .tar.gz); + tar -xvzf "$f" --directory=$(basename "$f" .tar.gz); done - name: Setup .NET SDK uses: actions/setup-dotnet@5a3fa01c67e60dba8f95e2878436c7151c4b5f01 From c6146a59d9e85fdb6215efc2be142f196a736161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=81abu=C5=9B?= Date: Thu, 5 Jan 2023 17:18:45 +0100 Subject: [PATCH 009/110] Attempt to fix publish-native-packages GitHub workflow --- .github/workflows/publish-native-packages.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/publish-native-packages.yml b/.github/workflows/publish-native-packages.yml index c905913e..1507f34f 100644 --- a/.github/workflows/publish-native-packages.yml +++ b/.github/workflows/publish-native-packages.yml @@ -18,9 +18,14 @@ jobs: github_token: ${{secrets.GITHUB_TOKEN}} workflow: build.yml path: artifacts + skip_unpack: true - name: Extract Artifacts working-directory: artifacts run: | + for z in *.zip; do + unzip "$z"; + done + for f in *.tar.gz; do mkdir $(basename "$f" .tar.gz); tar -xvzf "$f" --directory=$(basename "$f" .tar.gz); From dda3485b4c73b6a239f45be6db34135a003f3a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=81abu=C5=9B?= Date: Thu, 5 Jan 2023 17:29:37 +0100 Subject: [PATCH 010/110] Attempt to fix publish-native-packages GitHub workflow --- .github/workflows/publish-native-packages.yml | 16 ++++++++++------ .../RadixDlt.RadixEngineToolkit.Native.nuspec | 8 ++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish-native-packages.yml b/.github/workflows/publish-native-packages.yml index 1507f34f..85db3fc6 100644 --- a/.github/workflows/publish-native-packages.yml +++ b/.github/workflows/publish-native-packages.yml @@ -18,17 +18,21 @@ jobs: github_token: ${{secrets.GITHUB_TOKEN}} workflow: build.yml path: artifacts - skip_unpack: true - name: Extract Artifacts working-directory: artifacts run: | - for z in *.zip; do - unzip "$z"; + mkdir native + + for d in radix-engine-toolkit-native-*.tar.gz; do + mv ./$d/* ./native/ done + cd native + for f in *.tar.gz; do - mkdir $(basename "$f" .tar.gz); - tar -xvzf "$f" --directory=$(basename "$f" .tar.gz); + fn=`echo "$f" | cut -d'.' -f 1` + mkdir "$fn" + tar -xvzf "$f" --directory="$fn"; done - name: Setup .NET SDK uses: actions/setup-dotnet@5a3fa01c67e60dba8f95e2878436c7151c4b5f01 @@ -44,7 +48,7 @@ jobs: sed -i "s/\(\)[^<>]*\(<\/version>\)/\1$VERSION\2/g" interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec - echo "Configured Version: VERSION" + echo "Configured Version: $VERSION" - name: NuGet Pack working-directory: interop/csharp run: nuget pack diff --git a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec index 6cd19792..49563dca 100644 --- a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec +++ b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec @@ -12,10 +12,10 @@ radix sbor - - - - + + + + \ No newline at end of file From 250fca29794274b9cd4f9fb8cc4da8ae5318dba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=81abu=C5=9B?= Date: Thu, 5 Jan 2023 17:48:38 +0100 Subject: [PATCH 011/110] Fixed broken path in publish-native-packages GitHub workflow --- .github/workflows/publish-native-packages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-native-packages.yml b/.github/workflows/publish-native-packages.yml index 85db3fc6..a3d1f1be 100644 --- a/.github/workflows/publish-native-packages.yml +++ b/.github/workflows/publish-native-packages.yml @@ -53,6 +53,7 @@ jobs: 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 }} From 377cac1cb0e0b387fd931e4fb34a9b95cef2e78d Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 6 Jan 2023 13:02:45 +0300 Subject: [PATCH 012/110] Added a aarch64-unknown-linux-gnu target --- .github/workflows/build.yml | 6 +++ build-specific.sh | 47 +++++++++---------- .../RadixDlt.RadixEngineToolkit.Native.nuspec | 1 + ...RadixDlt.RadixEngineToolkit.Native.targets | 7 +++ 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 181e5850..d32ffec7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,11 @@ jobs: 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-native + 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 # radix-engine-toolkit-wasm Crate - crate: radix-engine-toolkit-wasm @@ -96,6 +101,7 @@ jobs: - name: Install Build Dependencies run: | brew tap SergioBenitez/osxct + brew tap messense/macos-cross-toolchains brew install llvm brew install x86_64-unknown-linux-gnu brew install mingw-w64 diff --git a/build-specific.sh b/build-specific.sh index 8c38defa..8b0c71bd 100755 --- a/build-specific.sh +++ b/build-specific.sh @@ -48,31 +48,6 @@ cargo_build() { --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() { @@ -110,5 +85,25 @@ CRATE_PATH="$SCRIPT_DIR/$CRATE_NAME" cd $CRATE_PATH cargo_build $TARGET_TRIPLE -generate_cbindgen_header $TARGET_TRIPLE $CRATE_PATH +target_triple=$TARGET_TRIPLE +crate_path=$CRATE_PATH + +# 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" package_and_compress_build $TARGET_TRIPLE $CRATE_PATH \ No newline at end of file diff --git a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec index 49563dca..16213964 100644 --- a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec +++ b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec @@ -13,6 +13,7 @@ + diff --git a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets index dbf4e902..5660554d 100644 --- a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets +++ b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets @@ -15,6 +15,13 @@ true false + + true + PreserveNewest + native\linux-arm64\libradix_engine_toolkit.so + true + false + true PreserveNewest From 9fdda33c85197276fd4651f9cd3d51b414a51f45 Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 6 Jan 2023 13:04:57 +0300 Subject: [PATCH 013/110] aarch64-unknown-linux-gnu target for JNI --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d32ffec7..f5a42175 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,6 +78,11 @@ jobs: 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-jni + 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-jni target-triple: aarch64-linux-android custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang From bf76d2e00c27bf82ae7706d88b9732fa5d43b2c9 Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 6 Jan 2023 13:06:56 +0300 Subject: [PATCH 014/110] Add aarch64 brew tap later --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f5a42175..829e6f59 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -106,10 +106,12 @@ jobs: - name: Install Build Dependencies run: | brew tap SergioBenitez/osxct - brew tap messense/macos-cross-toolchains brew install llvm brew install x86_64-unknown-linux-gnu brew install mingw-w64 + + brew tap messense/macos-cross-toolchains + brew install aarch64-unknown-linux-gnu wget https://dl.google.com/android/repository/android-ndk-r22b-darwin-x86_64.zip unzip -q android-ndk-r22b-darwin-x86_64.zip -d $HOME/android-ndk From 15b37dbf9f34e2b847a21aa2347834f1cd599e68 Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 6 Jan 2023 13:17:16 +0300 Subject: [PATCH 015/110] Added a 32-bit linux target --- .github/workflows/build.yml | 11 +++++++++++ .../csharp/RadixDlt.RadixEngineToolkit.Native.nuspec | 4 ++++ .../csharp/RadixDlt.RadixEngineToolkit.Native.targets | 9 +++++++++ 3 files changed, 24 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 829e6f59..a00770d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,6 +49,11 @@ jobs: 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-native + 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 # radix-engine-toolkit-wasm Crate - crate: radix-engine-toolkit-wasm @@ -83,6 +88,11 @@ jobs: 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-jni + 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-jni target-triple: aarch64-linux-android custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang @@ -112,6 +122,7 @@ jobs: brew tap messense/macos-cross-toolchains brew install aarch64-unknown-linux-gnu + brew install i686-unknown-linux-gnu wget https://dl.google.com/android/repository/android-ndk-r22b-darwin-x86_64.zip unzip -q android-ndk-r22b-darwin-x86_64.zip -d $HOME/android-ndk diff --git a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec index 16213964..b070b384 100644 --- a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec +++ b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec @@ -13,10 +13,14 @@ + + + + \ No newline at end of file diff --git a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets index 5660554d..ed525294 100644 --- a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets +++ b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets @@ -8,6 +8,7 @@ true false + true PreserveNewest @@ -15,6 +16,13 @@ true false + + true + PreserveNewest + native\linux-x32\libradix_engine_toolkit.so + true + false + true PreserveNewest @@ -22,6 +30,7 @@ true false + true PreserveNewest From 444a4d475378d8a01ff6ff0219b646d6555bf77b Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 6 Jan 2023 14:22:07 +0300 Subject: [PATCH 016/110] Restore all changes made to build-specific.sh --- build-specific.sh | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/build-specific.sh b/build-specific.sh index 8b0c71bd..8c38defa 100755 --- a/build-specific.sh +++ b/build-specific.sh @@ -48,6 +48,31 @@ cargo_build() { --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() { @@ -85,25 +110,5 @@ CRATE_PATH="$SCRIPT_DIR/$CRATE_NAME" cd $CRATE_PATH cargo_build $TARGET_TRIPLE -target_triple=$TARGET_TRIPLE -crate_path=$CRATE_PATH - -# 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" +generate_cbindgen_header $TARGET_TRIPLE $CRATE_PATH package_and_compress_build $TARGET_TRIPLE $CRATE_PATH \ No newline at end of file From ab188d83895d94e38d248f95a46601bb8e735488 Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 6 Jan 2023 14:24:09 +0300 Subject: [PATCH 017/110] Update package version --- docs-examples-generator/Cargo.toml | 2 +- docs-examples-generator/request-examples.md | 2 +- radix-engine-toolkit-core/Cargo.toml | 2 +- radix-engine-toolkit-jni/Cargo.toml | 2 +- radix-engine-toolkit-native/Cargo.toml | 2 +- radix-engine-toolkit-wasm/Cargo.toml | 2 +- spec/transaction-api-spec.yaml | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs-examples-generator/Cargo.toml b/docs-examples-generator/Cargo.toml index 6257129e..f551d559 100644 --- a/docs-examples-generator/Cargo.toml +++ b/docs-examples-generator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "docs-examples-generator" -version = "0.1.0" +version = "0.7.0" edition = "2021" [dependencies] diff --git a/docs-examples-generator/request-examples.md b/docs-examples-generator/request-examples.md index 0d011d67..2f68b990 100644 --- a/docs-examples-generator/request-examples.md +++ b/docs-examples-generator/request-examples.md @@ -25,7 +25,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "package_version": "0.1.0" + "package_version": "0.7.0" } ``` diff --git a/radix-engine-toolkit-core/Cargo.toml b/radix-engine-toolkit-core/Cargo.toml index 3d8e3311..866f3608 100644 --- a/radix-engine-toolkit-core/Cargo.toml +++ b/radix-engine-toolkit-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "radix-engine-toolkit-core" -version = "0.1.0" +version = "0.7.0" edition = "2021" resolver = "2" diff --git a/radix-engine-toolkit-jni/Cargo.toml b/radix-engine-toolkit-jni/Cargo.toml index 5d28a47b..23e7acd9 100644 --- a/radix-engine-toolkit-jni/Cargo.toml +++ b/radix-engine-toolkit-jni/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "radix-engine-toolkit-jni" -version = "0.1.0" +version = "0.7.0" edition = "2021" [dependencies] diff --git a/radix-engine-toolkit-native/Cargo.toml b/radix-engine-toolkit-native/Cargo.toml index 5f029ed1..0a27fd2d 100644 --- a/radix-engine-toolkit-native/Cargo.toml +++ b/radix-engine-toolkit-native/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "radix-engine-toolkit-native" -version = "0.1.0" +version = "0.7.0" edition = "2021" [dependencies] diff --git a/radix-engine-toolkit-wasm/Cargo.toml b/radix-engine-toolkit-wasm/Cargo.toml index 1a7c373a..93eeaa34 100644 --- a/radix-engine-toolkit-wasm/Cargo.toml +++ b/radix-engine-toolkit-wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "radix-engine-toolkit-wasm" -version = "0.1.0" +version = "0.7.0" edition = "2021" [dependencies] diff --git a/spec/transaction-api-spec.yaml b/spec/transaction-api-spec.yaml index 84ff0b88..4f4542b8 100644 --- a/spec/transaction-api-spec.yaml +++ b/spec/transaction-api-spec.yaml @@ -19,7 +19,7 @@ openapi: 3.0.3 info: title: Radix Engine Toolkit description: "A Rust library with multiple compilation targets that aims to make the creation and decompilation of transactions possible with clients written in any language." - version: 0.1.0 + version: 0.7.0 servers: [] paths: {} components: @@ -44,7 +44,7 @@ components: package_version: type: string example: - package_version: "0.1.0" + package_version: "0.7.0" # Convert Manifest ConvertManifestRequest: From 676f164f64b476d2c76edfdf069d984472269219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=81abu=C5=9B?= Date: Sat, 7 Jan 2023 14:47:38 +0100 Subject: [PATCH 018/110] Fixed broken x86 native library path for dotnet interpos --- .../RadixDlt.RadixEngineToolkit.Native.nuspec | 2 +- ...RadixDlt.RadixEngineToolkit.Native.targets | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec index b070b384..be48aa3d 100644 --- a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec +++ b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec @@ -12,8 +12,8 @@ radix sbor + - diff --git a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets index ed525294..bd48447e 100644 --- a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets +++ b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets @@ -1,14 +1,13 @@ - + true PreserveNewest - native\win-x64\radix_engine_toolkit.dll + native\linux-x86\libradix_engine_toolkit.so true false - true PreserveNewest @@ -16,13 +15,6 @@ true false - - true - PreserveNewest - native\linux-x32\libradix_engine_toolkit.so - true - false - true PreserveNewest @@ -46,6 +38,14 @@ false + + true + PreserveNewest + native\win-x64\radix_engine_toolkit.dll + true + 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 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets deleted file mode 100644 index bd48447e..00000000 --- a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets +++ /dev/null @@ -1,60 +0,0 @@ - - - - - true - PreserveNewest - native\linux-x86\libradix_engine_toolkit.so - true - false - - - true - PreserveNewest - native\linux-x64\libradix_engine_toolkit.so - true - false - - - true - PreserveNewest - native\linux-arm64\libradix_engine_toolkit.so - true - false - - - - true - PreserveNewest - native\osx-x64\libradix_engine_toolkit.dylib - true - false - - - true - PreserveNewest - native\osx-arm64\libradix_engine_toolkit.dylib - true - false - - - - true - PreserveNewest - native\win-x64\radix_engine_toolkit.dll - true - false - - - - - - \ No newline at end of file diff --git a/radix-engine-toolkit-core/Cargo.toml b/radix-engine-toolkit-core/Cargo.toml deleted file mode 100644 index 866f3608..00000000 --- a/radix-engine-toolkit-core/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -name = "radix-engine-toolkit-core" -version = "0.7.0" -edition = "2021" -resolver = "2" - -[dependencies] -hex = { version = "0.4.3", default-features = false } -bech32 = { version = "0.9.0", default-features = false } - -serde = { version = "1.0.144", default-features = false, features = ["serde_derive"] } -serde_json = { version = "1.0.85", default-features = false, features = ["std"] } -serde_with = { version = "2.0.0", default-features = false, features = ["hex", "macros"] } - -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.7.0" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.7.0", features = ["serde"] } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.7.0", package = "utils" } -radix_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.7.0", features = ["serde"], package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.7.0" } - -[dev-dependencies] -lazy_static = "1.4.0" -serde_json = { version = "1.0.85", default-features = false, features = ["std", "preserve_order"] } - -[lib] -crate-type = ["lib"] diff --git a/radix-engine-toolkit-core/clippy.toml b/radix-engine-toolkit-core/clippy.toml deleted file mode 100644 index 79878f4d..00000000 --- a/radix-engine-toolkit-core/clippy.toml +++ /dev/null @@ -1,11 +0,0 @@ -# In the future, the following types will not be allowed to be used in the repository and will lead -# to linting errors if used. These types are not allowed as they can lead to non-determinisim in the -# Radix Engine Toolkit which is extremely undesirable. - -disallowed-types = [ - { path = "std::collections::BTreeMap", reason = "Non determinstic types such as this type can lead to non-determinism in compiled transactions. Use IndexMap as a deterministic alternative to this type." }, - { path = "std::collections::HashMap", reason = "Non determinstic types such as this type can lead to non-determinism in compiled transactions. Use IndexMap as a deterministic alternative to this type." }, - - { path = "std::collections::BTreeSet", reason = "Non determinstic types such as this type can lead to non-determinism in compiled transactions. Use IndexSet as a deterministic alternative to this type" }, - { path = "std::collections::HashSet", reason = "Non determinstic types such as this type can lead to non-determinism in compiled transactions. Use IndexSet as a deterministic alternative to this type" }, -] \ No newline at end of file diff --git a/radix-engine-toolkit-core/src/error.rs b/radix-engine-toolkit-core/src/error.rs deleted file mode 100644 index 04cda13a..00000000 --- a/radix-engine-toolkit-core/src/error.rs +++ /dev/null @@ -1,210 +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 crate::model::{value::ValueKind, RENodeKind}; -use serde::{Deserialize, Serialize}; - -/// Represents an error encountered by the operations of the crate. -/// -/// This is the main error type used throughout this crate to represent errors of all kinds. This -/// error enum is not meant consist of other error types (as values of its variants) for three -/// mains reasons: -/// -/// 1. When errors are nested a few levels deep, their serialized representation looks very -/// unintuitive and is not very easy to understand. -/// 2. Modeling of non-nested errors is easier in other languages (such as TypeScript) which will be -/// consuming and making use of this API. -/// 3. Some errors can not be nested since they do not implement the `Serialize` trait and therefore -/// Serde can not serialize them. -/// -/// Therefore, it is fine for variants of this enum to have values as long as these values are not -/// error enums which need to be serialized. -/// -/// Regarding the issue with certain errors not being serializable. An easy (but perhaps temporary) -/// way of dealing with this is to represent these errors as `String`s. As an example, a -/// `DecimalParseError` can not be represented as the following variant: -/// `DecimalParseError(DecimalParseError)` since the `DecimalParseError` type does not implement -/// `Serialize`. But, a variant can be created which holds a `String` value and a -/// `From` trait can be implemented for this error type to allow for -/// `DecimalParseError` errors to be represented through this type. -#[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Ord, Eq)] -#[serde(tag = "error", content = "value")] -pub enum Error { - // =============== - // General Errors - // =============== - /// An error emitted if the encoding or decoding of Bech32 addresses fails. - AddressError(String), - - /// An error emitted when attempting to get information on an address but its format could not - /// be established. Typically, this means that the entity byte is invalid or unknown. - UnrecognizedAddressFormat, - - /// An error emitted when the decoding of SBOR fails. - SborDecodeError(String), - - /// An error emitted when the decoding of SBOR fails. - SborEncodeError(String), - - // ===================== - // Serde Related Errors - // ===================== - /// An error emitted when deserialization of a JSON payload fails. - DeserializationError(String), - - /// An error emitted when the contents of the request string pointer could not be loaded. - InvalidRequestString(String), - - // ======================== - // Value Conversion Errors - // ======================== - /// An error emitted during the conversion from radix_transaction::ast::Value => crate::Value. This - /// error typically means that the contents of some value were unexpected. An example of this is - /// a package address being found inside of a [`radix_transaction::manifest::ast::Value::Decimal`]. - UnexpectedContents { - kind_being_parsed: ValueKind, - allowed_children_kinds: Vec, - found_child_kind: ValueKind, - }, - - /// An error emitted during the conversion of [`crate::model::RENode`] into the AST's native - /// type. This error signals that unexpected contents were found when parsing the contents of - /// RENode. For example, for the case where we are parsing a [`crate::model::RENode::Bucket`], - /// we expect that it consists of a [`radix_transaction::manifest::ast::Value::String`] or a - /// [`radix_transaction::manifest::ast::Value::U32`]. If when parsing this `RENode`, we - /// encounter anything else that is not the types we expect, then this error is emitted. - UnexpectedReNodeContents { - kind_being_parsed: RENodeKind, - allowed_children_kinds: Vec, - found_child_kind: ValueKind, - }, - - /// An error emitted when validating the type of `Value` objects. - InvalidType { - expected_types: Vec, - actual_type: ValueKind, - }, - - /// An error emitted when encountering an unknown SBOR type id during value conversion. - UnknownTypeId { type_id: u8 }, - - /// An error emitted when the parsing of a value from string fails. - ParseError { kind: ValueKind, message: String }, - - /// An error emitted when the hex decoding of a byte array fails. - HexDecodeError(String), - - // ============================== - // Instruction Conversion Errors - // ============================== - /// An error emitted when an error is encountered during transaction compilation. - TransactionCompileError(String), - - /// An error when an error encountered during transaction manifest decompilation. - TransactionDecompileError(String), - - /// An error emitted when a transaction version is specified but the library has no support for - /// this transaction version. - UnsupportedTransactionVersion(u8), - - /// An error emitted during the conversion of ast::Instructions to a `TransactionManifest` - GeneratorError(String), - - // =========================== - // Internal Operations Errors - // =========================== - /// An error emitted when the conversion to a specific request or response type fails - RequestResponseConversionError(String), - - /// An error emitted when attempting to decompile a transaction intent but the format is not - /// known to the library. - UnrecognizedCompiledIntentFormat, - - /// An error emitted when attempting to validate a transaction fails. - TransactionValidationError(String), - - /// An error emitted when the extraction of the package ABI fails. - ExtractAbiError(String), - - /// An error emitted when there is a network mismatch between addresses and the header network - NetworkMismatchError { expected: u8, found: u8 }, -} - -macro_rules! impl_from_error { - ($($error_type: ty => $variant_ident: ident,)*) => { - $( - impl From<$error_type> for Error { - fn from(error: $error_type) -> Self { - Self::$variant_ident(format!("{:?}", error)) - } - } - )* - }; -} - -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: ValueKind::$kind, - message: format!("{:?}", error) - } - } - } - )* - }; -} - -impl_from_parse_error! { - scrypto::prelude::ParseDecimalError => Decimal, - scrypto::prelude::ParsePreciseDecimalError => PreciseDecimal, - scrypto::prelude::ParseHashError => Hash, - scrypto::prelude::ParseNonFungibleIdError => NonFungibleId, - scrypto::prelude::ParseNonFungibleAddressError => NonFungibleAddress, - scrypto::prelude::ParseBlobError => Blob, - scrypto::prelude::ParseExpressionError => Expression, - scrypto::prelude::ParseEcdsaSecp256k1PublicKeyError => EcdsaSecp256k1PublicKey, - scrypto::prelude::ParseEcdsaSecp256k1SignatureError => EcdsaSecp256k1Signature, - scrypto::prelude::ParseEddsaEd25519PublicKeyError => EddsaEd25519PublicKey, - scrypto::prelude::ParseEddsaEd25519SignatureError => EddsaEd25519Signature, -} - -impl_from_error! { - scrypto::radix_engine_interface::address::AddressError => AddressError, - sbor::DecodeError => SborDecodeError, - sbor::EncodeError => SborEncodeError, - hex::FromHexError => HexDecodeError, - - serde_json::Error => DeserializationError, - std::str::Utf8Error => InvalidRequestString, - - radix_transaction::manifest::CompileError => TransactionCompileError, - radix_transaction::manifest::DecompileError => TransactionDecompileError, - radix_transaction::manifest::generator::GeneratorError => GeneratorError, - radix_transaction::errors::TransactionValidationError => TransactionValidationError, - radix_transaction::errors::SignatureValidationError => TransactionValidationError, -} - -impl Display for Error { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self) - } -} diff --git a/radix-engine-toolkit-core/src/lib.rs b/radix-engine-toolkit-core/src/lib.rs deleted file mode 100644 index a34ad9eb..00000000 --- a/radix-engine-toolkit-core/src/lib.rs +++ /dev/null @@ -1,27 +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. - -// When ready to completely not allow for the disallowed types, switch this to from `warn` to `deny` -// and clippy will error out when these types are used. -#![warn(clippy::disallowed_types)] - -pub mod error; -pub mod memory; -pub mod model; -pub mod requests; -pub mod traits; -pub mod utils; diff --git a/radix-engine-toolkit-core/src/memory.rs b/radix-engine-toolkit-core/src/memory.rs deleted file mode 100644 index a60bf8d8..00000000 --- a/radix-engine-toolkit-core/src/memory.rs +++ /dev/null @@ -1,168 +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 crate::error::Error; -use serde::{Deserialize, Serialize}; -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); -} - -/// Reads and deserializes a JSON string from memory. -/// -/// This function reads a JSON-encoded null-terminated UTF-8 encoded c-string from memory and -/// attempts to deserialize it from JSON as the generic type `T`. -/// -/// There are two cases where this function could return a [`Result::Err`]: -/// -/// 1. If no null-terminated c-string could be read from the provided memory location. -/// 2. If the string could not be deserialized to the generic type `T`. -/// -/// # Safety -/// -/// * This function makes use of pointers which is an unsafe feature. -/// -/// # Note -/// -/// This function does **NOT** take ownership of the data at the provided memory location. The -/// allocated memory still requires deallocation through one of the deallocation function defined in -/// the [`crate::memory`] module. -/// -/// # Arguments -/// -/// * `string_pointer`: [`Pointer`] - A pointer to the allocated memory location -/// -/// # Returns -/// -/// * [`Result`]: An object of type `T` is returned if the reading of the memory and the -/// deserialization both succeed. Otherwise, an [`Error`] is returned. -pub unsafe fn toolkit_read_and_deserialize_json_string_from_memory<'t, T>( - string_pointer: Pointer, -) -> Result -where - T: Deserialize<'t>, -{ - let string = std::ffi::CStr::from_ptr(string_pointer as *const std::ffi::c_char).to_str()?; - Ok(serde_json::from_str(string)?) -} - -/// Serializes and writes the serialized string to memory -/// -/// This function takes an object that can be serialized using serde--an object that implements the -/// [`Serialize`] trait--serializes it to a JSON string, allocates the required memory to write this -/// string to memory as a null-terminated C-String, and writes the string to memory. This function -/// then returns a pointer to the memory location that the string is stored at. -/// -/// # Safety -/// -/// * This function makes use of pointers which is an unsafe feature. -/// -/// # Arguments -/// -/// * `object`: `T` - A generic object that implements the [`Serialize`] trait. -/// -/// # Arguments -/// -/// * [`Pointer`] - A pointer to the allocated memory location -pub unsafe fn toolkit_serialize_to_json_string_and_write_to_memory( - object: &T, -) -> Result -where - T: Serialize, -{ - let object_string = serde_json::to_string(object)?; - let object_bytes = object_string.as_bytes(); - let byte_count = object_bytes.len() + 1; - - let pointer = toolkit_alloc(byte_count); - pointer.copy_from( - [object_bytes, &[0]].concat().as_ptr() as Pointer, - byte_count, - ); - Ok(pointer) -} diff --git a/radix-engine-toolkit-core/src/model/address/bech32_coder.rs b/radix-engine-toolkit-core/src/model/address/bech32_coder.rs deleted file mode 100644 index 0cb7233a..00000000 --- a/radix-engine-toolkit-core/src/model/address/bech32_coder.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 scrypto::radix_engine_interface::address::{Bech32Decoder, Bech32Encoder}; -use scrypto::radix_engine_interface::core::NetworkDefinition; - -use crate::error::Error; -use crate::utils::{ - network_definition_from_network_id, network_id_from_address_string, network_id_from_hrp, -}; - -pub struct Bech32Coder { - pub network_definition: NetworkDefinition, - pub encoder: Bech32Encoder, - pub decoder: Bech32Decoder, -} - -impl Bech32Coder { - pub fn new(network_id: u8) -> Self { - let network_definition = network_definition_from_network_id(network_id); - Self { - network_definition: network_definition.clone(), - encoder: Bech32Encoder::new(&network_definition), - decoder: Bech32Decoder::new(&network_definition), - } - } - - pub fn network_id(&self) -> u8 { - self.network_definition.id - } - - pub fn new_from_hrp(hrp: &str) -> Result { - Ok(Self::new(network_id_from_hrp(hrp)?)) - } - - pub fn new_from_address(address: &str) -> Result { - Ok(Self::new(network_id_from_address_string(address)?)) - } -} - -impl AsRef for Bech32Coder { - fn as_ref(&self) -> &Bech32Coder { - self - } -} diff --git a/radix-engine-toolkit-core/src/model/address/entity_address.rs b/radix-engine-toolkit-core/src/model/address/entity_address.rs deleted file mode 100644 index efeb3497..00000000 --- a/radix-engine-toolkit-core/src/model/address/entity_address.rs +++ /dev/null @@ -1,164 +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 serde::{Deserialize, Serialize}; - -use super::network_aware_address::*; -use crate::{error::Error, traits::ValidateWithContext}; - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(tag = "type", content = "address")] -pub enum EntityAddress { - ComponentAddress(NetworkAwareComponentAddress), - ResourceAddress(NetworkAwareResourceAddress), - PackageAddress(NetworkAwarePackageAddress), - SystemAddress(NetworkAwareSystemAddress), -} - -impl EntityAddress { - pub fn kind(&self) -> AddressKind { - match self { - Self::ComponentAddress(component_address) => match component_address.address { - scrypto::prelude::ComponentAddress::Normal(_) => AddressKind::NormalComponent, - scrypto::prelude::ComponentAddress::Account(_) => AddressKind::AccountComponent, - scrypto::prelude::ComponentAddress::EcdsaSecp256k1VirtualAccount(_) => { - AddressKind::EcdsaSecp256k1VirtualAccount - } - scrypto::prelude::ComponentAddress::EddsaEd25519VirtualAccount(_) => { - AddressKind::EddsaEd25519VirtualAccount - } - }, - Self::ResourceAddress(resource_address) => match resource_address.address { - scrypto::prelude::ResourceAddress::Normal(_) => AddressKind::Resource, - }, - Self::PackageAddress(package_address) => match package_address.address { - scrypto::prelude::PackageAddress::Normal(_) => AddressKind::Package, - }, - Self::SystemAddress(system_address) => match system_address.address { - scrypto::prelude::SystemAddress::EpochManager(_) => AddressKind::SystemEpochManager, - scrypto::prelude::SystemAddress::Clock(_) => AddressKind::SystemClock, - }, - } - } - - 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, - Self::SystemAddress(address) => address.network_id, - } - } - - pub fn from_u8_array(array: &[u8], network_id: u8) -> Result { - if let Ok(component_address) = - NetworkAwareComponentAddress::from_u8_array(array, network_id) - { - Ok(Self::ComponentAddress(component_address)) - } else if let Ok(resource_address) = - NetworkAwareResourceAddress::from_u8_array(array, network_id) - { - Ok(Self::ResourceAddress(resource_address)) - } else if let Ok(package_address) = - NetworkAwarePackageAddress::from_u8_array(array, network_id) - { - Ok(Self::PackageAddress(package_address)) - } else { - Err(Error::UnrecognizedAddressFormat) - } - } -} - -impl From for EntityAddress { - fn from(address: NetworkAwareComponentAddress) -> Self { - Self::ComponentAddress(address) - } -} - -impl From for EntityAddress { - fn from(address: NetworkAwareResourceAddress) -> Self { - Self::ResourceAddress(address) - } -} - -impl From for EntityAddress { - fn from(address: NetworkAwarePackageAddress) -> Self { - Self::PackageAddress(address) - } -} - -impl From for EntityAddress { - fn from(address: NetworkAwareSystemAddress) -> Self { - Self::SystemAddress(address) - } -} - -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), - EntityAddress::SystemAddress(address) => write!(f, "{}", address), - } - } -} - -impl FromStr for EntityAddress { - type Err = Error; - - fn from_str(s: &str) -> Result { - if let Ok(component_address) = NetworkAwareComponentAddress::from_str(s) { - Ok(Self::ComponentAddress(component_address)) - } else if let Ok(resource_address) = NetworkAwareResourceAddress::from_str(s) { - Ok(Self::ResourceAddress(resource_address)) - } else if let Ok(package_address) = NetworkAwarePackageAddress::from_str(s) { - Ok(Self::PackageAddress(package_address)) - } else { - Err(Error::UnrecognizedAddressFormat) - } - } -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum AddressKind { - Resource, - Package, - SystemClock, - SystemEpochManager, - - NormalComponent, - AccountComponent, - EcdsaSecp256k1VirtualAccount, - EddsaEd25519VirtualAccount, -} - -impl ValidateWithContext for EntityAddress { - fn validate(&self, network_id: u8) -> Result<(), Error> { - if self.network_id() == network_id { - Ok(()) - } else { - Err(Error::NetworkMismatchError { - expected: network_id, - found: self.network_id(), - }) - } - } -} diff --git a/radix-engine-toolkit-core/src/model/address/mod.rs b/radix-engine-toolkit-core/src/model/address/mod.rs deleted file mode 100644 index 5db6ec6a..00000000 --- a/radix-engine-toolkit-core/src/model/address/mod.rs +++ /dev/null @@ -1,24 +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 bech32_coder; -pub mod entity_address; -pub mod network_aware_address; - -pub use bech32_coder::*; -pub use entity_address::*; -pub use network_aware_address::*; diff --git a/radix-engine-toolkit-core/src/model/address/network_aware_address.rs b/radix-engine-toolkit-core/src/model/address/network_aware_address.rs deleted file mode 100644 index e2c874e2..00000000 --- a/radix-engine-toolkit-core/src/model/address/network_aware_address.rs +++ /dev/null @@ -1,133 +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::convert::TryFrom; -use std::fmt::Display; -use std::str::FromStr; - -use serde::de::Error as DeserializationError; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -use crate::error::Error; -use crate::model::address::bech32_coder::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, Clone, Hash, Eq, PartialEq, PartialOrd, Ord)] - pub struct $network_aware_struct_ident { - pub network_id: u8, - pub address: $underlying_type, - } - - 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<'de> Deserialize<'de> for $network_aware_struct_ident { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let address_string: String = Deserialize::deserialize(deserializer)?; - let address = address_string - .parse() - .map_err(|err| DeserializationError::custom(format!("{:?}", err)))?; - Ok(address) - } - } - - impl Serialize for $network_aware_struct_ident { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - serializer.serialize_str(&self.to_string()) - } - } - - impl From<$network_aware_struct_ident> for $underlying_type { - fn from(address: $network_aware_struct_ident) -> $underlying_type { - address.address - } - } - - impl From<&$network_aware_struct_ident> for $underlying_type { - fn from(address: &$network_aware_struct_ident) -> $underlying_type { - address.address - } - } - - 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.encoder.$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.decoder.$decoding_method_ident(s)?, - network_id: bech32_coder.network_id(), - }) - } - } - }; -} - -define_network_aware_address!( - scrypto::prelude::ComponentAddress => NetworkAwareComponentAddress, - encode_component_address_to_string, - validate_and_decode_component_address -); -define_network_aware_address!( - scrypto::prelude::PackageAddress => NetworkAwarePackageAddress, - encode_package_address_to_string, - validate_and_decode_package_address -); -define_network_aware_address!( - scrypto::prelude::ResourceAddress => NetworkAwareResourceAddress, - encode_resource_address_to_string, - validate_and_decode_resource_address -); -define_network_aware_address!( - scrypto::prelude::SystemAddress => NetworkAwareSystemAddress, - encode_system_address_to_string, - validate_and_decode_system_address -); diff --git a/radix-engine-toolkit-core/src/model/helper/call_method_receiver.rs b/radix-engine-toolkit-core/src/model/helper/call_method_receiver.rs deleted file mode 100644 index b00da8a8..00000000 --- a/radix-engine-toolkit-core/src/model/helper/call_method_receiver.rs +++ /dev/null @@ -1,101 +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::{Bech32Coder, NetworkAwareComponentAddress, NodeIdentifier, Value, ValueKind}; -use radix_transaction::manifest::ast::{ScryptoReceiver as AstScryptoReceiver, Value as AstValue}; - -#[derive(Clone, Debug, PartialEq, Eq)] -pub enum ScryptoReceiver { - ComponentAddress(NetworkAwareComponentAddress), - Component(NodeIdentifier), -} - -impl ScryptoReceiver { - pub fn to_ast_scrypto_receiver(&self, bech32_coder: &Bech32Coder) -> AstScryptoReceiver { - match self { - Self::Component(identifier) => { - AstScryptoReceiver::Component(AstValue::String(identifier.to_string())) - } - Self::ComponentAddress(address) => { - let address_string = bech32_coder - .encoder - .encode_component_address_to_string(&address.address); - AstScryptoReceiver::Global(AstValue::String(address_string)) - } - } - } - - pub fn from_ast_scrypto_receiver( - receiver: &AstScryptoReceiver, - bech32_coder: &Bech32Coder, - ) -> Result { - match receiver { - AstScryptoReceiver::Component(value) => { - if let AstValue::String(identifier_hex) = value { - Ok(Self::Component(identifier_hex.parse()?)) - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::Component, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - }) - } - } - AstScryptoReceiver::Global(value) => { - if let AstValue::String(address_string) = value { - Ok(Self::ComponentAddress(NetworkAwareComponentAddress { - network_id: bech32_coder.network_id(), - address: bech32_coder - .decoder - .validate_and_decode_component_address(address_string)?, - })) - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::ComponentAddress, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - }) - } - } - } - } -} - -impl From for Value { - fn from(receiver: ScryptoReceiver) -> Self { - match receiver { - ScryptoReceiver::Component(identifier) => Value::Component { identifier }, - ScryptoReceiver::ComponentAddress(address) => Value::ComponentAddress { address }, - } - } -} - -impl TryFrom for ScryptoReceiver { - type Error = Error; - - fn try_from(value: Value) -> Result { - match value { - Value::Component { identifier } => Ok(ScryptoReceiver::Component(identifier)), - Value::ComponentAddress { address } => Ok(ScryptoReceiver::ComponentAddress(address)), - _ => Err(Error::InvalidType { - expected_types: vec![ValueKind::Component, ValueKind::ComponentAddress], - actual_type: value.kind(), - }), - } - } -} diff --git a/radix-engine-toolkit-core/src/model/helper/mod.rs b/radix-engine-toolkit-core/src/model/helper/mod.rs deleted file mode 100644 index e8066397..00000000 --- a/radix-engine-toolkit-core/src/model/helper/mod.rs +++ /dev/null @@ -1,32 +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 call_method_receiver; -pub mod non_fungible_address; -pub mod non_fungible_id_proxy; -pub mod option_proxy; -pub mod result_proxy; -pub mod validation_config_proxy; -pub mod value_proxy; - -pub use call_method_receiver::*; -pub use non_fungible_address::*; -pub use non_fungible_id_proxy::*; -pub use option_proxy::*; -pub use result_proxy::*; -pub use validation_config_proxy::*; -pub use value_proxy::*; diff --git a/radix-engine-toolkit-core/src/model/helper/non_fungible_address.rs b/radix-engine-toolkit-core/src/model/helper/non_fungible_address.rs deleted file mode 100644 index 3c8e29b4..00000000 --- a/radix-engine-toolkit-core/src/model/helper/non_fungible_address.rs +++ /dev/null @@ -1,68 +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 serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use scrypto::prelude::{ - FromPublicKey, NonFungibleAddress as NativeNonFungibleAddress, NonFungibleId, PublicKey, -}; - -use super::ValueSerializationProxy; -use crate::model::NetworkAwareResourceAddress; - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] -pub struct NonFungibleAddress { - #[serde_as(as = "ValueSerializationProxy")] - pub resource_address: NetworkAwareResourceAddress, - - #[serde_as(as = "ValueSerializationProxy")] - pub non_fungible_id: NonFungibleId, -} - -impl NonFungibleAddress { - pub fn new( - resource_address: NetworkAwareResourceAddress, - non_fungible_id: NonFungibleId, - ) -> Self { - Self { - resource_address, - non_fungible_id, - } - } - - pub fn from_public_key + Clone>(public_key: &P, network_id: u8) -> Self { - let native_non_fungible_address = NativeNonFungibleAddress::from_public_key(public_key); - Self { - resource_address: NetworkAwareResourceAddress { - network_id, - address: native_non_fungible_address.resource_address(), - }, - non_fungible_id: native_non_fungible_address.non_fungible_id().clone(), - } - } -} - -impl From for scrypto::prelude::NonFungibleAddress { - fn from(value: NonFungibleAddress) -> Self { - scrypto::prelude::NonFungibleAddress::new( - value.resource_address.address, - value.non_fungible_id, - ) - } -} diff --git a/radix-engine-toolkit-core/src/model/helper/non_fungible_id_proxy.rs b/radix-engine-toolkit-core/src/model/helper/non_fungible_id_proxy.rs deleted file mode 100644 index 04628e1c..00000000 --- a/radix-engine-toolkit-core/src/model/helper/non_fungible_id_proxy.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 serde::{Deserialize, Serialize}; -use serde_with::{serde_as, DisplayFromStr}; - -use scrypto::prelude::NonFungibleId; - -#[serde_as] -#[derive(Serialize, Deserialize)] -#[serde(tag = "variant", content = "value")] -pub enum NonFungibleIdProxy { - String(String), - U32(#[serde_as(as = "DisplayFromStr")] u32), - U64(#[serde_as(as = "DisplayFromStr")] u64), - Bytes(#[serde_as(as = "serde_with::hex::Hex")] Vec), - UUID(#[serde_as(as = "DisplayFromStr")] u128), -} - -impl From for NonFungibleIdProxy { - fn from(value: NonFungibleId) -> Self { - match value { - NonFungibleId::U32(value) => Self::U32(value), - NonFungibleId::U64(value) => Self::U64(value), - NonFungibleId::UUID(value) => Self::UUID(value), - NonFungibleId::String(value) => Self::String(value), - NonFungibleId::Bytes(value) => Self::Bytes(value), - } - } -} - -impl From for NonFungibleId { - fn from(value: NonFungibleIdProxy) -> Self { - match value { - NonFungibleIdProxy::U32(value) => Self::U32(value), - NonFungibleIdProxy::U64(value) => Self::U64(value), - NonFungibleIdProxy::UUID(value) => Self::UUID(value), - NonFungibleIdProxy::String(value) => Self::String(value), - NonFungibleIdProxy::Bytes(value) => Self::Bytes(value), - } - } -} diff --git a/radix-engine-toolkit-core/src/model/helper/option_proxy.rs b/radix-engine-toolkit-core/src/model/helper/option_proxy.rs deleted file mode 100644 index dfef956b..00000000 --- a/radix-engine-toolkit-core/src/model/helper/option_proxy.rs +++ /dev/null @@ -1,43 +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 serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize)] -#[serde(tag = "variant")] -pub enum OptionProxy { - Some { field: T }, - None, -} - -impl From> for OptionProxy { - fn from(option: Option) -> Self { - match option { - Option::Some(field) => Self::Some { field }, - Option::None => Self::None, - } - } -} - -impl From> for Option { - fn from(option: OptionProxy) -> Self { - match option { - OptionProxy::Some { field } => Self::Some(field), - OptionProxy::None => Self::None, - } - } -} diff --git a/radix-engine-toolkit-core/src/model/helper/result_proxy.rs b/radix-engine-toolkit-core/src/model/helper/result_proxy.rs deleted file mode 100644 index 415ebceb..00000000 --- a/radix-engine-toolkit-core/src/model/helper/result_proxy.rs +++ /dev/null @@ -1,43 +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 serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize)] -#[serde(tag = "variant")] -pub enum ResultProxy { - Ok { field: O }, - Err { field: E }, -} - -impl From> for Result { - fn from(result: ResultProxy) -> Self { - match result { - ResultProxy::Ok { field } => Result::Ok(field), - ResultProxy::Err { field } => Result::Err(field), - } - } -} - -impl From> for ResultProxy { - fn from(result: Result) -> Self { - match result { - Result::Ok(field) => ResultProxy::Ok { field }, - Result::Err(field) => ResultProxy::Err { field }, - } - } -} diff --git a/radix-engine-toolkit-core/src/model/helper/validation_config_proxy.rs b/radix-engine-toolkit-core/src/model/helper/validation_config_proxy.rs deleted file mode 100644 index 7f51ab10..00000000 --- a/radix-engine-toolkit-core/src/model/helper/validation_config_proxy.rs +++ /dev/null @@ -1,68 +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_transaction::validation::ValidationConfig; -use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, DisplayFromStr}; - -#[serde_as] -#[derive(Serialize, Deserialize)] -pub struct ValidationConfigProxy { - #[serde_as(as = "DisplayFromStr")] - pub network_id: u8, - - #[serde_as(as = "DisplayFromStr")] - pub min_cost_unit_limit: u32, - - #[serde_as(as = "DisplayFromStr")] - pub max_cost_unit_limit: u32, - - #[serde_as(as = "DisplayFromStr")] - pub min_tip_percentage: u8, - - #[serde_as(as = "DisplayFromStr")] - pub max_tip_percentage: u8, - - #[serde_as(as = "DisplayFromStr")] - pub max_epoch_range: u64, -} - -impl From for ValidationConfigProxy { - 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, - } - } -} - -impl From for ValidationConfig { - fn from(value: ValidationConfigProxy) -> 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-core/src/model/helper/value_proxy.rs b/radix-engine-toolkit-core/src/model/helper/value_proxy.rs deleted file mode 100644 index c75b6a4d..00000000 --- a/radix-engine-toolkit-core/src/model/helper/value_proxy.rs +++ /dev/null @@ -1,54 +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 serde::de::Error as DeserializationError; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use serde_with::{DeserializeAs, SerializeAs}; - -use crate::error::Error; -use crate::model::value::Value; - -/// A serde-as serializer that serializes and deserializes object as a [Value]. This is useful for -/// consistent returns from the toolkit. -pub struct ValueSerializationProxy; - -impl SerializeAs for ValueSerializationProxy -where - T: Into + Clone, -{ - fn serialize_as(source: &T, serializer: S) -> Result - where - S: Serializer, - { - let value = source.clone().into(); - value.serialize(serializer) - } -} - -impl<'de, T> DeserializeAs<'de, T> for ValueSerializationProxy -where - T: TryFrom + Clone, -{ - fn deserialize_as(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - Value::deserialize(deserializer)? - .try_into() - .map_err(|err| D::Error::custom(format!("{:?}", err))) - } -} diff --git a/radix-engine-toolkit-core/src/model/identifier.rs b/radix-engine-toolkit-core/src/model/identifier.rs deleted file mode 100644 index 76d65b9c..00000000 --- a/radix-engine-toolkit-core/src/model/identifier.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 std::{convert::Infallible, str::FromStr}; - -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, Hash, PartialEq, Eq, Clone, PartialOrd, Ord)] -#[serde(untagged)] -pub enum Identifier { - String(String), - U32(u32), -} - -impl From for Identifier { - fn from(value: String) -> Self { - Self::String(value) - } -} - -impl From for Identifier { - fn from(value: u32) -> Self { - Self::U32(value) - } -} - -impl FromStr for Identifier { - type Err = Infallible; - - fn from_str(s: &str) -> Result { - Ok(Self::String(s.into())) - } -} - -#[derive(Serialize, Deserialize, Debug, Hash, PartialEq, Eq, Clone, PartialOrd, Ord)] -pub struct BucketId(pub Identifier); - -impl From for BucketId { - fn from(identifier: Identifier) -> Self { - Self(identifier) - } -} - -impl From for Identifier { - fn from(bucket_id: BucketId) -> Self { - bucket_id.0 - } -} - -#[derive(Serialize, Deserialize, Debug, Hash, PartialEq, Eq, Clone, PartialOrd, Ord)] -pub struct ProofId(pub Identifier); - -impl From for ProofId { - fn from(identifier: Identifier) -> Self { - Self(identifier) - } -} - -impl From for Identifier { - fn from(proof_id: ProofId) -> Self { - proof_id.0 - } -} diff --git a/radix-engine-toolkit-core/src/model/instruction.rs b/radix-engine-toolkit-core/src/model/instruction.rs deleted file mode 100644 index b01bb59c..00000000 --- a/radix-engine-toolkit-core/src/model/instruction.rs +++ /dev/null @@ -1,829 +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_transaction::manifest::ast::{ - Instruction as AstInstruction, Receiver as AstReceiver, Value as AstValue, -}; -use scrypto::prelude::{Blob, Decimal, NonFungibleId}; -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; -use std::collections::HashSet; - -use crate::error::Error; -use crate::model::re_node::*; -use crate::model::value::*; -use crate::model::{ - Bech32Coder, BucketId, NetworkAwarePackageAddress, NetworkAwareResourceAddress, ProofId, - ValueSerializationProxy, -}; -use crate::traits::ValidateWithContext; - -use super::EntityAddress; -use super::NonFungibleAddress; -use super::ScryptoReceiver; - -#[serde_as] -#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] -#[serde(tag = "instruction", rename_all = "SCREAMING_SNAKE_CASE")] -pub enum Instruction { - CallFunction { - #[serde_as(as = "ValueSerializationProxy")] - package_address: NetworkAwarePackageAddress, - - #[serde_as(as = "ValueSerializationProxy")] - blueprint_name: String, - - #[serde_as(as = "ValueSerializationProxy")] - function_name: String, - - #[serde(default, skip_serializing_if = "Option::is_none")] - arguments: Option>, - }, - CallNativeFunction { - #[serde_as(as = "ValueSerializationProxy")] - blueprint_name: String, - - #[serde_as(as = "ValueSerializationProxy")] - function_name: String, - - #[serde(default, skip_serializing_if = "Option::is_none")] - arguments: Option>, - }, - - CallMethod { - #[serde_as(as = "ValueSerializationProxy")] - component_address: ScryptoReceiver, - - #[serde_as(as = "ValueSerializationProxy")] - method_name: String, - - #[serde(default, skip_serializing_if = "Option::is_none")] - arguments: Option>, - }, - CallNativeMethod { - receiver: RENode, - - #[serde_as(as = "ValueSerializationProxy")] - method_name: String, - - #[serde(default, skip_serializing_if = "Option::is_none")] - arguments: Option>, - }, - - TakeFromWorktop { - #[serde_as(as = "ValueSerializationProxy")] - resource_address: NetworkAwareResourceAddress, - - #[serde_as(as = "ValueSerializationProxy")] - into_bucket: BucketId, - }, - TakeFromWorktopByAmount { - #[serde_as(as = "ValueSerializationProxy")] - amount: Decimal, - - #[serde_as(as = "ValueSerializationProxy")] - resource_address: NetworkAwareResourceAddress, - - #[serde_as(as = "ValueSerializationProxy")] - into_bucket: BucketId, - }, - TakeFromWorktopByIds { - #[serde_as(as = "HashSet")] - ids: HashSet, - - #[serde_as(as = "ValueSerializationProxy")] - resource_address: NetworkAwareResourceAddress, - - #[serde_as(as = "ValueSerializationProxy")] - into_bucket: BucketId, - }, - ReturnToWorktop { - #[serde_as(as = "ValueSerializationProxy")] - bucket: BucketId, - }, - - AssertWorktopContains { - #[serde_as(as = "ValueSerializationProxy")] - resource_address: NetworkAwareResourceAddress, - }, - AssertWorktopContainsByAmount { - #[serde_as(as = "ValueSerializationProxy")] - amount: Decimal, - - #[serde_as(as = "ValueSerializationProxy")] - resource_address: NetworkAwareResourceAddress, - }, - AssertWorktopContainsByIds { - #[serde_as(as = "HashSet")] - ids: HashSet, - - #[serde_as(as = "ValueSerializationProxy")] - resource_address: NetworkAwareResourceAddress, - }, - - PopFromAuthZone { - #[serde_as(as = "ValueSerializationProxy")] - into_proof: ProofId, - }, - PushToAuthZone { - #[serde_as(as = "ValueSerializationProxy")] - proof: ProofId, - }, - ClearAuthZone, - - CreateProofFromAuthZone { - #[serde_as(as = "ValueSerializationProxy")] - resource_address: NetworkAwareResourceAddress, - - #[serde_as(as = "ValueSerializationProxy")] - into_proof: ProofId, - }, - CreateProofFromAuthZoneByAmount { - #[serde_as(as = "ValueSerializationProxy")] - amount: Decimal, - - #[serde_as(as = "ValueSerializationProxy")] - resource_address: NetworkAwareResourceAddress, - - #[serde_as(as = "ValueSerializationProxy")] - into_proof: ProofId, - }, - CreateProofFromAuthZoneByIds { - #[serde_as(as = "HashSet")] - ids: HashSet, - - #[serde_as(as = "ValueSerializationProxy")] - resource_address: NetworkAwareResourceAddress, - - #[serde_as(as = "ValueSerializationProxy")] - into_proof: ProofId, - }, - - CreateProofFromBucket { - #[serde_as(as = "ValueSerializationProxy")] - bucket: BucketId, - - #[serde_as(as = "ValueSerializationProxy")] - into_proof: ProofId, - }, - - CloneProof { - #[serde_as(as = "ValueSerializationProxy")] - proof: ProofId, - - #[serde_as(as = "ValueSerializationProxy")] - into_proof: ProofId, - }, - DropProof { - #[serde_as(as = "ValueSerializationProxy")] - proof: ProofId, - }, - DropAllProofs, - - PublishPackageWithOwner { - #[serde_as(as = "ValueSerializationProxy")] - code: Blob, - - #[serde_as(as = "ValueSerializationProxy")] - abi: Blob, - - #[serde_as(as = "ValueSerializationProxy")] - owner_badge: NonFungibleAddress, - }, - - // TODO: Figure out the structured model of this. - CreateResource { - resource_type: Value, - metadata: Value, - access_rules: Value, - mint_params: Value, - }, - - BurnBucket { - #[serde_as(as = "ValueSerializationProxy")] - bucket: BucketId, - }, - - MintFungible { - #[serde_as(as = "ValueSerializationProxy")] - resource_address: NetworkAwareResourceAddress, - - #[serde_as(as = "ValueSerializationProxy")] - amount: Decimal, - }, -} - -impl Instruction { - // ============ - // Conversions - // ============ - pub fn to_ast_instruction(&self, bech32_coder: &Bech32Coder) -> Result { - let instruction = self.clone(); - let ast_instruction = match instruction { - Self::CallFunction { - package_address, - blueprint_name, - function_name, - arguments, - } => AstInstruction::CallFunction { - package_address: Value::from(package_address).to_ast_value(bech32_coder)?, - blueprint_name: Value::from(blueprint_name).to_ast_value(bech32_coder)?, - function_name: Value::from(function_name).to_ast_value(bech32_coder)?, - args: arguments - .unwrap_or_default() - .iter() - .map(|v| v.to_ast_value(bech32_coder)) - .collect::, _>>()?, - }, - Self::CallNativeFunction { - blueprint_name, - function_name, - arguments, - } => AstInstruction::CallNativeFunction { - blueprint_name: Value::from(blueprint_name).to_ast_value(bech32_coder)?, - function_name: Value::from(function_name).to_ast_value(bech32_coder)?, - args: arguments - .unwrap_or_default() - .iter() - .map(|v| v.to_ast_value(bech32_coder)) - .collect::, _>>()?, - }, - Self::CallMethod { - component_address, - method_name, - arguments, - } => AstInstruction::CallMethod { - receiver: component_address.to_ast_scrypto_receiver(bech32_coder), - method: Value::from(method_name).to_ast_value(bech32_coder)?, - args: arguments - .unwrap_or_default() - .iter() - .map(|v| v.to_ast_value(bech32_coder)) - .collect::, _>>()?, - }, - Self::CallNativeMethod { - receiver, - method_name, - arguments, - } => AstInstruction::CallNativeMethod { - receiver: AstReceiver::Ref(ast_re_node_from_re_node(&receiver)), - method: Value::from(method_name).to_ast_value(bech32_coder)?, - args: arguments - .unwrap_or_default() - .iter() - .map(|v| v.to_ast_value(bech32_coder)) - .collect::, _>>()?, - }, - - Self::TakeFromWorktop { - resource_address, - into_bucket, - } => AstInstruction::TakeFromWorktop { - resource_address: Value::from(resource_address).to_ast_value(bech32_coder)?, - new_bucket: Value::from(into_bucket).to_ast_value(bech32_coder)?, - }, - Self::TakeFromWorktopByAmount { - amount, - resource_address, - into_bucket, - } => AstInstruction::TakeFromWorktopByAmount { - amount: Value::from(amount).to_ast_value(bech32_coder)?, - resource_address: Value::from(resource_address).to_ast_value(bech32_coder)?, - new_bucket: Value::from(into_bucket).to_ast_value(bech32_coder)?, - }, - Self::TakeFromWorktopByIds { - ids, - resource_address, - into_bucket, - } => AstInstruction::TakeFromWorktopByIds { - ids: Value::Array { - element_type: ValueKind::NonFungibleId, - elements: ids.into_iter().map(Value::from).collect(), - } - .to_ast_value(bech32_coder)?, - resource_address: Value::from(resource_address).to_ast_value(bech32_coder)?, - new_bucket: Value::from(into_bucket).to_ast_value(bech32_coder)?, - }, - Self::ReturnToWorktop { bucket } => AstInstruction::ReturnToWorktop { - bucket: Value::from(bucket).to_ast_value(bech32_coder)?, - }, - - Self::AssertWorktopContains { resource_address } => { - AstInstruction::AssertWorktopContains { - resource_address: Value::from(resource_address).to_ast_value(bech32_coder)?, - } - } - Self::AssertWorktopContainsByAmount { - amount, - resource_address, - } => AstInstruction::AssertWorktopContainsByAmount { - amount: Value::from(amount).to_ast_value(bech32_coder)?, - resource_address: Value::from(resource_address).to_ast_value(bech32_coder)?, - }, - Self::AssertWorktopContainsByIds { - ids, - resource_address, - } => AstInstruction::AssertWorktopContainsByIds { - ids: Value::Array { - element_type: ValueKind::NonFungibleId, - elements: ids.into_iter().map(Value::from).collect(), - } - .to_ast_value(bech32_coder)?, - resource_address: Value::from(resource_address).to_ast_value(bech32_coder)?, - }, - - Self::PopFromAuthZone { into_proof } => AstInstruction::PopFromAuthZone { - new_proof: Value::from(into_proof).to_ast_value(bech32_coder)?, - }, - Self::PushToAuthZone { proof } => AstInstruction::PushToAuthZone { - proof: Value::from(proof).to_ast_value(bech32_coder)?, - }, - Self::ClearAuthZone => AstInstruction::ClearAuthZone, - - Self::CreateProofFromAuthZone { - resource_address, - into_proof, - } => AstInstruction::CreateProofFromAuthZone { - resource_address: Value::from(resource_address).to_ast_value(bech32_coder)?, - new_proof: Value::from(into_proof).to_ast_value(bech32_coder)?, - }, - Self::CreateProofFromAuthZoneByAmount { - amount, - resource_address, - into_proof, - } => AstInstruction::CreateProofFromAuthZoneByAmount { - amount: Value::from(amount).to_ast_value(bech32_coder)?, - resource_address: Value::from(resource_address).to_ast_value(bech32_coder)?, - new_proof: Value::from(into_proof).to_ast_value(bech32_coder)?, - }, - Self::CreateProofFromAuthZoneByIds { - ids, - resource_address, - into_proof, - } => AstInstruction::CreateProofFromAuthZoneByIds { - ids: Value::Array { - element_type: ValueKind::NonFungibleId, - elements: ids.into_iter().map(Value::from).collect(), - } - .to_ast_value(bech32_coder)?, - resource_address: Value::from(resource_address).to_ast_value(bech32_coder)?, - new_proof: Value::from(into_proof).to_ast_value(bech32_coder)?, - }, - Self::CreateProofFromBucket { bucket, into_proof } => { - AstInstruction::CreateProofFromBucket { - bucket: Value::from(bucket).to_ast_value(bech32_coder)?, - new_proof: Value::from(into_proof).to_ast_value(bech32_coder)?, - } - } - - Self::CloneProof { proof, into_proof } => AstInstruction::CloneProof { - proof: Value::from(proof).to_ast_value(bech32_coder)?, - new_proof: Value::from(into_proof).to_ast_value(bech32_coder)?, - }, - - Self::DropProof { proof } => AstInstruction::DropProof { - proof: Value::from(proof).to_ast_value(bech32_coder)?, - }, - Self::DropAllProofs => AstInstruction::DropAllProofs, - Self::PublishPackageWithOwner { - code, - abi, - owner_badge, - } => AstInstruction::PublishPackageWithOwner { - owner_badge: Value::from(owner_badge).to_ast_value(bech32_coder)?, - code: Value::from(code).to_ast_value(bech32_coder)?, - abi: Value::from(abi).to_ast_value(bech32_coder)?, - }, - - Self::MintFungible { - resource_address, - amount, - } => AstInstruction::MintFungible { - resource_address: Value::from(resource_address).to_ast_value(bech32_coder)?, - amount: Value::from(amount).to_ast_value(bech32_coder)?, - }, - Self::BurnBucket { bucket } => AstInstruction::BurnBucket { - bucket: Value::from(bucket).to_ast_value(bech32_coder)?, - }, - Self::CreateResource { - resource_type, - metadata, - access_rules, - mint_params, - } => AstInstruction::CreateResource { - resource_type: resource_type.to_ast_value(bech32_coder)?, - metadata: metadata.to_ast_value(bech32_coder)?, - access_rules: access_rules.to_ast_value(bech32_coder)?, - mint_params: mint_params.to_ast_value(bech32_coder)?, - }, - }; - Ok(ast_instruction) - } - - pub fn from_ast_instruction( - ast_instruction: &AstInstruction, - bech32_coder: &Bech32Coder, - ) -> Result { - let instruction = match ast_instruction { - AstInstruction::CallFunction { - package_address, - blueprint_name, - function_name, - args, - } => Self::CallFunction { - package_address: Value::from_ast_value(package_address, bech32_coder)? - .try_into()?, - blueprint_name: Value::from_ast_value(blueprint_name, bech32_coder)?.try_into()?, - function_name: Value::from_ast_value(function_name, bech32_coder)?.try_into()?, - arguments: { - let arguments = args - .iter() - .map(|v| Value::from_ast_value(v, bech32_coder)) - .collect::, _>>()?; - match arguments.len() { - 0 => None, - _ => Some(arguments), - } - }, - }, - AstInstruction::CallNativeFunction { - blueprint_name, - function_name, - args, - } => Self::CallNativeFunction { - blueprint_name: Value::from_ast_value(blueprint_name, bech32_coder)?.try_into()?, - function_name: Value::from_ast_value(function_name, bech32_coder)?.try_into()?, - arguments: { - let arguments = args - .iter() - .map(|v| Value::from_ast_value(v, bech32_coder)) - .collect::, _>>()?; - match arguments.len() { - 0 => None, - _ => Some(arguments), - } - }, - }, - AstInstruction::CallMethod { - receiver, - method, - args, - } => Self::CallMethod { - component_address: ScryptoReceiver::from_ast_scrypto_receiver( - receiver, - bech32_coder, - )?, - method_name: Value::from_ast_value(method, bech32_coder)?.try_into()?, - arguments: { - let arguments = args - .iter() - .map(|v| Value::from_ast_value(v, bech32_coder)) - .collect::, _>>()?; - match arguments.len() { - 0 => None, - _ => Some(arguments), - } - }, - }, - AstInstruction::CallNativeMethod { - receiver, - method, - args, - } => Self::CallNativeMethod { - receiver: match receiver { - AstReceiver::Ref(ast_re_node) => re_node_from_ast_re_node(ast_re_node)?, - }, - method_name: Value::from_ast_value(method, bech32_coder)?.try_into()?, - arguments: { - let arguments = args - .iter() - .map(|v| Value::from_ast_value(v, bech32_coder)) - .collect::, _>>()?; - match arguments.len() { - 0 => None, - _ => Some(arguments), - } - }, - }, - - AstInstruction::TakeFromWorktop { - resource_address, - new_bucket, - } => Self::TakeFromWorktop { - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?.try_into()?, - }, - AstInstruction::TakeFromWorktopByAmount { - amount, - resource_address, - new_bucket, - } => Self::TakeFromWorktopByAmount { - amount: Value::from_ast_value(amount, bech32_coder)?.try_into()?, - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?.try_into()?, - }, - AstInstruction::TakeFromWorktopByIds { - ids, - resource_address, - new_bucket, - } => Self::TakeFromWorktopByIds { - ids: if let Value::Array { - element_type: _, - elements, - } = Value::from_ast_value(ids, bech32_coder)? - { - elements - .into_iter() - .map(NonFungibleId::try_from) - .collect::, _>>()? - } else { - panic!("Expected type Array!") - }, - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?.try_into()?, - }, - AstInstruction::ReturnToWorktop { bucket } => Self::ReturnToWorktop { - bucket: Value::from_ast_value(bucket, bech32_coder)?.try_into()?, - }, - - AstInstruction::AssertWorktopContains { resource_address } => { - Self::AssertWorktopContains { - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - } - } - AstInstruction::AssertWorktopContainsByAmount { - amount, - resource_address, - } => Self::AssertWorktopContainsByAmount { - amount: Value::from_ast_value(amount, bech32_coder)?.try_into()?, - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - }, - AstInstruction::AssertWorktopContainsByIds { - ids, - resource_address, - } => Self::AssertWorktopContainsByIds { - ids: if let Value::Array { - element_type: _, - elements, - } = Value::from_ast_value(ids, bech32_coder)? - { - elements - .into_iter() - .map(NonFungibleId::try_from) - .collect::, _>>()? - } else { - panic!("Expected type Array!") - }, - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - }, - - AstInstruction::PopFromAuthZone { new_proof } => Self::PopFromAuthZone { - into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, - }, - AstInstruction::PushToAuthZone { proof } => Self::PushToAuthZone { - proof: Value::from_ast_value(proof, bech32_coder)?.try_into()?, - }, - AstInstruction::ClearAuthZone => Self::ClearAuthZone, - - AstInstruction::CreateProofFromAuthZone { - resource_address, - new_proof, - } => Self::CreateProofFromAuthZone { - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, - }, - AstInstruction::CreateProofFromAuthZoneByAmount { - amount, - resource_address, - new_proof, - } => Self::CreateProofFromAuthZoneByAmount { - amount: Value::from_ast_value(amount, bech32_coder)?.try_into()?, - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, - }, - AstInstruction::CreateProofFromAuthZoneByIds { - ids, - resource_address, - new_proof, - } => Self::CreateProofFromAuthZoneByIds { - ids: if let Value::Array { - element_type: _, - elements, - } = Value::from_ast_value(ids, bech32_coder)? - { - elements - .into_iter() - .map(NonFungibleId::try_from) - .collect::, _>>()? - } else { - panic!("Expected type Array!") - }, - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, - }, - AstInstruction::CreateProofFromBucket { bucket, new_proof } => { - Self::CreateProofFromBucket { - bucket: Value::from_ast_value(bucket, bech32_coder)?.try_into()?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, - } - } - - AstInstruction::CloneProof { proof, new_proof } => Self::CloneProof { - proof: Value::from_ast_value(proof, bech32_coder)?.try_into()?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, - }, - AstInstruction::DropProof { proof } => Self::DropProof { - proof: Value::from_ast_value(proof, bech32_coder)?.try_into()?, - }, - AstInstruction::DropAllProofs => Self::DropAllProofs, - AstInstruction::PublishPackageWithOwner { - code, - abi, - owner_badge, - } => Self::PublishPackageWithOwner { - owner_badge: Value::from_ast_value(owner_badge, bech32_coder)?.try_into()?, - code: Value::from_ast_value(code, bech32_coder)?.try_into()?, - abi: Value::from_ast_value(abi, bech32_coder)?.try_into()?, - }, - AstInstruction::MintFungible { - resource_address, - amount, - } => Self::MintFungible { - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - amount: Value::from_ast_value(amount, bech32_coder)?.try_into()?, - }, - AstInstruction::BurnBucket { bucket } => Self::BurnBucket { - bucket: Value::from_ast_value(bucket, bech32_coder)?.try_into()?, - }, - AstInstruction::CreateResource { - resource_type, - metadata, - access_rules, - mint_params, - } => Self::CreateResource { - resource_type: Value::from_ast_value(resource_type, bech32_coder)?, - metadata: Value::from_ast_value(metadata, bech32_coder)?, - access_rules: Value::from_ast_value(access_rules, bech32_coder)?, - mint_params: Value::from_ast_value(mint_params, bech32_coder)?, - }, - }; - Ok(instruction) - } -} - -// =========== -// Validation -// =========== - -impl ValidateWithContext for Instruction { - fn validate(&self, network_id: u8) -> Result<(), Error> { - let instruction = self.clone(); - match instruction { - Self::CallFunction { - package_address, - arguments, - .. - } => { - EntityAddress::from(package_address).validate(network_id)?; - arguments - .unwrap_or_default() - .iter() - .map(|arg| arg.validate((network_id, None))) - .collect::, Error>>()?; - Ok(()) - } - Self::CallNativeFunction { arguments, .. } => { - arguments - .unwrap_or_default() - .iter() - .map(|arg| arg.validate((network_id, None))) - .collect::, Error>>()?; - Ok(()) - } - - Self::CallMethod { - component_address, - arguments, - .. - } => { - if let ScryptoReceiver::ComponentAddress(address) = component_address { - EntityAddress::from(address).validate(network_id)?; - } else { - } - arguments - .unwrap_or_default() - .iter() - .map(|arg| arg.validate((network_id, None))) - .collect::, Error>>()?; - Ok(()) - } - Self::CallNativeMethod { arguments, .. } => { - arguments - .unwrap_or_default() - .iter() - .map(|arg| arg.validate((network_id, None))) - .collect::, Error>>()?; - Ok(()) - } - - Self::TakeFromWorktop { - resource_address, .. - } => { - EntityAddress::from(resource_address).validate(network_id)?; - Ok(()) - } - Self::TakeFromWorktopByAmount { - resource_address, .. - } => { - EntityAddress::from(resource_address).validate(network_id)?; - Ok(()) - } - Self::TakeFromWorktopByIds { - resource_address, .. - } => { - EntityAddress::from(resource_address).validate(network_id)?; - Ok(()) - } - Self::ReturnToWorktop { bucket: _ } => Ok(()), - - Self::AssertWorktopContains { resource_address } => { - EntityAddress::from(resource_address).validate(network_id)?; - Ok(()) - } - Self::AssertWorktopContainsByAmount { - resource_address, .. - } => { - EntityAddress::from(resource_address).validate(network_id)?; - Ok(()) - } - Self::AssertWorktopContainsByIds { - resource_address, .. - } => { - EntityAddress::from(resource_address).validate(network_id)?; - Ok(()) - } - - Self::PopFromAuthZone { .. } => Ok(()), - Self::PushToAuthZone { .. } => Ok(()), - Self::ClearAuthZone => Ok(()), - - Self::CreateProofFromAuthZone { - resource_address, .. - } => { - EntityAddress::from(resource_address).validate(network_id)?; - Ok(()) - } - Self::CreateProofFromAuthZoneByAmount { - resource_address, .. - } => { - EntityAddress::from(resource_address).validate(network_id)?; - Ok(()) - } - Self::CreateProofFromAuthZoneByIds { - resource_address, .. - } => { - EntityAddress::from(resource_address).validate(network_id)?; - Ok(()) - } - - Self::CreateProofFromBucket { .. } => Ok(()), - - Self::CloneProof { proof: _, .. } => Ok(()), - Self::DropProof { proof: _ } => Ok(()), - Self::DropAllProofs => Ok(()), - - Self::PublishPackageWithOwner { .. } => Ok(()), - - Self::MintFungible { .. } => Ok(()), - Self::BurnBucket { bucket: _ } => Ok(()), - Self::CreateResource { .. } => { - // TODO: Add validation for this instruction - Ok(()) - } - } - } -} diff --git a/radix-engine-toolkit-core/src/model/mod.rs b/radix-engine-toolkit-core/src/model/mod.rs deleted file mode 100644 index 25c7b6ae..00000000 --- a/radix-engine-toolkit-core/src/model/mod.rs +++ /dev/null @@ -1,32 +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; -pub mod helper; -pub mod identifier; -pub mod instruction; -pub mod radix_engine_node; -pub mod transaction; -pub mod value; - -pub use address::*; -pub use helper::*; -pub use identifier::*; -pub use instruction::*; -pub use radix_engine_node::*; -pub use transaction::*; -pub use value::*; diff --git a/radix-engine-toolkit-core/src/model/radix_engine_node/mod.rs b/radix-engine-toolkit-core/src/model/radix_engine_node/mod.rs deleted file mode 100644 index 2617fa0c..00000000 --- a/radix-engine-toolkit-core/src/model/radix_engine_node/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. - -pub mod node_identifier; -pub mod re_node; - -pub use node_identifier::*; -pub use re_node::*; diff --git a/radix-engine-toolkit-core/src/model/radix_engine_node/node_identifier.rs b/radix-engine-toolkit-core/src/model/radix_engine_node/node_identifier.rs deleted file mode 100644 index ac948eed..00000000 --- a/radix-engine-toolkit-core/src/model/radix_engine_node/node_identifier.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 std::str::FromStr; - -use serde::de::Error as DeserializationError; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -use scrypto::prelude::Hash; -use scrypto_utils::copy_u8_array; - -use crate::error::Error; - -#[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] -pub struct NodeIdentifier(pub (Hash, u32)); - -impl NodeIdentifier { - pub fn to_bytes(&self) -> [u8; 36] { - let mut node_id_bytes = self.0 .0.to_vec(); - node_id_bytes.extend(self.0 .1.to_le_bytes()); - copy_u8_array(&node_id_bytes) - } - - pub fn from_bytes(vec: [u8; 36]) -> Self { - let hash_bytes = &vec[0..32]; - let index_bytes = &vec[32..]; - - let hash = Hash(copy_u8_array(hash_bytes)); - let index = u32::from_le_bytes(copy_u8_array(index_bytes)); - - Self((hash, index)) - } -} - -impl From<(Hash, u32)> for NodeIdentifier { - fn from(value: (Hash, u32)) -> Self { - Self(value) - } -} - -impl From for (Hash, u32) { - fn from(entity_id: NodeIdentifier) -> Self { - entity_id.0 - } -} - -impl Serialize for NodeIdentifier { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - serializer.serialize_str(&self.to_string()) - } -} - -impl<'de> Deserialize<'de> for NodeIdentifier { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let node_id_string: String = Deserialize::deserialize(deserializer)?; - node_id_string - .parse() - .map_err(|_| DeserializationError::custom("Failed to parse node id from string")) - } -} - -impl ToString for NodeIdentifier { - fn to_string(&self) -> String { - hex::encode(self.to_bytes()) - } -} - -impl FromStr for NodeIdentifier { - type Err = Error; - - fn from_str(s: &str) -> Result { - let node_id_bytes = hex::decode(s) - .map_err(|_| Error::DeserializationError(format!("Failed to decode node id: {}", s)))?; - - // TODO: Should not do a copy u8 array without first checking the length - Ok(Self::from_bytes(copy_u8_array(&node_id_bytes))) - } -} diff --git a/radix-engine-toolkit-core/src/model/radix_engine_node/re_node.rs b/radix-engine-toolkit-core/src/model/radix_engine_node/re_node.rs deleted file mode 100644 index d2f7f75f..00000000 --- a/radix-engine-toolkit-core/src/model/radix_engine_node/re_node.rs +++ /dev/null @@ -1,278 +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_transaction::manifest::ast::{RENode as AstRENode, Value as AstValue}; - -use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, DisplayFromStr}; - -use crate::error::Error; -use crate::model::{Identifier, NodeIdentifier}; - -use crate::model::value::ValueKind; - -#[serde_as] -#[derive(Serialize, Deserialize, Debug, Hash, PartialEq, Eq, Clone)] -#[serde(tag = "type", content = "identifier")] -pub enum RENode { - Bucket(Identifier), - Proof(Identifier), - - AuthZoneStack(#[serde_as(as = "DisplayFromStr")] u32), - Worktop, - - Global(String), - KeyValueStore(NodeIdentifier), - NonFungibleStore(NodeIdentifier), - Component(NodeIdentifier), - EpochManager(NodeIdentifier), - Vault(NodeIdentifier), - ResourceManager(NodeIdentifier), - Package(NodeIdentifier), - Clock(NodeIdentifier), -} - -#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, PartialOrd, Ord, Eq)] -pub enum RENodeKind { - Bucket, - Proof, - - AuthZoneStack, - Worktop, - - Global, - KeyValueStore, - NonFungibleStore, - Component, - EpochManager, - Vault, - ResourceManager, - Package, - Clock, -} - -// ============ -// Conversions -// ============ - -pub fn ast_re_node_from_re_node(re_node: &RENode) -> AstRENode { - match re_node { - RENode::Bucket(identifier) => { - let ast_value = match identifier { - Identifier::String(string) => AstValue::String(string.clone()), - Identifier::U32(number) => AstValue::U32(*number), - }; - AstRENode::Bucket(ast_value) - } - RENode::Proof(identifier) => { - let ast_value = match identifier { - Identifier::String(string) => AstValue::String(string.clone()), - Identifier::U32(number) => AstValue::U32(*number), - }; - AstRENode::Proof(ast_value) - } - - RENode::AuthZoneStack(auth_zone_id) => { - let ast_value = AstValue::U32(*auth_zone_id); - AstRENode::AuthZoneStack(ast_value) - } - RENode::Worktop => AstRENode::Worktop, - - RENode::Global(identifier) => { - let ast_value = AstValue::String(identifier.to_owned()); - AstRENode::Global(ast_value) - } - RENode::KeyValueStore(identifier) => { - let ast_value = AstValue::String(identifier.to_string()); - AstRENode::KeyValueStore(ast_value) - } - RENode::NonFungibleStore(identifier) => { - let ast_value = AstValue::String(identifier.to_string()); - AstRENode::NonFungibleStore(ast_value) - } - RENode::Component(identifier) => { - let ast_value = AstValue::String(identifier.to_string()); - AstRENode::Component(ast_value) - } - RENode::EpochManager(identifier) => { - let ast_value = AstValue::String(identifier.to_string()); - AstRENode::EpochManager(ast_value) - } - RENode::Vault(identifier) => { - let ast_value = AstValue::String(identifier.to_string()); - AstRENode::Vault(ast_value) - } - RENode::ResourceManager(identifier) => { - let ast_value = AstValue::String(identifier.to_string()); - AstRENode::ResourceManager(ast_value) - } - RENode::Package(identifier) => { - let ast_value = AstValue::String(identifier.to_string()); - AstRENode::Package(ast_value) - } - RENode::Clock(identifier) => { - let ast_value = AstValue::String(identifier.to_string()); - AstRENode::Clock(ast_value) - } - } -} - -pub fn re_node_from_ast_re_node(ast_re_node: &AstRENode) -> Result { - let re_node = match ast_re_node { - AstRENode::Bucket(identifier) => { - if let AstValue::U32(identifier) = identifier { - RENode::Bucket(Identifier::U32(*identifier)) - } else if let AstValue::String(identifier) = identifier { - RENode::Bucket(Identifier::String(identifier.clone())) - } else { - Err(Error::UnexpectedReNodeContents { - kind_being_parsed: RENodeKind::Bucket, - allowed_children_kinds: vec![ValueKind::U32, ValueKind::String], - found_child_kind: identifier.kind().into(), - })? - } - } - AstRENode::Proof(identifier) => { - if let AstValue::U32(identifier) = identifier { - RENode::Proof(Identifier::U32(*identifier)) - } else if let AstValue::String(identifier) = identifier { - RENode::Proof(Identifier::String(identifier.clone())) - } else { - Err(Error::UnexpectedReNodeContents { - kind_being_parsed: RENodeKind::Proof, - allowed_children_kinds: vec![ValueKind::U32, ValueKind::String], - found_child_kind: identifier.kind().into(), - })? - } - } - - AstRENode::AuthZoneStack(identifier) => { - if let AstValue::U32(identifier) = identifier { - RENode::AuthZoneStack(*identifier) - } else { - Err(Error::UnexpectedReNodeContents { - kind_being_parsed: RENodeKind::AuthZoneStack, - allowed_children_kinds: vec![ValueKind::U32], - found_child_kind: identifier.kind().into(), - })? - } - } - - AstRENode::Worktop => RENode::Worktop, - - AstRENode::Global(identifier) => { - if let AstValue::String(identifier) = identifier { - RENode::Global(identifier.clone()) - } else { - Err(Error::UnexpectedReNodeContents { - kind_being_parsed: RENodeKind::Global, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: identifier.kind().into(), - })? - } - } - AstRENode::KeyValueStore(identifier) => { - if let AstValue::String(identifier) = identifier { - RENode::KeyValueStore(identifier.parse()?) - } else { - Err(Error::UnexpectedReNodeContents { - kind_being_parsed: RENodeKind::KeyValueStore, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: identifier.kind().into(), - })? - } - } - AstRENode::NonFungibleStore(identifier) => { - if let AstValue::String(identifier) = identifier { - RENode::NonFungibleStore(identifier.parse()?) - } else { - Err(Error::UnexpectedReNodeContents { - kind_being_parsed: RENodeKind::NonFungibleStore, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: identifier.kind().into(), - })? - } - } - AstRENode::Component(identifier) => { - if let AstValue::String(identifier) = identifier { - RENode::Component(identifier.parse()?) - } else { - Err(Error::UnexpectedReNodeContents { - kind_being_parsed: RENodeKind::Component, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: identifier.kind().into(), - })? - } - } - AstRENode::EpochManager(identifier) => { - if let AstValue::String(identifier) = identifier { - RENode::EpochManager(identifier.parse()?) - } else { - Err(Error::UnexpectedReNodeContents { - kind_being_parsed: RENodeKind::EpochManager, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: identifier.kind().into(), - })? - } - } - AstRENode::Vault(identifier) => { - if let AstValue::String(identifier) = identifier { - RENode::Vault(identifier.parse()?) - } else { - Err(Error::UnexpectedReNodeContents { - kind_being_parsed: RENodeKind::Vault, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: identifier.kind().into(), - })? - } - } - AstRENode::ResourceManager(identifier) => { - if let AstValue::String(identifier) = identifier { - RENode::ResourceManager(identifier.parse()?) - } else { - Err(Error::UnexpectedReNodeContents { - kind_being_parsed: RENodeKind::ResourceManager, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: identifier.kind().into(), - })? - } - } - AstRENode::Package(identifier) => { - if let AstValue::String(identifier) = identifier { - RENode::Package(identifier.parse()?) - } else { - Err(Error::UnexpectedReNodeContents { - kind_being_parsed: RENodeKind::Package, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: identifier.kind().into(), - })? - } - } - AstRENode::Clock(identifier) => { - if let AstValue::String(identifier) = identifier { - RENode::Clock(identifier.parse()?) - } else { - Err(Error::UnexpectedReNodeContents { - kind_being_parsed: RENodeKind::Clock, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: identifier.kind().into(), - })? - } - } - }; - Ok(re_node) -} diff --git a/radix-engine-toolkit-core/src/model/transaction/header.rs b/radix-engine-toolkit-core/src/model/transaction/header.rs deleted file mode 100644 index f8b2ec92..00000000 --- a/radix-engine-toolkit-core/src/model/transaction/header.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 radix_transaction::model::TransactionHeader as NativeTransactionHeader; -use radix_transaction::validation::NotarizedTransactionValidator; - -use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, DisplayFromStr}; - -use crate::model::{TransactionIntent, TransactionManifest}; -use crate::traits::Validate; -use crate::utils::validation_config_from_header; - -// ================= -// Model Definition -// ================= - -#[serde_as] -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct TransactionHeader { - #[serde_as(as = "DisplayFromStr")] - pub version: u8, - #[serde_as(as = "DisplayFromStr")] - pub network_id: u8, - #[serde_as(as = "DisplayFromStr")] - pub start_epoch_inclusive: u64, - #[serde_as(as = "DisplayFromStr")] - pub end_epoch_exclusive: u64, - #[serde_as(as = "DisplayFromStr")] - pub nonce: u64, - pub notary_public_key: scrypto::prelude::PublicKey, - pub notary_as_signatory: bool, - #[serde_as(as = "DisplayFromStr")] - pub cost_unit_limit: u32, - #[serde_as(as = "DisplayFromStr")] - pub tip_percentage: u8, -} - -// ============ -// Conversions -// ============ - -impl From for TransactionHeader { - fn from(header: NativeTransactionHeader) -> Self { - Self { - version: header.version, - network_id: header.network_id, - start_epoch_inclusive: header.start_epoch_inclusive, - end_epoch_exclusive: header.end_epoch_exclusive, - nonce: header.nonce, - notary_public_key: header.notary_public_key, - notary_as_signatory: header.notary_as_signatory, - cost_unit_limit: header.cost_unit_limit, - tip_percentage: header.tip_percentage, - } - } -} - -impl From for NativeTransactionHeader { - fn from(header: TransactionHeader) -> Self { - Self { - version: header.version, - network_id: header.network_id, - start_epoch_inclusive: header.start_epoch_inclusive, - end_epoch_exclusive: header.end_epoch_exclusive, - nonce: header.nonce, - notary_public_key: header.notary_public_key, - notary_as_signatory: header.notary_as_signatory, - cost_unit_limit: header.cost_unit_limit, - tip_percentage: header.tip_percentage, - } - } -} - -// =========== -// Validation -// =========== - -impl Validate for TransactionHeader { - fn validate(&self) -> Result<(), crate::error::Error> { - NotarizedTransactionValidator::new(validation_config_from_header(self)) - .validate_header( - &TransactionIntent { - header: self.clone(), - manifest: TransactionManifest { - instructions: crate::model::ManifestInstructions::JSON(Vec::new()), - blobs: Vec::new(), - }, - } - .try_into()?, - ) - .map_err( - radix_transaction::errors::TransactionValidationError::HeaderValidationError, - )?; - Ok(()) - } -} diff --git a/radix-engine-toolkit-core/src/model/transaction/intent.rs b/radix-engine-toolkit-core/src/model/transaction/intent.rs deleted file mode 100644 index 83c0d6f8..00000000 --- a/radix-engine-toolkit-core/src/model/transaction/intent.rs +++ /dev/null @@ -1,125 +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_transaction::model::TransactionIntent as NativeTransactionIntent; -use radix_transaction::validation::{NotarizedTransactionValidator, TestIntentHashManager}; -use scrypto::prelude::{scrypto_decode, scrypto_encode}; - -use serde::{Deserialize, Serialize}; - -use crate::error::Error; -use crate::model::address::Bech32Coder; -use crate::model::transaction::{TransactionHeader, TransactionManifest}; -use crate::model::ManifestInstructionsKind; -use crate::traits::{CompilableIntent, TryIntoWithContext, Validate, ValidateWithContext}; -use crate::utils::validation_config_from_header; - -// ================= -// Model Definition -// ================= - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct TransactionIntent { - pub header: TransactionHeader, - pub manifest: TransactionManifest, -} - -// ============ -// Conversions -// ============ - -impl TryInto for TransactionIntent { - type Error = Error; - - fn try_into(self) -> Result { - let bech32_coder = Bech32Coder::new(self.header.network_id); - - let transaction_intent = NativeTransactionIntent { - header: self.header.into(), - manifest: self.manifest.try_into_with_context(&bech32_coder)?, - }; - Ok(transaction_intent) - } -} - -impl TryIntoWithContext for NativeTransactionIntent { - type Error = Error; - - fn try_into_with_context( - self, - manifest_output_format: ManifestInstructionsKind, - ) -> Result { - let bech32_coder = Bech32Coder::new(self.header.network_id); - - let transaction_intent = TransactionIntent { - header: self.header.into(), - manifest: self - .manifest - .try_into_with_context((manifest_output_format, &bech32_coder))?, - }; - Ok(transaction_intent) - } -} - -// ============================== -// Compilation and Decompilation -// ============================== - -impl CompilableIntent for TransactionIntent { - fn compile(&self) -> Result, Error> { - // Convert the transaction intent into a native transaction intent. - let transaction_intent: NativeTransactionIntent = self.clone().try_into()?; - - // Compile the native transaction intent - Ok(scrypto_encode(&transaction_intent)?) - } - - fn decompile( - data: &T, - output_manifest_format: ManifestInstructionsKind, - ) -> Result - where - Self: Sized, - T: AsRef<[u8]>, - { - // Decompile to a native transaction intent - let data = data.as_ref(); - let transaction_intent = scrypto_decode::(data)?; - - // Convert to this type - transaction_intent.try_into_with_context(output_manifest_format) - } -} - -// =========== -// Validation -// =========== - -impl Validate for TransactionIntent { - fn validate(&self) -> Result<(), Error> { - self.header.validate()?; - self.manifest.validate(self.header.network_id)?; - NotarizedTransactionValidator::new(validation_config_from_header(&self.header)) - .validate_intent( - &self.hash()?, - &self.clone().try_into()?, - &TestIntentHashManager::new(), - )?; - - Ok(()) - } -} diff --git a/radix-engine-toolkit-core/src/model/transaction/manifest.rs b/radix-engine-toolkit-core/src/model/transaction/manifest.rs deleted file mode 100644 index c510e947..00000000 --- a/radix-engine-toolkit-core/src/model/transaction/manifest.rs +++ /dev/null @@ -1,127 +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_transaction::manifest::decompile; -use radix_transaction::manifest::generator::generate_manifest; -use radix_transaction::model::TransactionManifest as NativeTransactionManifest; - -use scrypto::prelude::hash; -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::error::Error; -use crate::model::address::Bech32Coder; -use crate::model::{ManifestInstructions, ManifestInstructionsKind}; -use crate::traits::{TryIntoWithContext, ValidateWithContext}; - -// ================= -// Model Definition -// ================= - -#[serde_as] -#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] -pub struct TransactionManifest { - pub instructions: ManifestInstructions, - #[serde_as(as = "Vec")] - #[serde(skip_serializing_if = "Vec::is_empty", default)] - pub blobs: Vec>, -} - -// ============ -// Conversions -// ============ - -impl TryIntoWithContext for TransactionManifest -where - T: AsRef, -{ - type Error = Error; - - fn try_into_with_context( - self, - bech32_coder: T, - ) -> Result { - let bech32_coder = bech32_coder.as_ref(); - - let transaction_manifest = NativeTransactionManifest { - instructions: self - .instructions - .transaction_instructions(bech32_coder, self.blobs.clone())?, - blobs: self.blobs, - }; - Ok(transaction_manifest) - } -} - -impl TryIntoWithContext - for NativeTransactionManifest -where - T: AsRef, -{ - type Error = Error; - - fn try_into_with_context( - self, - (manifest_instruction_kind, bech32_coder): (ManifestInstructionsKind, T), - ) -> Result { - let bech32_coder = bech32_coder.as_ref(); - - // Converting a TransactionInstruction to a string is rather easy to do, so we will convert - // them into a String, and then we will convert the entire manifest instructions into the - // requested format provided in the context. - let manifest_instructions = ManifestInstructions::String(decompile( - &self.instructions, - &bech32_coder.network_definition, - )?); - - // Converting the manifest instructions according to the requested manifest instructions - // kind. - let manifest_instructions = manifest_instructions.convert_to_manifest_instructions_kind( - manifest_instruction_kind, - bech32_coder, - self.blobs.clone(), - )?; - - let transaction_manifest = TransactionManifest { - instructions: manifest_instructions, - blobs: self.blobs, - }; - Ok(transaction_manifest) - } -} - -// =========== -// Validation -// =========== - -impl ValidateWithContext for TransactionManifest { - fn validate(&self, network_id: u8) -> Result<(), Error> { - let bech32_coder = Bech32Coder::new(network_id); - - self.instructions - .instructions(&bech32_coder)? - .iter() - .map(|instruction| instruction.validate(network_id)) - .collect::, _>>()?; - generate_manifest( - &self.instructions.ast_instructions(&bech32_coder)?, - &bech32_coder.decoder, - self.blobs.iter().map(|x| (hash(x), x.clone())).collect(), - )?; - Ok(()) - } -} diff --git a/radix-engine-toolkit-core/src/model/transaction/manifest_instructions.rs b/radix-engine-toolkit-core/src/model/transaction/manifest_instructions.rs deleted file mode 100644 index b7e20eda..00000000 --- a/radix-engine-toolkit-core/src/model/transaction/manifest_instructions.rs +++ /dev/null @@ -1,213 +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_transaction::manifest::ast::Instruction as AstInstruction; -use radix_transaction::manifest::decompile; -use radix_transaction::model::Instruction as TransactionInstruction; - -use scrypto::prelude::hash; -use serde::{Deserialize, Serialize}; - -use crate::error::Error; -use crate::model::address::Bech32Coder; -use crate::model::Instruction; -use crate::traits::Validate; - -// ================== -// Model Definitions -// ================== - -/// Represents the type of the manifest instructions kind. -#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] -pub enum ManifestInstructionsKind { - String, - JSON, -} - -/// A union type of the two states that manifest instructions can be represented in: as a string or -/// as a vector of instructions (called JSON in this case for user friendliness when serialized). -#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] -#[serde(tag = "type", content = "value")] -pub enum ManifestInstructions { - String(String), - JSON(Vec), -} - -// ====================== -// Model Implementations -// ====================== - -impl ManifestInstructions { - pub fn instructions(&self, bech32_coder: &Bech32Coder) -> Result, Error> { - let json_instructions = self.convert_to_json(bech32_coder)?; - if let ManifestInstructions::JSON(instructions) = json_instructions { - Ok(instructions) - } else { - panic!("Impossible case.") - } - } - - pub fn ast_instructions( - &self, - bech32_coder: &Bech32Coder, - ) -> Result, Error> { - match self { - Self::String(string) => { - let tokens = radix_transaction::manifest::lexer::tokenize(string) - .map_err(radix_transaction::manifest::CompileError::LexerError)?; - - let instructions = radix_transaction::manifest::parser::Parser::new(tokens) - .parse_manifest() - .map_err(radix_transaction::manifest::CompileError::ParserError)?; - Ok(instructions) - } - Self::JSON(instructions) => instructions - .iter() - .map(|instruction| instruction.to_ast_instruction(bech32_coder)) - .collect::, _>>(), - } - } - - pub fn transaction_instructions( - &self, - 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, Error> { - let instructions = self.ast_instructions(bech32_coder)?; - let instructions = radix_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 problem. 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::JSON(_) => { - // 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 -> TransactionInstruction conversion and - // skip the AstInstruction phase? - // A. Because the IdValidator and id validation in general takes place when the - // instruction is being converted from AstInstruction -> TransactionInstruction. - // 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.transaction_instructions(bech32_coder, blobs)?; - - // Vec --> String Conversion (based on above comment) - Ok(Self::String(decompile( - &instructions, - &bech32_coder.network_definition, - )?)) - } - } - } - - pub fn convert_to_json(&self, bech32_coder: &Bech32Coder) -> Result { - match self { - Self::JSON(_) => 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::, _>>()?; - Ok(Self::JSON(instructions)) - } - } - } - - pub fn convert_to_manifest_instructions_kind( - &self, - manifest_instructions_kind: ManifestInstructionsKind, - 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 { - ManifestInstructionsKind::String => self.convert_to_string(bech32_coder, blobs), - ManifestInstructionsKind::JSON => self.convert_to_json(bech32_coder), - } - } -} - -// =========== -// Validation -// =========== - -impl Validate for ManifestInstructions { - fn validate(&self) -> Result<(), Error> { - // TODO: What kind of validation can be done here? This can not use external context so we - // do not have access to the blobs and can not pass it through the generator to check it. - Ok(()) - } -} diff --git a/radix-engine-toolkit-core/src/model/transaction/mod.rs b/radix-engine-toolkit-core/src/model/transaction/mod.rs deleted file mode 100644 index 74247ef9..00000000 --- a/radix-engine-toolkit-core/src/model/transaction/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. - -pub mod header; -pub mod intent; -pub mod manifest; -pub mod manifest_instructions; -pub mod notarized_intent; -pub mod signed_intent; - -pub use header::*; -pub use intent::*; -pub use manifest::*; -pub use manifest_instructions::*; -pub use notarized_intent::*; -pub use signed_intent::*; diff --git a/radix-engine-toolkit-core/src/model/transaction/notarized_intent.rs b/radix-engine-toolkit-core/src/model/transaction/notarized_intent.rs deleted file mode 100644 index 29803fb3..00000000 --- a/radix-engine-toolkit-core/src/model/transaction/notarized_intent.rs +++ /dev/null @@ -1,125 +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_transaction::model::NotarizedTransaction as NativeNotarizedTransaction; -use radix_transaction::validation::{ - NotarizedTransactionValidator, TestIntentHashManager, TransactionValidator, -}; -use scrypto::prelude::{scrypto_decode, scrypto_encode, Signature}; - -use serde::{Deserialize, Serialize}; - -use crate::error::Error; -use crate::model::transaction::SignedTransactionIntent; -use crate::model::ManifestInstructionsKind; -use crate::traits::{CompilableIntent, TryIntoWithContext, Validate, ValidateWithContext}; -use crate::utils::validation_config_from_header; - -// ================= -// Model Definition -// ================= - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct NotarizedTransaction { - pub signed_intent: SignedTransactionIntent, - pub notary_signature: Signature, -} - -// ============ -// Conversions -// ============ - -impl TryInto for NotarizedTransaction { - type Error = Error; - - fn try_into(self) -> Result { - let notarized_transaction = NativeNotarizedTransaction { - signed_intent: self.signed_intent.try_into()?, - notary_signature: self.notary_signature, - }; - Ok(notarized_transaction) - } -} - -impl TryIntoWithContext - for NativeNotarizedTransaction -{ - type Error = Error; - - fn try_into_with_context( - self, - manifest_output_format: ManifestInstructionsKind, - ) -> Result { - let notarized_transaction = NotarizedTransaction { - signed_intent: self - .signed_intent - .try_into_with_context(manifest_output_format)?, - notary_signature: self.notary_signature, - }; - Ok(notarized_transaction) - } -} - -// ============================== -// Compilation and Decompilation -// ============================== - -impl CompilableIntent for NotarizedTransaction { - fn compile(&self) -> Result, Error> { - // Convert the notarized transaction intent into a native notarized transaction intent. - let notarized_transaction: NativeNotarizedTransaction = self.clone().try_into()?; - - // Compile the native notarized transaction intent - Ok(scrypto_encode(¬arized_transaction).expect("Failed to encode trusted payload")) - } - - fn decompile( - data: &T, - output_manifest_format: ManifestInstructionsKind, - ) -> Result - where - Self: Sized, - T: AsRef<[u8]>, - { - // Decompile to a native notarized transaction intent - let data = data.as_ref(); - let notarized_transaction = scrypto_decode::(data)?; - - // Convert to this type - notarized_transaction.try_into_with_context(output_manifest_format) - } -} - -// =========== -// Validation -// =========== - -impl Validate for NotarizedTransaction { - fn validate(&self) -> Result<(), Error> { - self.signed_intent.intent.header.validate()?; - self.signed_intent - .intent - .manifest - .validate(self.signed_intent.intent.header.network_id)?; - NotarizedTransactionValidator::new(validation_config_from_header( - &self.signed_intent.intent.header, - )) - .validate(&self.clone().try_into()?, &TestIntentHashManager::new())?; - - Ok(()) - } -} diff --git a/radix-engine-toolkit-core/src/model/transaction/signed_intent.rs b/radix-engine-toolkit-core/src/model/transaction/signed_intent.rs deleted file mode 100644 index 2ddaaf4d..00000000 --- a/radix-engine-toolkit-core/src/model/transaction/signed_intent.rs +++ /dev/null @@ -1,122 +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_transaction::model::SignedTransactionIntent as NativeSignedTransactionIntent; -use radix_transaction::validation::{NotarizedTransactionValidator, TestIntentHashManager}; -use scrypto::prelude::{scrypto_decode, scrypto_encode, SignatureWithPublicKey}; - -use serde::{Deserialize, Serialize}; - -use crate::error::Error; -use crate::model::transaction::TransactionIntent; -use crate::model::ManifestInstructionsKind; -use crate::traits::{CompilableIntent, TryIntoWithContext, Validate, ValidateWithContext}; -use crate::utils::validation_config_from_header; - -// ================= -// Model Definition -// ================= - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct SignedTransactionIntent { - pub intent: TransactionIntent, - pub intent_signatures: Vec, -} - -// ============ -// Conversions -// ============ - -impl TryInto for SignedTransactionIntent { - type Error = Error; - - fn try_into(self) -> Result { - let signed_transaction_intent = NativeSignedTransactionIntent { - intent: self.intent.try_into()?, - intent_signatures: self.intent_signatures, - }; - Ok(signed_transaction_intent) - } -} - -impl TryIntoWithContext - for NativeSignedTransactionIntent -{ - type Error = Error; - - fn try_into_with_context( - self, - manifest_output_format: ManifestInstructionsKind, - ) -> Result { - let signed_transaction_intent = SignedTransactionIntent { - intent: self.intent.try_into_with_context(manifest_output_format)?, - intent_signatures: self.intent_signatures, - }; - Ok(signed_transaction_intent) - } -} - -// ============================== -// Compilation and Decompilation -// ============================== - -impl CompilableIntent for SignedTransactionIntent { - fn compile(&self) -> Result, Error> { - // Convert the signed transaction intent into a native signed transaction intent. - let signed_transaction_intent: NativeSignedTransactionIntent = self.clone().try_into()?; - - // Compile the native signed transaction intent - Ok(scrypto_encode(&signed_transaction_intent)?) - } - - fn decompile( - data: &T, - output_manifest_format: ManifestInstructionsKind, - ) -> Result - where - Self: Sized, - T: AsRef<[u8]>, - { - // Decompile to a native signed transaction intent - let data = data.as_ref(); - let signed_transaction_intent = scrypto_decode::(data)?; - - // Convert to this type - signed_transaction_intent.try_into_with_context(output_manifest_format) - } -} - -// =========== -// Validation -// =========== - -impl Validate for SignedTransactionIntent { - fn validate(&self) -> Result<(), Error> { - self.intent.header.validate()?; - self.intent - .manifest - .validate(self.intent.header.network_id)?; - NotarizedTransactionValidator::new(validation_config_from_header(&self.intent.header)) - .validate_intent( - &self.hash()?, - &self.intent.clone().try_into()?, - &TestIntentHashManager::new(), - )?; - - Ok(()) - } -} diff --git a/radix-engine-toolkit-core/src/model/value.rs b/radix-engine-toolkit-core/src/model/value.rs deleted file mode 100644 index 26d4b860..00000000 --- a/radix-engine-toolkit-core/src/model/value.rs +++ /dev/null @@ -1,1744 +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 implements the [Value] struct as well as all of its related methods for conversion -//! and validation. - -use radix_transaction::manifest::ast::Value as AstValue; -use sbor::type_id::*; -use scrypto::data::ScryptoCustomTypeId; -use scrypto::prelude::{ - scrypto_decode, scrypto_encode, Blob, Decimal, EcdsaSecp256k1PublicKey, - EcdsaSecp256k1Signature, EddsaEd25519PublicKey, EddsaEd25519Signature, Expression, Hash, - NonFungibleId, PreciseDecimal, ScryptoCustomValue, ScryptoValue, -}; -use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, DisplayFromStr, FromInto}; - -use super::{ - BucketId, Identifier, NodeIdentifier, NonFungibleAddress, OptionProxy, ProofId, ResultProxy, -}; -use crate::error::Error; -use crate::model::address::*; -use crate::traits::ValidateWithContext; - -// ====== -// Value -// ====== - -#[serde_as] -#[derive(Serialize, Deserialize, Debug, Hash, PartialEq, Eq, Clone)] -#[serde(tag = "type")] -pub enum Value { - Unit, - Bool { - value: bool, - }, - - U8 { - #[serde_as(as = "DisplayFromStr")] - value: u8, - }, - U16 { - #[serde_as(as = "DisplayFromStr")] - value: u16, - }, - U32 { - #[serde_as(as = "DisplayFromStr")] - value: u32, - }, - U64 { - #[serde_as(as = "DisplayFromStr")] - value: u64, - }, - U128 { - #[serde_as(as = "DisplayFromStr")] - value: u128, - }, - - I8 { - #[serde_as(as = "DisplayFromStr")] - value: i8, - }, - I16 { - #[serde_as(as = "DisplayFromStr")] - value: i16, - }, - I32 { - #[serde_as(as = "DisplayFromStr")] - value: i32, - }, - I64 { - #[serde_as(as = "DisplayFromStr")] - value: i64, - }, - I128 { - #[serde_as(as = "DisplayFromStr")] - value: i128, - }, - - String { - value: String, - }, - - Enum { - variant: String, - #[serde(default, skip_serializing_if = "Option::is_none")] - fields: Option>, - }, - Option { - #[serde(flatten)] - #[serde_as(as = "Box>>")] - value: Box>, - }, - Result { - #[serde(flatten)] - #[serde_as(as = "Box>>")] - value: Box>, - }, - - Array { - element_type: ValueKind, - elements: Vec, - }, - Tuple { - elements: Vec, - }, - - // Scrypto Values - KeyValueStore { - identifier: NodeIdentifier, - }, - - Decimal { - #[serde_as(as = "DisplayFromStr")] - value: Decimal, - }, - PreciseDecimal { - #[serde_as(as = "DisplayFromStr")] - value: PreciseDecimal, - }, - - Component { - identifier: NodeIdentifier, - }, - - ComponentAddress { - address: NetworkAwareComponentAddress, - }, - ResourceAddress { - address: NetworkAwareResourceAddress, - }, - PackageAddress { - address: NetworkAwarePackageAddress, - }, - SystemAddress { - address: NetworkAwareSystemAddress, - }, - - Hash { - #[serde_as(as = "DisplayFromStr")] - value: Hash, - }, - EcdsaSecp256k1PublicKey { - #[serde_as(as = "DisplayFromStr")] - public_key: EcdsaSecp256k1PublicKey, - }, - EcdsaSecp256k1Signature { - #[serde_as(as = "DisplayFromStr")] - signature: EcdsaSecp256k1Signature, - }, - EddsaEd25519PublicKey { - #[serde_as(as = "DisplayFromStr")] - public_key: EddsaEd25519PublicKey, - }, - EddsaEd25519Signature { - #[serde_as(as = "DisplayFromStr")] - signature: EddsaEd25519Signature, - }, - - Bucket { - identifier: BucketId, - }, - Proof { - identifier: ProofId, - }, - Vault { - identifier: NodeIdentifier, - }, - NonFungibleId { - #[serde(flatten)] - #[serde_as(as = "FromInto")] - value: NonFungibleId, - }, - NonFungibleAddress { - #[serde(flatten)] - address: NonFungibleAddress, - }, - - Blob { - #[serde_as(as = "DisplayFromStr")] - hash: Blob, - }, - Expression { - #[serde_as(as = "DisplayFromStr")] - value: Expression, - }, - Bytes { - #[serde_as(as = "serde_with::hex::Hex")] - value: Vec, - }, -} - -impl Value { - pub fn kind(&self) -> ValueKind { - match self { - Self::Unit => ValueKind::Unit, - Self::Bool { .. } => ValueKind::Bool, - - Self::I8 { .. } => ValueKind::I8, - Self::I16 { .. } => ValueKind::I16, - Self::I32 { .. } => ValueKind::I32, - Self::I64 { .. } => ValueKind::I64, - Self::I128 { .. } => ValueKind::I128, - - Self::U8 { .. } => ValueKind::U8, - Self::U16 { .. } => ValueKind::U16, - Self::U32 { .. } => ValueKind::U32, - Self::U64 { .. } => ValueKind::U64, - Self::U128 { .. } => ValueKind::U128, - - Self::String { .. } => ValueKind::String, - - Self::Enum { .. } => ValueKind::Enum, - Self::Option { .. } => ValueKind::Option, - Self::Result { .. } => ValueKind::Result, - - Self::Array { .. } => ValueKind::Array, - Self::Tuple { .. } => ValueKind::Tuple, - - Self::Decimal { .. } => ValueKind::Decimal, - Self::PreciseDecimal { .. } => ValueKind::PreciseDecimal, - - Self::Component { .. } => ValueKind::Component, - Self::PackageAddress { .. } => ValueKind::PackageAddress, - Self::ComponentAddress { .. } => ValueKind::ComponentAddress, - Self::ResourceAddress { .. } => ValueKind::ResourceAddress, - Self::SystemAddress { .. } => ValueKind::SystemAddress, - - Self::Hash { .. } => ValueKind::Hash, - - Self::Bucket { .. } => ValueKind::Bucket, - Self::Proof { .. } => ValueKind::Proof, - Self::Vault { .. } => ValueKind::Vault, - - Self::NonFungibleId { .. } => ValueKind::NonFungibleId, - Self::NonFungibleAddress { .. } => ValueKind::NonFungibleAddress, - - Self::KeyValueStore { .. } => ValueKind::KeyValueStore, - - Self::EcdsaSecp256k1PublicKey { .. } => ValueKind::EcdsaSecp256k1PublicKey, - Self::EcdsaSecp256k1Signature { .. } => ValueKind::EcdsaSecp256k1Signature, - Self::EddsaEd25519PublicKey { .. } => ValueKind::EddsaEd25519PublicKey, - Self::EddsaEd25519Signature { .. } => ValueKind::EddsaEd25519Signature, - - Self::Blob { .. } => ValueKind::Blob, - Self::Expression { .. } => ValueKind::Expression, - Self::Bytes { .. } => ValueKind::Bytes, - } - } - - // =========== - // Validation - // =========== - - fn validate_kind(&self, expected_kind: ValueKind) -> Result<(), Error> { - if self.kind() == expected_kind { - Ok(()) - } else { - Err(Error::InvalidType { - expected_types: vec![expected_kind], - actual_type: self.kind(), - }) - } - } - - fn validate_if_collection(&self, network_id: u8) -> Result<(), Error> { - match self { - Self::Array { - element_type, - elements, - } => { - elements - .iter() - .map(|item| item.validate((network_id, Some(*element_type)))) - .collect::, _>>()?; - Ok(()) - } - Self::Tuple { elements } => { - elements - .iter() - .map(|item| item.validate((network_id, None))) - .collect::, _>>()?; - Ok(()) - } - // Not a collection. No validation required. - _ => Ok(()), - } - } - - fn validate_address_network_id(&self, expected_network_id: u8) -> Result<(), Error> { - let network_id = match self { - Self::ComponentAddress { address } => address.network_id, - Self::ResourceAddress { address } => address.network_id, - Self::PackageAddress { address } => address.network_id, - Self::SystemAddress { address } => address.network_id, - _ => return Ok(()), - }; - if network_id == expected_network_id { - Ok(()) - } else { - Err(Error::NetworkMismatchError { - expected: expected_network_id, - found: network_id, - }) - } - } - - // ============ - // Conversions - // ============ - - pub fn from_ast_value(ast_value: &AstValue, bech32_coder: &Bech32Coder) -> Result { - let value = match ast_value { - AstValue::Unit => Self::Unit, - AstValue::Bool(value) => Self::Bool { value: *value }, - - AstValue::I8(value) => Self::I8 { value: *value }, - AstValue::I16(value) => Self::I16 { value: *value }, - AstValue::I32(value) => Self::I32 { value: *value }, - AstValue::I64(value) => Self::I64 { value: *value }, - AstValue::I128(value) => Self::I128 { value: *value }, - - AstValue::U8(value) => Self::U8 { value: *value }, - AstValue::U16(value) => Self::U16 { value: *value }, - AstValue::U32(value) => Self::U32 { value: *value }, - AstValue::U64(value) => Self::U64 { value: *value }, - AstValue::U128(value) => Self::U128 { value: *value }, - - AstValue::String(value) => Self::String { - value: value.clone(), - }, - - AstValue::Enum(variant, fields) => match (variant.as_str(), fields.len()) { - ("Some", 1) => Self::Option { - value: Box::new(Some(Self::from_ast_value(&fields[0], bech32_coder)?)), - }, - ("None", 0) => Self::Option { - value: Box::new(None), - }, - ("Ok", 1) => Self::Result { - value: Box::new(Ok(Self::from_ast_value(&fields[0], bech32_coder)?)), - }, - ("Err", 1) => Self::Result { - value: Box::new(Err(Self::from_ast_value(&fields[0], bech32_coder)?)), - }, - _ => Self::Enum { - variant: variant.clone(), - fields: { - let fields = fields - .iter() - .map(|v| Self::from_ast_value(v, bech32_coder)) - .collect::, _>>()?; - match fields.len() { - 0 => None, - _ => Some(fields), - } - }, - }, - }, - AstValue::Some(value) => Self::Option { - value: Box::new(Some(Self::from_ast_value(value, bech32_coder)?)), - }, - AstValue::None => Self::Option { - value: Box::new(None), - }, - AstValue::Ok(value) => Self::Result { - value: Box::new(Ok(Self::from_ast_value(value, bech32_coder)?)), - }, - AstValue::Err(value) => Self::Result { - value: Box::new(Err(Self::from_ast_value(value, bech32_coder)?)), - }, - - AstValue::Array(ast_type, elements) => Self::Array { - element_type: (*ast_type).into(), - elements: elements - .iter() - .map(|v| Self::from_ast_value(v, bech32_coder)) - .collect::, _>>()?, - }, - AstValue::Tuple(elements) => Self::Tuple { - elements: elements - .iter() - .map(|v| Self::from_ast_value(v, bech32_coder)) - .collect::, _>>()?, - }, - - AstValue::Decimal(value) => { - if let AstValue::String(value) = &**value { - Self::Decimal { - value: value.parse()?, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::Decimal, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - AstValue::PreciseDecimal(value) => { - if let AstValue::String(value) = &**value { - Self::PreciseDecimal { - value: value.parse()?, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::PreciseDecimal, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - - AstValue::Component(value) => { - if let AstValue::String(value) = &**value { - Self::Component { - identifier: value.parse()?, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::Component, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - AstValue::PackageAddress(value) => { - if let AstValue::String(value) = &**value { - Self::PackageAddress { - address: NetworkAwarePackageAddress { - network_id: bech32_coder.network_id(), - address: bech32_coder - .decoder - .validate_and_decode_package_address(value)?, - }, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::PackageAddress, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - AstValue::ComponentAddress(value) => { - if let AstValue::String(value) = &**value { - Self::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id: bech32_coder.network_id(), - address: bech32_coder - .decoder - .validate_and_decode_component_address(value)?, - }, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::ComponentAddress, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - AstValue::ResourceAddress(value) => { - if let AstValue::String(value) = &**value { - Self::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: bech32_coder.network_id(), - address: bech32_coder - .decoder - .validate_and_decode_resource_address(value)?, - }, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::ResourceAddress, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - AstValue::SystemAddress(value) => { - if let AstValue::String(value) = &**value { - Self::SystemAddress { - address: NetworkAwareSystemAddress { - network_id: bech32_coder.network_id(), - address: bech32_coder - .decoder - .validate_and_decode_system_address(value)?, - }, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::SystemAddress, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - - AstValue::Hash(value) => { - if let AstValue::String(value) = &**value { - Self::Hash { - value: value.parse()?, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::Hash, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - - AstValue::Bucket(value) => { - if let AstValue::U32(value) = &**value { - Self::Bucket { - identifier: Identifier::U32(*value).into(), - } - } else if let AstValue::String(value) = &**value { - Self::Bucket { - identifier: Identifier::String(value.clone()).into(), - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::Bucket, - allowed_children_kinds: vec![ValueKind::U32, ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - AstValue::Proof(value) => { - if let AstValue::U32(value) = &**value { - Self::Proof { - identifier: Identifier::U32(*value).into(), - } - } else if let AstValue::String(value) = &**value { - Self::Proof { - identifier: Identifier::String(value.clone()).into(), - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::Proof, - allowed_children_kinds: vec![ValueKind::U32, ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - - AstValue::NonFungibleId(value) => Self::NonFungibleId { - value: match &**value { - AstValue::U32(value) => NonFungibleId::U32(*value), - AstValue::U64(value) => NonFungibleId::U64(*value), - AstValue::U128(value) => NonFungibleId::UUID(*value), - AstValue::String(value) => NonFungibleId::String(value.clone()), - AstValue::Bytes(value) => { - if let AstValue::String(value) = &**value { - NonFungibleId::Bytes(hex::decode(value)?) - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::NonFungibleId, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - _ => Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::NonFungibleId, - allowed_children_kinds: vec![ - ValueKind::U32, - ValueKind::U64, - ValueKind::U128, - ValueKind::String, - ValueKind::Bytes, - ], - found_child_kind: value.kind().into(), - })?, - }, - }, - AstValue::NonFungibleAddress(resource_address, non_fungible_id) => { - let resource_address = if let AstValue::String(address_string) = &**resource_address - { - let address = bech32_coder - .decoder - .validate_and_decode_resource_address(address_string)?; - NetworkAwareResourceAddress { - network_id: bech32_coder.network_id(), - address, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::NonFungibleAddress, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: resource_address.kind().into(), - })? - }; - - // TODO: de-duplicate. Refactor out - let non_fungible_id = match &**non_fungible_id { - AstValue::U32(value) => NonFungibleId::U32(*value), - AstValue::U64(value) => NonFungibleId::U64(*value), - AstValue::U128(value) => NonFungibleId::UUID(*value), - AstValue::String(value) => NonFungibleId::String(value.clone()), - AstValue::Bytes(value) => { - if let AstValue::String(value) = &**value { - NonFungibleId::Bytes(hex::decode(value)?) - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::NonFungibleAddress, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - value => Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::NonFungibleAddress, - allowed_children_kinds: vec![ - ValueKind::U32, - ValueKind::U64, - ValueKind::U128, - ValueKind::String, - ValueKind::Bytes, - ], - found_child_kind: value.kind().into(), - })?, - }; - - let non_fungible_address = NonFungibleAddress { - resource_address, - non_fungible_id, - }; - Value::NonFungibleAddress { - address: non_fungible_address, - } - } - - AstValue::Blob(value) => { - if let AstValue::String(value) = &**value { - Self::Blob { - hash: value.parse()?, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::Blob, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - AstValue::Expression(value) => { - if let AstValue::String(value) = &**value { - Self::Expression { - value: value.parse()?, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::Expression, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - - AstValue::Vault(value) => { - if let AstValue::String(value) = &**value { - Self::Vault { - identifier: value.parse()?, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::Vault, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - AstValue::KeyValueStore(value) => { - if let AstValue::String(value) = &**value { - Self::KeyValueStore { - identifier: value.parse()?, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::KeyValueStore, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - AstValue::EcdsaSecp256k1PublicKey(value) => { - if let AstValue::String(value) = &**value { - Self::EcdsaSecp256k1PublicKey { - public_key: value.parse()?, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::EcdsaSecp256k1PublicKey, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - AstValue::EcdsaSecp256k1Signature(value) => { - if let AstValue::String(value) = &**value { - Self::EcdsaSecp256k1Signature { - signature: value.parse()?, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::EcdsaSecp256k1Signature, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - AstValue::EddsaEd25519PublicKey(value) => { - if let AstValue::String(value) = &**value { - Self::EddsaEd25519PublicKey { - public_key: value.parse()?, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::EddsaEd25519PublicKey, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - AstValue::EddsaEd25519Signature(value) => { - if let AstValue::String(value) = &**value { - Self::EddsaEd25519Signature { - signature: value.parse()?, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::EddsaEd25519Signature, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - AstValue::Bytes(value) => { - if let AstValue::String(value) = &**value { - Self::Bytes { - value: hex::decode(value)?, - } - } else { - Err(Error::UnexpectedContents { - kind_being_parsed: ValueKind::Bytes, - allowed_children_kinds: vec![ValueKind::String], - found_child_kind: value.kind().into(), - })? - } - } - }; - Ok(value) - } - - pub fn to_ast_value(&self, bech32_coder: &Bech32Coder) -> Result { - let ast_value = match self { - Value::Unit => AstValue::Unit, - Value::Bool { value } => AstValue::Bool(*value), - - Value::I8 { value } => AstValue::I8(*value), - Value::I16 { value } => AstValue::I16(*value), - Value::I32 { value } => AstValue::I32(*value), - Value::I64 { value } => AstValue::I64(*value), - Value::I128 { value } => AstValue::I128(*value), - - Value::U8 { value } => AstValue::U8(*value), - Value::U16 { value } => AstValue::U16(*value), - Value::U32 { value } => AstValue::U32(*value), - Value::U64 { value } => AstValue::U64(*value), - Value::U128 { value } => AstValue::U128(*value), - - Value::String { value } => AstValue::String(value.clone()), - - Value::Enum { variant, fields } => AstValue::Enum( - variant.clone(), - fields - .clone() - .unwrap_or_default() - .iter() - .map(|v| v.to_ast_value(bech32_coder)) - .collect::, _>>()?, - ), - Value::Option { value } => match &**value { - Some(value) => AstValue::Some(Box::new(value.to_ast_value(bech32_coder)?)), - None => AstValue::None, - }, - Value::Result { value } => match &**value { - Ok(value) => AstValue::Ok(Box::new(value.to_ast_value(bech32_coder)?)), - Err(value) => AstValue::Err(Box::new(value.to_ast_value(bech32_coder)?)), - }, - - Value::Array { - element_type, - elements, - } => AstValue::Array( - (*element_type).into(), - elements - .iter() - .map(|id| id.to_ast_value(bech32_coder)) - .collect::, Error>>()?, - ), - Value::Tuple { elements } => AstValue::Tuple( - elements - .iter() - .map(|v| v.to_ast_value(bech32_coder)) - .collect::, _>>()?, - ), - - Value::Decimal { value } => { - AstValue::Decimal(Box::new(AstValue::String(value.to_string()))) - } - Value::PreciseDecimal { value } => { - AstValue::PreciseDecimal(Box::new(AstValue::String(value.to_string()))) - } - - Value::PackageAddress { address: value } => { - AstValue::PackageAddress(Box::new(AstValue::String( - bech32_coder - .encoder - .encode_package_address_to_string(&value.address), - ))) - } - Value::ComponentAddress { address: value } => { - AstValue::ComponentAddress(Box::new(AstValue::String( - bech32_coder - .encoder - .encode_component_address_to_string(&value.address), - ))) - } - Value::ResourceAddress { address: value } => { - AstValue::ResourceAddress(Box::new(AstValue::String( - bech32_coder - .encoder - .encode_resource_address_to_string(&value.address), - ))) - } - Value::SystemAddress { address: value } => { - AstValue::SystemAddress(Box::new(AstValue::String( - bech32_coder - .encoder - .encode_system_address_to_string(&value.address), - ))) - } - - Value::Hash { value } => AstValue::Hash(Box::new(AstValue::String(value.to_string()))), - Value::Bucket { identifier } => AstValue::Bucket(Box::new(match identifier.0 { - Identifier::String(ref string) => AstValue::String(string.clone()), - Identifier::U32(number) => AstValue::U32(number), - })), - Value::Proof { identifier } => AstValue::Proof(Box::new(match identifier.0 { - Identifier::String(ref string) => AstValue::String(string.clone()), - Identifier::U32(number) => AstValue::U32(number), - })), - - Value::NonFungibleId { value } => AstValue::NonFungibleId(Box::new(match value { - NonFungibleId::U32(value) => AstValue::U32(*value), - NonFungibleId::U64(value) => AstValue::U64(*value), - NonFungibleId::UUID(value) => AstValue::U128(*value), - NonFungibleId::String(ref value) => AstValue::String(value.clone()), - NonFungibleId::Bytes(ref value) => { - AstValue::Bytes(Box::new(AstValue::String(hex::encode(value)))) - } - })), - Value::NonFungibleAddress { address } => { - let resource_address_string = address.resource_address.to_string(); - let resource_address = AstValue::String(resource_address_string); - - let non_fungible_id = match address.non_fungible_id { - NonFungibleId::U32(value) => AstValue::U32(value), - NonFungibleId::U64(value) => AstValue::U64(value), - NonFungibleId::UUID(value) => AstValue::U128(value), - NonFungibleId::String(ref value) => AstValue::String(value.clone()), - NonFungibleId::Bytes(ref value) => { - AstValue::Bytes(Box::new(AstValue::String(hex::encode(value)))) - } - }; - - AstValue::NonFungibleAddress(Box::new(resource_address), Box::new(non_fungible_id)) - } - - Value::Blob { hash } => AstValue::Blob(Box::new(AstValue::String(hash.to_string()))), - Value::Expression { value } => { - AstValue::Expression(Box::new(AstValue::String(value.to_string()))) - } - - Value::Component { identifier } => { - AstValue::Component(Box::new(AstValue::String(identifier.to_string()))) - } - Value::Vault { identifier } => { - AstValue::Vault(Box::new(AstValue::String(identifier.to_string()))) - } - Value::KeyValueStore { identifier } => { - AstValue::KeyValueStore(Box::new(AstValue::String(identifier.to_string()))) - } - - Value::EcdsaSecp256k1PublicKey { public_key } => AstValue::EcdsaSecp256k1PublicKey( - Box::new(AstValue::String(public_key.to_string())), - ), - Value::EcdsaSecp256k1Signature { signature } => { - AstValue::EcdsaSecp256k1Signature(Box::new(AstValue::String(signature.to_string()))) - } - - Value::EddsaEd25519PublicKey { public_key } => { - AstValue::EddsaEd25519PublicKey(Box::new(AstValue::String(public_key.to_string()))) - } - Value::EddsaEd25519Signature { signature } => { - AstValue::EddsaEd25519Signature(Box::new(AstValue::String(signature.to_string()))) - } - Value::Bytes { value } => { - AstValue::Bytes(Box::new(AstValue::String(hex::encode(value)))) - } - }; - Ok(ast_value) - } - - pub fn to_scrypto_value(&self) -> Result { - let scrypto_value = match self { - Value::Unit => ScryptoValue::Unit, - Value::Bool { value } => ScryptoValue::Bool { value: *value }, - - Value::U8 { value } => ScryptoValue::U8 { value: *value }, - Value::U16 { value } => ScryptoValue::U16 { value: *value }, - Value::U32 { value } => ScryptoValue::U32 { value: *value }, - Value::U64 { value } => ScryptoValue::U64 { value: *value }, - Value::U128 { value } => ScryptoValue::U128 { value: *value }, - - Value::I8 { value } => ScryptoValue::I8 { value: *value }, - Value::I16 { value } => ScryptoValue::I16 { value: *value }, - Value::I32 { value } => ScryptoValue::I32 { value: *value }, - Value::I64 { value } => ScryptoValue::I64 { value: *value }, - Value::I128 { value } => ScryptoValue::I128 { value: *value }, - - Value::String { value } => ScryptoValue::String { - value: value.clone(), - }, - Value::Enum { variant, fields } => ScryptoValue::Enum { - discriminator: variant.clone(), - fields: fields - .clone() - .unwrap_or_default() - .into_iter() - .map(|x| x.to_scrypto_value()) - .collect::, _>>()?, - }, - Value::Option { value } => match &**value { - Some(value) => ScryptoValue::Enum { - discriminator: "Some".into(), - fields: vec![value.to_scrypto_value()?], - }, - None => ScryptoValue::Enum { - discriminator: "None".into(), - fields: Vec::new(), - }, - }, - Value::Result { value } => match &**value { - Ok(value) => ScryptoValue::Enum { - discriminator: "Ok".into(), - fields: vec![value.to_scrypto_value()?], - }, - Err(value) => ScryptoValue::Enum { - discriminator: "Err".into(), - fields: vec![value.to_scrypto_value()?], - }, - }, - Value::Array { - element_type, - elements, - } => ScryptoValue::Array { - element_type_id: (*element_type).into(), - elements: elements - .clone() - .into_iter() - .map(|x| x.to_scrypto_value()) - .collect::, _>>()?, - }, - Value::Tuple { elements } => ScryptoValue::Tuple { - fields: elements - .clone() - .into_iter() - .map(|x| x.to_scrypto_value()) - .collect::, _>>()?, - }, - Value::KeyValueStore { identifier } => ScryptoValue::Custom { - value: ScryptoCustomValue::KeyValueStore(identifier.to_bytes()), - }, - - Value::Decimal { value } => ScryptoValue::Custom { - value: ScryptoCustomValue::Decimal(*value), - }, - Value::PreciseDecimal { value } => ScryptoValue::Custom { - value: ScryptoCustomValue::PreciseDecimal(*value), - }, - Value::Component { identifier } => ScryptoValue::Custom { - value: ScryptoCustomValue::Component(identifier.to_bytes()), - }, - Value::ComponentAddress { address } => ScryptoValue::Custom { - value: ScryptoCustomValue::ComponentAddress(address.address), - }, - Value::PackageAddress { address } => ScryptoValue::Custom { - value: ScryptoCustomValue::PackageAddress(address.address), - }, - Value::ResourceAddress { address } => ScryptoValue::Custom { - value: ScryptoCustomValue::ResourceAddress(address.address), - }, - Value::SystemAddress { address } => ScryptoValue::Custom { - value: ScryptoCustomValue::SystemAddress(address.address), - }, - - Value::Hash { value } => ScryptoValue::Custom { - value: ScryptoCustomValue::Hash(*value), - }, - - Value::EcdsaSecp256k1PublicKey { public_key } => ScryptoValue::Custom { - value: ScryptoCustomValue::EcdsaSecp256k1PublicKey(*public_key), - }, - Value::EddsaEd25519PublicKey { public_key } => ScryptoValue::Custom { - value: ScryptoCustomValue::EddsaEd25519PublicKey(*public_key), - }, - - Value::EcdsaSecp256k1Signature { signature } => ScryptoValue::Custom { - value: ScryptoCustomValue::EcdsaSecp256k1Signature(*signature), - }, - Value::EddsaEd25519Signature { signature } => ScryptoValue::Custom { - value: ScryptoCustomValue::EddsaEd25519Signature(*signature), - }, - - Value::Bucket { identifier } => ScryptoValue::Custom { - value: match identifier.0 { - Identifier::U32(numeric_identifier) => { - ScryptoCustomValue::Bucket(numeric_identifier) - } - Identifier::String(_) => { - return Err(Error::SborEncodeError( - "Unable to encode a Bucket with a string identifier".into(), - )); - } - }, - }, - Value::Proof { identifier } => ScryptoValue::Custom { - value: match identifier.0 { - Identifier::U32(numeric_identifier) => { - ScryptoCustomValue::Proof(numeric_identifier) - } - Identifier::String(_) => { - return Err(Error::SborEncodeError( - "Unable to encode a Proof with a string identifier".into(), - )); - } - }, - }, - Value::Vault { identifier } => ScryptoValue::Custom { - value: ScryptoCustomValue::Vault(identifier.to_bytes()), - }, - - Value::NonFungibleId { value } => ScryptoValue::Custom { - value: ScryptoCustomValue::NonFungibleId(value.clone()), - }, - Value::NonFungibleAddress { address } => ScryptoValue::Custom { - value: ScryptoCustomValue::NonFungibleAddress(address.clone().into()), - }, - - Value::Blob { hash } => ScryptoValue::Custom { - value: ScryptoCustomValue::Blob(hash.clone()), - }, - Value::Expression { value } => ScryptoValue::Custom { - value: ScryptoCustomValue::Expression(value.clone()), - }, - Value::Bytes { value } => ScryptoValue::Array { - element_type_id: SborTypeId::U8, - elements: value - .clone() - .into_iter() - .map(|value| ScryptoValue::U8 { value }) - .collect(), - }, - }; - Ok(scrypto_value) - } - - pub fn from_scrypto_value(scrypto_value: &ScryptoValue, network_id: u8) -> Self { - match scrypto_value { - ScryptoValue::Unit => Value::Unit, - ScryptoValue::Bool { value } => Value::Bool { value: *value }, - - ScryptoValue::U8 { value } => Value::U8 { value: *value }, - ScryptoValue::U16 { value } => Value::U16 { value: *value }, - ScryptoValue::U32 { value } => Value::U32 { value: *value }, - ScryptoValue::U64 { value } => Value::U64 { value: *value }, - ScryptoValue::U128 { value } => Value::U128 { value: *value }, - - ScryptoValue::I8 { value } => Value::I8 { value: *value }, - ScryptoValue::I16 { value } => Value::I16 { value: *value }, - ScryptoValue::I32 { value } => Value::I32 { value: *value }, - ScryptoValue::I64 { value } => Value::I64 { value: *value }, - ScryptoValue::I128 { value } => Value::I128 { value: *value }, - - ScryptoValue::String { value } => Value::String { - value: value.clone(), - }, - - ScryptoValue::Enum { - discriminator, - fields, - } => match (discriminator.as_str(), fields.len()) { - ("Some", 1) => Value::Option { - value: Box::new(Some(Self::from_scrypto_value(&fields[0], network_id))), - }, - ("None", 0) => Value::Option { - value: Box::new(None), - }, - ("Ok", 1) => Value::Result { - value: Box::new(Ok(Self::from_scrypto_value(&fields[0], network_id))), - }, - ("Err", 1) => Value::Result { - value: Box::new(Err(Self::from_scrypto_value(&fields[0], network_id))), - }, - _ => Value::Enum { - variant: discriminator.clone(), - fields: if fields.is_empty() { - None - } else { - Some( - fields - .clone() - .into_iter() - .map(|x| Self::from_scrypto_value(&x, network_id)) - .collect(), - ) - }, - }, - }, - ScryptoValue::Array { - element_type_id, - elements, - } => Value::Array { - element_type: (*element_type_id).into(), - elements: elements - .clone() - .into_iter() - .map(|x| Self::from_scrypto_value(&x, network_id)) - .collect(), - }, - ScryptoValue::Tuple { fields } => Value::Tuple { - elements: fields - .clone() - .into_iter() - .map(|x| Self::from_scrypto_value(&x, network_id)) - .collect(), - }, - - ScryptoValue::Custom { value } => match value { - ScryptoCustomValue::PackageAddress(address) => Value::PackageAddress { - address: NetworkAwarePackageAddress { - network_id, - address: *address, - }, - }, - ScryptoCustomValue::ComponentAddress(address) => Value::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id, - address: *address, - }, - }, - ScryptoCustomValue::ResourceAddress(address) => Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id, - address: *address, - }, - }, - ScryptoCustomValue::SystemAddress(address) => Value::SystemAddress { - address: NetworkAwareSystemAddress { - network_id, - address: *address, - }, - }, - - ScryptoCustomValue::Component(node_id) => Value::Component { - identifier: NodeIdentifier::from_bytes(*node_id), - }, - ScryptoCustomValue::KeyValueStore(node_id) => Value::KeyValueStore { - identifier: NodeIdentifier::from_bytes(*node_id), - }, - ScryptoCustomValue::Vault(node_id) => Value::Vault { - identifier: NodeIdentifier::from_bytes(*node_id), - }, - ScryptoCustomValue::Bucket(identifier) => Value::Bucket { - identifier: Identifier::U32(*identifier).into(), - }, - ScryptoCustomValue::Proof(identifier) => Value::Proof { - identifier: Identifier::U32(*identifier).into(), - }, - - ScryptoCustomValue::Expression(value) => Value::Expression { - value: value.clone(), - }, - ScryptoCustomValue::Blob(value) => Value::Blob { - hash: value.clone(), - }, - ScryptoCustomValue::Hash(value) => Value::Hash { value: *value }, - - ScryptoCustomValue::EcdsaSecp256k1PublicKey(value) => { - Value::EcdsaSecp256k1PublicKey { public_key: *value } - } - ScryptoCustomValue::EddsaEd25519PublicKey(value) => { - Value::EddsaEd25519PublicKey { public_key: *value } - } - ScryptoCustomValue::EcdsaSecp256k1Signature(value) => { - Value::EcdsaSecp256k1Signature { signature: *value } - } - ScryptoCustomValue::EddsaEd25519Signature(value) => { - Value::EddsaEd25519Signature { signature: *value } - } - - ScryptoCustomValue::Decimal(value) => Value::Decimal { value: *value }, - ScryptoCustomValue::PreciseDecimal(value) => { - Value::PreciseDecimal { value: *value } - } - - ScryptoCustomValue::NonFungibleId(value) => Value::NonFungibleId { - value: value.clone(), - }, - ScryptoCustomValue::NonFungibleAddress(value) => Value::NonFungibleAddress { - address: NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - address: value.resource_address(), - network_id, - }, - non_fungible_id: value.non_fungible_id().clone(), - }, - }, - }, - } - } - - // =========================== - // SBOR Encoding and Decoding - // =========================== - - pub fn encode(&self) -> Result, Error> { - let scrypto_value = self.to_scrypto_value()?; - scrypto_encode(&scrypto_value).map_err(|err| err.into()) - } - - pub fn decode(bytes: &[u8], network_id: u8) -> Result { - let scrypto_value = scrypto_decode::(bytes)?; - Ok(Self::from_scrypto_value(&scrypto_value, network_id)) - } -} - -// =========== -// Validation -// =========== - -impl ValidateWithContext<(u8, Option)> for Value { - fn validate(&self, (network_id, expected_kind): (u8, Option)) -> Result<(), Error> { - self.validate_if_collection(network_id)?; - self.validate_address_network_id(network_id)?; - if let Some(expected_kind) = expected_kind { - self.validate_kind(expected_kind)?; - }; - Ok(()) - } -} - -// ========== -// ValueKind -// ========== - -#[repr(C)] -#[derive(Serialize, Deserialize, Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)] -pub enum ValueKind { - Unit, - Bool, - - I8, - I16, - I32, - I64, - I128, - - U8, - U16, - U32, - U64, - U128, - - String, - - Enum, - Option, - Result, - - Array, - Tuple, - - Decimal, - PreciseDecimal, - - Component, - PackageAddress, - ComponentAddress, - ResourceAddress, - SystemAddress, - - Hash, - - Bucket, - Proof, - Vault, - - NonFungibleId, - NonFungibleAddress, - - KeyValueStore, - - EcdsaSecp256k1PublicKey, - EcdsaSecp256k1Signature, - EddsaEd25519PublicKey, - EddsaEd25519Signature, - - Blob, - Expression, - Bytes, -} - -impl ValueKind { - pub fn type_id(&self) -> u8 { - match self { - Self::Unit => TYPE_UNIT, - Self::Bool => TYPE_BOOL, - - Self::U8 => TYPE_U8, - Self::U16 => TYPE_U16, - Self::U32 => TYPE_U32, - Self::U64 => TYPE_U64, - Self::U128 => TYPE_U128, - - Self::I8 => TYPE_I8, - Self::I16 => TYPE_I16, - Self::I32 => TYPE_I32, - Self::I64 => TYPE_I64, - Self::I128 => TYPE_I128, - - Self::String => TYPE_STRING, - - Self::Enum => TYPE_ENUM, - Self::Option => TYPE_ENUM, - Self::Result => TYPE_ENUM, - - Self::Array => TYPE_ARRAY, - Self::Bytes => TYPE_ARRAY, - Self::Tuple => TYPE_TUPLE, - - Self::KeyValueStore => ScryptoCustomTypeId::KeyValueStore.as_u8(), - - Self::Decimal => ScryptoCustomTypeId::Decimal.as_u8(), - Self::PreciseDecimal => ScryptoCustomTypeId::PreciseDecimal.as_u8(), - - Self::Component => ScryptoCustomTypeId::Component.as_u8(), - Self::PackageAddress => ScryptoCustomTypeId::PackageAddress.as_u8(), - Self::ResourceAddress => ScryptoCustomTypeId::ResourceAddress.as_u8(), - Self::ComponentAddress => ScryptoCustomTypeId::ComponentAddress.as_u8(), - Self::SystemAddress => ScryptoCustomTypeId::SystemAddress.as_u8(), - - Self::Hash => ScryptoCustomTypeId::Hash.as_u8(), - - Self::Bucket => ScryptoCustomTypeId::Bucket.as_u8(), - Self::Proof => ScryptoCustomTypeId::Proof.as_u8(), - Self::Vault => ScryptoCustomTypeId::Vault.as_u8(), - - Self::NonFungibleId => ScryptoCustomTypeId::NonFungibleId.as_u8(), - Self::NonFungibleAddress => ScryptoCustomTypeId::NonFungibleAddress.as_u8(), - - Self::EcdsaSecp256k1PublicKey => ScryptoCustomTypeId::EcdsaSecp256k1PublicKey.as_u8(), - Self::EcdsaSecp256k1Signature => ScryptoCustomTypeId::EcdsaSecp256k1Signature.as_u8(), - Self::EddsaEd25519PublicKey => ScryptoCustomTypeId::EddsaEd25519PublicKey.as_u8(), - Self::EddsaEd25519Signature => ScryptoCustomTypeId::EddsaEd25519Signature.as_u8(), - - Self::Blob => ScryptoCustomTypeId::Blob.as_u8(), - Self::Expression => ScryptoCustomTypeId::Expression.as_u8(), - } - } - - pub fn from_type_id(type_id: u8) -> Result { - let value_kind = match type_id { - TYPE_UNIT => Self::Unit, - TYPE_BOOL => Self::Bool, - - TYPE_U8 => Self::U8, - TYPE_U16 => Self::U16, - TYPE_U32 => Self::U32, - TYPE_U64 => Self::U64, - TYPE_U128 => Self::U128, - - TYPE_I8 => Self::I8, - TYPE_I16 => Self::I16, - TYPE_I32 => Self::I32, - TYPE_I64 => Self::I64, - TYPE_I128 => Self::I128, - - TYPE_STRING => Self::String, - - TYPE_ENUM => Self::Enum, - - TYPE_ARRAY => Self::Array, - TYPE_TUPLE => Self::Tuple, - - type_id => match ScryptoCustomTypeId::from_u8(type_id) { - Some(scrypto_type) => match scrypto_type { - ScryptoCustomTypeId::Decimal => Self::Decimal, - ScryptoCustomTypeId::PreciseDecimal => Self::PreciseDecimal, - ScryptoCustomTypeId::PackageAddress => Self::PackageAddress, - ScryptoCustomTypeId::ResourceAddress => Self::ResourceAddress, - ScryptoCustomTypeId::ComponentAddress => Self::ComponentAddress, - ScryptoCustomTypeId::SystemAddress => Self::SystemAddress, - ScryptoCustomTypeId::Hash => Self::Hash, - ScryptoCustomTypeId::Bucket => Self::Bucket, - ScryptoCustomTypeId::Proof => Self::Proof, - ScryptoCustomTypeId::NonFungibleId => Self::NonFungibleId, - ScryptoCustomTypeId::NonFungibleAddress => Self::NonFungibleAddress, - ScryptoCustomTypeId::Component => Self::Component, - ScryptoCustomTypeId::Vault => Self::Vault, - ScryptoCustomTypeId::EcdsaSecp256k1PublicKey => Self::EcdsaSecp256k1PublicKey, - ScryptoCustomTypeId::EcdsaSecp256k1Signature => Self::EcdsaSecp256k1Signature, - ScryptoCustomTypeId::EddsaEd25519PublicKey => Self::EddsaEd25519PublicKey, - ScryptoCustomTypeId::EddsaEd25519Signature => Self::EddsaEd25519Signature, - ScryptoCustomTypeId::KeyValueStore => Self::KeyValueStore, - ScryptoCustomTypeId::Blob => Self::Blob, - ScryptoCustomTypeId::Expression => Self::Expression, - }, - None => return Err(Error::UnknownTypeId { type_id }), - }, - }; - Ok(value_kind) - } -} - -impl From for radix_transaction::manifest::ast::Type { - fn from(value: ValueKind) -> radix_transaction::manifest::ast::Type { - match value { - ValueKind::Unit => radix_transaction::manifest::ast::Type::Unit, - - ValueKind::Bool => radix_transaction::manifest::ast::Type::Bool, - ValueKind::I8 => radix_transaction::manifest::ast::Type::I8, - ValueKind::I16 => radix_transaction::manifest::ast::Type::I16, - ValueKind::I32 => radix_transaction::manifest::ast::Type::I32, - ValueKind::I64 => radix_transaction::manifest::ast::Type::I64, - ValueKind::I128 => radix_transaction::manifest::ast::Type::I128, - - ValueKind::U8 => radix_transaction::manifest::ast::Type::U8, - ValueKind::U16 => radix_transaction::manifest::ast::Type::U16, - ValueKind::U32 => radix_transaction::manifest::ast::Type::U32, - ValueKind::U64 => radix_transaction::manifest::ast::Type::U64, - ValueKind::U128 => radix_transaction::manifest::ast::Type::U128, - - ValueKind::String => radix_transaction::manifest::ast::Type::String, - - ValueKind::Enum => radix_transaction::manifest::ast::Type::Enum, - ValueKind::Option => radix_transaction::manifest::ast::Type::Enum, - ValueKind::Result => radix_transaction::manifest::ast::Type::Enum, - - ValueKind::Array => radix_transaction::manifest::ast::Type::Array, - ValueKind::Tuple => radix_transaction::manifest::ast::Type::Tuple, - - ValueKind::Decimal => radix_transaction::manifest::ast::Type::Decimal, - ValueKind::PreciseDecimal => radix_transaction::manifest::ast::Type::PreciseDecimal, - - ValueKind::PackageAddress => radix_transaction::manifest::ast::Type::PackageAddress, - ValueKind::ComponentAddress => radix_transaction::manifest::ast::Type::ComponentAddress, - ValueKind::ResourceAddress => radix_transaction::manifest::ast::Type::ResourceAddress, - ValueKind::SystemAddress => radix_transaction::manifest::ast::Type::SystemAddress, - - ValueKind::Hash => radix_transaction::manifest::ast::Type::Hash, - - ValueKind::Bucket => radix_transaction::manifest::ast::Type::Bucket, - ValueKind::Proof => radix_transaction::manifest::ast::Type::Proof, - - ValueKind::NonFungibleId => radix_transaction::manifest::ast::Type::NonFungibleId, - ValueKind::NonFungibleAddress => { - radix_transaction::manifest::ast::Type::NonFungibleAddress - } - - ValueKind::Blob => radix_transaction::manifest::ast::Type::Blob, - ValueKind::Bytes => radix_transaction::manifest::ast::Type::Bytes, - ValueKind::Expression => radix_transaction::manifest::ast::Type::Expression, - - ValueKind::Component => radix_transaction::manifest::ast::Type::Component, - ValueKind::KeyValueStore => radix_transaction::manifest::ast::Type::KeyValueStore, - ValueKind::Vault => radix_transaction::manifest::ast::Type::Vault, - ValueKind::EcdsaSecp256k1PublicKey => { - radix_transaction::manifest::ast::Type::EcdsaSecp256k1PublicKey - } - ValueKind::EcdsaSecp256k1Signature => { - radix_transaction::manifest::ast::Type::EcdsaSecp256k1Signature - } - ValueKind::EddsaEd25519PublicKey => { - radix_transaction::manifest::ast::Type::EddsaEd25519PublicKey - } - ValueKind::EddsaEd25519Signature => { - radix_transaction::manifest::ast::Type::EddsaEd25519Signature - } - } - } -} - -impl From for ValueKind { - fn from(value: radix_transaction::manifest::ast::Type) -> ValueKind { - match value { - radix_transaction::manifest::ast::Type::Unit => Self::Unit, - radix_transaction::manifest::ast::Type::Bool => Self::Bool, - - radix_transaction::manifest::ast::Type::I8 => Self::I8, - radix_transaction::manifest::ast::Type::I16 => Self::I16, - radix_transaction::manifest::ast::Type::I32 => Self::I32, - radix_transaction::manifest::ast::Type::I64 => Self::I64, - radix_transaction::manifest::ast::Type::I128 => Self::I128, - radix_transaction::manifest::ast::Type::U8 => Self::U8, - radix_transaction::manifest::ast::Type::U16 => Self::U16, - radix_transaction::manifest::ast::Type::U32 => Self::U32, - radix_transaction::manifest::ast::Type::U64 => Self::U64, - radix_transaction::manifest::ast::Type::U128 => Self::U128, - - radix_transaction::manifest::ast::Type::String => Self::String, - - radix_transaction::manifest::ast::Type::Enum => Self::Enum, - - radix_transaction::manifest::ast::Type::Array => Self::Array, - radix_transaction::manifest::ast::Type::Tuple => Self::Tuple, - - radix_transaction::manifest::ast::Type::Decimal => Self::Decimal, - radix_transaction::manifest::ast::Type::PreciseDecimal => Self::PreciseDecimal, - - radix_transaction::manifest::ast::Type::Component => Self::Component, - radix_transaction::manifest::ast::Type::PackageAddress => Self::PackageAddress, - radix_transaction::manifest::ast::Type::ComponentAddress => Self::ComponentAddress, - radix_transaction::manifest::ast::Type::ResourceAddress => Self::ResourceAddress, - radix_transaction::manifest::ast::Type::SystemAddress => Self::SystemAddress, - - radix_transaction::manifest::ast::Type::Hash => Self::Hash, - radix_transaction::manifest::ast::Type::EcdsaSecp256k1PublicKey => { - Self::EcdsaSecp256k1PublicKey - } - radix_transaction::manifest::ast::Type::EcdsaSecp256k1Signature => { - Self::EcdsaSecp256k1Signature - } - radix_transaction::manifest::ast::Type::EddsaEd25519PublicKey => { - Self::EddsaEd25519PublicKey - } - radix_transaction::manifest::ast::Type::EddsaEd25519Signature => { - Self::EddsaEd25519Signature - } - - radix_transaction::manifest::ast::Type::Vault => Self::Vault, - radix_transaction::manifest::ast::Type::KeyValueStore => Self::KeyValueStore, - - radix_transaction::manifest::ast::Type::Bucket => Self::Bucket, - radix_transaction::manifest::ast::Type::Proof => Self::Proof, - - radix_transaction::manifest::ast::Type::NonFungibleId => Self::NonFungibleId, - radix_transaction::manifest::ast::Type::NonFungibleAddress => Self::NonFungibleAddress, - - radix_transaction::manifest::ast::Type::Blob => Self::Blob, - radix_transaction::manifest::ast::Type::Expression => Self::Expression, - radix_transaction::manifest::ast::Type::Bytes => Self::Bytes, - } - } -} - -impl From for SborTypeId { - fn from(value: ValueKind) -> Self { - match value { - ValueKind::Unit => SborTypeId::Unit, - ValueKind::Bool => SborTypeId::Bool, - - ValueKind::U8 => SborTypeId::U8, - ValueKind::U16 => SborTypeId::U16, - ValueKind::U32 => SborTypeId::U32, - ValueKind::U64 => SborTypeId::U64, - ValueKind::U128 => SborTypeId::U128, - - ValueKind::I8 => SborTypeId::I8, - ValueKind::I16 => SborTypeId::I16, - ValueKind::I32 => SborTypeId::I32, - ValueKind::I64 => SborTypeId::I64, - ValueKind::I128 => SborTypeId::I128, - - ValueKind::String => SborTypeId::String, - - ValueKind::Enum => SborTypeId::Enum, - ValueKind::Option => SborTypeId::Enum, - ValueKind::Result => SborTypeId::Enum, - - ValueKind::Array => SborTypeId::Array, - ValueKind::Bytes => SborTypeId::Array, - ValueKind::Tuple => SborTypeId::Tuple, - - ValueKind::Component => SborTypeId::Custom(ScryptoCustomTypeId::Component), - ValueKind::SystemAddress => SborTypeId::Custom(ScryptoCustomTypeId::SystemAddress), - ValueKind::PackageAddress => SborTypeId::Custom(ScryptoCustomTypeId::PackageAddress), - ValueKind::ResourceAddress => SborTypeId::Custom(ScryptoCustomTypeId::ResourceAddress), - ValueKind::ComponentAddress => { - SborTypeId::Custom(ScryptoCustomTypeId::ComponentAddress) - } - - ValueKind::Vault => SborTypeId::Custom(ScryptoCustomTypeId::Vault), - ValueKind::Proof => SborTypeId::Custom(ScryptoCustomTypeId::Proof), - ValueKind::Bucket => SborTypeId::Custom(ScryptoCustomTypeId::Bucket), - ValueKind::KeyValueStore => SborTypeId::Custom(ScryptoCustomTypeId::KeyValueStore), - - ValueKind::Expression => SborTypeId::Custom(ScryptoCustomTypeId::Expression), - ValueKind::Blob => SborTypeId::Custom(ScryptoCustomTypeId::Blob), - ValueKind::NonFungibleAddress => { - SborTypeId::Custom(ScryptoCustomTypeId::NonFungibleAddress) - } - - ValueKind::Hash => SborTypeId::Custom(ScryptoCustomTypeId::Hash), - ValueKind::EcdsaSecp256k1PublicKey => { - SborTypeId::Custom(ScryptoCustomTypeId::EcdsaSecp256k1PublicKey) - } - ValueKind::EcdsaSecp256k1Signature => { - SborTypeId::Custom(ScryptoCustomTypeId::EcdsaSecp256k1Signature) - } - ValueKind::EddsaEd25519PublicKey => { - SborTypeId::Custom(ScryptoCustomTypeId::EddsaEd25519PublicKey) - } - ValueKind::EddsaEd25519Signature => { - SborTypeId::Custom(ScryptoCustomTypeId::EddsaEd25519Signature) - } - ValueKind::Decimal => SborTypeId::Custom(ScryptoCustomTypeId::Decimal), - ValueKind::PreciseDecimal => SborTypeId::Custom(ScryptoCustomTypeId::PreciseDecimal), - ValueKind::NonFungibleId => SborTypeId::Custom(ScryptoCustomTypeId::NonFungibleId), - } - } -} - -impl From> for ValueKind { - fn from(value: SborTypeId) -> Self { - match value { - SborTypeId::Unit => ValueKind::Unit, - SborTypeId::Bool => ValueKind::Bool, - - SborTypeId::U8 => ValueKind::U8, - SborTypeId::U16 => ValueKind::U16, - SborTypeId::U32 => ValueKind::U32, - SborTypeId::U64 => ValueKind::U64, - SborTypeId::U128 => ValueKind::U128, - - SborTypeId::I8 => ValueKind::I8, - SborTypeId::I16 => ValueKind::I16, - SborTypeId::I32 => ValueKind::I32, - SborTypeId::I64 => ValueKind::I64, - SborTypeId::I128 => ValueKind::I128, - - SborTypeId::String => ValueKind::String, - - SborTypeId::Enum => ValueKind::Enum, - SborTypeId::Array => ValueKind::Array, - SborTypeId::Tuple => ValueKind::Tuple, - - SborTypeId::Custom(custom_type_id) => match custom_type_id { - ScryptoCustomTypeId::PackageAddress => ValueKind::PackageAddress, - ScryptoCustomTypeId::ComponentAddress => ValueKind::ComponentAddress, - ScryptoCustomTypeId::ResourceAddress => ValueKind::ResourceAddress, - ScryptoCustomTypeId::SystemAddress => ValueKind::SystemAddress, - - ScryptoCustomTypeId::Component => ValueKind::Component, - ScryptoCustomTypeId::KeyValueStore => ValueKind::KeyValueStore, - ScryptoCustomTypeId::Bucket => ValueKind::Bucket, - ScryptoCustomTypeId::Proof => ValueKind::Proof, - ScryptoCustomTypeId::Vault => ValueKind::Vault, - - ScryptoCustomTypeId::Expression => ValueKind::Expression, - ScryptoCustomTypeId::Blob => ValueKind::Blob, - ScryptoCustomTypeId::NonFungibleAddress => ValueKind::NonFungibleAddress, - - ScryptoCustomTypeId::Hash => ValueKind::Hash, - ScryptoCustomTypeId::EcdsaSecp256k1PublicKey => ValueKind::EcdsaSecp256k1PublicKey, - ScryptoCustomTypeId::EcdsaSecp256k1Signature => ValueKind::EcdsaSecp256k1Signature, - ScryptoCustomTypeId::EddsaEd25519PublicKey => ValueKind::EddsaEd25519PublicKey, - ScryptoCustomTypeId::EddsaEd25519Signature => ValueKind::EddsaEd25519Signature, - ScryptoCustomTypeId::Decimal => ValueKind::Decimal, - ScryptoCustomTypeId::PreciseDecimal => ValueKind::PreciseDecimal, - ScryptoCustomTypeId::NonFungibleId => ValueKind::NonFungibleId, - }, - } - } -} - -// ============================= -// From and TryFrom Conversions -// ============================= - -macro_rules! impl_from_and_try_from_value { - ($variant_name: ident, $underlying_type: ident, $field: ident) => { - impl From<$underlying_type> for Value { - fn from($field: $underlying_type) -> Self { - Value::$variant_name { $field } - } - } - - impl TryFrom for $underlying_type { - type Error = Error; - - fn try_from(val: Value) -> Result { - match val { - Value::$variant_name { $field } => Ok($field), - _ => Err(Error::InvalidType { - expected_types: vec![ValueKind::$variant_name], - actual_type: val.kind(), - }), - } - } - } - }; -} - -impl_from_and_try_from_value! {Blob, Blob, hash} -impl_from_and_try_from_value! {String, String, value} -impl_from_and_try_from_value! {Decimal, Decimal, value} -impl_from_and_try_from_value! {Proof, ProofId, identifier} -impl_from_and_try_from_value! {Bucket, BucketId, identifier} -impl_from_and_try_from_value! {NonFungibleId, NonFungibleId, value} -impl_from_and_try_from_value! {NonFungibleAddress, NonFungibleAddress, address} -impl_from_and_try_from_value! {SystemAddress, NetworkAwareSystemAddress, address} -impl_from_and_try_from_value! {PackageAddress, NetworkAwarePackageAddress, address} -impl_from_and_try_from_value! {ResourceAddress, NetworkAwareResourceAddress, address} -impl_from_and_try_from_value! {ComponentAddress, NetworkAwareComponentAddress, address} diff --git a/radix-engine-toolkit-core/src/requests/compile_notarized_transaction_intent_request.rs b/radix-engine-toolkit-core/src/requests/compile_notarized_transaction_intent_request.rs deleted file mode 100644 index f2b9186b..00000000 --- a/radix-engine-toolkit-core/src/requests/compile_notarized_transaction_intent_request.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 serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::error::Error; -use crate::model::NotarizedTransaction; -use crate::traits::{CompilableIntent, Request, Validate}; - -// ========================== -// Request & Response Models -// ========================== - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct CompileNotarizedTransactionIntentRequest { - #[serde(flatten)] - pub notarized_transaction: NotarizedTransaction, -} - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct CompileNotarizedTransactionIntentResponse { - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_notarized_intent: Vec, -} - -// =========== -// Validation -// =========== - -impl Validate for CompileNotarizedTransactionIntentRequest { - fn validate(&self) -> Result<(), Error> { - self.notarized_transaction.validate()?; - Ok(()) - } -} - -impl Validate for CompileNotarizedTransactionIntentResponse { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, CompileNotarizedTransactionIntentResponse> - for CompileNotarizedTransactionIntentRequest -{ - fn handle_request(self) -> Result { - let compiled_notarized_intent = self.notarized_transaction.compile()?; - - Ok(CompileNotarizedTransactionIntentResponse { - compiled_notarized_intent, - }) - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - // TODO: Unit tests for this request type -} diff --git a/radix-engine-toolkit-core/src/requests/compile_signed_transaction_intent_request.rs b/radix-engine-toolkit-core/src/requests/compile_signed_transaction_intent_request.rs deleted file mode 100644 index ac584933..00000000 --- a/radix-engine-toolkit-core/src/requests/compile_signed_transaction_intent_request.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 serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::error::Error; -use crate::model::SignedTransactionIntent; -use crate::traits::{CompilableIntent, Request, Validate}; - -// ========================== -// Request & Response Models -// ========================== - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct CompileSignedTransactionIntentRequest { - #[serde(flatten)] - pub signed_intent: SignedTransactionIntent, -} - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct CompileSignedTransactionIntentResponse { - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_signed_intent: Vec, -} - -// =========== -// Validation -// =========== - -impl Validate for CompileSignedTransactionIntentRequest { - fn validate(&self) -> Result<(), Error> { - self.signed_intent.validate()?; - Ok(()) - } -} - -impl Validate for CompileSignedTransactionIntentResponse { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, CompileSignedTransactionIntentResponse> - for CompileSignedTransactionIntentRequest -{ - fn handle_request(self) -> Result { - let compiled_signed_intent = self.signed_intent.compile()?; - - Ok(CompileSignedTransactionIntentResponse { - compiled_signed_intent, - }) - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - // TODO: Unit tests for this request type -} diff --git a/radix-engine-toolkit-core/src/requests/compile_transaction_intent_request.rs b/radix-engine-toolkit-core/src/requests/compile_transaction_intent_request.rs deleted file mode 100644 index 52520445..00000000 --- a/radix-engine-toolkit-core/src/requests/compile_transaction_intent_request.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 serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::error::Error; -use crate::model::TransactionIntent; -use crate::traits::{CompilableIntent, Request, Validate}; - -// ========================== -// Request & Response Models -// ========================== - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct CompileTransactionIntentRequest { - #[serde(flatten)] - pub transaction_intent: TransactionIntent, -} - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct CompileTransactionIntentResponse { - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_intent: Vec, -} - -// =========== -// Validation -// =========== - -impl Validate for CompileTransactionIntentRequest { - fn validate(&self) -> Result<(), Error> { - self.transaction_intent.validate()?; - Ok(()) - } -} - -impl Validate for CompileTransactionIntentResponse { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, CompileTransactionIntentResponse> for CompileTransactionIntentRequest { - fn handle_request(self) -> Result { - let compiled_intent = self.transaction_intent.compile()?; - - Ok(CompileTransactionIntentResponse { compiled_intent }) - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - // TODO: Unit tests for this request type -} diff --git a/radix-engine-toolkit-core/src/requests/convert_manifest_request.rs b/radix-engine-toolkit-core/src/requests/convert_manifest_request.rs deleted file mode 100644 index 408dc745..00000000 --- a/radix-engine-toolkit-core/src/requests/convert_manifest_request.rs +++ /dev/null @@ -1,97 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 - -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -//! Defines the request and response models for the convert manifest request. This request is made -//! when the client has a manifest in one format (JSON as an example) and they wish to convert -//! the manifest to another format (String as an example). The conversion between the supported -//! formats is dependent on two main factors: the transaction version, and the network id. - -use serde::{Deserialize, Serialize}; - -use crate::error::Error; -use crate::model::address::Bech32Coder; -use crate::model::manifest_instructions::ManifestInstructionsKind; -use crate::model::TransactionManifest; -use crate::traits::{Request, Validate, ValidateWithContext}; - -// ========================== -// Request & Response Models -// ========================== - -#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] -pub struct ConvertManifestRequest { - /// The version of the passed transaction manifest. Used to determine how the manifest is - /// interpreted by the library. - pub transaction_version: u8, - - /// The network id of the network that this transaction manifest is meant for. This is used for - /// the Bech32 address encoding and decoding. - pub network_id: u8, - - /// Defines the output format that we would like the manifest to be in after this request is - /// performed. - pub manifest_instructions_output_format: ManifestInstructionsKind, - - /// The manifest that the conversion will happen on - pub manifest: TransactionManifest, -} - -#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] -pub struct ConvertManifestResponse { - /// The manifest after it has been converted to the type specified in the [ConvertManifestRequest] - #[serde(flatten)] - pub manifest: TransactionManifest, -} - -// =========== -// Validation -// =========== - -impl Validate for ConvertManifestRequest { - fn validate(&self) -> Result<(), Error> { - self.manifest.validate(self.network_id)?; - Ok(()) - } -} - -impl Validate for ConvertManifestResponse { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, ConvertManifestResponse> for ConvertManifestRequest { - fn handle_request(self) -> Result { - Ok(ConvertManifestResponse { - manifest: TransactionManifest { - instructions: self - .manifest - .instructions - .convert_to_manifest_instructions_kind( - self.manifest_instructions_output_format, - &Bech32Coder::new(self.network_id), - self.manifest.blobs.clone(), - )?, - blobs: self.manifest.blobs, - }, - }) - } -} diff --git a/radix-engine-toolkit-core/src/requests/decode_address_request.rs b/radix-engine-toolkit-core/src/requests/decode_address_request.rs deleted file mode 100644 index dec0fc92..00000000 --- a/radix-engine-toolkit-core/src/requests/decode_address_request.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 bech32::{self, FromBase32, Variant}; - -use scrypto::radix_engine_interface::address::AddressError; -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::error::Error; -use crate::model::{AddressKind, EntityAddress}; -use crate::traits::{Request, Validate}; -use crate::utils::*; - -// ========================== -// Request & Response Models -// ========================== - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DecodeAddressRequest { - pub address: String, -} - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DecodeAddressResponse { - pub network_id: u8, - pub network_name: String, - pub entity_type: AddressKind, - #[serde_as(as = "serde_with::hex::Hex")] - pub data: Vec, - pub hrp: String, - pub address: EntityAddress, -} - -// =========== -// Validation -// =========== - -impl Validate for DecodeAddressRequest { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -impl Validate for DecodeAddressResponse { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, DecodeAddressResponse> for DecodeAddressRequest { - fn handle_request(self) -> 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(&self.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 = self.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(), - address, - }) - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - // TODO: Unit tests for this request type -} diff --git a/radix-engine-toolkit-core/src/requests/decompile_notarized_transaction_intent_request.rs b/radix-engine-toolkit-core/src/requests/decompile_notarized_transaction_intent_request.rs deleted file mode 100644 index 27c22ee4..00000000 --- a/radix-engine-toolkit-core/src/requests/decompile_notarized_transaction_intent_request.rs +++ /dev/null @@ -1,88 +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 serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::error::Error; - -use crate::model::manifest_instructions::ManifestInstructionsKind; -use crate::model::NotarizedTransaction; -use crate::traits::{CompilableIntent, Request, Validate}; - -// ========================== -// Request & Response Models -// ========================== - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DecompileNotarizedTransactionIntentRequest { - pub manifest_instructions_output_format: ManifestInstructionsKind, - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_notarized_intent: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DecompileNotarizedTransactionIntentResponse { - #[serde(flatten)] - pub notarized_transaction: NotarizedTransaction, -} - -// =========== -// Validation -// =========== - -impl Validate for DecompileNotarizedTransactionIntentRequest { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -impl Validate for DecompileNotarizedTransactionIntentResponse { - fn validate(&self) -> Result<(), Error> { - self.notarized_transaction.validate()?; - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, DecompileNotarizedTransactionIntentResponse> - for DecompileNotarizedTransactionIntentRequest -{ - fn handle_request(self) -> Result { - let notarized_transaction = NotarizedTransaction::decompile( - &self.compiled_notarized_intent, - self.manifest_instructions_output_format, - )?; - - Ok(DecompileNotarizedTransactionIntentResponse { - notarized_transaction, - }) - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - // TODO: Unit tests for this request type -} diff --git a/radix-engine-toolkit-core/src/requests/decompile_signed_transaction_intent_request.rs b/radix-engine-toolkit-core/src/requests/decompile_signed_transaction_intent_request.rs deleted file mode 100644 index 123b6d25..00000000 --- a/radix-engine-toolkit-core/src/requests/decompile_signed_transaction_intent_request.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 serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::error::Error; -use crate::model::manifest_instructions::ManifestInstructionsKind; -use crate::model::SignedTransactionIntent; -use crate::traits::{CompilableIntent, Request, Validate}; - -// ========================== -// Request & Response Models -// ========================== - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DecompileSignedTransactionIntentRequest { - pub manifest_instructions_output_format: ManifestInstructionsKind, - - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_signed_intent: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DecompileSignedTransactionIntentResponse { - #[serde(flatten)] - pub signed_intent: SignedTransactionIntent, -} - -// =========== -// Validation -// =========== - -impl Validate for DecompileSignedTransactionIntentRequest { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -impl Validate for DecompileSignedTransactionIntentResponse { - fn validate(&self) -> Result<(), Error> { - self.signed_intent.validate()?; - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, DecompileSignedTransactionIntentResponse> - for DecompileSignedTransactionIntentRequest -{ - fn handle_request(self) -> Result { - let signed_intent = SignedTransactionIntent::decompile( - &self.compiled_signed_intent, - self.manifest_instructions_output_format, - )?; - - Ok(DecompileSignedTransactionIntentResponse { signed_intent }) - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - // TODO: Unit tests for this request type -} diff --git a/radix-engine-toolkit-core/src/requests/decompile_transaction_intent_request.rs b/radix-engine-toolkit-core/src/requests/decompile_transaction_intent_request.rs deleted file mode 100644 index 4c17a54a..00000000 --- a/radix-engine-toolkit-core/src/requests/decompile_transaction_intent_request.rs +++ /dev/null @@ -1,87 +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 serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use crate::error::Error; -use crate::model::manifest_instructions::ManifestInstructionsKind; -use crate::model::TransactionIntent; -use crate::traits::{CompilableIntent, Request, Validate}; - -// ========================== -// Request & Response Models -// ========================== - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DecompileTransactionIntentRequest { - /// Defines the output format that we would like the manifest to be in after this request is - /// performed. - pub manifest_instructions_output_format: ManifestInstructionsKind, - - /// The compiled intent which we wish to decompile. - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_intent: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DecompileTransactionIntentResponse { - #[serde(flatten)] - pub transaction_intent: TransactionIntent, -} - -// =========== -// Validation -// =========== - -impl Validate for DecompileTransactionIntentRequest { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -impl Validate for DecompileTransactionIntentResponse { - fn validate(&self) -> Result<(), Error> { - self.transaction_intent.validate()?; - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, DecompileTransactionIntentResponse> for DecompileTransactionIntentRequest { - fn handle_request(self) -> Result { - let transaction_intent = TransactionIntent::decompile( - &self.compiled_intent, - self.manifest_instructions_output_format, - )?; - - Ok(DecompileTransactionIntentResponse { transaction_intent }) - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - // TODO: Unit tests for this request type -} diff --git a/radix-engine-toolkit-core/src/requests/decompile_unknown_transaction_intent_request.rs b/radix-engine-toolkit-core/src/requests/decompile_unknown_transaction_intent_request.rs deleted file mode 100644 index 024639c3..00000000 --- a/radix-engine-toolkit-core/src/requests/decompile_unknown_transaction_intent_request.rs +++ /dev/null @@ -1,144 +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::manifest_instructions::ManifestInstructionsKind; -use crate::requests::*; -use crate::traits::{Request, Validate}; -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -// ========================== -// Request & Response Models -// ========================== - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DecompileUnknownTransactionIntentRequest { - pub manifest_instructions_output_format: ManifestInstructionsKind, - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_unknown_intent: Vec, -} - -impl From for DecompileTransactionIntentRequest { - fn from(request: DecompileUnknownTransactionIntentRequest) -> Self { - DecompileTransactionIntentRequest { - compiled_intent: request.compiled_unknown_intent, - manifest_instructions_output_format: request.manifest_instructions_output_format, - } - } -} - -impl From for DecompileSignedTransactionIntentRequest { - fn from(request: DecompileUnknownTransactionIntentRequest) -> Self { - DecompileSignedTransactionIntentRequest { - compiled_signed_intent: request.compiled_unknown_intent, - manifest_instructions_output_format: request.manifest_instructions_output_format, - } - } -} - -impl From for DecompileNotarizedTransactionIntentRequest { - fn from(request: DecompileUnknownTransactionIntentRequest) -> Self { - DecompileNotarizedTransactionIntentRequest { - compiled_notarized_intent: request.compiled_unknown_intent, - manifest_instructions_output_format: request.manifest_instructions_output_format, - } - } -} - -#[derive(Serialize, Deserialize, Clone, Debug)] -#[serde(untagged)] -pub enum DecompileUnknownTransactionIntentResponse { - TransactionIntent(DecompileTransactionIntentResponse), - SignedTransactionIntent(DecompileSignedTransactionIntentResponse), - NotarizedTransactionIntent(DecompileNotarizedTransactionIntentResponse), -} - -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: DecompileNotarizedTransactionIntentResponse) -> Self { - Self::NotarizedTransactionIntent(response) - } -} - -// =========== -// Validation -// =========== - -impl Validate for DecompileUnknownTransactionIntentRequest { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -impl Validate for DecompileUnknownTransactionIntentResponse { - fn validate(&self) -> Result<(), Error> { - // Validation is not done here. The other request which fulfills this request will do the - // validation on its own. - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, DecompileUnknownTransactionIntentResponse> - for DecompileUnknownTransactionIntentRequest -{ - fn handle_request(self) -> Result { - if let Ok(response) = - DecompileTransactionIntentRequest::from(self.clone()).fulfill_request() - { - Ok(response.into()) - } else if let Ok(response) = - DecompileSignedTransactionIntentRequest::from(self.clone()).fulfill_request() - { - Ok(response.into()) - } else if let Ok(response) = - DecompileNotarizedTransactionIntentRequest::from(self).fulfill_request() - { - Ok(response.into()) - } else { - Err(Error::UnrecognizedCompiledIntentFormat) - } - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - // TODO: Unit tests for this request type -} diff --git a/radix-engine-toolkit-core/src/requests/derive_virtual_account_address.rs b/radix-engine-toolkit-core/src/requests/derive_virtual_account_address.rs deleted file mode 100644 index b2573b14..00000000 --- a/radix-engine-toolkit-core/src/requests/derive_virtual_account_address.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; -use crate::model::helper::ValueSerializationProxy; -use crate::model::NetworkAwareComponentAddress; -use crate::traits::{Request, Validate}; - -use scrypto::prelude::{ComponentAddress, PublicKey}; -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -// ========================== -// Request & Response Models -// ========================== - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DeriveVirtualAccountAddressRequest { - pub network_id: u8, - - pub public_key: PublicKey, -} - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct DeriveVirtualAccountAddressResponse { - #[serde_as(as = "ValueSerializationProxy")] - pub virtual_account_address: NetworkAwareComponentAddress, -} - -// =========== -// Validation -// =========== - -impl Validate for DeriveVirtualAccountAddressRequest { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -impl Validate for DeriveVirtualAccountAddressResponse { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, DeriveVirtualAccountAddressResponse> for DeriveVirtualAccountAddressRequest { - fn handle_request(self) -> Result { - Ok(DeriveVirtualAccountAddressResponse { - virtual_account_address: NetworkAwareComponentAddress { - network_id: self.network_id, - address: ComponentAddress::virtual_account_from_public_key(&self.public_key), - }, - }) - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - // TODO: Unit tests for this request type -} diff --git a/radix-engine-toolkit-core/src/requests/encode_address_request.rs b/radix-engine-toolkit-core/src/requests/encode_address_request.rs deleted file mode 100644 index ccb803ec..00000000 --- a/radix-engine-toolkit-core/src/requests/encode_address_request.rs +++ /dev/null @@ -1,80 +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::EntityAddress; -use crate::traits::{Request, Validate}; - -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -// ========================== -// Request & Response Models -// ========================== - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct EncodeAddressRequest { - #[serde_as(as = "serde_with::hex::Hex")] - pub address_bytes: Vec, - - pub network_id: u8, -} - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct EncodeAddressResponse { - #[serde(flatten)] - pub address: EntityAddress, -} - -// =========== -// Validation -// =========== - -impl Validate for EncodeAddressRequest { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -impl Validate for EncodeAddressResponse { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, EncodeAddressResponse> for EncodeAddressRequest { - fn handle_request(self) -> Result { - let address = &self.address_bytes; - let address = EntityAddress::from_u8_array(address, self.network_id)?; - - Ok(EncodeAddressResponse { address }) - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - // TODO: Unit tests for this request type -} diff --git a/radix-engine-toolkit-core/src/requests/information_request.rs b/radix-engine-toolkit-core/src/requests/information_request.rs deleted file mode 100644 index 81842f48..00000000 --- a/radix-engine-toolkit-core/src/requests/information_request.rs +++ /dev/null @@ -1,81 +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. - -//! Defines the request and response models used in an information request. This is a simple request -//! which has no arguments and returns an information response containing the current version of the -//! package. You may treat this request as a "hello world" request of sorts as it can be used to -//! check if the communication with this library is successful or not. - -use crate::error::Error; -use crate::traits::{Request, Validate}; - -use serde::{Deserialize, Serialize}; - -// ========================== -// Request & Response Models -// ========================== - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct InformationRequest {} - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct InformationResponse { - pub package_version: String, -} - -// =========== -// Validation -// =========== - -impl Validate for InformationRequest { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -impl Validate for InformationResponse { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, InformationResponse> for InformationRequest { - fn handle_request(self) -> Result { - Ok(InformationResponse { - package_version: env!("CARGO_PKG_VERSION").into(), - }) - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn information_handler_returns_ok() { - let response = InformationRequest {}.fulfill_request(); - assert!(matches!(response, Ok(_))); - } -} diff --git a/radix-engine-toolkit-core/src/requests/known_entity_addresses_request.rs b/radix-engine-toolkit-core/src/requests/known_entity_addresses_request.rs deleted file mode 100644 index ee5e1249..00000000 --- a/radix-engine-toolkit-core/src/requests/known_entity_addresses_request.rs +++ /dev/null @@ -1,135 +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::helper::ValueSerializationProxy; -use crate::model::{ - NetworkAwareComponentAddress, NetworkAwarePackageAddress, NetworkAwareResourceAddress, - NetworkAwareSystemAddress, -}; -use crate::traits::{Request, Validate}; -use scrypto::prelude::{ - ACCOUNT_PACKAGE, CLOCK, ECDSA_SECP256K1_TOKEN, EDDSA_ED25519_TOKEN, EPOCH_MANAGER, - FAUCET_COMPONENT, FAUCET_PACKAGE, RADIX_TOKEN, SYSTEM_TOKEN, -}; -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -// ========================== -// Request & Response Models -// ========================== - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct KnownEntityAddressesRequest { - pub network_id: u8, -} - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct KnownEntityAddressesResponse { - #[serde_as(as = "ValueSerializationProxy")] - faucet_component_address: NetworkAwareComponentAddress, - - #[serde_as(as = "ValueSerializationProxy")] - faucet_package_address: NetworkAwarePackageAddress, - - #[serde_as(as = "ValueSerializationProxy")] - account_package_address: NetworkAwarePackageAddress, - - #[serde_as(as = "ValueSerializationProxy")] - xrd_resource_address: NetworkAwareResourceAddress, - - #[serde_as(as = "ValueSerializationProxy")] - system_token_resource_address: NetworkAwareResourceAddress, - - #[serde_as(as = "ValueSerializationProxy")] - ecdsa_secp256k1_token_resource_address: NetworkAwareResourceAddress, - - #[serde_as(as = "ValueSerializationProxy")] - eddsa_ed25519_token_resource_address: NetworkAwareResourceAddress, - - #[serde_as(as = "ValueSerializationProxy")] - epoch_manager_system_address: NetworkAwareSystemAddress, - - #[serde_as(as = "ValueSerializationProxy")] - clock_system_address: NetworkAwareSystemAddress, -} - -// =========== -// Validation -// =========== - -impl Validate for KnownEntityAddressesRequest { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -impl Validate for KnownEntityAddressesResponse { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, KnownEntityAddressesResponse> for KnownEntityAddressesRequest { - fn handle_request(self) -> Result { - let network_id = self.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, - }, - epoch_manager_system_address: NetworkAwareSystemAddress { - address: EPOCH_MANAGER, - network_id, - }, - clock_system_address: NetworkAwareSystemAddress { - address: CLOCK, - network_id, - }, - }) - } -} diff --git a/radix-engine-toolkit-core/src/requests/mod.rs b/radix-engine-toolkit-core/src/requests/mod.rs deleted file mode 100644 index bfaabe27..00000000 --- a/radix-engine-toolkit-core/src/requests/mod.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. - -pub mod information_request; - -pub mod convert_manifest_request; - -pub mod compile_transaction_intent_request; -pub mod decompile_transaction_intent_request; - -pub mod compile_signed_transaction_intent_request; -pub mod decompile_signed_transaction_intent_request; - -pub mod compile_notarized_transaction_intent_request; -pub mod decompile_notarized_transaction_intent_request; - -pub mod decompile_unknown_transaction_intent_request; - -pub mod decode_address_request; -pub mod encode_address_request; - -pub mod sbor_decode_request; -pub mod sbor_encode_request; - -pub mod derive_virtual_account_address; - -pub mod known_entity_addresses_request; - -pub mod statically_validate_transaction_request; - -pub use compile_notarized_transaction_intent_request::*; -pub use compile_signed_transaction_intent_request::*; -pub use compile_transaction_intent_request::*; -pub use convert_manifest_request::*; -pub use decode_address_request::*; -pub use decompile_notarized_transaction_intent_request::*; -pub use decompile_signed_transaction_intent_request::*; -pub use decompile_transaction_intent_request::*; -pub use decompile_unknown_transaction_intent_request::*; -pub use derive_virtual_account_address::*; -pub use encode_address_request::*; -pub use information_request::*; -pub use known_entity_addresses_request::*; -pub use sbor_decode_request::*; -pub use sbor_encode_request::*; -pub use statically_validate_transaction_request::*; diff --git a/radix-engine-toolkit-core/src/requests/sbor_decode_request.rs b/radix-engine-toolkit-core/src/requests/sbor_decode_request.rs deleted file mode 100644 index 01f56565..00000000 --- a/radix-engine-toolkit-core/src/requests/sbor_decode_request.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 crate::error::Error; -use crate::model::Value; -use crate::traits::{Request, Validate}; - -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -// ========================== -// Request & Response Models -// ========================== - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct SBORDecodeRequest { - #[serde_as(as = "serde_with::hex::Hex")] - pub encoded_value: Vec, - pub network_id: u8, -} - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct SBORDecodeResponse { - #[serde(flatten)] - pub value: Value, -} - -// =========== -// Validation -// =========== - -impl Validate for SBORDecodeRequest { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -impl Validate for SBORDecodeResponse { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, SBORDecodeResponse> for SBORDecodeRequest { - fn handle_request(self) -> Result { - Ok(SBORDecodeResponse { - value: Value::decode(&self.encoded_value, self.network_id)?, - }) - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - // TODO: Unit tests for this request type -} diff --git a/radix-engine-toolkit-core/src/requests/sbor_encode_request.rs b/radix-engine-toolkit-core/src/requests/sbor_encode_request.rs deleted file mode 100644 index 7cbd1d71..00000000 --- a/radix-engine-toolkit-core/src/requests/sbor_encode_request.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::error::Error; -use crate::model::Value; -use crate::traits::{Request, Validate}; - -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -// ========================== -// Request & Response Models -// ========================== - -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct SBOREncodeRequest { - #[serde(flatten)] - pub value: Value, -} - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct SBOREncodeResponse { - #[serde_as(as = "serde_with::hex::Hex")] - pub encoded_value: Vec, -} - -// =========== -// Validation -// =========== - -impl Validate for SBOREncodeRequest { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -impl Validate for SBOREncodeResponse { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, SBOREncodeResponse> for SBOREncodeRequest { - fn handle_request(self) -> Result { - Ok(SBOREncodeResponse { - encoded_value: self.value.encode()?, - }) - } -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - // TODO: Unit tests for this request type -} diff --git a/radix-engine-toolkit-core/src/requests/statically_validate_transaction_request.rs b/radix-engine-toolkit-core/src/requests/statically_validate_transaction_request.rs deleted file mode 100644 index 44a8a962..00000000 --- a/radix-engine-toolkit-core/src/requests/statically_validate_transaction_request.rs +++ /dev/null @@ -1,91 +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::{ManifestInstructionsKind, NotarizedTransaction, ValidationConfigProxy}; -use crate::traits::{CompilableIntent, Request, Validate}; - -use radix_transaction::validation::{ - NotarizedTransactionValidator, TestIntentHashManager, TransactionValidator, ValidationConfig, -}; -use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, FromInto}; - -// ========================== -// Request & Response Models -// ========================== - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -pub struct StaticallyValidateTransactionRequest { - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_notarized_intent: Vec, - - #[serde_as(as = "FromInto")] - pub validation_config: ValidationConfig, -} - -#[serde_as] -#[derive(Serialize, Deserialize, Clone, Debug)] -#[serde(tag = "validity")] -pub enum StaticallyValidateTransactionResponse { - Valid, - Invalid { error: String }, -} - -// =========== -// Validation -// =========== - -impl Validate for StaticallyValidateTransactionRequest { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -impl Validate for StaticallyValidateTransactionResponse { - fn validate(&self) -> Result<(), Error> { - Ok(()) - } -} - -// ======================= -// Request Implementation -// ======================= - -impl<'r> Request<'r, StaticallyValidateTransactionResponse> - for StaticallyValidateTransactionRequest -{ - fn handle_request(self) -> Result { - let notarized_transaction = NotarizedTransaction::decompile( - &self.compiled_notarized_intent, - ManifestInstructionsKind::String, - )?; - - let intent_hash_manager = TestIntentHashManager::new(); - - if let Err(ref error) = NotarizedTransactionValidator::new(self.validation_config) - .validate(¬arized_transaction.try_into()?, &intent_hash_manager) - { - Ok(StaticallyValidateTransactionResponse::Invalid { - error: format!("{:?}", error), - }) - } else { - Ok(StaticallyValidateTransactionResponse::Valid) - } - } -} diff --git a/radix-engine-toolkit-core/src/traits.rs b/radix-engine-toolkit-core/src/traits.rs deleted file mode 100644 index 27d9cf15..00000000 --- a/radix-engine-toolkit-core/src/traits.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::{error::Error, model::ManifestInstructionsKind}; -use scrypto::prelude::{hash, Hash}; -use serde::{Deserialize, Serialize}; - -/// A trait that defines the common interface for a type which can be validated. This validation -/// happens without external context, internal only. -pub trait Validate { - fn validate(&self) -> Result<(), Error>; -} - -pub trait ValidateWithContext { - fn validate(&self, context: T) -> Result<(), Error>; -} - -/// A trait that defines the common interface for a request and response. -pub trait Request<'a, Response> -where - Self: Deserialize<'a> + Validate, - Response: Serialize + Validate, -{ - fn validate_request(&self) -> Result<(), Error> { - self.validate() - } - fn validate_response(response: &Response) -> Result<(), Error> { - response.validate() - } - - fn handle_request(self) -> Result; - fn fulfill_request(self) -> Result { - self.validate_request()?; - let response = self.handle_request()?; - Self::validate_response(&response)?; - Ok(response) - } - - /// Creates a new request from a character pointer - /// - /// # Safety - /// - /// This function makes use of pointers which is an unsafe feature. - unsafe fn new_from_pointer( - request_string_pointer: crate::memory::Pointer, - ) -> Result { - crate::memory::toolkit_read_and_deserialize_json_string_from_memory(request_string_pointer) - } -} - -/// A trait for the conversions into a different types with generic external context -pub trait TryIntoWithContext { - type Error; - - fn try_into_with_context(self, context: C) -> Result; -} - -pub trait CompilableIntent { - fn compile(&self) -> Result, Error>; - - fn decompile( - data: &T, - output_manifest_format: ManifestInstructionsKind, - ) -> Result - where - Self: Sized, - T: AsRef<[u8]>; - - fn hash(&self) -> Result { - self.compile().map(hash) - } -} diff --git a/radix-engine-toolkit-core/src/utils.rs b/radix-engine-toolkit-core/src/utils.rs deleted file mode 100644 index e49761b3..00000000 --- a/radix-engine-toolkit-core/src/utils.rs +++ /dev/null @@ -1,133 +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; -use radix_transaction::validation::ValidationConfig; -use scrypto::radix_engine_interface::{address::AddressError, core::NetworkDefinition}; - -use crate::model::TransactionHeader; - -/// 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), - }, - - 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), - }, - - 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 Numeric Test Network".into(), - hrp_suffix: format!("tdx_{:x}_", network_id), - }, - } -} - -pub fn network_id_from_hrp(hrp: &str) -> Result { - // Getting the network specifier from the given HRP. Bech32 HRPs used in Babylon are structured - // as follows: - let splitted_hrp = hrp.split('_').collect::>(); - let network_specifier = { - match splitted_hrp.get(1) { - Some(_) => Ok(splitted_hrp - .into_iter() - .skip(1) - .collect::>() - .join("_")), - None => Err(AddressError::InvalidHrp), - } - }?; - - // 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), - } - }?, - }; - Ok(network_id) -} - -pub fn network_id_from_address_string(address: &str) -> 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).map_err(AddressError::Bech32mDecodingError)?; - network_id_from_hrp(&hrp) -} - -pub fn validation_config_from_header(transaction_header: &TransactionHeader) -> ValidationConfig { - ValidationConfig::default(transaction_header.network_id) -} diff --git a/radix-engine-toolkit-core/tests/convert_manifest_request.rs b/radix-engine-toolkit-core/tests/convert_manifest_request.rs deleted file mode 100644 index 79c92f9c..00000000 --- a/radix-engine-toolkit-core/tests/convert_manifest_request.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 radix_engine_toolkit_core::error::Error; -use radix_engine_toolkit_core::model::ManifestInstructionsKind; -use radix_engine_toolkit_core::requests::ConvertManifestRequest; - -mod test_vector; -use radix_engine_toolkit_core::traits::Request; -use test_vector::TRANSACTION_MANIFEST_TEST_VECTORS; - -#[test] -pub fn manifests_converted_from_string_to_json_match_expected() { - // Arrange - let network_id = 0xF2; - - for test_vector in TRANSACTION_MANIFEST_TEST_VECTORS.iter() { - let request = ConvertManifestRequest { - manifest: test_vector.manifest.clone(), - network_id, - transaction_version: 0x01, - manifest_instructions_output_format: ManifestInstructionsKind::JSON, - }; - - // Act - let response = request - .fulfill_request() - .expect("Failed to convert a trusted manifest"); - - // Assert - assert_eq!(test_vector.expected_json_representation, response.manifest); - } -} - -#[test] -pub fn validation_fails_on_a_convert_manifest_request_with_network_mismatches() { - // Arrange - let network_id = 0x01; // Incorrect network. All test vectors use local simulator (0xF2). - - for test_vector in TRANSACTION_MANIFEST_TEST_VECTORS.iter() { - let request = ConvertManifestRequest { - manifest: test_vector.manifest.clone(), - network_id, - transaction_version: 0x01, - manifest_instructions_output_format: ManifestInstructionsKind::JSON, - }; - - // Act - let response = request.fulfill_request(); - - // Assert - // TODO: Feels like this should be a network mismatch error and not an "invalid HRP" error. - assert!(matches!(response, Err(Error::AddressError(..)))); - } -} diff --git a/radix-engine-toolkit-core/tests/derivations.rs b/radix-engine-toolkit-core/tests/derivations.rs deleted file mode 100644 index 4cc7a879..00000000 --- a/radix-engine-toolkit-core/tests/derivations.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 radix_engine_toolkit_core::{model::Bech32Coder, utils::network_id_from_address_string}; -use scrypto::prelude::{ - ComponentAddress, PackageAddress, ResourceAddress, SystemAddress, ACCOUNT_PACKAGE, CLOCK, - ECDSA_SECP256K1_TOKEN, EDDSA_ED25519_TOKEN, EPOCH_MANAGER, FAUCET_COMPONENT, FAUCET_PACKAGE, - RADIX_TOKEN, SYSTEM_TOKEN, -}; - -#[test] -pub fn network_id_can_be_derived_from_address_string_for_all_networks() { - // Arrange - let addresses = vec![ - EntityAddress::ComponentAddress(FAUCET_COMPONENT), - EntityAddress::SystemAddress(EPOCH_MANAGER), - EntityAddress::SystemAddress(CLOCK), - EntityAddress::PackageAddress(ACCOUNT_PACKAGE), - EntityAddress::PackageAddress(FAUCET_PACKAGE), - EntityAddress::ResourceAddress(RADIX_TOKEN), - EntityAddress::ResourceAddress(SYSTEM_TOKEN), - EntityAddress::ResourceAddress(EDDSA_ED25519_TOKEN), - EntityAddress::ResourceAddress(ECDSA_SECP256K1_TOKEN), - ]; - let networks = 0u8..0xFFu8; - - for network in networks { - for address in addresses.clone() { - let network = network + 1; - let address_string = address.to_string(network); - - // Act - let derived_network_id = network_id_from_address_string(&address_string).unwrap(); - - // Assert - assert_eq!( - network, derived_network_id, - "Derivation of network id from address {} produced network {} but we expected network {}", - address_string, derived_network_id, network - ); - } - } -} - -#[derive(Debug, Clone)] -pub enum EntityAddress { - ComponentAddress(ComponentAddress), - ResourceAddress(ResourceAddress), - PackageAddress(PackageAddress), - SystemAddress(SystemAddress), -} - -impl EntityAddress { - fn to_string(&self, network: u8) -> String { - let bech32_coder = Bech32Coder::new(network); - match self { - Self::ComponentAddress(address) => bech32_coder - .encoder - .encode_component_address_to_string(address), - Self::ResourceAddress(address) => bech32_coder - .encoder - .encode_resource_address_to_string(address), - Self::PackageAddress(address) => bech32_coder - .encoder - .encode_package_address_to_string(address), - Self::SystemAddress(address) => bech32_coder - .encoder - .encode_system_address_to_string(address), - } - } -} - -impl From for EntityAddress { - fn from(address: ComponentAddress) -> Self { - Self::ComponentAddress(address) - } -} - -impl From for EntityAddress { - fn from(address: ResourceAddress) -> Self { - Self::ResourceAddress(address) - } -} - -impl From for EntityAddress { - fn from(address: PackageAddress) -> Self { - Self::PackageAddress(address) - } -} - -impl From for EntityAddress { - fn from(address: SystemAddress) -> Self { - Self::SystemAddress(address) - } -} diff --git a/radix-engine-toolkit-core/tests/instruction.rs b/radix-engine-toolkit-core/tests/instruction.rs deleted file mode 100644 index 9a161828..00000000 --- a/radix-engine-toolkit-core/tests/instruction.rs +++ /dev/null @@ -1,125 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 - -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -mod test_vector; - -use radix_engine_toolkit_core::{ - model::{Bech32Coder, Instruction, NetworkAwarePackageAddress}, - traits::ValidateWithContext, -}; -use scrypto::prelude::PackageAddress; -use test_vector::*; - -#[test] -fn serialized_instructions_match_expected() { - // Checking that the serialization of instructions matches - for test_vector in INSTRUCTION_JSON_CONVERSION_TEST_VECTORS.iter() { - // Act - let expected_serialized_instruction: serde_json::Value = - serde_json::from_str(&test_vector.json_representation) - .expect("Failed to deserialize trusted instruction"); - let serialized_instruction = serde_json::to_value(&test_vector.instruction) - .expect("Failed to serialize trusted instruction"); - - // Assert - assert_eq!(expected_serialized_instruction, serialized_instruction); - } -} - -#[test] -fn deserialized_instructions_match_expected() { - // Checking that the deserialization of instructions matches - for test_vector in INSTRUCTION_JSON_CONVERSION_TEST_VECTORS.iter() { - // Act - let expected_instruction = &test_vector.instruction; - let deserialized_instruction = serde_json::from_str(&test_vector.json_representation) - .expect("Deserialization failed!"); - - // Assert - assert_eq!(*expected_instruction, deserialized_instruction) - } -} - -#[test] -fn instruction_ast_conversions_match_that_produced_by_transaction_compiler() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - // Testing that the Instruction -> AstInstruction conversion matches that obtained from parsing the manifest - for test_vector in INSTRUCTION_AST_CONVERSIONS_TEST_VECTORS.iter() { - let expected_ast_instruction = test_vector.manifest_representation_as_ast_instruction(); - - // Act - let ast_instruction = test_vector - .instruction - .to_ast_instruction(&bech32_coder) - .expect("Instruction -> AstInstruction conversion of trusted instruction failed"); - - // Assert - assert_eq!(expected_ast_instruction, ast_instruction) - } -} - -#[test] -fn no_information_is_lost_when_converting_instruction_to_ast_instruction_and_back() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - // Testing that the Instruction -> AstInstruction conversion matches that obtained from parsing the manifest - for test_vector in INSTRUCTION_AST_CONVERSIONS_TEST_VECTORS.iter() { - let expected_instruction = &test_vector.instruction; - - // Act - let ast_instruction = Instruction::from_ast_instruction( - &test_vector - .instruction - .to_ast_instruction(&bech32_coder) - .expect("Instruction -> AstInstruction conversion of trusted instruction failed"), - &bech32_coder, - ) - .expect("AstInstruction -> Instruction for a trusted instruction failed"); - - // Assert - assert_eq!(*expected_instruction, ast_instruction) - } -} - -#[test] -fn invalid_values_invalidate_an_instruction() { - // Arrange - let network_id = 0xf2; - - for test_vector in VALUE_VALIDATION_TEST_VECTORS.iter() { - let expected_validation_result = &test_vector.validation_result; - - let instruction = Instruction::CallFunction { - package_address: NetworkAwarePackageAddress { - network_id: 0xf2, - address: PackageAddress::Normal([0; 26]), - }, - blueprint_name: "HelloWorld".into(), - function_name: "world_hello".into(), - arguments: Some(vec![test_vector.value.clone()]), - }; - - // Act - let validation_result = instruction.validate(network_id); - - // Assert - assert_eq!(*expected_validation_result, validation_result); - } -} diff --git a/radix-engine-toolkit-core/tests/test_vector/instruction.rs b/radix-engine-toolkit-core/tests/test_vector/instruction.rs deleted file mode 100644 index c340da3a..00000000 --- a/radix-engine-toolkit-core/tests/test_vector/instruction.rs +++ /dev/null @@ -1,1290 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 - -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#![allow(dead_code)] -#![macro_use] -extern crate lazy_static; - -use radix_engine_toolkit_core::model::*; -use radix_transaction::manifest::lexer::tokenize; -use scrypto::prelude::*; - -pub struct InstructionSerializationTestVector { - pub instruction: Instruction, - pub json_representation: String, -} - -impl InstructionSerializationTestVector { - pub fn new>(instruction: Instruction, json_representation: S) -> Self { - let json_representation: &str = json_representation.as_ref(); - let json_representation: String = json_representation.to_string(); - Self { - instruction, - json_representation, - } - } -} - -pub struct InstructionAstConversionsTestVector { - pub instruction: Instruction, - pub manifest_representation: String, -} - -impl InstructionAstConversionsTestVector { - pub fn new>(instruction: Instruction, manifest_representation: S) -> Self { - let manifest_representation: &str = manifest_representation.as_ref(); - let manifest_representation: String = manifest_representation.into(); - Self { - manifest_representation, - instruction, - } - } - - pub fn manifest_representation_as_ast_instruction( - &self, - ) -> radix_transaction::manifest::ast::Instruction { - radix_transaction::manifest::parser::Parser::new( - tokenize(&self.manifest_representation).expect("Failed to tokenize trusted value"), - ) - .parse_instruction() - .expect("Failed to parse trusted value to ast value") - } -} - -lazy_static::lazy_static! { - pub static ref INSTRUCTION_JSON_CONVERSION_TEST_VECTORS: Vec = vec![ - InstructionSerializationTestVector::new( - Instruction::CallFunction { - package_address: NetworkAwarePackageAddress { - network_id: 0xf2, - address: PackageAddress::Normal([0; 26]), - }, - blueprint_name: "HelloWorld".into(), - function_name: "world_hello".into(), - arguments: Some(vec![Value::Decimal { - value: "129333".parse().unwrap() - }]) - }, - r#"{ - "instruction": "CALL_FUNCTION", - "package_address": { - "type": "PackageAddress", - "address": "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq" - }, - "blueprint_name": { - "type": "String", - "value": "HelloWorld" - }, - "function_name": { - "type": "String", - "value": "world_hello" - }, - "arguments": [ - { - "type": "Decimal", - "value": "129333" - } - ] - }"# - ), - InstructionSerializationTestVector::new( - Instruction::CallFunction { - package_address: NetworkAwarePackageAddress { - network_id: 0xf2, - address: PackageAddress::Normal([0; 26]), - }, - blueprint_name: "HelloWorld".into(), - function_name: "world_hello".into(), - arguments: None - }, - r#"{ - "instruction": "CALL_FUNCTION", - "package_address": { - "type": "PackageAddress", - "address": "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq" - }, - "blueprint_name": { - "type": "String", - "value": "HelloWorld" - }, - "function_name": { - "type": "String", - "value": "world_hello" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::CallNativeFunction { - blueprint_name: "HelloWorld".into(), - function_name: "world_hello".into(), - arguments: Some(vec![Value::Decimal { - value: "129333".parse().unwrap() - }]) - }, - r#"{ - "instruction": "CALL_NATIVE_FUNCTION", - "blueprint_name": { - "type": "String", - "value": "HelloWorld" - }, - "function_name": { - "type": "String", - "value": "world_hello" - }, - "arguments": [ - { - "type": "Decimal", - "value": "129333" - } - ] - }"# - ), - InstructionSerializationTestVector::new( - Instruction::CallNativeFunction { - blueprint_name: "HelloWorld".into(), - function_name: "world_hello".into(), - arguments: None - }, - r#"{ - "instruction": "CALL_NATIVE_FUNCTION", - "blueprint_name": { - "type": "String", - "value": "HelloWorld" - }, - "function_name": { - "type": "String", - "value": "world_hello" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::CallMethod { - component_address: ScryptoReceiver::ComponentAddress( - NetworkAwareComponentAddress { - network_id: 0xf2, - address: scrypto::prelude::ComponentAddress::Normal([0; 26]), - } - ), - method_name: "remove_user".into(), - arguments: Some(vec![Value::NonFungibleId { - value: scrypto::prelude::NonFungibleId::U64(18) - }]) - }, - r#"{ - "instruction": "CALL_METHOD", - "component_address": { - "type": "ComponentAddress", - "address": "component_sim1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq8ecz5v" - }, - "method_name": { - "type": "String", - "value": "remove_user" - }, - "arguments": [ - { - "type": "NonFungibleId", - "variant": "U64", - "value": "18" - } - ] - }"# - ), - InstructionSerializationTestVector::new( - Instruction::CallMethod { - component_address: ScryptoReceiver::Component( - "000000000000000000000000000000000000000000000000000000000000000000000005" - .parse() - .unwrap() - ), - method_name: "remove_user".into(), - arguments: Some(vec![Value::NonFungibleId { - value: scrypto::prelude::NonFungibleId::U64(18) - }]) - }, - r#"{ - "instruction": "CALL_METHOD", - "component_address": { - "type": "Component", - "identifier": "000000000000000000000000000000000000000000000000000000000000000000000005" - }, - "method_name": { - "type": "String", - "value": "remove_user" - }, - "arguments": [ - { - "type": "NonFungibleId", - "variant": "U64", - "value": "18" - } - ] - }"# - ), - InstructionSerializationTestVector::new( - Instruction::CallNativeMethod { - receiver: radix_engine_toolkit_core::model::RENode::Bucket( - radix_engine_toolkit_core::model::Identifier::U32(32) - ), - method_name: "inspect".into(), - arguments: None - }, - r#"{ - "instruction": "CALL_NATIVE_METHOD", - "receiver": { - "type": "Bucket", - "identifier": 32 - }, - "method_name": { - "type": "String", - "value": "inspect" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::TakeFromWorktop { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_bucket: BucketId(Identifier::String("bucket".into())) - }, - r#"{ - "instruction": "TAKE_FROM_WORKTOP", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "into_bucket": { - "type": "Bucket", - "identifier": "bucket" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::TakeFromWorktop { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_bucket: BucketId(Identifier::U32(29)) - }, - r#"{ - "instruction": "TAKE_FROM_WORKTOP", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "into_bucket": { - "type": "Bucket", - "identifier": 29 - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::TakeFromWorktopByAmount { - amount: dec!("123"), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_bucket: BucketId(Identifier::String("bucket".into())) - }, - r#"{ - "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", - "amount": { - "type": "Decimal", - "value": "123" - }, - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "into_bucket": { - "type": "Bucket", - "identifier": "bucket" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::TakeFromWorktopByAmount { - amount: dec!("123"), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_bucket: BucketId(Identifier::U32(29)) - }, - r#"{ - "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", - "amount": { - "type": "Decimal", - "value": "123" - }, - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "into_bucket": { - "type": "Bucket", - "identifier": 29 - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::TakeFromWorktopByIds { - ids: HashSet::from([NonFungibleId::U32(18),]), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_bucket: BucketId(Identifier::String("bucket".into())) - }, - r#"{ - "instruction": "TAKE_FROM_WORKTOP_BY_IDS", - "ids": [ - { - "type": "NonFungibleId", - "variant": "U32", - "value": "18" - } - ], - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "into_bucket": { - "type": "Bucket", - "identifier": "bucket" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::TakeFromWorktopByIds { - ids: HashSet::from([NonFungibleId::U32(18),]), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_bucket: BucketId(Identifier::U32(29)) - }, - r#"{ - "instruction": "TAKE_FROM_WORKTOP_BY_IDS", - "ids": [ - { - "type": "NonFungibleId", - "variant": "U32", - "value": "18" - } - ], - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "into_bucket": { - "type": "Bucket", - "identifier": 29 - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::ReturnToWorktop { - bucket: BucketId(Identifier::String("bucket".into())) - }, - r#"{ - "instruction": "RETURN_TO_WORKTOP", - "bucket": { - "type": "Bucket", - "identifier": "bucket" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::ReturnToWorktop { - bucket: BucketId(Identifier::U32(12)) - }, - r#"{ - "instruction": "RETURN_TO_WORKTOP", - "bucket": { - "type": "Bucket", - "identifier": 12 - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::AssertWorktopContains { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - }, - r#"{ - "instruction": "ASSERT_WORKTOP_CONTAINS", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::AssertWorktopContains { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - }, - r#"{ - "instruction": "ASSERT_WORKTOP_CONTAINS", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::AssertWorktopContainsByAmount { - amount: dec!("123"), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - }, - r#"{ - "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", - "amount": { - "type": "Decimal", - "value": "123" - }, - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::AssertWorktopContainsByAmount { - amount: dec!("123"), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - }, - r#"{ - "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", - "amount": { - "type": "Decimal", - "value": "123" - }, - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::AssertWorktopContainsByIds { - ids: HashSet::from([NonFungibleId::U32(18),]), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - }, - r#"{ - "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", - "ids": [ - { - "type": "NonFungibleId", - "variant": "U32", - "value": "18" - } - ], - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::AssertWorktopContainsByIds { - ids: HashSet::from([NonFungibleId::U32(18),]), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - }, - r#"{ - "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", - "ids": [ - { - "type": "NonFungibleId", - "variant": "U32", - "value": "18" - } - ], - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::PopFromAuthZone { - into_proof: ProofId(Identifier::String("proof".into())) - }, - r#"{ - "instruction": "POP_FROM_AUTH_ZONE", - "into_proof": { - "type": "Proof", - "identifier": "proof" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::PopFromAuthZone { - into_proof: ProofId(Identifier::U32(12)) - }, - r#"{ - "instruction": "POP_FROM_AUTH_ZONE", - "into_proof": { - "type": "Proof", - "identifier": 12 - } - }"# - ), - - InstructionSerializationTestVector::new( - Instruction::PushToAuthZone { - proof: ProofId(Identifier::String("proof".into())) - }, - r#"{ - "instruction": "PUSH_TO_AUTH_ZONE", - "proof": { - "type": "Proof", - "identifier": "proof" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::PushToAuthZone { - proof: ProofId(Identifier::U32(12)) - }, - r#"{ - "instruction": "PUSH_TO_AUTH_ZONE", - "proof": { - "type": "Proof", - "identifier": 12 - } - }"# - ), - - InstructionSerializationTestVector::new( - Instruction::ClearAuthZone{}, - r#"{ - "instruction": "CLEAR_AUTH_ZONE" - }"# - ), - - InstructionSerializationTestVector::new( - Instruction::CreateProofFromAuthZone { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_proof: ProofId(Identifier::String("proof".into())) - }, - r#"{ - "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "into_proof": { - "type": "Proof", - "identifier": "proof" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::CreateProofFromAuthZone { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_proof: ProofId(Identifier::U32(29)) - }, - r#"{ - "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "into_proof": { - "type": "Proof", - "identifier": 29 - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::CreateProofFromAuthZoneByAmount { - amount: dec!("123"), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_proof: ProofId(Identifier::String("proof".into())) - }, - r#"{ - "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", - "amount": { - "type": "Decimal", - "value": "123" - }, - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "into_proof": { - "type": "Proof", - "identifier": "proof" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::CreateProofFromAuthZoneByAmount { - amount: dec!("123"), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_proof: ProofId(Identifier::U32(29)) - }, - r#"{ - "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", - "amount": { - "type": "Decimal", - "value": "123" - }, - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "into_proof": { - "type": "Proof", - "identifier": 29 - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::CreateProofFromAuthZoneByIds { - ids: HashSet::from([NonFungibleId::U32(18),]), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_proof: ProofId(Identifier::String("proof".into())) - }, - r#"{ - "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", - "ids": [ - { - "type": "NonFungibleId", - "variant": "U32", - "value": "18" - } - ], - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "into_proof": { - "type": "Proof", - "identifier": "proof" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::CreateProofFromAuthZoneByIds { - ids: HashSet::from([NonFungibleId::U32(18),]), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_proof: ProofId(Identifier::U32(29)) - }, - r#"{ - "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", - "ids": [ - { - "type": "NonFungibleId", - "variant": "U32", - "value": "18" - } - ], - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "into_proof": { - "type": "Proof", - "identifier": 29 - } - }"# - ), - - InstructionSerializationTestVector::new( - Instruction::CreateProofFromBucket { - bucket: BucketId(Identifier::U32(12)), - into_proof: ProofId(Identifier::U32(12)) - }, - r#"{ - "instruction": "CREATE_PROOF_FROM_BUCKET", - "bucket": { - "type": "Bucket", - "identifier": 12 - }, - "into_proof": { - "type": "Proof", - "identifier": 12 - } - }"# - ), - - InstructionSerializationTestVector::new( - Instruction::CloneProof { - proof: ProofId(Identifier::U32(12)), - into_proof: ProofId(Identifier::U32(13)) - }, - r#"{ - "instruction": "CLONE_PROOF", - "proof": { - "type": "Proof", - "identifier": 12 - }, - "into_proof": { - "type": "Proof", - "identifier": 13 - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::DropProof { - proof: ProofId(Identifier::U32(12)), - }, - r#"{ - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": 12 - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::DropAllProofs {}, - r#"{ - "instruction": "DROP_ALL_PROOFS" - }"# - ), - InstructionSerializationTestVector::new( - Instruction::PublishPackageWithOwner { - code: Blob("36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618".parse().unwrap()), - abi: Blob("15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d".parse().unwrap()), - owner_badge: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::U32(1144418947) - } - }, - r#"{ - "instruction": "PUBLISH_PACKAGE_WITH_OWNER", - "code": { - "type": "Blob", - "hash": "36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618" - }, - "abi": { - "type": "Blob", - "hash": "15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d" - }, - "owner_badge": { - "type": "NonFungibleAddress", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "non_fungible_id": { - "type": "NonFungibleId", - "variant": "U32", - "value": "1144418947" - } - } - }"# - ), - - // TODO: Better test and more structured `CreateResource` is needed here. - InstructionSerializationTestVector::new( - Instruction::CreateResource { - resource_type: Value::Enum { variant: "Fungible".into(), fields: Some(vec![Value::U8 { value: 18 }]) }, - metadata: Value::Array { element_type: ValueKind::Tuple, elements: vec![] }, - access_rules: Value::Array { element_type: ValueKind::Tuple, elements: vec![] }, - mint_params: Value::Option { value: Box::new(None) } - }, - r#"{ - "instruction": "CREATE_RESOURCE", - "resource_type": { - "type": "Enum", - "variant": "Fungible", - "fields": [ - { - "type": "U8", - "value": "18" - } - ] - }, - "metadata": { - "type": "Array", - "element_type": "Tuple", - "elements": [] - }, - "access_rules": { - "type": "Array", - "element_type": "Tuple", - "elements": [] - }, - "mint_params": { - "type": "Option", - "variant": "None" - } - }"# - ), - - InstructionSerializationTestVector::new( - Instruction::BurnBucket { - bucket: BucketId(Identifier::String("bucket".into())) - }, - r#"{ - "instruction": "BURN_BUCKET", - "bucket": { - "type": "Bucket", - "identifier": "bucket" - } - }"# - ), - InstructionSerializationTestVector::new( - Instruction::MintFungible { - amount: dec!("123"), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - }, - r#"{ - "instruction": "MINT_FUNGIBLE", - "amount": { - "type": "Decimal", - "value": "123" - }, - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - } - }"# - ), - ]; - - pub static ref INSTRUCTION_AST_CONVERSIONS_TEST_VECTORS: Vec = vec![ - InstructionAstConversionsTestVector::new( - Instruction::CallFunction { - package_address: NetworkAwarePackageAddress { - network_id: 0xf2, - address: PackageAddress::Normal([0; 26]), - }, - blueprint_name: "HelloWorld".into(), - function_name: "world_hello".into(), - arguments: Some(vec![Value::Decimal { - value: "129333".parse().unwrap() - }]) - }, - r#"CALL_FUNCTION PackageAddress("package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq") "HelloWorld" "world_hello" Decimal("129333");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::CallFunction { - package_address: NetworkAwarePackageAddress { - network_id: 0xf2, - address: PackageAddress::Normal([0; 26]), - }, - blueprint_name: "HelloWorld".into(), - function_name: "world_hello".into(), - arguments: None - }, - r#"CALL_FUNCTION PackageAddress("package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq") "HelloWorld" "world_hello";"# - ), - InstructionAstConversionsTestVector::new( - Instruction::CallNativeFunction { - blueprint_name: "HelloWorld".into(), - function_name: "world_hello".into(), - arguments: Some(vec![Value::Decimal { - value: "129333".parse().unwrap() - }]) - }, - r#"CALL_NATIVE_FUNCTION "HelloWorld" "world_hello" Decimal("129333");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::CallNativeFunction { - blueprint_name: "HelloWorld".into(), - function_name: "world_hello".into(), - arguments: None - }, - r#"CALL_NATIVE_FUNCTION "HelloWorld" "world_hello";"# - ), - InstructionAstConversionsTestVector::new( - Instruction::CallMethod { - component_address: ScryptoReceiver::ComponentAddress( - NetworkAwareComponentAddress { - network_id: 0xf2, - address: scrypto::prelude::ComponentAddress::Normal([0; 26]), - } - ), - method_name: "remove_user".into(), - arguments: Some(vec![Value::NonFungibleId { - value: scrypto::prelude::NonFungibleId::U64(18) - }]) - }, - r#"CALL_METHOD ComponentAddress("component_sim1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq8ecz5v") "remove_user" NonFungibleId(18u64);"# - ), - InstructionAstConversionsTestVector::new( - Instruction::CallMethod { - component_address: ScryptoReceiver::Component( - "000000000000000000000000000000000000000000000000000000000000000000000005" - .parse() - .unwrap() - ), - method_name: "remove_user".into(), - arguments: Some(vec![Value::NonFungibleId { - value: scrypto::prelude::NonFungibleId::U64(18) - }]) - }, - r#"CALL_METHOD Component("000000000000000000000000000000000000000000000000000000000000000000000005") "remove_user" NonFungibleId(18u64);"# - ), - InstructionAstConversionsTestVector::new( - Instruction::CallNativeMethod { - receiver: radix_engine_toolkit_core::model::RENode::Bucket( - radix_engine_toolkit_core::model::Identifier::U32(32) - ), - method_name: "inspect".into(), - arguments: None - }, - r#"CALL_NATIVE_METHOD Bucket(32u32) "inspect";"# - ), - InstructionAstConversionsTestVector::new( - Instruction::TakeFromWorktop { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_bucket: BucketId(Identifier::String("bucket".into())) - }, - r#"TAKE_FROM_WORKTOP ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") Bucket("bucket");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::TakeFromWorktop { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_bucket: BucketId(Identifier::U32(29)) - }, - r#"TAKE_FROM_WORKTOP ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") Bucket(29u32);"# - ), - InstructionAstConversionsTestVector::new( - Instruction::TakeFromWorktopByAmount { - amount: dec!("123"), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_bucket: BucketId(Identifier::String("bucket".into())) - }, - r#"TAKE_FROM_WORKTOP_BY_AMOUNT Decimal("123") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") Bucket("bucket");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::TakeFromWorktopByAmount { - amount: dec!("123"), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_bucket: BucketId(Identifier::U32(29)) - }, - r#"TAKE_FROM_WORKTOP_BY_AMOUNT Decimal("123") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") Bucket(29u32);"# - ), - InstructionAstConversionsTestVector::new( - Instruction::TakeFromWorktopByIds { - ids: HashSet::from([NonFungibleId::U32(18),]), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_bucket: BucketId(Identifier::String("bucket".into())) - }, - r#"TAKE_FROM_WORKTOP_BY_IDS Array(NonFungibleId(18u32)) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") Bucket("bucket");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::TakeFromWorktopByIds { - ids: HashSet::from([NonFungibleId::U32(18),]), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_bucket: BucketId(Identifier::U32(29)) - }, - r#"TAKE_FROM_WORKTOP_BY_IDS Array(NonFungibleId(18u32)) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") Bucket(29u32);"# - ), - InstructionAstConversionsTestVector::new( - Instruction::ReturnToWorktop { - bucket: BucketId(Identifier::String("bucket".into())) - }, - r#"RETURN_TO_WORKTOP Bucket("bucket");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::ReturnToWorktop { - bucket: BucketId(Identifier::U32(12)) - }, - r#"RETURN_TO_WORKTOP Bucket(12u32);"# - ), - InstructionAstConversionsTestVector::new( - Instruction::AssertWorktopContains { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - }, - r#"ASSERT_WORKTOP_CONTAINS ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::AssertWorktopContains { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - }, - r#"ASSERT_WORKTOP_CONTAINS ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::AssertWorktopContainsByAmount { - amount: dec!("123"), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - }, - r#"ASSERT_WORKTOP_CONTAINS_BY_AMOUNT Decimal("123") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::AssertWorktopContainsByAmount { - amount: dec!("123"), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - }, - r#"ASSERT_WORKTOP_CONTAINS_BY_AMOUNT Decimal("123") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::AssertWorktopContainsByIds { - ids: HashSet::from([NonFungibleId::U32(18),]), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - }, - r#"ASSERT_WORKTOP_CONTAINS_BY_IDS Array(NonFungibleId(18u32)) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::AssertWorktopContainsByIds { - ids: HashSet::from([NonFungibleId::U32(18),]), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - }, - r#"ASSERT_WORKTOP_CONTAINS_BY_IDS Array(NonFungibleId(18u32)) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::PopFromAuthZone { - into_proof: ProofId(Identifier::String("proof".into())) - }, - r#"POP_FROM_AUTH_ZONE Proof("proof");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::PopFromAuthZone { - into_proof: ProofId(Identifier::U32(12)) - }, - r#"POP_FROM_AUTH_ZONE Proof(12u32);"# - ), - - InstructionAstConversionsTestVector::new( - Instruction::PushToAuthZone { - proof: ProofId(Identifier::String("proof".into())) - }, - r#"PUSH_TO_AUTH_ZONE Proof("proof");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::PushToAuthZone { - proof: ProofId(Identifier::U32(12)) - }, - r#"PUSH_TO_AUTH_ZONE Proof(12u32);"# - ), - - InstructionAstConversionsTestVector::new( - Instruction::ClearAuthZone{}, - r#"CLEAR_AUTH_ZONE;"# - ), - - InstructionAstConversionsTestVector::new( - Instruction::CreateProofFromAuthZone { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_proof: ProofId(Identifier::String("proof".into())) - }, - r#"CREATE_PROOF_FROM_AUTH_ZONE ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") Proof("proof");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::CreateProofFromAuthZone { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_proof: ProofId(Identifier::U32(29)) - }, - r#"CREATE_PROOF_FROM_AUTH_ZONE ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") Proof(29u32);"# - ), - InstructionAstConversionsTestVector::new( - Instruction::CreateProofFromAuthZoneByAmount { - amount: dec!("123"), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_proof: ProofId(Identifier::String("proof".into())) - }, - r#"CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT Decimal("123") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") Proof("proof");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::CreateProofFromAuthZoneByAmount { - amount: dec!("123"), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_proof: ProofId(Identifier::U32(29)) - }, - r#"CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT Decimal("123") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") Proof(29u32);"# - ), - InstructionAstConversionsTestVector::new( - Instruction::CreateProofFromAuthZoneByIds { - ids: HashSet::from([NonFungibleId::U32(18),]), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_proof: ProofId(Identifier::String("proof".into())) - }, - r#"CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS Array(NonFungibleId(18u32)) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") Proof("proof");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::CreateProofFromAuthZoneByIds { - ids: HashSet::from([NonFungibleId::U32(18),]), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - into_proof: ProofId(Identifier::U32(29)) - }, - r#"CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS Array(NonFungibleId(18u32)) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") Proof(29u32);"# - ), - - InstructionAstConversionsTestVector::new( - Instruction::CreateProofFromBucket { - bucket: BucketId(Identifier::U32(12)), - into_proof: ProofId(Identifier::U32(12)) - }, - r#"CREATE_PROOF_FROM_BUCKET Bucket(12u32) Proof(12u32);"# - ), - - InstructionAstConversionsTestVector::new( - Instruction::CloneProof { - proof: ProofId(Identifier::U32(12)), - into_proof: ProofId(Identifier::U32(13)) - }, - r#"CLONE_PROOF Proof(12u32) Proof(13u32);"# - ), - InstructionAstConversionsTestVector::new( - Instruction::DropProof { - proof: ProofId(Identifier::U32(12)), - }, - r#"DROP_PROOF Proof(12u32);"# - ), - InstructionAstConversionsTestVector::new( - Instruction::DropAllProofs {}, - r#"DROP_ALL_PROOFS;"# - ), - InstructionAstConversionsTestVector::new( - Instruction::PublishPackageWithOwner { - code: Blob("36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618".parse().unwrap()), - abi: Blob("15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d".parse().unwrap()), - owner_badge: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::U32(1144418947) - } - }, - r#"PUBLISH_PACKAGE_WITH_OWNER Blob("36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618") Blob("15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d") NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", 1144418947u32);"# - ), - - // TODO: Better test and more structured `CreateResource` is needed here. - InstructionAstConversionsTestVector::new( - Instruction::CreateResource { - resource_type: Value::Enum { variant: "Fungible".into(), fields: Some(vec![Value::U8 { value: 18 }]) }, - metadata: Value::Array { element_type: ValueKind::Tuple, elements: vec![] }, - access_rules: Value::Array { element_type: ValueKind::Tuple, elements: vec![] }, - mint_params: Value::Option { value: Box::new(None) } - }, - r#"CREATE_RESOURCE Enum("Fungible", 18u8) Array() Array() None;"# - ), - - InstructionAstConversionsTestVector::new( - Instruction::BurnBucket { - bucket: BucketId(Identifier::String("bucket".into())) - }, - r#"BURN_BUCKET Bucket("bucket");"# - ), - InstructionAstConversionsTestVector::new( - Instruction::MintFungible { - amount: dec!("123"), - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: ResourceAddress::Normal([0; 26]), - }, - }, - r#"MINT_FUNGIBLE ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") Decimal("123");"# - ), - ]; -} diff --git a/radix-engine-toolkit-core/tests/test_vector/manifest/any_value.blob b/radix-engine-toolkit-core/tests/test_vector/manifest/any_value.blob deleted file mode 100644 index 1410dba7c5abcd2860c56268e15249e08788f717..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmY+9J#NB45JqRbHVzmmRyr4v+#rR*XuT+rC^-O4E-)H3!9g1^}Sr=S*PV;H)sh9uXsjkS;QH$K&JigyatY9dFd4k*0G~04pNP1Cz8?VM25f z?x|ugDu66(xsmt{;g!e_Twkg0e%e7CoR+=o>{yHQ!OM-?^T=nx@O$(Ftmml~@5L6? kgpr$D{a)@q4?CTI9Bf&cQh!Nqv@wM?h1qY-I{ka`3x?h_pa1{> diff --git a/radix-engine-toolkit-core/tests/test_vector/manifest/any_value.rtm b/radix-engine-toolkit-core/tests/test_vector/manifest/any_value.rtm deleted file mode 100644 index e6f68596..00000000 --- a/radix-engine-toolkit-core/tests/test_vector/manifest/any_value.rtm +++ /dev/null @@ -1,64 +0,0 @@ -TAKE_FROM_WORKTOP ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("temp1"); - -CREATE_PROOF_FROM_AUTH_ZONE ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Proof("temp2"); - -CALL_METHOD - ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") - "with_aliases" - - # Test aliases and their non-aliased versions - None - Enum("None") - - Some("hello") - Enum("Some", "hello") - - Ok("test") - Enum("Ok", "test") - - Err("test123") - Enum("Err", "test123") - - Bytes("050aff") - Array(5u8, 10u8, 255u8) - ; - -CALL_METHOD - ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") - "with_all_types" - - # Global address types - PackageAddress("package_sim1qyqzcexvnyg60z7lnlwauh66nhzg3m8tch2j8wc0e70qkydk8r") - ComponentAddress("account_sim1q0u9gxewjxj8nhxuaschth2mgencma2hpkgwz30s9wlslthace") - ResourceAddress("resource_sim1qq8cays25704xdyap2vhgmshkkfyr023uxdtk59ddd4qs8cr5v") - SystemAddress("system_sim1qne8qu4seyvzfgd94p3z8rjcdl3v0nfhv84judpum2lq7x4635") - - # RE nodes types - Component("000000000000000000000000000000000000000000000000000000000000000005000000") - KeyValueStore("000000000000000000000000000000000000000000000000000000000000000005000000") - Bucket("temp1") - Proof("temp2") - Vault("000000000000000000000000000000000000000000000000000000000000000005000000") - - # Other interpreted types - Expression("ALL_WORKTOP_RESOURCES") - Blob("36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618") - NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag", "value") - NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag", 123u32) - NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag", 456u64) - NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag", Bytes("031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f")) - NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag", 1234567890u128) - - # Uninterpreted - Hash("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824") - EcdsaSecp256k1PublicKey("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798") - EcdsaSecp256k1Signature("0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e") - EddsaEd25519PublicKey("4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29") - EddsaEd25519Signature("ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09") - Decimal("1.2") - PreciseDecimal("1.2") - NonFungibleId(Bytes("031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f")) - NonFungibleId(12u32) - NonFungibleId(12345u64) - NonFungibleId(1234567890u128) - NonFungibleId("SomeId"); \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/test_vector/manifest/call_function.rtm b/radix-engine-toolkit-core/tests/test_vector/manifest/call_function.rtm deleted file mode 100644 index 9350a1ae..00000000 --- a/radix-engine-toolkit-core/tests/test_vector/manifest/call_function.rtm +++ /dev/null @@ -1,8 +0,0 @@ -# Inovke scrypto function -CALL_FUNCTION PackageAddress("package_sim1qy4hrp8a9apxldp5cazvxgwdj80cxad4u8cpkaqqnhlsa3lfpe") "Blueprint" "function"; - -# Invoke native function -CALL_NATIVE_FUNCTION "EpochManager" "create"; -CALL_NATIVE_FUNCTION "ResourceManager" "create"; -CALL_NATIVE_FUNCTION "Package" "publish"; -CALL_NATIVE_FUNCTION "TransactionProcessor" "run"; \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/test_vector/manifest/call_method.rtm b/radix-engine-toolkit-core/tests/test_vector/manifest/call_method.rtm deleted file mode 100644 index b733b0bd..00000000 --- a/radix-engine-toolkit-core/tests/test_vector/manifest/call_method.rtm +++ /dev/null @@ -1,21 +0,0 @@ -# Inovke scrypto method (both global and local) -CALL_METHOD ComponentAddress("component_sim1qgvyxt5rrjhwctw7krgmgkrhv82zuamcqkq75tkkrwgs00m736") "free_xrd"; -CALL_METHOD Component("000000000000000000000000000000000000000000000000000000000000000005000000") "free_xrd"; - -# Invoke native method (ref only) -TAKE_FROM_WORKTOP ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("xrd"); -CREATE_PROOF_FROM_AUTH_ZONE ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Proof("proof"); -CALL_NATIVE_METHOD Bucket("xrd") "get_resource_address"; -CALL_NATIVE_METHOD Bucket(1u32) "get_resource_address"; -CALL_NATIVE_METHOD Proof("proof") "get_resource_address"; -CALL_NATIVE_METHOD Proof(1u32) "get_resource_address"; -CALL_NATIVE_METHOD AuthZoneStack(1u32) "drain"; -CALL_NATIVE_METHOD Worktop "drain"; -CALL_NATIVE_METHOD KeyValueStore("000000000000000000000000000000000000000000000000000000000000000005000000") "method"; -CALL_NATIVE_METHOD NonFungibleStore("000000000000000000000000000000000000000000000000000000000000000005000000") "method"; -CALL_NATIVE_METHOD Component("000000000000000000000000000000000000000000000000000000000000000005000000") "add_access_check"; -CALL_NATIVE_METHOD EpochManager("000000000000000000000000000000000000000000000000000000000000000005000000") "get_transaction_hash"; -CALL_NATIVE_METHOD Vault("000000000000000000000000000000000000000000000000000000000000000005000000") "get_resource_address"; -CALL_NATIVE_METHOD ResourceManager("000000000000000000000000000000000000000000000000000000000000000000000005") "burn"; -CALL_NATIVE_METHOD Package("000000000000000000000000000000000000000000000000000000000000000000000005") "method"; -CALL_NATIVE_METHOD Global("resource_sim1qrc4s082h9trka3yrghwragylm3sdne0u668h2sy6c9sckkpn6") "method"; \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/test_vector/manifest/complex.abi b/radix-engine-toolkit-core/tests/test_vector/manifest/complex.abi deleted file mode 100644 index 0f54d027e4439141b2872a20f5200a510a24b4e9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7 McmXrw5nuoU00I2~PXGV_ diff --git a/radix-engine-toolkit-core/tests/test_vector/manifest/complex.code b/radix-engine-toolkit-core/tests/test_vector/manifest/complex.code deleted file mode 100644 index 1410dba7c5abcd2860c56268e15249e08788f717..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmY+9J#NB45JqRbHVzmmRyr4v+#rR*XuT+rC^-O4E-)H3!9g1^}Sr=S*PV;H)sh9uXsjkS;QH$K&JigyatY9dFd4k*0G~04pNP1Cz8?VM25f z?x|ugDu66(xsmt{;g!e_Twkg0e%e7CoR+=o>{yHQ!OM-?^T=nx@O$(Ftmml~@5L6? kgpr$D{a)@q4?CTI9Bf&cQh!Nqv@wM?h1qY-I{ka`3x?h_pa1{> diff --git a/radix-engine-toolkit-core/tests/test_vector/manifest/complex.rtm b/radix-engine-toolkit-core/tests/test_vector/manifest/complex.rtm deleted file mode 100644 index a0d708c9..00000000 --- a/radix-engine-toolkit-core/tests/test_vector/manifest/complex.rtm +++ /dev/null @@ -1,39 +0,0 @@ -# Withdraw XRD from account -CALL_METHOD ComponentAddress("account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064") "withdraw_by_amount" Decimal("5.0") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"); - -# Buy GUM with XRD -TAKE_FROM_WORKTOP_BY_AMOUNT Decimal("2.0") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("xrd"); -CALL_METHOD ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") "buy_gumball" Bucket("xrd"); -ASSERT_WORKTOP_CONTAINS_BY_AMOUNT Decimal("3.0") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"); -ASSERT_WORKTOP_CONTAINS ResourceAddress("resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6"); - -# Create a proof from bucket, clone it and drop both -TAKE_FROM_WORKTOP ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("some_xrd"); -CREATE_PROOF_FROM_BUCKET Bucket("some_xrd") Proof("proof1"); -CLONE_PROOF Proof("proof1") Proof("proof2"); -DROP_PROOF Proof("proof1"); -DROP_PROOF Proof("proof2"); - -# Create a proof from account and drop it -CALL_METHOD ComponentAddress("account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064") "create_proof_by_amount" Decimal("5.0") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"); -POP_FROM_AUTH_ZONE Proof("proof3"); -DROP_PROOF Proof("proof3"); - -# Return a bucket to worktop -RETURN_TO_WORKTOP Bucket("some_xrd"); -TAKE_FROM_WORKTOP_BY_IDS Array(NonFungibleId(Bytes("031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f"))) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("nfts"); - -# Create a new fungible resource -CREATE_RESOURCE Enum("Fungible", 0u8) Array() Array() Some(Enum("Fungible", Decimal("1.0"))); - -# Cancel all buckets and move resources to account -CALL_METHOD ComponentAddress("account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064") "deposit_batch" Expression("ENTIRE_WORKTOP"); - -# Drop all proofs -DROP_ALL_PROOFS; - -# Complicated method that takes all of the number types -CALL_METHOD ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") "complicated_method" Decimal("1") PreciseDecimal("2"); - -# Publish package -PUBLISH_PACKAGE_WITH_OWNER Blob("36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618") Blob("15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d") NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag", Bytes("031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f")); \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/test_vector/manifest/mod.rs b/radix-engine-toolkit-core/tests/test_vector/manifest/mod.rs deleted file mode 100644 index 663ffe82..00000000 --- a/radix-engine-toolkit-core/tests/test_vector/manifest/mod.rs +++ /dev/null @@ -1,490 +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. - -// All of the manifests in this module are obtained from the original Scrypto repo. The hopes of the -// test vectors here is to make sure that Scrypto can understand can also be understood by the Radix -// Engine Toolkit. Source of manifests: -// https://github.com/radixdlt/radixdlt-scrypto/tree/release/betanet-v1/transaction/examples - -use std::collections::HashSet; - -use radix_engine_toolkit_core::model::{ - Identifier, Instruction::*, ManifestInstructions, NonFungibleAddress, RENode, ScryptoReceiver, - TransactionManifest, Value, ValueKind, -}; -use scrypto::prelude::{Expression, NonFungibleId}; - -pub struct TransactionManifestTestVector { - pub original_manifest: String, - pub manifest: TransactionManifest, - pub expected_json_representation: TransactionManifest, -} - -impl TransactionManifestTestVector { - pub fn new>( - manifest: S, - blobs: &[&[u8]], - expected_json_representation: TransactionManifest, - ) -> Self { - Self { - original_manifest: manifest.as_ref().to_string(), - manifest: TransactionManifest { - instructions: radix_engine_toolkit_core::model::ManifestInstructions::String( - manifest.as_ref().to_string(), - ), - blobs: blobs.iter().map(|x| (*x).to_owned()).collect(), - }, - expected_json_representation, - } - } -} - -macro_rules! parse { - ($expression: expr) => { - $expression.parse().unwrap() - }; -} - -lazy_static::lazy_static! { - pub static ref TRANSACTION_MANIFEST_TEST_VECTORS: Vec = vec![ - TransactionManifestTestVector::new( - include_str!("./complex.rtm"), - &[include_bytes!("./complex.code"), include_bytes!("./complex.abi")], - TransactionManifest { - instructions: ManifestInstructions::JSON(vec![ - // Withdraw XRD from account - CallMethod { - component_address: ScryptoReceiver::ComponentAddress(parse!("account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064")), - method_name: parse!("withdraw_by_amount"), - arguments: Some(vec![ - Value::Decimal { value: parse!("5.0") }, - Value::ResourceAddress { address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") }, - ]) - }, - - // Buy GUM with XRD - TakeFromWorktopByAmount { - amount: parse!("2.0"), - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - into_bucket: Identifier::String(parse!("xrd")).into() - }, - CallMethod { - component_address: ScryptoReceiver::ComponentAddress(parse!("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum")), - method_name: parse!("buy_gumball"), - arguments: Some(vec![ - Value::Bucket { identifier: Identifier::String(parse!("xrd")).into() } - ]) - }, - AssertWorktopContainsByAmount { - amount: parse!("3.0"), - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") - }, - AssertWorktopContains { - resource_address: parse!("resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6") - }, - - // Create a proof from bucket, clone it and drop both - TakeFromWorktop { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - into_bucket: Identifier::String(parse!("some_xrd")).into() - }, - CreateProofFromBucket { - bucket: Identifier::String(parse!("some_xrd")).into(), - into_proof: Identifier::String(parse!("proof1")).into() - }, - CloneProof { - proof: Identifier::String(parse!("proof1")).into(), - into_proof: Identifier::String(parse!("proof2")).into() - }, - DropProof { - proof: Identifier::String(parse!("proof1")).into(), - }, - DropProof { - proof: Identifier::String(parse!("proof2")).into(), - }, - - // Create a proof from account and drop it - CallMethod { - component_address: ScryptoReceiver::ComponentAddress(parse!("account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064")), - method_name: parse!("create_proof_by_amount"), - arguments: Some(vec![ - Value::Decimal { value: parse!("5.0") }, - Value::ResourceAddress { address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") }, - ]) - }, - PopFromAuthZone { - into_proof: Identifier::String(parse!("proof3")).into() - }, - DropProof { - proof: Identifier::String(parse!("proof3")).into(), - }, - - // Return a bucket to worktop - ReturnToWorktop { - bucket: Identifier::String(parse!("some_xrd")).into() - }, - TakeFromWorktopByIds { - ids: HashSet::from([ - NonFungibleId::Bytes(hex::decode("031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f").unwrap()) - ]), - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - into_bucket: Identifier::String(parse!("nfts")).into() - }, - - // Create a new fungible resource - CreateResource { - resource_type: Value::Enum { - variant: parse!("Fungible"), - fields: Some(vec![Value::U8 { value: 0 }]) - }, - metadata: Value::Array { - element_type: ValueKind::Tuple, - elements: vec![] - }, - access_rules: Value::Array { - element_type: ValueKind::Tuple, - elements: vec![] - }, - mint_params: Value::Option { - value: Box::new(Some(Value::Enum { - variant: parse!("Fungible"), - fields: Some(vec![Value::Decimal { value: parse!("1.0") }]) - })) - } - }, - - // Cancel all buckets and move resources to account - CallMethod { - component_address: ScryptoReceiver::ComponentAddress(parse!("account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064")), - method_name: parse!("deposit_batch"), - arguments: Some(vec![Value::Expression { value: Expression::entire_worktop() }]) - }, - - // Drop all proofs - DropAllProofs, - - // Complicated method that takes all of the number types - CallMethod { - component_address: ScryptoReceiver::ComponentAddress(parse!("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum")), - method_name: parse!("complicated_method"), - arguments: Some(vec![ - Value::Decimal { value: parse!("1") }, - Value::PreciseDecimal { value: parse!("2") } - ]) - }, - - // Publish package - PublishPackageWithOwner { - code: parse!("36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618"), - abi: parse!("15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d"), - owner_badge: NonFungibleAddress { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - non_fungible_id: NonFungibleId::Bytes(hex::decode("031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f").unwrap()) - } - } - - ]), - blobs: vec![ - include_bytes!("./complex.code").to_vec(), - include_bytes!("./complex.abi").to_vec() - ] - } - ), - TransactionManifestTestVector::new( - include_str!("./call_method.rtm"), - &[], - TransactionManifest { - instructions: ManifestInstructions::JSON(vec![ - // Invoke scrypto method (both global and local) - CallMethod { - component_address: ScryptoReceiver::ComponentAddress(parse!("component_sim1qgvyxt5rrjhwctw7krgmgkrhv82zuamcqkq75tkkrwgs00m736")), - method_name: parse!("free_xrd"), - arguments: None - }, - CallMethod { - component_address: ScryptoReceiver::Component(parse!("000000000000000000000000000000000000000000000000000000000000000005000000")), - method_name: parse!("free_xrd"), - arguments: None - }, - - // Invoke native method (ref only) - TakeFromWorktop { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - into_bucket: Identifier::String(parse!("xrd")).into() - }, - CreateProofFromAuthZone { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - into_proof: Identifier::String(parse!("proof")).into() - }, - - CallNativeMethod { - receiver: RENode::Bucket(parse!("xrd")), - method_name: parse!("get_resource_address"), - arguments: None - }, - CallNativeMethod { - receiver: RENode::Bucket(1u32.into()), - method_name: parse!("get_resource_address"), - arguments: None - }, - CallNativeMethod { - receiver: RENode::Proof(parse!("proof")), - method_name: parse!("get_resource_address"), - arguments: None - }, - CallNativeMethod { - receiver: RENode::Proof(1u32.into()), - method_name: parse!("get_resource_address"), - arguments: None - }, - CallNativeMethod { - receiver: RENode::AuthZoneStack(1u32), - method_name: parse!("drain"), - arguments: None - }, - CallNativeMethod { - receiver: RENode::Worktop, - method_name: parse!("drain"), - arguments: None - }, - CallNativeMethod { - receiver: RENode::KeyValueStore(parse!("000000000000000000000000000000000000000000000000000000000000000005000000")), - method_name: parse!("method"), - arguments: None - }, - CallNativeMethod { - receiver: RENode::NonFungibleStore(parse!("000000000000000000000000000000000000000000000000000000000000000005000000")), - method_name: parse!("method"), - arguments: None - }, - CallNativeMethod { - receiver: RENode::Component(parse!("000000000000000000000000000000000000000000000000000000000000000005000000")), - method_name: parse!("add_access_check"), - arguments: None - }, - CallNativeMethod { - receiver: RENode::EpochManager(parse!("000000000000000000000000000000000000000000000000000000000000000005000000")), - method_name: parse!("get_transaction_hash"), - arguments: None - }, - CallNativeMethod { - receiver: RENode::Vault(parse!("000000000000000000000000000000000000000000000000000000000000000005000000")), - method_name: parse!("get_resource_address"), - arguments: None - }, - CallNativeMethod { - receiver: RENode::ResourceManager(parse!("000000000000000000000000000000000000000000000000000000000000000000000005")), - method_name: parse!("burn"), - arguments: None - }, - CallNativeMethod { - receiver: RENode::Package(parse!("000000000000000000000000000000000000000000000000000000000000000000000005")), - method_name: parse!("method"), - arguments: None - }, - CallNativeMethod { - receiver: RENode::Global(parse!("resource_sim1qrc4s082h9trka3yrghwragylm3sdne0u668h2sy6c9sckkpn6")), - method_name: parse!("method"), - arguments: None - }, - ]), - blobs: Vec::new() - } - ), - TransactionManifestTestVector::new( - include_str!("./call_function.rtm"), - &[], - TransactionManifest { - instructions: ManifestInstructions::JSON(vec![ - // Invoke scrypto function - CallFunction { - package_address: parse!("package_sim1qy4hrp8a9apxldp5cazvxgwdj80cxad4u8cpkaqqnhlsa3lfpe"), - blueprint_name: parse!("Blueprint"), - function_name: parse!("function"), - arguments: None, - }, - - // Invoke native function - CallNativeFunction { - blueprint_name: parse!("EpochManager"), - function_name: parse!("create"), - arguments: None - }, - CallNativeFunction { - blueprint_name: parse!("ResourceManager"), - function_name: parse!("create"), - arguments: None - }, - CallNativeFunction { - blueprint_name: parse!("Package"), - function_name: parse!("publish"), - arguments: None - }, - CallNativeFunction { - blueprint_name: parse!("TransactionProcessor"), - function_name: parse!("run"), - arguments: None - }, - ]), - blobs: vec![] - } - ), - TransactionManifestTestVector::new( - include_str!("./any_value.rtm"), - &[include_bytes!("./any_value.blob")], - TransactionManifest { - instructions: ManifestInstructions::JSON(vec![ - TakeFromWorktop { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - into_bucket: Identifier::String(parse!("temp1")).into() - }, - - CreateProofFromAuthZone { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - into_proof: Identifier::String(parse!("temp2")).into() - }, - - CallMethod { - component_address: ScryptoReceiver::ComponentAddress(parse!("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum")), - method_name: parse!("with_aliases"), - arguments: Some(vec![ - // Test aliases and their non-aliased versions - Value::Option { value: Box::new(None) }, - Value::Option { value: Box::new(None) }, - - Value::Option { value: Box::new(Some(Value::String { value: parse!("hello") })) }, - Value::Option { value: Box::new(Some(Value::String { value: parse!("hello") })) }, - - Value::Result { value: Box::new(Ok(Value::String { value: parse!("test") })) }, - Value::Result { value: Box::new(Ok(Value::String { value: parse!("test") })) }, - - Value::Result { value: Box::new(Err(Value::String { value: parse!("test123") })) }, - Value::Result { value: Box::new(Err(Value::String { value: parse!("test123") })) }, - - Value::Bytes { value: vec![5u8, 10u8, 255u8] }, - Value::Array { element_type: ValueKind::U8, elements: [5u8, 10u8, 255u8].iter().map(|x| Value::U8 { value: *x }).collect() }, - ]) - }, - - CallMethod { - component_address: ScryptoReceiver::ComponentAddress(parse!("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum")), - method_name: parse!("with_all_types"), - arguments: Some(vec![ - // Global address types - Value::PackageAddress { address: parse!("package_sim1qyqzcexvnyg60z7lnlwauh66nhzg3m8tch2j8wc0e70qkydk8r") }, - Value::ComponentAddress { address: parse!("account_sim1q0u9gxewjxj8nhxuaschth2mgencma2hpkgwz30s9wlslthace") }, - Value::ResourceAddress { address: parse!("resource_sim1qq8cays25704xdyap2vhgmshkkfyr023uxdtk59ddd4qs8cr5v") }, - Value::SystemAddress { address: parse!("system_sim1qne8qu4seyvzfgd94p3z8rjcdl3v0nfhv84judpum2lq7x4635") }, - - // RE nodes types - Value::Component { identifier: parse!("000000000000000000000000000000000000000000000000000000000000000005000000") }, - Value::KeyValueStore { identifier: parse!("000000000000000000000000000000000000000000000000000000000000000005000000") }, - Value::Bucket { identifier: Identifier::String(parse!("temp1")).into() }, - Value::Proof { identifier: Identifier::String(parse!("temp2")).into() }, - Value::Vault { identifier: parse!("000000000000000000000000000000000000000000000000000000000000000005000000") }, - - // Other interpreted types - Value::Expression { value: Expression::new("ALL_WORKTOP_RESOURCES") }, - Value::Blob { hash: parse!("36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618") }, - Value::NonFungibleAddress { address: NonFungibleAddress { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - non_fungible_id: NonFungibleId::String(parse!("value")) - }}, - Value::NonFungibleAddress { address: NonFungibleAddress { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - non_fungible_id: NonFungibleId::U32(123) - }}, - Value::NonFungibleAddress { address: NonFungibleAddress { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - non_fungible_id: NonFungibleId::U64(456) - }}, - Value::NonFungibleAddress { address: NonFungibleAddress { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - non_fungible_id: NonFungibleId::Bytes(hex::decode("031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f").unwrap()) - }}, - Value::NonFungibleAddress { address: NonFungibleAddress { - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - non_fungible_id: NonFungibleId::UUID(1234567890) - }}, - - // Uninterpreted - Value::Hash { - value: parse!("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824") - }, - Value::EcdsaSecp256k1PublicKey { - public_key: parse!("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798") - }, - Value::EcdsaSecp256k1Signature { - signature: parse!("0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e") - }, - Value::EddsaEd25519PublicKey { - public_key: parse!("4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29") - }, - Value::EddsaEd25519Signature { - signature: parse!("ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09") - }, - Value::Decimal { value: parse!("1.2") }, - Value::PreciseDecimal { value: parse!("1.2") }, - Value::NonFungibleId { value: NonFungibleId::Bytes(hex::decode("031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f").unwrap()) }, - Value::NonFungibleId { value: NonFungibleId::U32(12) }, - Value::NonFungibleId { value: NonFungibleId::U64(12345u64) }, - Value::NonFungibleId { value: NonFungibleId::UUID(1234567890) }, - Value::NonFungibleId { value: NonFungibleId::String(parse!("SomeId")) }, - ]) - } - ]), - blobs: vec![ - include_bytes!("./any_value.blob").to_vec() - ] - } - ), - TransactionManifestTestVector::new( - include_str!("./non_fungible_ids_canonical.rtm"), - &[], - TransactionManifest { - instructions: ManifestInstructions::JSON(vec![ - TakeFromWorktopByIds { - ids: HashSet::from([NonFungibleId::U32(12)]), - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - into_bucket: Identifier::String(parse!("bucket1")).into() - }, - TakeFromWorktopByIds { - ids: HashSet::from([NonFungibleId::U64(19)]), - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - into_bucket: Identifier::String(parse!("bucket2")).into() - }, - TakeFromWorktopByIds { - ids: HashSet::from([NonFungibleId::String(parse!("HelloWorld"))]), - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - into_bucket: Identifier::String(parse!("bucket3")).into() - }, - TakeFromWorktopByIds { - ids: HashSet::from([NonFungibleId::Bytes(hex::decode("121922ff03").unwrap())]), - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - into_bucket: Identifier::String(parse!("bucket4")).into() - }, - TakeFromWorktopByIds { - ids: HashSet::from([NonFungibleId::UUID(1922931322)]), - resource_address: parse!("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), - into_bucket: Identifier::String(parse!("bucket5")).into() - }, - ]), - blobs: vec![] - } - ), - ]; -} diff --git a/radix-engine-toolkit-core/tests/test_vector/manifest/non_fungible_ids_canonical.rtm b/radix-engine-toolkit-core/tests/test_vector/manifest/non_fungible_ids_canonical.rtm deleted file mode 100644 index 45d2025f..00000000 --- a/radix-engine-toolkit-core/tests/test_vector/manifest/non_fungible_ids_canonical.rtm +++ /dev/null @@ -1,5 +0,0 @@ -TAKE_FROM_WORKTOP_BY_IDS Array(NonFungibleId(12u32)) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("bucket1"); -TAKE_FROM_WORKTOP_BY_IDS Array(NonFungibleId(19u64)) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("bucket2"); -TAKE_FROM_WORKTOP_BY_IDS Array(NonFungibleId("HelloWorld")) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("bucket3"); -TAKE_FROM_WORKTOP_BY_IDS Array(NonFungibleId(Bytes("121922ff03"))) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("bucket4"); -TAKE_FROM_WORKTOP_BY_IDS Array(NonFungibleId(1922931322u128)) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("bucket5"); \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/test_vector/mod.rs b/radix-engine-toolkit-core/tests/test_vector/mod.rs deleted file mode 100644 index 5a228544..00000000 --- a/radix-engine-toolkit-core/tests/test_vector/mod.rs +++ /dev/null @@ -1,24 +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 instruction; -pub mod manifest; -pub mod value; - -pub use instruction::*; -pub use manifest::*; -pub use value::*; diff --git a/radix-engine-toolkit-core/tests/test_vector/value.rs b/radix-engine-toolkit-core/tests/test_vector/value.rs deleted file mode 100644 index e8d09e34..00000000 --- a/radix-engine-toolkit-core/tests/test_vector/value.rs +++ /dev/null @@ -1,1439 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 - -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#![allow(dead_code)] -#![macro_use] -extern crate lazy_static; - -use radix_engine_toolkit_core::error::Error; -use radix_engine_toolkit_core::model::*; -use radix_transaction::manifest::ast::Type as AstValueKind; -use radix_transaction::manifest::generator::{generate_value, NameResolver}; -use radix_transaction::manifest::lexer::tokenize; -use sbor::rust::collections::IndexMap; -use scrypto::prelude::*; - -pub struct ValueJsonRepresentationTestVector { - pub value: Value, - pub json_representation: String, -} - -impl ValueJsonRepresentationTestVector { - pub fn new>(value: Value, json_representation: S) -> Self { - let json_representation: &str = json_representation.as_ref(); - let json_representation: String = json_representation.into(); - Self { - value, - json_representation, - } - } -} - -pub struct ValueAstConversionsTestVector { - pub value: Value, - pub manifest_representation: String, -} - -impl ValueAstConversionsTestVector { - pub fn new>(value: Value, manifest_representation: S) -> Self { - let manifest_representation: &str = manifest_representation.as_ref(); - let manifest_representation: String = manifest_representation.into(); - Self { - manifest_representation, - value, - } - } - - pub fn manifest_representation_as_ast_value(&self) -> radix_transaction::manifest::ast::Value { - radix_transaction::manifest::parser::Parser::new( - tokenize(&self.manifest_representation).expect("Failed to tokenize trusted value"), - ) - .parse_value() - .expect("Failed to parse trusted value to ast value") - } - - pub fn manifest_representation_as_scrypto_value( - &self, - bech32_coder: &Bech32Coder, - ) -> ScryptoValue { - let mut blobs = IndexMap::>::new(); - if let Value::Blob { ref hash } = self.value { - blobs.insert(hash.0, Vec::new()); - }; - - let ast_value = self.manifest_representation_as_ast_value(); - generate_value( - &ast_value, - None, - &mut NameResolver::new(), - &bech32_coder.decoder, - &blobs, - ) - .expect("Failed to generate scrypto value from ast_value") - } -} - -pub struct ValueValidationTestVector { - pub value: Value, - pub validation_result: Result<(), Error>, -} - -impl ValueValidationTestVector { - pub fn new(value: Value, validation_result: Result<(), Error>) -> Self { - Self { - value, - validation_result, - } - } -} - -pub struct ValueKindTestVector { - pub value: Value, - pub value_kind: ValueKind, - pub ast_value_kind: AstValueKind, -} - -impl ValueKindTestVector { - pub fn new(value: Value, value_kind: ValueKind, ast_value_kind: AstValueKind) -> Self { - Self { - value, - value_kind, - ast_value_kind, - } - } -} - -lazy_static::lazy_static! { - pub static ref VALUE_JSON_CONVERSION_TEST_VECTORS: Vec = vec![ - // ================ - // Primitive Types - // ================ - - // Unit and Boolean - ValueJsonRepresentationTestVector::new(Value::Unit, r#"{"type": "Unit"}"#), - ValueJsonRepresentationTestVector::new( - Value::Bool { value: true }, - r#"{"type": "Bool", "value": true}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::Bool { value: false }, - r#"{"type": "Bool", "value": false}"#, - ), - // Unsigned Integers - ValueJsonRepresentationTestVector::new( - Value::U8 { value: 19 }, - r#"{"type": "U8", "value": "19"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::U16 { value: 19 }, - r#"{"type": "U16", "value": "19"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::U32 { value: 19 }, - r#"{"type": "U32", "value": "19"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::U64 { value: 19 }, - r#"{"type": "U64", "value": "19"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::U128 { value: 19 }, - r#"{"type": "U128", "value": "19"}"#, - ), - // Signed Integers - ValueJsonRepresentationTestVector::new( - Value::I8 { value: 19 }, - r#"{"type": "I8", "value": "19"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::I16 { value: 19 }, - r#"{"type": "I16", "value": "19"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::I32 { value: 19 }, - r#"{"type": "I32", "value": "19"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::I64 { value: 19 }, - r#"{"type": "I64", "value": "19"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::I128 { value: 19 }, - r#"{"type": "I128", "value": "19"}"#, - ), - // String - ValueJsonRepresentationTestVector::new( - Value::String { - value: "P2P Cash System".into(), - }, - r#"{"type": "String", "value": "P2P Cash System"}"#, - ), - // Enums and Enum Aliases (Option & Result) - ValueJsonRepresentationTestVector::new( - Value::Enum { - variant: "Create".into(), - fields: Some(vec![Value::String { - value: "Component".into(), - }]), - }, - r#"{"type": "Enum", "variant": "Create", "fields": [{"type": "String", "value": "Component"}]}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::Option { - value: Box::new(Some(Value::String { - value: "Component".into(), - })), - }, - r#"{"type": "Option", "variant": "Some", "field": {"type": "String", "value": "Component"}}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::Option { - value: Box::new(None), - }, - r#"{"type": "Option", "variant": "None"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::Result { - value: Box::new(Ok(Value::String { - value: "Component".into(), - })), - }, - r#"{"type": "Result", "variant": "Ok", "field": {"type": "String", "value": "Component"}}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::Result { - value: Box::new(Err(Value::String { - value: "Component".into(), - })), - }, - r#"{"type": "Result", "variant": "Err", "field": {"type": "String", "value": "Component"}}"#, - ), - // ================= - // Collection Types - // ================= - ValueJsonRepresentationTestVector::new( - Value::Array { - element_type: ValueKind::String, - elements: vec![Value::String { - value: "World, Hello!".into(), - }], - }, - r#"{"type": "Array", "element_type": "String", "elements": [{"type": "String", "value": "World, Hello!"}]}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::Tuple { - elements: vec![Value::I64 { value: 19 }, Value::I8 { value: 19 }], - }, - r#"{"type": "Tuple", "elements": [{"type": "I64", "value": "19"}, {"type": "I8", "value": "19"}]}"#, - ), - // ========================= - // Node Identifier Wrappers - // ========================= - ValueJsonRepresentationTestVector::new( - Value::KeyValueStore { - identifier: - "000000000000000000000000000000000000000000000000000000000000000000000005" - .parse() - .unwrap(), - }, - r#"{"type": "KeyValueStore", "identifier": "000000000000000000000000000000000000000000000000000000000000000000000005"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::Component { - identifier: - "000000000000000000000000000000000000000000000000000000000000000000000005" - .parse() - .unwrap(), - }, - r#"{"type": "Component", "identifier": "000000000000000000000000000000000000000000000000000000000000000000000005"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::Vault { - identifier: - "000000000000000000000000000000000000000000000000000000000000000000000005" - .parse() - .unwrap(), - }, - r#"{"type": "Vault", "identifier": "000000000000000000000000000000000000000000000000000000000000000000000005"}"#, - ), - // ============================ - // Decimal And Precise Decimal - // ============================ - ValueJsonRepresentationTestVector::new( - Value::Decimal { - value: "1923319912.102221313".parse().unwrap(), - }, - r#"{"type": "Decimal", "value": "1923319912.102221313"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::PreciseDecimal { - value: "1923319912.102221313".parse().unwrap(), - }, - r#"{"type": "PreciseDecimal", "value": "1923319912.102221313"}"#, - ), - // ============== - // Address Types - // ============== - ValueJsonRepresentationTestVector::new( - Value::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id: 0xf2, - address: scrypto::prelude::ComponentAddress::Normal([0; 26]), - }, - }, - r#"{"type": "ComponentAddress", "address": "component_sim1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq8ecz5v"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id: 0xf2, - address: scrypto::prelude::ComponentAddress::Account([0; 26]), - }, - }, - r#"{"type": "ComponentAddress", "address": "account_sim1qvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqg5cu7q"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - }, - r#"{"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::PackageAddress { - address: NetworkAwarePackageAddress { - network_id: 0xf2, - address: scrypto::prelude::PackageAddress::Normal([0; 26]), - }, - }, - r#"{"type": "PackageAddress", "address": "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::SystemAddress { - address: NetworkAwareSystemAddress { - network_id: 0xf2, - address: scrypto::prelude::SystemAddress::EpochManager([0; 26]), - }, - }, - r#"{"type": "SystemAddress", "address": "system_sim1qsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsglvqq"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::SystemAddress { - address: NetworkAwareSystemAddress { - network_id: 0xf2, - address: scrypto::prelude::SystemAddress::Clock([0; 26]), - }, - }, - r#"{"type": "SystemAddress", "address": "system_sim1q5qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz4jjwj"}"#, - ), - // ============== - // Cryptographic - // ============== - ValueJsonRepresentationTestVector::new( - Value::Hash { value: "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824".parse().unwrap() }, - r#"{"type": "Hash", "value": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::EcdsaSecp256k1PublicKey { public_key: "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798".parse().unwrap() }, - r#"{"type": "EcdsaSecp256k1PublicKey", "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::EddsaEd25519PublicKey { public_key: "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29".parse().unwrap() }, - r#"{"type": "EddsaEd25519PublicKey", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::EcdsaSecp256k1Signature { signature: "0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e".parse().unwrap() }, - r#"{"type": "EcdsaSecp256k1Signature", "signature": "0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::EddsaEd25519Signature { signature: "ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09".parse().unwrap() }, - r#"{"type": "EddsaEd25519Signature", "signature": "ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09"}"#, - ), - - // =================== - // Buckets and Proofs - // =================== - ValueJsonRepresentationTestVector::new( - Value::Bucket { identifier: BucketId(Identifier::String("xrd_bucket".into())) }, - r#"{"type": "Bucket", "identifier": "xrd_bucket"}"# - ), - ValueJsonRepresentationTestVector::new( - Value::Bucket { identifier: BucketId(Identifier::U32(28)) }, - r#"{"type": "Bucket", "identifier": 28}"# - ), - ValueJsonRepresentationTestVector::new( - Value::Proof { identifier: ProofId(Identifier::String("xrd_proof".into())) }, - r#"{"type": "Proof", "identifier": "xrd_proof"}"# - ), - ValueJsonRepresentationTestVector::new( - Value::Proof { identifier: ProofId(Identifier::U32(28)) }, - r#"{"type": "Proof", "identifier": 28}"# - ), - - // ========================== - // Non Fungible Id & Address - // ========================== - - ValueJsonRepresentationTestVector::new( - Value::NonFungibleId { value: NonFungibleId::U32(1144418947) }, - r#"{"type": "NonFungibleId", "variant": "U32", "value": "1144418947"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::NonFungibleId { value: NonFungibleId::U64(114441894733333) }, - r#"{"type": "NonFungibleId", "variant": "U64", "value": "114441894733333"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::NonFungibleId { value: NonFungibleId::UUID(11444189334733333) }, - r#"{"type": "NonFungibleId", "variant": "UUID", "value": "11444189334733333"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::NonFungibleId { value: NonFungibleId::String("hello_world".into()) }, - r#"{"type": "NonFungibleId", "variant": "String", "value": "hello_world"}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::NonFungibleId { value: NonFungibleId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) }, - r#"{"type": "NonFungibleId", "variant": "Bytes", "value": "10a23101"}"#, - ), - - ValueJsonRepresentationTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::U32(1144418947) - } - }, - r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "variant": "U32", "value": "1144418947"}}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::U64(114441894733333) - } - }, - r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "variant": "U64", "value": "114441894733333"}}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::UUID(11444189334733333) - } - }, - r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "variant": "UUID", "value": "11444189334733333"}}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::String("hello_world".into()) - } - }, - r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "variant": "String", "value": "hello_world"}}"#, - ), - ValueJsonRepresentationTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) - } - }, - r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "variant": "Bytes", "value": "10a23101"}}"#, - ), - - // ================= - // Other Misc Types - // ================= - ValueJsonRepresentationTestVector::new( - Value::Blob { hash: Blob("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824".parse().unwrap()) }, - r#"{"type": "Blob", "hash": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"}"# - ), - ValueJsonRepresentationTestVector::new( - Value::Expression { value: Expression::entire_auth_zone() }, - r#"{"type": "Expression", "value": "ENTIRE_AUTH_ZONE"}"# - ), - ValueJsonRepresentationTestVector::new( - Value::Expression { value: Expression::entire_worktop() }, - r#"{"type": "Expression", "value": "ENTIRE_WORKTOP"}"# - ), - ValueJsonRepresentationTestVector::new( - Value::Bytes { value: vec![0x12, 0x19, 0x12, 0x20, 0x8] }, - r#"{"type": "Bytes", "value": "1219122008"}"# - ), - ]; - - pub static ref VALUE_AST_CONVERSIONS_TEST_VECTORS: Vec = vec![ - // ================ - // Primitive Types - // ================ - - // Unit and Boolean - ValueAstConversionsTestVector::new( - Value::Unit, - r#"()"# - ), - ValueAstConversionsTestVector::new( - Value::Bool { value: true }, - r#"true"#, - ), - ValueAstConversionsTestVector::new( - Value::Bool { value: false }, - r#"false"#, - ), - // Unsigned Integers - ValueAstConversionsTestVector::new( - Value::U8 { value: 19 }, - "19u8" - ), - ValueAstConversionsTestVector::new( - Value::U16 { value: 19 }, - "19u16" - ), - ValueAstConversionsTestVector::new( - Value::U32 { value: 19 }, - "19u32" - ), - ValueAstConversionsTestVector::new( - Value::U64 { value: 19 }, - "19u64" - ), - ValueAstConversionsTestVector::new( - Value::U128 { value: 19 }, - "19u128" - ), - // Signed Integers - ValueAstConversionsTestVector::new( - Value::I8 { value: 19 }, - "19i8" - ), - ValueAstConversionsTestVector::new( - Value::I16 { value: 19 }, - "19i16" - ), - ValueAstConversionsTestVector::new( - Value::I32 { value: 19 }, - "19i32" - ), - ValueAstConversionsTestVector::new( - Value::I64 { value: 19 }, - "19i64" - ), - ValueAstConversionsTestVector::new( - Value::I128 { value: 19 }, - "19i128" - ), - // String - ValueAstConversionsTestVector::new( - Value::String { - value: "P2P Cash System".into(), - }, - r#""P2P Cash System""#, - ), - // Enums and Enum Aliases (Option & Result) - ValueAstConversionsTestVector::new( - Value::Enum { - variant: "Create".into(), - fields: Some(vec![Value::String { - value: "Component".into(), - }]), - }, - r#"Enum("Create", "Component")"#, - ), - ValueAstConversionsTestVector::new( - Value::Option { - value: Box::new(Some(Value::String { - value: "Component".into(), - })), - }, - r#"Some("Component")"#, - ), - ValueAstConversionsTestVector::new( - Value::Option { - value: Box::new(None), - }, - r#"None"#, - ), - ValueAstConversionsTestVector::new( - Value::Result { - value: Box::new(Ok(Value::String { - value: "Component".into(), - })), - }, - r#"Ok("Component")"#, - ), - ValueAstConversionsTestVector::new( - Value::Result { - value: Box::new(Err(Value::String { - value: "Component".into(), - })), - }, - r#"Err("Component")"#, - ), - // ================= - // Collection Types - // ================= - ValueAstConversionsTestVector::new( - Value::Array { - element_type: ValueKind::String, - elements: vec![Value::String { - value: "World, Hello!".into(), - }], - }, - r#"Array("World, Hello!")"#, - ), - ValueAstConversionsTestVector::new( - Value::Tuple { - elements: vec![Value::I64 { value: 19 }, Value::I8 { value: 19 }], - }, - "Tuple(19i64, 19i8)" - ), - // ========================= - // Node Identifier Wrappers - // ========================= - ValueAstConversionsTestVector::new( - Value::KeyValueStore { - identifier: - "000000000000000000000000000000000000000000000000000000000000000000000005" - .parse() - .unwrap(), - }, - r#"KeyValueStore("000000000000000000000000000000000000000000000000000000000000000000000005")"#, - ), - ValueAstConversionsTestVector::new( - Value::Component { - identifier: - "000000000000000000000000000000000000000000000000000000000000000000000005" - .parse() - .unwrap(), - }, - r#"Component("000000000000000000000000000000000000000000000000000000000000000000000005")"#, - ), - ValueAstConversionsTestVector::new( - Value::Vault { - identifier: - "000000000000000000000000000000000000000000000000000000000000000000000005" - .parse() - .unwrap(), - }, - r#"Vault("000000000000000000000000000000000000000000000000000000000000000000000005")"#, - ), - // ============================ - // Decimal And Precise Decimal - // ============================ - ValueAstConversionsTestVector::new( - Value::Decimal { - value: "1923319912.102221313".parse().unwrap(), - }, - r#"Decimal("1923319912.102221313")"#, - ), - ValueAstConversionsTestVector::new( - Value::PreciseDecimal { - value: "1923319912.102221313".parse().unwrap(), - }, - r#"PreciseDecimal("1923319912.102221313")"#, - ), - // ============== - // Address Types - // ============== - ValueAstConversionsTestVector::new( - Value::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id: 0xf2, - address: scrypto::prelude::ComponentAddress::Normal([0; 26]), - }, - }, - r#"ComponentAddress("component_sim1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq8ecz5v")"#, - ), - ValueAstConversionsTestVector::new( - Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - }, - r#"ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety")"#, - ), - ValueAstConversionsTestVector::new( - Value::PackageAddress { - address: NetworkAwarePackageAddress { - network_id: 0xf2, - address: scrypto::prelude::PackageAddress::Normal([0; 26]), - }, - }, - r#"PackageAddress("package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq")"#, - ), - ValueAstConversionsTestVector::new( - Value::SystemAddress { - address: NetworkAwareSystemAddress { - network_id: 0xf2, - address: scrypto::prelude::SystemAddress::EpochManager([0; 26]), - }, - }, - r#"SystemAddress("system_sim1qsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsglvqq")"#, - ), - // ============== - // Cryptographic - // ============== - ValueAstConversionsTestVector::new( - Value::Hash { value: "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824".parse().unwrap() }, - r#"Hash("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824")"#, - ), - ValueAstConversionsTestVector::new( - Value::EcdsaSecp256k1PublicKey { public_key: "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798".parse().unwrap() }, - r#"EcdsaSecp256k1PublicKey("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")"#, - ), - ValueAstConversionsTestVector::new( - Value::EddsaEd25519PublicKey { public_key: "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29".parse().unwrap() }, - r#"EddsaEd25519PublicKey("4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29")"#, - ), - ValueAstConversionsTestVector::new( - Value::EcdsaSecp256k1Signature { signature: "0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e".parse().unwrap() }, - r#"EcdsaSecp256k1Signature("0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e")"#, - ), - ValueAstConversionsTestVector::new( - Value::EddsaEd25519Signature { signature: "ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09".parse().unwrap() }, - r#"EddsaEd25519Signature("ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09")"#, - ), - - // =================== - // Buckets and Proofs - // =================== - ValueAstConversionsTestVector::new( - Value::Bucket { identifier: BucketId(Identifier::String("xrd_bucket".into())) }, - r#"Bucket("xrd_bucket")"# - ), - ValueAstConversionsTestVector::new( - Value::Bucket { identifier: BucketId(Identifier::U32(28)) }, - r#"Bucket(28u32)"# - ), - ValueAstConversionsTestVector::new( - Value::Proof { identifier: ProofId(Identifier::String("xrd_proof".into())) }, - r#"Proof("xrd_proof")"# - ), - ValueAstConversionsTestVector::new( - Value::Proof { identifier: ProofId(Identifier::U32(28)) }, - r#"Proof(28u32)"# - ), - - // ========================== - // Non Fungible Id & Address - // ========================== - ValueAstConversionsTestVector::new( - Value::NonFungibleId { value: NonFungibleId::U32(1144418947) }, - r#"NonFungibleId(1144418947u32)"#, - ), - ValueAstConversionsTestVector::new( - Value::NonFungibleId { value: NonFungibleId::U64(114441894733333) }, - r#"NonFungibleId(114441894733333u64)"#, - ), - ValueAstConversionsTestVector::new( - Value::NonFungibleId { value: NonFungibleId::UUID(11444189334733333) }, - r#"NonFungibleId(11444189334733333u128)"#, - ), - ValueAstConversionsTestVector::new( - Value::NonFungibleId { value: NonFungibleId::String("hello_world".into()) }, - r#"NonFungibleId("hello_world")"#, - ), - ValueAstConversionsTestVector::new( - Value::NonFungibleId { value: NonFungibleId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) }, - r#"NonFungibleId(Bytes("10a23101"))"#, - ), - - ValueAstConversionsTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::U32(1144418947) - } - }, - r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", 1144418947u32)"#, - ), - ValueAstConversionsTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::U64(114441894733333) - } - }, - r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", 114441894733333u64)"#, - ), - ValueAstConversionsTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::UUID(11444189334733333) - } - }, - r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", 11444189334733333u128)"#, - ), - ValueAstConversionsTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::String("hello_world".into()) - } - }, - r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", "hello_world")"#, - ), - ValueAstConversionsTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) - } - }, - r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", Bytes("10a23101"))"#, - ), - - // ================= - // Other Misc Types - // ================= - ValueAstConversionsTestVector::new( - Value::Blob { hash: Blob("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824".parse().unwrap()) }, - r#"Blob("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824")"# - ), - ValueAstConversionsTestVector::new( - Value::Expression { value: Expression::entire_auth_zone() }, - r#"Expression("ENTIRE_AUTH_ZONE")"# - ), - ValueAstConversionsTestVector::new( - Value::Expression { value: Expression::entire_worktop() }, - r#"Expression("ENTIRE_WORKTOP")"# - ), - ValueAstConversionsTestVector::new( - Value::Bytes { value: vec![0x12, 0x19, 0x12, 0x20, 0x8] }, - r#"Bytes("1219122008")"# - ), - ]; - - pub static ref VALUE_VALIDATION_TEST_VECTORS: Vec = vec![ - // ==================================== - // Address Network Mismatch Validation - // ==================================== - ValueValidationTestVector::new( - Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0x10, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]) - } - }, - Err(Error::NetworkMismatchError { expected: 0xf2, found: 0x10 }) - ), - ValueValidationTestVector::new( - Value::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id: 0x10, - address: scrypto::prelude::ComponentAddress::Normal([0; 26]) - } - }, - Err(Error::NetworkMismatchError { expected: 0xf2, found: 0x10 }) - ), - ValueValidationTestVector::new( - Value::SystemAddress { - address: NetworkAwareSystemAddress { - network_id: 0x10, - address: scrypto::prelude::SystemAddress::EpochManager([0; 26]) - } - }, - Err(Error::NetworkMismatchError { expected: 0xf2, found: 0x10 }) - ), - ValueValidationTestVector::new( - Value::PackageAddress { - address: NetworkAwarePackageAddress { - network_id: 0x10, - address: scrypto::prelude::PackageAddress::Normal([0; 26]) - } - }, - Err(Error::NetworkMismatchError { expected: 0xf2, found: 0x10 }) - ), - - ValueValidationTestVector::new( - Value::Array { element_type: ValueKind::Array, elements: vec![ - Value::Array { element_type: ValueKind::Tuple, elements: vec![ - Value::Tuple { elements: vec![ - Value::Array { element_type: ValueKind::Tuple, elements: vec![ - Value::Tuple { elements: vec![ - Value::PackageAddress { - address: NetworkAwarePackageAddress { - network_id: 0x10, - address: scrypto::prelude::PackageAddress::Normal([0; 26]) - } - } - ] } - ] } - ] } - ] } - ] }, - Err(Error::NetworkMismatchError { expected: 0xf2, found: 0x10 }) - ), - // ============================ - // Collection Types Validation - // ============================ - ValueValidationTestVector::new( - Value::Array { - element_type: ValueKind::Decimal, - elements: vec![ - Value::Decimal { value: dec!("20") }, - Value::Decimal { value: dec!("100") }, - Value::Decimal { - value: dec!("192.31"), - }, - ], - }, - Ok(()) - ), - ValueValidationTestVector::new( - Value::Array { - element_type: ValueKind::Decimal, - elements: vec![ - Value::Decimal { value: dec!("20") }, - Value::Decimal { value: dec!("100") }, - Value::Decimal { - value: dec!("192.31"), - }, - Value::PreciseDecimal { - value: pdec!("192.31"), - }, - ], - }, - Err(Error::InvalidType { - expected_types: vec![ValueKind::Decimal], - actual_type: ValueKind::PreciseDecimal - }) - ), - ValueValidationTestVector::new( - Value::Tuple { - elements: vec![ - Value::Decimal { value: dec!("10") }, - Value::PreciseDecimal { value: pdec!("10") }, - Value::String { - value: "Hello World!".into(), - }, - Value::Tuple { - elements: vec![ - Value::Decimal { value: dec!("10") }, - Value::PreciseDecimal { value: pdec!("10") }, - Value::String { - value: "Hello World!".into(), - }, - Value::Tuple { - elements: vec![ - Value::Decimal { value: dec!("10") }, - Value::PreciseDecimal { value: pdec!("10") }, - Value::String { - value: "Hello World!".into(), - }, - Value::Tuple { - elements: vec![ - Value::Decimal { value: dec!("10") }, - Value::PreciseDecimal { value: pdec!("10") }, - Value::String { - value: "Hello World!".into(), - }, - Value::Array { - element_type: ValueKind::Decimal, - elements: vec![ - Value::Decimal { value: dec!("20") }, - Value::Decimal { value: dec!("100") }, - Value::Decimal { - value: dec!("192.31"), - }, - Value::PreciseDecimal { - value: pdec!("192.31"), - }, - ], - }, - ], - }, - ], - }, - ], - }, - ], - }, - Err(Error::InvalidType { - expected_types: vec![ValueKind::Decimal], - actual_type: ValueKind::PreciseDecimal - }) - ), - ]; - - pub static ref VALUE_KIND_TEST_VECTORS: Vec = vec![ - // ================ - // Primitive Types - // ================ - - // Unit and Boolean - ValueKindTestVector::new( - Value::Unit, - ValueKind::Unit, - AstValueKind::Unit - ), - ValueKindTestVector::new( - Value::Bool { value: true }, - ValueKind::Bool, - AstValueKind::Bool, - ), - ValueKindTestVector::new( - Value::Bool { value: false }, - ValueKind::Bool, - AstValueKind::Bool, - ), - // Unsigned Integers - ValueKindTestVector::new( - Value::U8 { value: 19 }, - ValueKind::U8, - AstValueKind::U8, - ), - ValueKindTestVector::new( - Value::U16 { value: 19 }, - ValueKind::U16, - AstValueKind::U16, - ), - ValueKindTestVector::new( - Value::U32 { value: 19 }, - ValueKind::U32, - AstValueKind::U32, - ), - ValueKindTestVector::new( - Value::U64 { value: 19 }, - ValueKind::U64, - AstValueKind::U64, - ), - ValueKindTestVector::new( - Value::U128 { value: 19 }, - ValueKind::U128, - AstValueKind::U128, - ), - // Signed Integers - ValueKindTestVector::new( - Value::I8 { value: 19 }, - ValueKind::I8, - AstValueKind::I8, - ), - ValueKindTestVector::new( - Value::I16 { value: 19 }, - ValueKind::I16, - AstValueKind::I16, - ), - ValueKindTestVector::new( - Value::I32 { value: 19 }, - ValueKind::I32, - AstValueKind::I32, - ), - ValueKindTestVector::new( - Value::I64 { value: 19 }, - ValueKind::I64, - AstValueKind::I64, - ), - ValueKindTestVector::new( - Value::I128 { value: 19 }, - ValueKind::I128, - AstValueKind::I128, - ), - // String - ValueKindTestVector::new( - Value::String { - value: "P2P Cash System".into(), - }, - ValueKind::String, - AstValueKind::String, - ), - // Enums and Enum Aliases (Option & Result) - ValueKindTestVector::new( - Value::Enum { - variant: "Create".into(), - fields: Some(vec![Value::String { - value: "Component".into(), - }]), - }, - ValueKind::Enum, - AstValueKind::Enum, - ), - ValueKindTestVector::new( - Value::Option { - value: Box::new(Some(Value::String { - value: "Component".into(), - })), - }, - ValueKind::Option, - AstValueKind::Enum, - ), - ValueKindTestVector::new( - Value::Option { - value: Box::new(None), - }, - ValueKind::Option, - AstValueKind::Enum, - ), - ValueKindTestVector::new( - Value::Result { - value: Box::new(Ok(Value::String { - value: "Component".into(), - })), - }, - ValueKind::Result, - AstValueKind::Enum, - ), - ValueKindTestVector::new( - Value::Result { - value: Box::new(Err(Value::String { - value: "Component".into(), - })), - }, - ValueKind::Result, - AstValueKind::Enum, - ), - // ================= - // Collection Types - // ================= - ValueKindTestVector::new( - Value::Array { - element_type: ValueKind::String, - elements: vec![Value::String { - value: "World, Hello!".into(), - }], - }, - ValueKind::Array, - AstValueKind::Array, - ), - ValueKindTestVector::new( - Value::Tuple { - elements: vec![Value::I64 { value: 19 }, Value::I8 { value: 19 }], - }, - ValueKind::Tuple, - AstValueKind::Tuple, - ), - // ========================= - // Node Identifier Wrappers - // ========================= - ValueKindTestVector::new( - Value::KeyValueStore { - identifier: - "000000000000000000000000000000000000000000000000000000000000000000000005" - .parse() - .unwrap(), - }, - ValueKind::KeyValueStore, - AstValueKind::KeyValueStore, - ), - ValueKindTestVector::new( - Value::Component { - identifier: - "000000000000000000000000000000000000000000000000000000000000000000000005" - .parse() - .unwrap(), - }, - ValueKind::Component, - AstValueKind::Component, - ), - ValueKindTestVector::new( - Value::Vault { - identifier: - "000000000000000000000000000000000000000000000000000000000000000000000005" - .parse() - .unwrap(), - }, - ValueKind::Vault, - AstValueKind::Vault, - ), - // ============================ - // Decimal And Precise Decimal - // ============================ - ValueKindTestVector::new( - Value::Decimal { - value: "1923319912.102221313".parse().unwrap(), - }, - ValueKind::Decimal, - AstValueKind::Decimal, - ), - ValueKindTestVector::new( - Value::PreciseDecimal { - value: "1923319912.102221313".parse().unwrap(), - }, - ValueKind::PreciseDecimal, - AstValueKind::PreciseDecimal, - ), - // ============== - // Address Types - // ============== - ValueKindTestVector::new( - Value::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id: 0xf2, - address: scrypto::prelude::ComponentAddress::Normal([0; 26]), - }, - }, - ValueKind::ComponentAddress, - AstValueKind::ComponentAddress, - ), - ValueKindTestVector::new( - Value::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id: 0xf2, - address: scrypto::prelude::ComponentAddress::Account([0; 26]), - }, - }, - ValueKind::ComponentAddress, - AstValueKind::ComponentAddress, - ), - ValueKindTestVector::new( - Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - }, - ValueKind::ResourceAddress, - AstValueKind::ResourceAddress, - ), - ValueKindTestVector::new( - Value::PackageAddress { - address: NetworkAwarePackageAddress { - network_id: 0xf2, - address: scrypto::prelude::PackageAddress::Normal([0; 26]), - }, - }, - ValueKind::PackageAddress, - AstValueKind::PackageAddress, - ), - ValueKindTestVector::new( - Value::SystemAddress { - address: NetworkAwareSystemAddress { - network_id: 0xf2, - address: scrypto::prelude::SystemAddress::EpochManager([0; 26]), - }, - }, - ValueKind::SystemAddress, - AstValueKind::SystemAddress, - ), - ValueKindTestVector::new( - Value::SystemAddress { - address: NetworkAwareSystemAddress { - network_id: 0xf2, - address: scrypto::prelude::SystemAddress::Clock([0; 26]), - }, - }, - ValueKind::SystemAddress, - AstValueKind::SystemAddress, - ), - // ============== - // Cryptographic - // ============== - ValueKindTestVector::new( - Value::Hash { value: "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824".parse().unwrap() }, - ValueKind::Hash, - AstValueKind::Hash, - ), - ValueKindTestVector::new( - Value::EcdsaSecp256k1PublicKey { public_key: "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798".parse().unwrap() }, - ValueKind::EcdsaSecp256k1PublicKey, - AstValueKind::EcdsaSecp256k1PublicKey, - ), - ValueKindTestVector::new( - Value::EddsaEd25519PublicKey { public_key: "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29".parse().unwrap() }, - ValueKind::EddsaEd25519PublicKey, - AstValueKind::EddsaEd25519PublicKey, - ), - ValueKindTestVector::new( - Value::EcdsaSecp256k1Signature { signature: "0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e".parse().unwrap() }, - ValueKind::EcdsaSecp256k1Signature, - AstValueKind::EcdsaSecp256k1Signature, - ), - ValueKindTestVector::new( - Value::EddsaEd25519Signature { signature: "ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09".parse().unwrap() }, - ValueKind::EddsaEd25519Signature, - AstValueKind::EddsaEd25519Signature, - ), - - // =================== - // Buckets and Proofs - // =================== - ValueKindTestVector::new( - Value::Bucket { identifier: BucketId(Identifier::String("xrd_bucket".into())) }, - ValueKind::Bucket, - AstValueKind::Bucket - ), - ValueKindTestVector::new( - Value::Bucket { identifier: BucketId(Identifier::U32(28)) }, - ValueKind::Bucket, - AstValueKind::Bucket - ), - ValueKindTestVector::new( - Value::Proof { identifier: ProofId(Identifier::String("xrd_proof".into())) }, - ValueKind::Proof, - AstValueKind::Proof - ), - ValueKindTestVector::new( - Value::Proof { identifier: ProofId(Identifier::U32(28)) }, - ValueKind::Proof, - AstValueKind::Proof - ), - - // ========================== - // Non Fungible Id & Address - // ========================== - - ValueKindTestVector::new( - Value::NonFungibleId { value: NonFungibleId::U32(1144418947) }, - ValueKind::NonFungibleId, - AstValueKind::NonFungibleId, - ), - ValueKindTestVector::new( - Value::NonFungibleId { value: NonFungibleId::U64(114441894733333) }, - ValueKind::NonFungibleId, - AstValueKind::NonFungibleId, - ), - ValueKindTestVector::new( - Value::NonFungibleId { value: NonFungibleId::UUID(11444189334733333) }, - ValueKind::NonFungibleId, - AstValueKind::NonFungibleId, - ), - ValueKindTestVector::new( - Value::NonFungibleId { value: NonFungibleId::String("hello_world".into()) }, - ValueKind::NonFungibleId, - AstValueKind::NonFungibleId, - ), - ValueKindTestVector::new( - Value::NonFungibleId { value: NonFungibleId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) }, - ValueKind::NonFungibleId, - AstValueKind::NonFungibleId, - ), - - ValueKindTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::U32(1144418947) - } - }, - ValueKind::NonFungibleAddress, - AstValueKind::NonFungibleAddress, - ), - ValueKindTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::U64(114441894733333) - } - }, - ValueKind::NonFungibleAddress, - AstValueKind::NonFungibleAddress, - ), - ValueKindTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::UUID(11444189334733333) - } - }, - ValueKind::NonFungibleAddress, - AstValueKind::NonFungibleAddress, - ), - ValueKindTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::String("hello_world".into()) - } - }, - ValueKind::NonFungibleAddress, - AstValueKind::NonFungibleAddress, - ), - ValueKindTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit_core::model::NonFungibleAddress { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_id: NonFungibleId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) - } - }, - ValueKind::NonFungibleAddress, - AstValueKind::NonFungibleAddress, - ), - - // ================= - // Other Misc Types - // ================= - ValueKindTestVector::new( - Value::Blob { hash: Blob("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824".parse().unwrap()) }, - ValueKind::Blob, - AstValueKind::Blob - ), - ValueKindTestVector::new( - Value::Expression { value: Expression::entire_auth_zone() }, - ValueKind::Expression, - AstValueKind::Expression - ), - ValueKindTestVector::new( - Value::Expression { value: Expression::entire_worktop() }, - ValueKind::Expression, - AstValueKind::Expression - ), - ValueKindTestVector::new( - Value::Bytes { value: vec![0x12, 0x19, 0x12, 0x20, 0x8] }, - ValueKind::Bytes, - AstValueKind::Bytes - ), - ]; -} diff --git a/radix-engine-toolkit-core/tests/value.rs b/radix-engine-toolkit-core/tests/value.rs deleted file mode 100644 index c9a91c59..00000000 --- a/radix-engine-toolkit-core/tests/value.rs +++ /dev/null @@ -1,329 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 - -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -mod test_vector; - -use radix_engine_toolkit_core::{ - model::{Bech32Coder, Identifier, Value}, - traits::ValidateWithContext, -}; -use scrypto::prelude::*; -pub use test_vector::*; - -#[test] -fn serialized_values_match_expected() { - // Checking that the serialization of values matches - for test_vector in VALUE_JSON_CONVERSION_TEST_VECTORS.iter() { - // Act - let expected_serialized_value: serde_json::Value = - serde_json::from_str(&test_vector.json_representation) - .expect("Failed to deserialize trusted value"); - let serialized_value = - serde_json::to_value(&test_vector.value).expect("Failed to serialize trusted value"); - - // Assert - assert_eq!(expected_serialized_value, serialized_value); - } -} - -#[test] -fn deserialized_values_match_expected() { - // Checking that the deserialization of values matches - for test_vector in VALUE_JSON_CONVERSION_TEST_VECTORS.iter() { - // Act - let expected_value = &test_vector.value; - let deserialized_value = serde_json::from_str(&test_vector.json_representation) - .expect("Deserialization failed!"); - - // Assert - assert_eq!(*expected_value, deserialized_value) - } -} - -/// # Background -/// -/// There are methods on the [Value] model to convert a [Value] to a -/// [radix_transaction::manifest::ast::Value]. This conversion requires some domain-specific -/// knowledge as to what the abstract syntax tree looks like. -/// -/// As an example for a `ResourceAddress("some_address")` in the manifest we know that this is an -/// `AstValue::ResourceAddress` with a `AstValue::String` inside of it. Because of the -/// domain-knowledge requirement for this conversion, the transaction compiler could have a change -/// made to it which changes the expected structure of the AST. There would likely be no -/// compile-time errors as the AST uses an unstructured value model. -/// -/// # Purpose -/// -/// The purpose of this test is to check that the conversion of a [Value] to a -/// [radix_transaction::manifest::ast::Value] matches the abstract syntax tree that is generated by -/// the transaction compiler for an equivalent manifest string value. -#[test] -fn value_ast_conversions_match_that_produced_by_transaction_compiler() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest - for test_vector in VALUE_AST_CONVERSIONS_TEST_VECTORS.iter() { - let expected_ast_value = test_vector.manifest_representation_as_ast_value(); - - // Act - let ast_value = test_vector - .value - .to_ast_value(&bech32_coder) - .expect("Value -> AstValue conversion of trusted value failed"); - - // Assert - assert_eq!(expected_ast_value, ast_value) - } -} - -#[test] -fn value_scrypto_value_conversion_match_that_produced_by_transaction_compiler() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - for test_vector in VALUE_AST_CONVERSIONS_TEST_VECTORS.iter() { - // This test will fail (as expected) for buckets and proofs with string identifiers. So, - // we skip those tests - if let Value::Bucket { ref identifier } = test_vector.value { - if let Identifier::String(..) = identifier.0 { - continue; - } - } else if let Value::Proof { ref identifier } = test_vector.value { - if let Identifier::String(..) = identifier.0 { - continue; - } - } - - let expected_scrypto_value = - test_vector.manifest_representation_as_scrypto_value(&bech32_coder); - - // Act - let scrypto_value = test_vector - .value - .to_scrypto_value() - .expect("Failed to convert a trusted value to a scrypto value"); - - // Assert - assert_eq!(scrypto_value, expected_scrypto_value); - } -} - -#[test] -fn no_information_is_lost_when_converting_value_to_ast_value_and_back() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest - for test_vector in VALUE_AST_CONVERSIONS_TEST_VECTORS.iter() { - let expected_value = &test_vector.value; - - // Act - let ast_value = Value::from_ast_value( - &test_vector - .value - .to_ast_value(&bech32_coder) - .expect("Value -> AstValue conversion of trusted value failed"), - &bech32_coder, - ) - .expect("AstValue -> Value for a trusted value failed"); - - // Assert - assert_eq!(*expected_value, ast_value) - } -} - -#[test] -fn no_information_is_lost_when_converting_value_to_scrypto_value_and_back() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest - for test_vector in VALUE_AST_CONVERSIONS_TEST_VECTORS.iter() { - // This test will fail (as expected) for buckets and proofs with string identifiers. So, - // we skip those tests - if let Value::Bucket { ref identifier } = test_vector.value { - if let Identifier::String(..) = identifier.0 { - continue; - } - } else if let Value::Proof { ref identifier } = test_vector.value { - if let Identifier::String(..) = identifier.0 { - continue; - } - } else if let Value::Bytes { .. } = test_vector.value { - // TODO: Remove this. Currently we ignore this test because converting bytes to a - // Scrypto value yields an Array. Converting an Array back to Value yields a - // Array. So, converting back does not currently mean the same thing in manifest - // land, but means the same thing in SBOR land. - continue; - } - - let expected_value = &test_vector.value; - - // Act - let ast_value = Value::from_scrypto_value( - &test_vector - .value - .to_scrypto_value() - .expect("Value -> AstValue conversion of trusted value failed"), - bech32_coder.network_id(), - ); - - // Assert - assert_eq!(*expected_value, ast_value) - } -} - -#[test] -fn sbor_encoding_value_yields_expected_result() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest - for test_vector in VALUE_AST_CONVERSIONS_TEST_VECTORS.iter() { - // This test will fail (as expected) for buckets and proofs with string identifiers. So, - // we skip those tests - if let Value::Bucket { ref identifier } = test_vector.value { - if let Identifier::String(..) = identifier.0 { - continue; - } - } else if let Value::Proof { ref identifier } = test_vector.value { - if let Identifier::String(..) = identifier.0 { - continue; - } - } - - let expected_encoding = - scrypto_encode(&test_vector.manifest_representation_as_scrypto_value(&bech32_coder)) - .unwrap(); - - // Act - let encoded_value = test_vector.value.encode().unwrap(); - - // Assert - assert_eq!(*expected_encoding, encoded_value) - } -} - -#[test] -fn sbor_decoding_value_yields_expected_result() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest - for test_vector in VALUE_AST_CONVERSIONS_TEST_VECTORS.iter() { - // This test will fail (as expected) for buckets and proofs with string identifiers. So, - // we skip those tests - if let Value::Bucket { ref identifier } = test_vector.value { - if let Identifier::String(..) = identifier.0 { - continue; - } - } else if let Value::Proof { ref identifier } = test_vector.value { - if let Identifier::String(..) = identifier.0 { - continue; - } - } else if let Value::Bytes { .. } = test_vector.value { - // TODO: Remove this. Currently we ignore this test because converting bytes to a - // Scrypto value yields an Array. Converting an Array back to Value yields a - // Array. So, converting back does not currently mean the same thing in manifest - // land, but means the same thing in SBOR land. - continue; - } - - let expected_value = &test_vector.value; - let encoded_value = - scrypto_encode(&test_vector.manifest_representation_as_scrypto_value(&bech32_coder)) - .unwrap(); - - // Act - let value = - Value::decode(&encoded_value, 0xf2).expect("Failed to SBOR decode trusted value"); - - // Assert - assert_eq!(*expected_value, value) - } -} - -#[test] -fn validation_of_values_produces_expected_validation_response() { - // Arrange - let network_id = 0xf2; - - for test_vector in VALUE_VALIDATION_TEST_VECTORS.iter() { - let expected_validation_result = &test_vector.validation_result; - - // Act - let validation_result = test_vector - .value - .validate((network_id, Some(test_vector.value.kind()))); - - // Assert - assert_eq!(*expected_validation_result, validation_result); - } - - for test_vector in VALUE_JSON_CONVERSION_TEST_VECTORS.iter() { - // Act - let validation_result = test_vector - .value - .validate((network_id, Some(test_vector.value.kind()))); - - // Assert - assert_eq!(validation_result, Ok(())) - } -} - -#[test] -fn value_has_expected_value_kind() { - // Arrange - for test_vector in VALUE_KIND_TEST_VECTORS.iter() { - let expected_value_kind = test_vector.value_kind; - - // Act - let value_kind = test_vector.value.kind(); - - // Assert - assert_eq!(expected_value_kind, value_kind); - } -} - -#[test] -fn value_has_expected_ast_value_kind() { - // Arrange - for test_vector in VALUE_KIND_TEST_VECTORS.iter() { - let expected_value_kind = test_vector.ast_value_kind; - - // Act - let value_kind = test_vector.value.kind().into(); - - // Assert - assert_eq!(expected_value_kind, value_kind); - } -} - -#[test] -fn value_kind_to_ast_value_kind_is_converted_as_expected() { - // Arrange - for test_vector in VALUE_KIND_TEST_VECTORS.iter() { - let expected_value_kind = test_vector.ast_value_kind; - - // Act - let value_kind = test_vector.value_kind.into(); - - // Assert - assert_eq!(expected_value_kind, value_kind); - } -} diff --git a/radix-engine-toolkit-jni/Cargo.toml b/radix-engine-toolkit-jni/Cargo.toml deleted file mode 100644 index 23e7acd9..00000000 --- a/radix-engine-toolkit-jni/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -name = "radix-engine-toolkit-jni" -version = "0.7.0" -edition = "2021" - -[dependencies] -radix-engine-toolkit-core = { path = "../radix-engine-toolkit-core" } - -jni = { version = "0.20.0", default-features = false } -paste = { version = "1.0.9", default-features = false } - -serde = { version = "1.0.144", default-features = false, features = ["serde_derive"] } -serde_json = { version = "1.0.85", default-features = false, features = ["std"] } - -# This release profile is chosen after many different profiles were tested. The main objective of -# this profile is to optimize the builds for size. Some of the data on why this profile was chosen -# can be found here: -# https://docs.google.com/spreadsheets/d/1sNFGZPr84PKdzTQA8xsZxHWedff2qNxPjj8bmBusyLM. -[profile.release] -panic = 'abort' -codegen-units = 1 - -[lib] -name = "radix_engine_toolkit" -crate-type = ["cdylib"] diff --git a/radix-engine-toolkit-jni/cbindgen.toml b/radix-engine-toolkit-jni/cbindgen.toml deleted file mode 100644 index 9df3c0c2..00000000 --- a/radix-engine-toolkit-jni/cbindgen.toml +++ /dev/null @@ -1,10 +0,0 @@ -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-jni"] \ No newline at end of file diff --git a/radix-engine-toolkit-jni/src/lib.rs b/radix-engine-toolkit-jni/src/lib.rs deleted file mode 100644 index 064656f3..00000000 --- a/radix-engine-toolkit-jni/src/lib.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 radix_engine_toolkit_core::requests::*; -use radix_engine_toolkit_core::traits::Request; - -/// Exports a request with the following C function signature: -/// -/// ```C -/// char* function_name(char* request); -/// ``` -#[macro_export] -macro_rules! export_request { - ($request_type: ident as $export_ident: ident) => { - paste::paste!{ - /// This function exports a request function and builds a wrapper for it. - #[no_mangle] - pub extern "system" fn [< Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_ $export_ident >]( - env: jni::JNIEnv, - _class: jni::objects::JClass, - input: jni::objects::JString, - ) -> jni::sys::jstring { - // Load the Java String - let input: String = env.get_string(input) - .expect("Failed to load Java string!") - .into(); - - // Deserialize the request string for the request type - let request = serde_json::from_str(&input); - let request: $request_type = match request { - Ok(request) => request, - Err(error) => return $crate::serialize_to_jstring!{env, radix_engine_toolkit_core::error::Error::from(error)} - }; - - // Fulfilling the request and either getting back an error or a valid response - let response = request.fulfill_request(); - match response { - Ok(response) => $crate::serialize_to_jstring!{env, response}, - Err(error) => $crate::serialize_to_jstring!{env, error}, - } - } - } - }; -} - -#[macro_export] -macro_rules! serialize_to_jstring { - ($env: expr, $value: expr) => { - $env.new_string( - serde_json::to_string(&$value).expect("Unable to serialize a trusted payload"), - ) - .expect("Could not create a JString from a trusted payload") - .into_raw() - }; -} - -export_request!(InformationRequest as information); - -export_request!(ConvertManifestRequest as convertManifest); - -export_request!(CompileTransactionIntentRequest as compileTransactionIntent); -export_request!(CompileSignedTransactionIntentRequest as compileSignedTransactionIntent); -export_request!(CompileNotarizedTransactionIntentRequest as compileNotarizedTransactionIntent); - -export_request!(DecompileTransactionIntentRequest as decompileTransactionIntent); -export_request!(DecompileSignedTransactionIntentRequest as decompileSignedTransactionIntent); -export_request!(DecompileNotarizedTransactionIntentRequest as decompileNotarizedTransactionIntent); -export_request!(DecompileUnknownTransactionIntentRequest as decompileUnknownTransactionIntent); - -export_request!(DeriveVirtualAccountAddressRequest as deriveVirtualAccountAddress); - -export_request!(EncodeAddressRequest as encodeAddress); -export_request!(DecodeAddressRequest as decodeAddress); - -export_request!(SBOREncodeRequest as sborEncode); -export_request!(SBORDecodeRequest as sborDecode); - -export_request!(KnownEntityAddressesRequest as knownEntityAddresses); -export_request!(StaticallyValidateTransactionRequest as staticallyValidateTransaction); diff --git a/radix-engine-toolkit-native/Cargo.toml b/radix-engine-toolkit-native/Cargo.toml deleted file mode 100644 index 0a27fd2d..00000000 --- a/radix-engine-toolkit-native/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "radix-engine-toolkit-native" -version = "0.7.0" -edition = "2021" - -[dependencies] -radix-engine-toolkit-core = { path = "../radix-engine-toolkit-core" } - -# This release profile is chosen after many different profiles were tested. The main objective of -# this profile is to optimize the builds for size. Some of the data on why this profile was chosen -# can be found here: -# https://docs.google.com/spreadsheets/d/1sNFGZPr84PKdzTQA8xsZxHWedff2qNxPjj8bmBusyLM. -[profile.release] -panic = 'abort' -codegen-units = 1 - -[lib] -name = "radix_engine_toolkit" -crate-type = ["staticlib", "cdylib"] \ No newline at end of file diff --git a/radix-engine-toolkit-native/cbindgen.toml b/radix-engine-toolkit-native/cbindgen.toml deleted file mode 100644 index 544872bd..00000000 --- a/radix-engine-toolkit-native/cbindgen.toml +++ /dev/null @@ -1,10 +0,0 @@ -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-native"] \ No newline at end of file diff --git a/radix-engine-toolkit-native/src/lib.rs b/radix-engine-toolkit-native/src/lib.rs deleted file mode 100644 index 4814a374..00000000 --- a/radix-engine-toolkit-native/src/lib.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 radix_engine_toolkit_core::requests::*; -use radix_engine_toolkit_core::traits::Request; - -/// Exports a request with the following C function signature: -/// -/// ```C -/// char* function_name(char* request); -/// ``` -#[macro_export] -macro_rules! export_request { - ($request_type: ident as $export_ident: ident) => { - /// This function exports a request function and builds a wrapper for it. - /// - /// # Safety - /// - /// This function makes use of pointers which is an unsafe feature. - #[no_mangle] - pub unsafe extern "C" fn $export_ident(string_pointer: radix_engine_toolkit_core::memory::Pointer) -> radix_engine_toolkit_core::memory::Pointer { - // Loading the request from a string pointer into a request object - let request = $request_type::new_from_pointer(string_pointer); - let request = match request { - Ok(request) => request, - Err(error) => { - return radix_engine_toolkit_core::memory::toolkit_serialize_to_json_string_and_write_to_memory( - &error, - ) - .expect("Failed to write a trusted string to memory") - } - }; - - // Fulfilling the request and either getting back an error or a valid response - let response = request.fulfill_request(); - match response { - Ok(response) => { - radix_engine_toolkit_core::memory::toolkit_serialize_to_json_string_and_write_to_memory( - &response, - ) - .expect("Failed to write a trusted string to memory") - } - Err(error) => { - radix_engine_toolkit_core::memory::toolkit_serialize_to_json_string_and_write_to_memory(&error) - .expect("Failed to write a trusted string to memory") - } - } - } - }; -} - -export_request!(InformationRequest as information); - -export_request!(ConvertManifestRequest as convert_manifest); - -export_request!(CompileTransactionIntentRequest as compile_transaction_intent); -export_request!(CompileSignedTransactionIntentRequest as compile_signed_transaction_intent); -export_request!(CompileNotarizedTransactionIntentRequest as compile_notarized_transaction_intent); - -export_request!(DecompileTransactionIntentRequest as decompile_transaction_intent); -export_request!(DecompileSignedTransactionIntentRequest as decompile_signed_transaction_intent); -export_request!( - DecompileNotarizedTransactionIntentRequest as decompile_notarized_transaction_intent -); -export_request!(DecompileUnknownTransactionIntentRequest as decompile_unknown_transaction_intent); - -export_request!(DeriveVirtualAccountAddressRequest as derive_virtual_account_address); - -export_request!(EncodeAddressRequest as encode_address); -export_request!(DecodeAddressRequest as decode_address); - -export_request!(SBOREncodeRequest as sbor_encode); -export_request!(SBORDecodeRequest as sbor_decode); - -export_request!(KnownEntityAddressesRequest as known_entity_addresses); -export_request!(StaticallyValidateTransactionRequest as statically_validate_transaction); diff --git a/radix-engine-toolkit-wasm/Cargo.toml b/radix-engine-toolkit-wasm/Cargo.toml deleted file mode 100644 index 93eeaa34..00000000 --- a/radix-engine-toolkit-wasm/Cargo.toml +++ /dev/null @@ -1,30 +0,0 @@ -[package] -name = "radix-engine-toolkit-wasm" -version = "0.7.0" -edition = "2021" - -[dependencies] -radix-engine-toolkit-core = { path = "../radix-engine-toolkit-core" } - -[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" } - -# This release profile is chosen after many different profiles were tested. The main objective of -# this profile is to optimize the builds for size. Some of the data on why this profile was chosen -# can be found here: -# https://docs.google.com/spreadsheets/d/1sNFGZPr84PKdzTQA8xsZxHWedff2qNxPjj8bmBusyLM. -[profile.release] -incremental = false -strip = true -panic = 'abort' -codegen-units = 1 -lto = true -opt-level = 'z' - -[lib] -name = "radix_engine_toolkit" -crate-type = ["cdylib"] \ No newline at end of file diff --git a/radix-engine-toolkit-wasm/cbindgen.toml b/radix-engine-toolkit-wasm/cbindgen.toml deleted file mode 100644 index 8bdcf3d6..00000000 --- a/radix-engine-toolkit-wasm/cbindgen.toml +++ /dev/null @@ -1,10 +0,0 @@ -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-wasm"] \ No newline at end of file diff --git a/radix-engine-toolkit-wasm/src/lib.rs b/radix-engine-toolkit-wasm/src/lib.rs deleted file mode 100644 index 2b6799d2..00000000 --- a/radix-engine-toolkit-wasm/src/lib.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 radix_engine_toolkit_core::requests::*; -use radix_engine_toolkit_core::traits::Request; - -/// Exports a request with the following C function signature: -/// -/// ```C -/// char* function_name(char* request); -/// ``` -#[macro_export] -macro_rules! export_request { - ($request_type: ident as $export_ident: ident) => { - /// This function exports a request function and builds a wrapper for it. - /// - /// # Safety - /// - /// This function makes use of pointers which is an unsafe feature. - #[no_mangle] - pub unsafe extern "C" fn $export_ident( - string_pointer: radix_engine_toolkit_core::memory::Pointer, - ) -> radix_engine_toolkit_core::memory::Pointer { - // Loading the request from a string pointer into a request object - let request = $request_type::new_from_pointer(string_pointer); - let request = match request { - Ok(request) => request, - Err(error) => { - return radix_engine_toolkit_core::memory::toolkit_serialize_to_json_string_and_write_to_memory( - &error, - ) - .expect("Failed to write a trusted string to memory") - } - }; - - // Fulfilling the request and either getting back an error or a valid response - let response = request.fulfill_request(); - match response { - Ok(response) => { - radix_engine_toolkit_core::memory::toolkit_serialize_to_json_string_and_write_to_memory( - &response, - ) - .expect("Failed to write a trusted string to memory") - } - Err(error) => { - radix_engine_toolkit_core::memory::toolkit_serialize_to_json_string_and_write_to_memory(&error) - .expect("Failed to write a trusted string to memory") - } - } - } - }; -} - -export_request!(InformationRequest as information); - -export_request!(ConvertManifestRequest as convert_manifest); - -export_request!(CompileTransactionIntentRequest as compile_transaction_intent); -export_request!(CompileSignedTransactionIntentRequest as compile_signed_transaction_intent); -export_request!(CompileNotarizedTransactionIntentRequest as compile_notarized_transaction_intent); - -export_request!(DecompileTransactionIntentRequest as decompile_transaction_intent); -export_request!(DecompileSignedTransactionIntentRequest as decompile_signed_transaction_intent); -export_request!( - DecompileNotarizedTransactionIntentRequest as decompile_notarized_transaction_intent -); -export_request!(DecompileUnknownTransactionIntentRequest as decompile_unknown_transaction_intent); - -export_request!(DeriveVirtualAccountAddressRequest as derive_virtual_account_address); - -export_request!(EncodeAddressRequest as encode_address); -export_request!(DecodeAddressRequest as decode_address); - -export_request!(SBOREncodeRequest as sbor_encode); -export_request!(SBORDecodeRequest as sbor_decode); - -export_request!(KnownEntityAddressesRequest as known_entity_addresses); -export_request!(StaticallyValidateTransactionRequest as statically_validate_transaction); diff --git a/radix-engine-toolkit-wasm/tests/transaction_library.rs b/radix-engine-toolkit-wasm/tests/transaction_library.rs deleted file mode 100644 index 5ec1feec..00000000 --- a/radix-engine-toolkit-wasm/tests/transaction_library.rs +++ /dev/null @@ -1,571 +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_core::error::Error; -use radix_engine_toolkit_core::requests::*; - -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"]) - .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! {CompileNotarizedTransactionIntentRequest, CompileNotarizedTransactionIntentResponse, compile_notarized_transaction_intent} - crate::define_request_function! {DecompileNotarizedTransactionIntentRequest, DecompileNotarizedTransactionIntentResponse, decompile_notarized_transaction_intent} - 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} - crate::define_request_function! {KnownEntityAddressesRequest, KnownEntityAddressesResponse, known_entity_addresses} - crate::define_request_function! {StaticallyValidateTransactionRequest, StaticallyValidateTransactionResponse, statically_validate_transaction} - - /// 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::from(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_intent: TypedFunc, - - pub decompile_transaction_intent: TypedFunc, - pub decompile_signed_transaction_intent: TypedFunc, - pub decompile_notarized_transaction_intent: 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 known_entity_addresses: TypedFunc, - pub statically_validate_transaction: 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_core::requests::{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/spec/transaction-api-spec.yaml b/spec/transaction-api-spec.yaml deleted file mode 100644 index 4f4542b8..00000000 --- a/spec/transaction-api-spec.yaml +++ /dev/null @@ -1,2362 +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. - -openapi: 3.0.3 -info: - title: Radix Engine Toolkit - description: "A Rust library with multiple compilation targets that aims to make the creation and decompilation of transactions possible with clients written in any language." - version: 0.7.0 -servers: [] -paths: {} -components: - schemas: - # =================== - # Request & Response - # =================== - - # Information - InformationRequest: - type: object - description: "This object represents the request for information on the Radix Engine Toolkit." - additionalProperties: false - - InformationResponse: - type: object - description: "The response returned from an `InformationRequest`. This response contains the version of the Radix Engine Toolkit currently in use." - additionalProperties: false - required: - - package_version - properties: - package_version: - type: string - example: - package_version: "0.7.0" - - # Convert Manifest - ConvertManifestRequest: - type: object - description: "A request to take a transaction manifest and convert it from one format to another. Currently, this request allows for the conversion of a transaction manifest from and to String and JSON." - additionalProperties: false - required: - - transaction_version - - network_id - - manifest_instructions_output_format - - manifest - properties: - transaction_version: - description: "An 8-bit unsigned integer representing the transaction version. Currently, the library only supports a transaction version of 1." - $ref: "#/components/schemas/Byte" - network_id: - description: "An 8-bit unsigned integer representing the network id that the manifest is for" - $ref: "#/components/schemas/Byte" - manifest_instructions_output_format: - description: "The format that the manifest should be returned in. Currently, this could either be `JSON` or `String`." - $ref: "#/components/schemas/ManifestInstructionsKind" - manifest: - description: "The transaction manifest to convert to the format specified in `manifest_instructions_output_format`. This is a complete transaction manifest along side the blobs required." - $ref: "#/components/schemas/TransactionManifest" - example: - transaction_version: 0 - network_id: 0xF2 - manifest_instructions_output_format: "JSON" - manifest: - instructions: - type: "String" - value: "DROP_ALL_PROOFS;" - blobs: [] - - ConvertManifestResponse: - description: "The response returned from a `ConvertManifestRequest` containing the manifest after it has been converted to the type specified in the `manifest_instructions_output_format` field of the request." - $ref: "#/components/schemas/TransactionManifest" - - # Compile Transaction Intent - CompileTransactionIntentRequest: - description: "A request to compile a transaction intent to its SBOR-encoded representation" - $ref: "#/components/schemas/TransactionIntent" - - CompileTransactionIntentResponse: - type: object - description: "The response to the `CompileTransactionIntentRequest` containing the compiled transaction intent as a hex-encoded string" - additionalProperties: false - required: - - compiled_intent - properties: - compiled_intent: - type: string - description: "The hex-encoded string of the compiled transaction intent" - example: - compiled_intent: "10020000001009000000070107f20a00000000000000000a20000000000000000a00000000000000009121000000031c3796382de8e6e7a1aacb069221e43943af8be417d4c8c92dca7c4b07f9396901000900000000090000000010010000003011130000000a00000043616c6c4d6574686f6403000000811b00000003d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1200000077697468647261775f62795f616d6f756e7430074a0000001002000000a1200000000000f44482916345000000000000000000000000000000000000000000000000b61b0000000000000000000000000000000000000000000000000000000000041700000054616b6546726f6d576f726b746f704279416d6f756e7402000000a1200000000000c84e676dc11b000000000000000000000000000000000000000000000000b61b0000000000000000000000000000000000000000000000000000000000040a00000043616c6c4d6574686f6403000000811b0000000292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b0000006275795f67756d62616c6c30070e0000001001000000b104000000000200001d000000417373657274576f726b746f70436f6e7461696e734279416d6f756e7402000000a12000000000002cf61a24a229000000000000000000000000000000000000000000000000b61b00000000000000000000000000000000000000000000000000000000000415000000417373657274576f726b746f70436f6e7461696e7301000000b61b00000000aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510f00000054616b6546726f6d576f726b746f7001000000b61b0000000000000000000000000000000000000000000000000000000000041500000043726561746550726f6f6646726f6d4275636b65740100000009010200000a000000436c6f6e6550726f6f660100000009020200000900000044726f7050726f6f660100000009020200000900000044726f7050726f6f660100000009030200000a00000043616c6c4d6574686f6403000000811b00000003d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c160000006372656174655f70726f6f665f62795f616d6f756e7430074a0000001002000000a1200000000000f44482916345000000000000000000000000000000000000000000000000b61b0000000000000000000000000000000000000000000000000000000000040f000000506f7046726f6d417574685a6f6e65000000000900000044726f7050726f6f660100000009040200000f00000052657475726e546f576f726b746f700100000009010200001400000054616b6546726f6d576f726b746f7042794964730200000031b402000000050000000905000000050000000907000000b61b0000000000000000000000000000000000000000000000000000000000041a00000043616c6c4d6574686f6457697468416c6c5265736f757263657302000000811b00000003d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d0000006465706f7369745f62617463680d00000044726f70416c6c50726f6f6673000000000e0000005075626c6973685061636b616765010000003007d200000010020000003007c00000000061736d010000000405017001010105030100100619037f01418080c0000b7f00418080c0000b7f00418080c0000b072503066d656d6f727902000a5f5f646174615f656e6403010b5f5f686561705f6261736503020019046e616d65071201000f5f5f737461636b5f706f696e746572004d0970726f64756365727302086c616e6775616765010452757374000c70726f6365737365642d6279010572757374631d312e35392e30202839643162323130366520323032322d30322d323329320c10000000000a00000043616c6c4d6574686f6403000000811b0000000292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c12000000636f6d706c6963617465645f6d6574686f6430076f0000001002000000a120000000000064a7b3b6e00d000000000000000000000000000000000000000000000000a2400000000000000000000000023ed47ec9da71dcda2f4fb5e9f37fd2079e3000000000000000000000000000000000000000000000000000000000000000000000000000" - - # Decompile Transaction Intent - DecompileTransactionIntentRequest: - description: "A request to take the SBOR-encoded compiled transaction intent and decompile it into a format supported by the library (either `JSON` or `String`)" - allOf: - - $ref: "#/components/schemas/CompileTransactionIntentResponse" - - type: object - additionalProperties: false - required: - - manifest_instructions_output_format - properties: - manifest_instructions_output_format: - description: "The format that the manifest should be returned in. Currently, this could either be `JSON` or `String`." - $ref: "#/components/schemas/ManifestInstructionsKind" - example: - compiled_intent: "10020000001009000000070107f20a00000000000000000a20000000000000000a00000000000000009121000000031c3796382de8e6e7a1aacb069221e43943af8be417d4c8c92dca7c4b07f9396901000900000000090000000010010000003011130000000a00000043616c6c4d6574686f6403000000811b00000003d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1200000077697468647261775f62795f616d6f756e7430074a0000001002000000a1200000000000f44482916345000000000000000000000000000000000000000000000000b61b0000000000000000000000000000000000000000000000000000000000041700000054616b6546726f6d576f726b746f704279416d6f756e7402000000a1200000000000c84e676dc11b000000000000000000000000000000000000000000000000b61b0000000000000000000000000000000000000000000000000000000000040a00000043616c6c4d6574686f6403000000811b0000000292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b0000006275795f67756d62616c6c30070e0000001001000000b104000000000200001d000000417373657274576f726b746f70436f6e7461696e734279416d6f756e7402000000a12000000000002cf61a24a229000000000000000000000000000000000000000000000000b61b00000000000000000000000000000000000000000000000000000000000415000000417373657274576f726b746f70436f6e7461696e7301000000b61b00000000aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510f00000054616b6546726f6d576f726b746f7001000000b61b0000000000000000000000000000000000000000000000000000000000041500000043726561746550726f6f6646726f6d4275636b65740100000009010200000a000000436c6f6e6550726f6f660100000009020200000900000044726f7050726f6f660100000009020200000900000044726f7050726f6f660100000009030200000a00000043616c6c4d6574686f6403000000811b00000003d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c160000006372656174655f70726f6f665f62795f616d6f756e7430074a0000001002000000a1200000000000f44482916345000000000000000000000000000000000000000000000000b61b0000000000000000000000000000000000000000000000000000000000040f000000506f7046726f6d417574685a6f6e65000000000900000044726f7050726f6f660100000009040200000f00000052657475726e546f576f726b746f700100000009010200001400000054616b6546726f6d576f726b746f7042794964730200000031b402000000050000000905000000050000000907000000b61b0000000000000000000000000000000000000000000000000000000000041a00000043616c6c4d6574686f6457697468416c6c5265736f757263657302000000811b00000003d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d0000006465706f7369745f62617463680d00000044726f70416c6c50726f6f6673000000000e0000005075626c6973685061636b616765010000003007d200000010020000003007c00000000061736d010000000405017001010105030100100619037f01418080c0000b7f00418080c0000b7f00418080c0000b072503066d656d6f727902000a5f5f646174615f656e6403010b5f5f686561705f6261736503020019046e616d65071201000f5f5f737461636b5f706f696e746572004d0970726f64756365727302086c616e6775616765010452757374000c70726f6365737365642d6279010572757374631d312e35392e30202839643162323130366520323032322d30322d323329320c10000000000a00000043616c6c4d6574686f6403000000811b0000000292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c12000000636f6d706c6963617465645f6d6574686f6430076f0000001002000000a120000000000064a7b3b6e00d000000000000000000000000000000000000000000000000a2400000000000000000000000023ed47ec9da71dcda2f4fb5e9f37fd2079e3000000000000000000000000000000000000000000000000000000000000000000000000000" - manifest_instructions_output_format: "JSON" - - DecompileTransactionIntentResponse: - $ref: "#/components/schemas/TransactionIntent" - description: "The response to the `DecompileTransactionIntentRequest` containing the decompiled transaction intent" - - # Compile Signed Transaction Intent - CompileSignedTransactionIntentRequest: - $ref: "#/components/schemas/SignedTransactionIntent" - description: "A request to compile a signed transaction intent to its SBOR-encoded representation" - - CompileSignedTransactionIntentResponse: - type: object - description: "The response to the `CompileSignedTransactionIntentRequest` request containing the compiled signed transaction intent as a hex-encoded string" - additionalProperties: false - required: - - compiled_signed_intent - properties: - compiled_signed_intent: - type: string - description: "The hex-encoded string of the compiled signed transaction intent" - example: - compiled_signed_intent: "100200000010020000001009000000070107f20a00000000000000000a20000000000000000a00000000000000009121000000031c3796382de8e6e7a1aacb069221e43943af8be417d4c8c92dca7c4b07f9396901000900000000090000000010010000003011130000000a00000043616c6c4d6574686f6403000000811b00000003d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1200000077697468647261775f62795f616d6f756e7430074a0000001002000000a1200000000000f44482916345000000000000000000000000000000000000000000000000b61b0000000000000000000000000000000000000000000000000000000000041700000054616b6546726f6d576f726b746f704279416d6f756e7402000000a1200000000000c84e676dc11b000000000000000000000000000000000000000000000000b61b0000000000000000000000000000000000000000000000000000000000040a00000043616c6c4d6574686f6403000000811b0000000292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b0000006275795f67756d62616c6c30070e0000001001000000b104000000000200001d000000417373657274576f726b746f70436f6e7461696e734279416d6f756e7402000000a12000000000002cf61a24a229000000000000000000000000000000000000000000000000b61b00000000000000000000000000000000000000000000000000000000000415000000417373657274576f726b746f70436f6e7461696e7301000000b61b00000000aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510f00000054616b6546726f6d576f726b746f7001000000b61b0000000000000000000000000000000000000000000000000000000000041500000043726561746550726f6f6646726f6d4275636b65740100000009010200000a000000436c6f6e6550726f6f660100000009020200000900000044726f7050726f6f660100000009020200000900000044726f7050726f6f660100000009030200000a00000043616c6c4d6574686f6403000000811b00000003d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c160000006372656174655f70726f6f665f62795f616d6f756e7430074a0000001002000000a1200000000000f44482916345000000000000000000000000000000000000000000000000b61b0000000000000000000000000000000000000000000000000000000000040f000000506f7046726f6d417574685a6f6e65000000000900000044726f7050726f6f660100000009040200000f00000052657475726e546f576f726b746f700100000009010200001400000054616b6546726f6d576f726b746f7042794964730200000031b402000000050000000905000000050000000907000000b61b0000000000000000000000000000000000000000000000000000000000041a00000043616c6c4d6574686f6457697468416c6c5265736f757263657302000000811b00000003d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d0000006465706f7369745f62617463680d00000044726f70416c6c50726f6f6673000000000e0000005075626c6973685061636b616765010000003007d200000010020000003007c00000000061736d010000000405017001010105030100100619037f01418080c0000b7f00418080c0000b7f00418080c0000b072503066d656d6f727902000a5f5f646174615f656e6403010b5f5f686561705f6261736503020019046e616d65071201000f5f5f737461636b5f706f696e746572004d0970726f64756365727302086c616e6775616765010452757374000c70726f6365737365642d6279010572757374631d312e35392e30202839643162323130366520323032322d30322d323329320c10000000000a00000043616c6c4d6574686f6403000000811b0000000292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c12000000636f6d706c6963617465645f6d6574686f6430076f0000001002000000a120000000000064a7b3b6e00d000000000000000000000000000000000000000000000000a2400000000000000000000000023ed47ec9da71dcda2f4fb5e9f37fd2079e300000000000000000000000000000000000000000000000000000000000000000000000000030210400000002000000912100000002e6dc9dc1d1b418aab0a30089623f2dd4bab8f1ee9262a3ac0340cddb98b944379240000000437849b37df54d58e49b37e0004fb92a7133491efdc5332e7ace2d69f6f73df5636bb4f65943bdb59facd400dc06e2b1386a19327c8e85ea5e404ef502ef6fbb02000000912100000002b2bb8940c7acb5a221c4efab35b1c77afaddc611106ff4625e31d45cc17c42259240000000c215331bb6319fd26dee491824345375e9d8936cd69d6645c8e06222bcdae4b061305e640781b84b63cb23c719eb0edb43fd2e3df04b5990434cff44a02a85a402000000912100000003e0366ffa0c2db669c4a7b671109309a25eb1511350aa34bf22415bc03d57fc1292400000008c6b942f5ef8d81116120102fb4f22796c00a1aea556082d1af1d8529733e7124582b49c2bdc1545cb9d90bbdbedcf8185d16d6df5d76584cdf12688e07d919b0200000091210000000362d5d7de2ddb98e35ac84e59c4767e1d024a95f68893af469c361f74ea08fa499240000000ba40502e403bd49db22369a9b93cbd08bf9ab10b643b237cf9ee40bb931c12d927faad0c6a5ea6a334b1432b7047f5f8293f06fc37d229b560f50f71b84b9768" - - # Decompile Signed Transaction Intent - DecompileSignedTransactionIntentRequest: - description: "A request to take the SBOR-encoded compiled signed transaction intent and decompile it into a format supported by the library (either `JSON` or `String`)" - allOf: - - $ref: "#/components/schemas/CompileSignedTransactionIntentResponse" - - type: object - additionalProperties: false - required: - - manifest_instructions_output_format - properties: - manifest_instructions_output_format: - description: "The format that the manifest should be returned in. Currently, this could either be `JSON` or `String`." - $ref: "#/components/schemas/ManifestInstructionsKind" - - DecompileSignedTransactionIntentResponse: - $ref: "#/components/schemas/SignedTransactionIntent" - description: "The response to the `DecompileSignedTransactionIntentRequest` containing the decompiled signed transaction intent" - - # Compile Notarized Transaction Intent - CompileNotarizedTransactionRequest: - $ref: "#/components/schemas/NotarizedTransaction" - description: "A request to compile a notarized transaction intent to its SBOR-encoded representation" - - CompileNotarizedTransactionResponse: - type: object - description: "The response to the `CompileNotarizedTransactionRequest` request containing the compiled notarized transaction intent as a hex-encoded string" - additionalProperties: false - required: - - compiled_notarized_intent - properties: - compiled_notarized_intent: - type: string - - # Decompile Notarized Transaction Intent - DecompileNotarizedTransactionRequest: - description: "A request to take the SBOR-encoded compiled notarized transaction intent and decompile it into a format supported by the library (either `JSON` or `String`)" - allOf: - - $ref: "#/components/schemas/CompileNotarizedTransactionResponse" - - type: object - additionalProperties: false - required: - - manifest_instructions_output_format - properties: - manifest_instructions_output_format: - description: "The format that the manifest should be returned in. Currently, this could either be `JSON` or `String`." - $ref: "#/components/schemas/ManifestInstructionsKind" - - DecompileNotarizedTransactionResponse: - description: "The response to the `DecompileNotarizedTransactionRequest` containing the decompiled notarized transaction intent" - $ref: "#/components/schemas/NotarizedTransaction" - - # Decompile Unknown Transaction Intent - DecompileUnknownTransactionIntentRequest: - type: object - description: "A request to decompile a compiled transaction intent of an unknown format to " - additionalProperties: false - required: - - manifest_instructions_output_format - - compiled_unknown_intent - properties: - manifest_instructions_output_format: - description: "The format that the manifest should be returned in. Currently, this could either be `JSON` or `String`." - $ref: "#/components/schemas/ManifestInstructionsKind" - compiled_unknown_intent: - type: string - description: "The unknown transaction intent provided as a hex-encoded string" - - DecompileUnknownTransactionIntentResponse: - description: "The response to the `DecompileUnknownTransactionIntentRequest` containing the decompiled transaction intent" - anyOf: - - $ref: "#/components/schemas/DecompileTransactionIntentResponse" - - $ref: "#/components/schemas/DecompileSignedTransactionIntentResponse" - - $ref: "#/components/schemas/DecompileNotarizedTransactionResponse" - - # Address Encoding - EncodeAddressRequest: - type: object - description: "A request to encode an addresss in Bech32m according with the HRPs specified by the `network_id`" - additionalProperties: false - required: - - address_bytes - - network_id - properties: - address_bytes: - type: string - description: "A hex-encoded string of the raw bytes that make up the address" - network_id: - description: "An 8-bit unsigned integer representing the network id that the address is for" - $ref: "#/components/schemas/Byte" - example: - address: "01ce8be5eb98800c15e6942d27e373599c18a19e08a53378341d2a" - network_id: 1 - - EncodeAddressResponse: - $ref: "#/components/schemas/Address" - description: "The response to the `EncodeAddressRequest` containing the encoded address" - example: - type: "PackageAddress" - address: "package_rdx1q88ghe0tnzqqc90xjskj0cmntxwp3gv7pzjnx7p5r54q5e29qu" - - # Address Decoding - DecodeAddressRequest: - type: object - description: "A request to decode a Bech32m-encoded address into its hrp, data, and entity type" - additionalProperties: false - required: - - address - properties: - address: - type: string - description: "The bech32m-encoded address string to decode" - - DecodeAddressResponse: - type: object - description: "The response to the `DecodeAddressRequest` containing the deocded address" - additionalProperties: false - required: - - network_id - - network_name - - entity_type - - data - - hrp - - address - properties: - network_id: - $ref: "#/components/schemas/Byte" - description: "An 8-bit unsigned integer representing the network id that the address is for" - network_name: - type: string - description: "The logical name of the network that this address is for" - entity_type: - $ref: "#/components/schemas/AddressKind" - description: "The type of entity addressed through this address type" - data: - type: string - description: "The hex-encoded data which was in the bech32m-encoded address" - hrp: - type: string - description: "The HRP (human readable part) of the bech32m-encoded address" - address: - $ref: "#/components/schemas/Address" - description: "The `Value` representation of this address" - - # SBOR Encoding - SBOREncodeRequest: - $ref: "#/components/schemas/Value" - description: "A request to encode a `Value` in SBOR and return the hex-encoded representation of the SBOR-encoded `Value`" - - SBOREncodeResponse: - type: object - description: "The response to the `SBOREncodeRequest` containing the hex-encoded representation of the SBOR-encoded `Value`" - additionalProperties: false - required: - - encoded_value - properties: - encoded_value: - type: string - description: "The hex-encoded representation of the SBOR-encoded `Value`" - - # SBOR Decoding - SBORDecodeRequest: - type: object - description: "A request to decode a hex-encoded representation of some SBOR-encoded bytes" - additionalProperties: false - required: - - encoded_value - - network_id - properties: - encoded_value: - type: string - description: "The hex-encoded representation of the SBOR-encoded `Value`" - network_id: - $ref: "#/components/schemas/Byte" - description: "The network id that this value is thought to be associated with. This is only relevant in the case of addresses and their bech32m encoding, aside from that, the network id is not used." - - SBORDecodeResponse: - $ref: "#/components/schemas/Value" - description: "A response to the `SBORDecodeRequest` containing the decoded value" - - # Derive NonFungibleAddress request - DeriveNonFungibleAddressRequest: - type: object - description: "A request to derive the `NonFungibleAddress` of a resource based on its `ResourceAddress` and the `NonFungibleId` of that non-fungible token" - additionalProperties: false - required: - - resource_address - - non_fungible_id - properties: - resource_address: - description: "A bech32m encoded string of the resource address that the non-fungible belongs to" - $ref: "#/components/schemas/ValueResourceAddress" - non_fungible_id: - description: "A hex-encoded string of the SBOR-encoded NonFungibleId bytes" - $ref: "#/components/schemas/NonFungibleId" - - DeriveNonFungibleAddressResponse: - type: object - description: "A response to the `DeriveNonFungibleAddressRequest` containing the derived `NonFungibleAddress`" - additionalProperties: false - required: - - non_fungible_address - properties: - non_fungible_address: - description: "A hex-encoded string of the `NonFungibleAddress`." - $ref: "#/components/schemas/ValueResourceAddress" - - # Derive NonFungibleAddress from PublicKey request - DeriveNonFungibleAddressFromPublicKeyRequest: - description: "A request to derive the `NonFungibleAddress` of the virtual badge corresponding with a given public key" - $ref: "#/components/schemas/PublicKey" - - DeriveNonFungibleAddressFromPublicKeyResponse: - type: object - description: "A response to the `DeriveNonFungibleAddressFromPublicKeyRequest` containing the derived `NonFungibleAddress`" - additionalProperties: false - required: - - non_fungible_address - properties: - non_fungible_address: - description: "A hex-encoded string of the `NonFungibleAddress`." - $ref: "#/components/schemas/ValueResourceAddress" - - # Derive NonFungibleAddress request - DeriveVirtualAccountAddressRequest: - type: object - description: "A request to derive the virtual account component address associated with a given public key" - additionalProperties: false - required: - - public_key - - network_id - properties: - network_id: - type: string - description: "An 8-bit unsigned integer representing the network id that the transaction is for" - public_key: - description: "The public key to derive the virtual account component address for" - $ref: "#/components/schemas/PublicKey" - - DeriveVirtualAccountAddressResponse: - type: object - description: "A response to the `DeriveVirtualAccountAddressRequest` containing the derived `ComponentAddress`" - additionalProperties: false - required: - - component_address - properties: - component_address: - $ref: "#/components/schemas/ValueComponentAddress" - description: "The virtual account component address associated with a given public key" - - # ================================ - # Request & Response Dependencies - # ================================ - - RENodeKind: - type: string - description: "An enum representing the type of the RENode." - enum: - - Bucket, - - Proof, - - - AuthZoneStack, - - Worktop, - - - Global, - - KeyValueStore, - - NonFungibleStore, - - Component, - - System, - - Vault, - - ResourceManager, - - Package, - - Clock, - - RENode: - oneOf: - - $ref: "#/components/schemas/ReNodeBucket" - - $ref: "#/components/schemas/ReNodeProof" - - - $ref: "#/components/schemas/ReNodeAuthZoneStack" - - $ref: "#/components/schemas/ReNodeWorktop" - - - $ref: "#/components/schemas/ReNodeGlobal" - - $ref: "#/components/schemas/ReNodeKeyValueStore" - - $ref: "#/components/schemas/ReNodeNonFungibleStore" - - $ref: "#/components/schemas/ReNodeComponent" - - $ref: "#/components/schemas/ReNodeSystem" - - $ref: "#/components/schemas/ReNodeVault" - - $ref: "#/components/schemas/ReNodeResourceManager" - - $ref: "#/components/schemas/ReNodePackage" - - $ref: "#/components/schemas/ReNodeClock" - discriminator: - propertyName: error - mapping: - Bucket: "#/components/schemas/ReNodeBucket" - Proof: "#/components/schemas/ReNodeProof" - AuthZoneStack: "#/components/schemas/ReNodeAuthZoneStack" - Worktop: "#/components/schemas/ReNodeWorktop" - Global: "#/components/schemas/ReNodeGlobal" - KeyValueStore: "#/components/schemas/ReNodeKeyValueStore" - NonFungibleStore: "#/components/schemas/ReNodeNonFungibleStore" - Component: "#/components/schemas/ReNodeComponent" - System: "#/components/schemas/ReNodeSystem" - Vault: "#/components/schemas/ReNodeVault" - ResourceManager: "#/components/schemas/ReNodeResourceManager" - Package: "#/components/schemas/ReNodePackage" - Clock: "#/components/schemas/ReNodeClock" - - ReNodeBucket: - type: object - required: - - type - - identifier - properties: - oneOf: - - additionalProperties: false - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - identifier: - type: string - description: "A string identifier used to provide user friendly names to buckets and proofs for easy identification" - - additionalProperties: false - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - identifier: - type: integer - description: "A 32-bit unsigned number used to identify buckets and proofs" - ReNodeProof: - type: object - required: - - type - - identifier - properties: - oneOf: - - additionalProperties: false - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - identifier: - type: string - description: "A string identifier used to provide user friendly names to buckets and proofs for easy identification" - - additionalProperties: false - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - identifier: - type: integer - description: "A 32-bit unsigned number used to identify buckets and proofs" - ReNodeAuthZoneStack: - type: object - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - identifier: - type: string - description: "A string of an unsigned 32-bit number of the identifier of the auth zone stack" - ReNodeWorktop: - type: object - required: - - type - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - ReNodeGlobal: - type: object - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - identifier: - type: string - description: "A string of an unsigned 32-bit number of the identifier of the auth zone stack" - - ReNodeKeyValueStore: - type: object - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - identifier: - $ref: "#/components/schemas/NodeId" - ReNodeNonFungibleStore: - type: object - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - identifier: - $ref: "#/components/schemas/NodeId" - ReNodeComponent: - type: object - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - identifier: - $ref: "#/components/schemas/NodeId" - ReNodeSystem: - type: object - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - identifier: - $ref: "#/components/schemas/NodeId" - ReNodeVault: - type: object - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - identifier: - $ref: "#/components/schemas/NodeId" - ReNodeResourceManager: - type: object - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - identifier: - $ref: "#/components/schemas/NodeId" - ReNodePackage: - type: object - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - identifier: - $ref: "#/components/schemas/NodeId" - ReNodeClock: - type: object - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/RENodeKind" - readOnly: true - identifier: - $ref: "#/components/schemas/NodeId" - - NodeId: - type: string - description: A hex-encoded representation of the 36-byte long Node Id where the lower 32 bytes are the transaction hash and the remaining 4 bytes are the index of the substate. - maxLength: 72 - minLength: 72 - - AddressKind: - type: string - description: "An enum representing the type of the type of the entity being addressed" - enum: - - Resource - - Package - - SystemClock - - SystemEpochManager - - NormalComponent - - AccountComponent - - EcdsaSecp256k1VirtualAccount - - EddsaEd25519VirtualAccount - - AddressType: - type: string - enum: - - SystemAddress - - PackageAddress - - ResourceAddress - - ComponentAddress - - Address: - oneOf: - - $ref: "#/components/schemas/NonValueSystemAddress" - - $ref: "#/components/schemas/NonValuePackageAddress" - - $ref: "#/components/schemas/NonValueResourceAddress" - - $ref: "#/components/schemas/NonValueComponentAddress" - discriminator: - propertyName: type - mapping: - SystemAddress: "#/components/schemas/NonValueSystemAddress" - PackageAddress: "#/components/schemas/NonValuePackageAddress" - ResourceAddress: "#/components/schemas/NonValueResourceAddress" - ComponentAddress: "#/components/schemas/NonValueComponentAddress" - - NonValueComponentAddress: - type: object - description: "A Bech32m-encoded component address" - required: - - type - - address - properties: - type: - readOnly: true - $ref: "#/components/schemas/AddressType" - address: - type: string - NonValuePackageAddress: - type: object - description: "A Bech32m-encoded package address" - required: - - type - - address - properties: - type: - readOnly: true - $ref: "#/components/schemas/AddressType" - address: - type: string - NonValueResourceAddress: - type: object - description: "A Bech32m-encoded resource address" - required: - - type - - address - properties: - type: - readOnly: true - $ref: "#/components/schemas/AddressType" - address: - type: string - NonValueSystemAddress: - type: object - description: "A Bech32m-encoded system address" - required: - - type - - address - properties: - type: - readOnly: true - $ref: "#/components/schemas/AddressType" - address: - type: string - - TransactionHeader: - type: object - description: "A transaction header used to describe different parameters about the transactions" - additionalProperties: false - required: - - version - - network_id - - start_epoch_inclusive - - end_epoch_exclusive - - nonce - - notary_public_key - - notary_as_signatory - - cost_unit_limit - - tip_percentage - properties: - version: - type: string - description: "An 8-bit unsigned integer representing the transaction version. Currently, the library only supports a transaction version of 1." - network_id: - type: string - description: "An 8-bit unsigned integer representing the network id that the transaction is for" - start_epoch_inclusive: - type: string - minimum: 0x00 - maximum: 0xFFFFFFFFFFFFFFFF - description: "A 64-bit unsigned integer representing the epoch the earliest that this transaction can be executed" - end_epoch_exclusive: - type: string - minimum: 0x00 - maximum: 0xFFFFFFFFFFFFFFFF - description: "A 64-bit unsigned integer representing the latest epoch this transaction should be executed" - nonce: - type: string - minimum: 0x00 - maximum: 0xFFFFFFFFFFFFFFFF - description: "A 64-bit unsigned integer of the nonce to use for the transaction" - notary_public_key: - $ref: "#/components/schemas/PublicKey" - description: "The public key of the notary" - notary_as_signatory: - type: boolean - description: "A boolean representing whether the notary is also one of the people signing the transaction" - cost_unit_limit: - type: string - minimum: 0x00 - maximum: 0xFFFFFFFF - description: "A 32-bit unsigned integer of the maximum cost units that this transaction can spend" - tip_percentage: - type: string - minimum: 0x00 - maximum: 0xFF - description: "An 8-bit unsigned integer of the percentage of the tip to give to validators" - - TransactionManifest: - type: object - description: "A transaction manifest which describes what happens in a transaction" - additionalProperties: false - required: - - instructions - - blobs - properties: - instructions: - $ref: "#/components/schemas/ManifestInstructions" - description: "The instructions to execute in this transaction" - blobs: - type: array - description: "An array of the blobs to use for the transaction" - items: - type: string - - ManifestInstructionsKind: - type: string - enum: - - String - - JSON - - ManifestInstructions: - description: "A union type which represents the manifest instructions either as a String or as JSON" - oneOf: - - $ref: "#/components/schemas/ManifestInstructionsString" - - $ref: "#/components/schemas/ManifestInstructionsJson" - discriminator: - propertyName: type - mapping: - String: "#/components/schemas/ManifestInstructionsString" - JSON: "#/components/schemas/ManifestInstructionsJson" - - ManifestInstructionsString: - type: object - description: "A string representation of the instructions of the transaction" - required: - - type - - value - properties: - type: - readOnly: true - $ref: "#/components/schemas/ManifestInstructionsKind" - value: - type: string - description: "A string representation of the instructions of the transaction" - - ManifestInstructionsJson: - type: object - description: "A JSON representation of the instructions of the transaction" - required: - - type - - value - properties: - type: - readOnly: true - $ref: "#/components/schemas/ManifestInstructionsKind" - value: - type: array - description: "A JSON representation of the instructions of the transaction" - items: - $ref: "#/components/schemas/Instruction" - - TransactionIntent: - type: object - description: "A transaction intent of what the transaction it meant to do as well as the header parameters" - additionalProperties: false - required: - - header - - manifest - properties: - header: - $ref: "#/components/schemas/TransactionHeader" - description: "A transaction header used to describe different parameters about the transactions" - manifest: - $ref: "#/components/schemas/TransactionManifest" - description: "A transaction manifest describing the instructions of a transaction" - - SignedTransactionIntent: - type: object - description: "A transaction intent which has been signed" - additionalProperties: false - required: - - intent - - intent_signatures - properties: - intent: - $ref: "#/components/schemas/TransactionIntent" - description: "A transaction header used to describe different parameters about the transactions" - intent_signatures: - type: array - description: "An array containing the signature of the signers" - items: - $ref: "#/components/schemas/SignatureWithPublicKey" - - NotarizedTransaction: - type: object - additionalProperties: false - required: - - signed_intent - - notary_signature - properties: - signed_intent: - $ref: "#/components/schemas/SignedTransactionIntent" - notary_signature: - $ref: "#/components/schemas/Signature" - description: "The signature of the notary" - - Byte: - type: integer - minimum: 0x00 - maximum: 0xFF - description: An 8-bit unsigned number. - - # ======= - # Crypto - # ======= - - Curve: - type: string - enum: - - EcdsaSecp256k1 - - EddsaEd25519 - - SignatureWithPublicKey: - description: "Represents a public key of any of the supported curves" - oneOf: - - $ref: "#/components/schemas/EcdsaSecp256k1SignatureWithPublicKey" - - $ref: "#/components/schemas/EddsaEd25519SignatureWithPublicKey" - discriminator: - propertyName: type - mapping: - EcdsaSecp256k1: "#/components/schemas/EcdsaSecp256k1SignatureWithPublicKey" - EddsaEd25519: "#/components/schemas/EddsaEd25519SignatureWithPublicKey" - - EcdsaSecp256k1SignatureWithPublicKey: - type: object - description: "An object representing an ECDSA Secp256k1 public key and signature" - additionalProperties: false - required: - - type - - signature - properties: - type: - $ref: "#/components/schemas/Curve" - readOnly: true - signature: - $ref: "#/components/schemas/EcdsaSecp256k1SignatureString" - - EddsaEd25519SignatureWithPublicKey: - type: object - description: "An object representing an EdDSA Ed25519 public key and signature" - additionalProperties: false - required: - - type - - public_key - - signature - properties: - type: - $ref: "#/components/schemas/Curve" - readOnly: true - public_key: - $ref: "#/components/schemas/EddsaEd25519PublicKeyString" - signature: - $ref: "#/components/schemas/EddsaEd25519SignatureString" - - PublicKey: - description: "An object representing an ECDSA or EdDSA public key" - oneOf: - - $ref: "#/components/schemas/EcdsaSecp256k1PublicKey" - - $ref: "#/components/schemas/EddsaEd25519PublicKey" - discriminator: - propertyName: type - mapping: - EcdsaSecp256k1: "#/components/schemas/EcdsaSecp256k1PublicKey" - EddsaEd25519: "#/components/schemas/EddsaEd25519PublicKey" - - EcdsaSecp256k1PublicKey: - type: object - additionalProperties: false - required: - - type - - public_key - properties: - type: - $ref: "#/components/schemas/Curve" - readOnly: true - public_key: - $ref: "#/components/schemas/EcdsaSecp256k1PublicKeyString" - - EddsaEd25519PublicKey: - type: object - additionalProperties: false - required: - - type - - public_key - properties: - type: - $ref: "#/components/schemas/Curve" - readOnly: true - public_key: - $ref: "#/components/schemas/EddsaEd25519PublicKeyString" - - Signature: - description: "An object representing an ECDSA or EdDSA public key" - oneOf: - - $ref: "#/components/schemas/EcdsaSecp256k1Signature" - - $ref: "#/components/schemas/EddsaEd25519Signature" - discriminator: - propertyName: type - mapping: - EcdsaSecp256k1: "#/components/schemas/EcdsaSecp256k1Signature" - EddsaEd25519: "#/components/schemas/EddsaEd25519Signature" - - EcdsaSecp256k1Signature: - type: object - additionalProperties: false - required: - - type - - signature - properties: - type: - $ref: "#/components/schemas/Curve" - readOnly: true - signature: - $ref: "#/components/schemas/EcdsaSecp256k1SignatureString" - - EddsaEd25519Signature: - type: object - additionalProperties: false - required: - - type - - signature - properties: - type: - $ref: "#/components/schemas/Curve" - readOnly: true - signature: - $ref: "#/components/schemas/EddsaEd25519SignatureString" - - EcdsaSecp256k1PublicKeyString: - type: string - description: "The hex-encoded 33-byte long public key of an ECDSA Secp256k1 key-pair" - minLength: 66 - maxLength: 66 - - EcdsaSecp256k1SignatureString: - type: string - description: "The hex-encoded 65-byte long recovery id and signature of an ECDSA Secp256k1 key-pair" - minLength: 130 - maxLength: 130 - - EddsaEd25519PublicKeyString: - type: string - description: "The hex-encoded 32-byte long public key of an EdDSA Ed25519 key-pair" - minLength: 64 - maxLength: 64 - - EddsaEd25519SignatureString: - type: string - description: "The hex-encoded 64-byte long recovery id and signature of an EdDSA Ed25519 key-pair" - minLength: 128 - maxLength: 128 - - # ====== - # Value - # ====== - - ValueKind: - type: string - enum: - - Unit - - Bool - - I8 - - I16 - - I32 - - I64 - - I128 - - U8 - - U16 - - U32 - - U64 - - U128 - - String - - Enum - - Option - - Result - - Array - - Tuple - - Decimal - - PreciseDecimal - - Component - - SystemAddress - - PackageAddress - - ResourceAddress - - ComponentAddress - - Hash - - Bucket - - Proof - - Vault - - NonFungibleId - - NonFungibleAddress - - KeyValueStore - - EcdsaSecp256k1PublicKey - - EcdsaSecp256k1Signature - - EddsaEd25519PublicKey - - EddsaEd25519Signature - - Blob - - Expression - - Value: - oneOf: - - $ref: "#/components/schemas/U8" - - $ref: "#/components/schemas/U16" - - $ref: "#/components/schemas/U32" - - $ref: "#/components/schemas/U64" - - $ref: "#/components/schemas/U128" - - $ref: "#/components/schemas/I8" - - $ref: "#/components/schemas/I16" - - $ref: "#/components/schemas/I32" - - $ref: "#/components/schemas/I64" - - $ref: "#/components/schemas/I128" - - $ref: "#/components/schemas/String" - - $ref: "#/components/schemas/Enum" - - $ref: "#/components/schemas/Option" - - $ref: "#/components/schemas/Result" - - $ref: "#/components/schemas/Array" - - $ref: "#/components/schemas/Tuple" - - $ref: "#/components/schemas/Decimal" - - $ref: "#/components/schemas/PreciseDecimal" - - $ref: "#/components/schemas/Component" - - $ref: "#/components/schemas/ValueComponentAddress" - - $ref: "#/components/schemas/ValueResourceAddress" - - $ref: "#/components/schemas/ValuePackageAddress" - - $ref: "#/components/schemas/ValueSystemAddress" - - $ref: "#/components/schemas/Hash" - - $ref: "#/components/schemas/KeyValueStore" - - $ref: "#/components/schemas/Bucket" - - $ref: "#/components/schemas/Proof" - - $ref: "#/components/schemas/Vault" - - $ref: "#/components/schemas/NonFungibleId" - - $ref: "#/components/schemas/NonFungibleAddress" - - $ref: "#/components/schemas/EcdsaSecp256k1PublicKeyValue" - - $ref: "#/components/schemas/EcdsaSecp256k1SignatureValue" - - $ref: "#/components/schemas/EddsaEd25519PublicKeyValue" - - $ref: "#/components/schemas/EddsaEd25519SignatureValue" - - $ref: "#/components/schemas/Expression" - - $ref: "#/components/schemas/Blob" - discriminator: - propertyName: type - mapping: - U8: "#/components/schemas/U8" - U16: "#/components/schemas/U16" - U32: "#/components/schemas/U32" - U64: "#/components/schemas/U64" - U128: "#/components/schemas/U128" - I8: "#/components/schemas/I8" - I16: "#/components/schemas/I16" - I32: "#/components/schemas/I32" - I64: "#/components/schemas/I64" - I128: "#/components/schemas/I128" - String: "#/components/schemas/String" - Enum: "#/components/schemas/Enum" - Option: "#/components/schemas/Option" - Result: "#/components/schemas/Result" - Array: "#/components/schemas/Array" - Tuple: "#/components/schemas/Tuple" - Decimal: "#/components/schemas/Decimal" - PreciseDecimal: "#/components/schemas/PreciseDecimal" - Component: "#/components/schemas/Component" - ComponentAddress: "#/components/schemas/ValueComponentAddress" - ResourceAddress: "#/components/schemas/ValueResourceAddress" - PackageAddress: "#/components/schemas/ValuePackageAddress" - SystemAddress: "#/components/schemas/ValueSystemAddress" - Hash: "#/components/schemas/Hash" - KeyValueStore: "#/components/schemas/KeyValueStore" - Bucket: "#/components/schemas/Bucket" - Proof: "#/components/schemas/Proof" - Vault: "#/components/schemas/Vault" - NonFungibleId: "#/components/schemas/NonFungibleId" - NonFungibleAddress: "#/components/schemas/NonFungibleAddress" - EcdsaSecp256k1PublicKey: "#/components/schemas/EcdsaSecp256k1PublicKeyValue" - EcdsaSecp256k1Signature: "#/components/schemas/EcdsaSecp256k1SignatureValue" - EddsaEd25519PublicKey: "#/components/schemas/EddsaEd25519PublicKeyValue" - EddsaEd25519Signature: "#/components/schemas/EddsaEd25519SignatureValue" - Expression: "#/components/schemas/Expression" - Blob: "#/components/schemas/Blob" - U8: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - U16: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - U32: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - U64: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - U128: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - I8: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - I16: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - I32: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - I64: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - I128: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - String: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - Enum: - additionalProperties: false - required: - - type - - variant - - fields - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - variant: - type: string - fields: - type: array - nullable: true - items: - $ref: "#/components/schemas/Value" - Option: - description: "TODO: Need to add this." - Result: - description: "TODO: Need to add this." - Array: - additionalProperties: false - required: - - type - - element_type - - elements - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - element_type: - $ref: "#/components/schemas/ValueKind" - elements: - type: array - items: - $ref: "#/components/schemas/Value" - Tuple: - additionalProperties: false - required: - - type - - elements - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - elements: - type: array - items: - $ref: "#/components/schemas/Value" - Decimal: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - PreciseDecimal: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - Component: - additionalProperties: false - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - identifier: - $ref: "#/components/schemas/NodeId" - ValueComponentAddress: - additionalProperties: false - required: - - type - - address - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - address: - type: string - ValueSystemAddress: - additionalProperties: false - required: - - type - - address - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - address: - type: string - ValueResourceAddress: - additionalProperties: false - required: - - type - - address - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - address: - type: string - ValuePackageAddress: - additionalProperties: false - required: - - type - - address - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - address: - type: string - Hash: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - description: "A 32-byte long (64 character long) hash" - type: string - Bucket: - oneOf: - - additionalProperties: false - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - identifier: - type: string - description: "A string identifier used to provide user friendly names to buckets and proofs for easy identification" - - additionalProperties: false - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - identifier: - type: integer - description: "A 32-bit unsigned number used to identify buckets and proofs" - Proof: - oneOf: - - additionalProperties: false - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - identifier: - type: string - description: "A string identifier used to provide user friendly names to buckets and proofs for easy identification" - - additionalProperties: false - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - identifier: - type: integer - description: "A 32-bit unsigned number used to identify buckets and proofs" - Vault: - additionalProperties: false - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - identifier: - $ref: "#/components/schemas/NodeId" - NonFungibleId: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - description: "The hex-encoded bytes of the SBOR-encoded NonFungibleId" - NonFungibleAddress: - additionalProperties: false - required: - - type - - address - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - address: - type: string - description: "The hex-encoded bytes of the NonFungibleAddress" - KeyValueStore: - additionalProperties: false - required: - - type - - identifier - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - identifier: - $ref: "#/components/schemas/NodeId" - EcdsaSecp256k1PublicKeyValue: - additionalProperties: false - required: - - type - - public_key - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - public_key: - type: string - EcdsaSecp256k1SignatureValue: - additionalProperties: false - required: - - type - - signature - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - signature: - type: string - EddsaEd25519PublicKeyValue: - additionalProperties: false - required: - - type - - public_key - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - public_key: - type: string - EddsaEd25519SignatureValue: - additionalProperties: false - required: - - type - - signature - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - signature: - type: string - Blob: - additionalProperties: false - required: - - type - - hash - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - hash: - type: string - minLength: 64 - maxLength: 64 - description: A 32-byte long (64 characters long) hash of the blob - Expression: - additionalProperties: false - required: - - type - - value - properties: - type: - $ref: "#/components/schemas/ValueKind" - readOnly: true - value: - type: string - - # ============= - # Instructions - # ============= - - InstructionKind: - type: string - enum: - - CALL_FUNCTION - - CALL_METHOD - - TAKE_FROM_WORKTOP - - TAKE_FROM_WORKTOP_BY_AMOUNT - - TAKE_FROM_WORKTOP_BY_IDS - - ASSERT_WORKTOP_CONTAINS - - ASSERT_WORKTOP_CONTAINS_BY_AMOUNT - - ASSERT_WORKTOP_CONTAINS_BY_IDS - - POP_FROM_AUTH_ZONE - - PUSH_TO_AUTH_ZONE - - CLEAR_AUTH_ZONE - - CREATE_PROOF_FROM_AUTH_ZONE - - CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT - - CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS - - CREATE_PROOF_FROM_BUCKET - - CLONE_PROOF - - DROP_PROOF - - DROP_ALL_PROOF - - RETURN_TO_WORKTOP - - PUBLISH_PACKAGE - - Instruction: - oneOf: - - $ref: "#/components/schemas/CallFunction" - - $ref: "#/components/schemas/CallNativeFunction" - - $ref: "#/components/schemas/CallMethod" - - $ref: "#/components/schemas/CallNativeMethod" - - $ref: "#/components/schemas/TakeFromWorktop" - - $ref: "#/components/schemas/TakeFromWorktopByAmount" - - $ref: "#/components/schemas/TakeFromWorktopByIds" - - $ref: "#/components/schemas/AssertWorktopContains" - - $ref: "#/components/schemas/AssertWorktopContainsByAmount" - - $ref: "#/components/schemas/AssertWorktopContainsByIds" - - $ref: "#/components/schemas/PopFromAuthZone" - - $ref: "#/components/schemas/PushToAuthZone" - - $ref: "#/components/schemas/ClearAuthZone" - - $ref: "#/components/schemas/CreateProofFromAuthZone" - - $ref: "#/components/schemas/CreateProofFromAuthZoneByAmount" - - $ref: "#/components/schemas/CreateProofFromAuthZoneByIds" - - $ref: "#/components/schemas/CreateProofFromBucket" - - $ref: "#/components/schemas/CloneProof" - - $ref: "#/components/schemas/DropProof" - - $ref: "#/components/schemas/DropAllProofs" - - $ref: "#/components/schemas/ReturnToWorktop" - - $ref: "#/components/schemas/PublishPackage" - - $ref: "#/components/schemas/CreateResource" - - $ref: "#/components/schemas/BurnBucket" - - $ref: "#/components/schemas/MintFungible" - discriminator: - propertyName: instruction - mapping: - CALL_FUNCTION: "#/components/schemas/CallFunction" - CALL_NATIVE_FUNCTION: "#/components/schemas/CallNativeFunction" - CALL_METHOD: "#/components/schemas/CallMethod" - CALL_NATIVE_METHOD: "#/components/schemas/CallNativeMethod" - TAKE_FROM_WORKTOP: "#/components/schemas/TakeFromWorktop" - TAKE_FROM_WORKTOP_BY_AMOUNT: "#/components/schemas/TakeFromWorktopByAmount" - TAKE_FROM_WORKTOP_BY_IDS: "#/components/schemas/TakeFromWorktopByIds" - ASSERT_WORKTOP_CONTAINS: "#/components/schemas/AssertWorktopContains" - ASSERT_WORKTOP_CONTAINS_BY_AMOUNT: "#/components/schemas/AssertWorktopContainsByAmount" - ASSERT_WORKTOP_CONTAINS_BY_IDS: "#/components/schemas/AssertWorktopContainsByIds" - POP_FROM_AUTH_ZONE: "#/components/schemas/PopFromAuthZone" - PUSH_TO_AUTH_ZONE: "#/components/schemas/PushToAuthZone" - CLEAR_AUTH_ZONE: "#/components/schemas/ClearAuthZone" - CREATE_PROOF_FROM_AUTH_ZONE: "#/components/schemas/CreateProofFromAuthZone" - CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT: "#/components/schemas/CreateProofFromAuthZoneByAmount" - CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS: "#/components/schemas/CreateProofFromAuthZoneByIds" - CREATE_PROOF_FROM_BUCKET: "#/components/schemas/CreateProofFromBucket" - CLONE_PROOF: "#/components/schemas/CloneProof" - DROP_PROOF: "#/components/schemas/DropProof" - DROP_ALL_PROOF: "#/components/schemas/DropAllProofs" - RETURN_TO_WORKTOP: "#/components/schemas/ReturnToWorktop" - PUBLISH_PACKAGE: "#/components/schemas/PublishPackage" - CREATE_RESOURCE: "#/components/schemas/CreateResource" - - CallFunction: - additionalProperties: false - required: - - instruction - - package_address - - blueprint_name - - function_name - - arguments - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - package_address: - $ref: "#/components/schemas/ValuePackageAddress" - blueprint_name: - $ref: "#/components/schemas/String" - function_name: - $ref: "#/components/schemas/String" - arguments: - type: array - nullable: true - items: - $ref: "#/components/schemas/Value" - CallNativeFunction: - additionalProperties: false - required: - - instruction - - blueprint_name - - function_name - - arguments - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - blueprint_name: - $ref: "#/components/schemas/String" - function_name: - $ref: "#/components/schemas/String" - arguments: - type: array - nullable: true - items: - $ref: "#/components/schemas/Value" - CallMethod: - additionalProperties: false - required: - - instruction - - component_address - - method_name - - arguments - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - component_address: - readOnly: true - oneOf: - - $ref: "#/components/schemas/ValueComponentAddress" - - $ref: "#/components/schemas/Component" - method_name: - $ref: "#/components/schemas/String" - arguments: - type: array - nullable: true - items: - $ref: "#/components/schemas/Value" - CallNativeMethod: - additionalProperties: false - required: - - instruction - - receiver - - method_name - - arguments - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - receiver: - readOnly: true - $ref: "#/components/schemas/RENode" - method_name: - $ref: "#/components/schemas/String" - arguments: - type: array - nullable: true - items: - $ref: "#/components/schemas/Value" - TakeFromWorktop: - additionalProperties: false - required: - - instruction - - resource_address - - into_bucket - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - resource_address: - $ref: "#/components/schemas/ValueResourceAddress" - into_bucket: - $ref: "#/components/schemas/Bucket" - TakeFromWorktopByAmount: - additionalProperties: false - required: - - instruction - - resource_address - - into_bucket - - amount - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - resource_address: - $ref: "#/components/schemas/ValueResourceAddress" - amount: - $ref: "#/components/schemas/Decimal" - into_bucket: - $ref: "#/components/schemas/Bucket" - TakeFromWorktopByIds: - additionalProperties: false - required: - - instruction - - resource_address - - into_bucket - - ids - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - resource_address: - $ref: "#/components/schemas/ValueResourceAddress" - ids: - type: array - items: - $ref: "#/components/schemas/NonFungibleId" - into_bucket: - $ref: "#/components/schemas/Bucket" - ReturnToWorktop: - additionalProperties: false - required: - - instruction - - bucket - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - bucket: - $ref: "#/components/schemas/Bucket" - AssertWorktopContains: - additionalProperties: false - required: - - instruction - - resource_address - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - resource_address: - $ref: "#/components/schemas/ValueResourceAddress" - AssertWorktopContainsByAmount: - additionalProperties: false - required: - - instruction - - resource_address - - amount - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - resource_address: - $ref: "#/components/schemas/ValueResourceAddress" - amount: - $ref: "#/components/schemas/Decimal" - AssertWorktopContainsByIds: - additionalProperties: false - required: - - instruction - - resource_address - - ids - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - resource_address: - $ref: "#/components/schemas/ValueResourceAddress" - ids: - type: array - items: - $ref: "#/components/schemas/NonFungibleId" - PopFromAuthZone: - additionalProperties: false - required: - - instruction - - into_proof - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - into_proof: - $ref: "#/components/schemas/Proof" - PushToAuthZone: - additionalProperties: false - required: - - instruction - - proof - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - proof: - $ref: "#/components/schemas/Proof" - ClearAuthZone: - required: - - instruction - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - additionalProperties: false - CreateProofFromAuthZone: - additionalProperties: false - required: - - instruction - - resource_address - - into_proof - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - resource_address: - $ref: "#/components/schemas/ValueResourceAddress" - into_proof: - $ref: "#/components/schemas/Proof" - CreateProofFromAuthZoneByAmount: - additionalProperties: false - required: - - instruction - - resource_address - - into_proof - - amount - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - resource_address: - $ref: "#/components/schemas/ValueResourceAddress" - amount: - $ref: "#/components/schemas/Decimal" - into_proof: - $ref: "#/components/schemas/Proof" - CreateProofFromAuthZoneByIds: - additionalProperties: false - required: - - instruction - - resource_address - - into_proof - - ids - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - resource_address: - $ref: "#/components/schemas/ValueResourceAddress" - ids: - type: array - items: - $ref: "#/components/schemas/NonFungibleId" - into_proof: - $ref: "#/components/schemas/Proof" - CreateProofFromBucket: - additionalProperties: false - required: - - instruction - - bucket - - into_proof - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - bucket: - $ref: "#/components/schemas/Bucket" - into_proof: - $ref: "#/components/schemas/Proof" - CloneProof: - additionalProperties: false - required: - - instruction - - proof - - into_proof - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - proof: - $ref: "#/components/schemas/Proof" - into_proof: - $ref: "#/components/schemas/Proof" - DropProof: - additionalProperties: false - required: - - instruction - - proof - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - proof: - $ref: "#/components/schemas/Proof" - DropAllProofs: - required: - - instruction - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - additionalProperties: false - PublishPackage: - additionalProperties: false - required: - - instruction - - code - - abi - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - code: - $ref: "#/components/schemas/Blob" - abi: - $ref: "#/components/schemas/Blob" - CreateResource: - type: object - required: - - instruction - - resource_type - - metadata - - access_rules - - mint_params - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - resource_type: - $ref: "#/components/schemas/Value" - metadata: - $ref: "#/components/schemas/Value" - access_rules: - $ref: "#/components/schemas/Value" - mint_params: - $ref: "#/components/schemas/Value" - BurnBucket: - type: object - required: - - instruction - - bucket - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - bucket: - $ref: "#/components/schemas/Bucket" - MintFungible: - type: object - required: - - instruction - - resource_address - - amount - properties: - instruction: - $ref: "#/components/schemas/InstructionKind" - readOnly: true - resource_address: - $ref: "#/components/schemas/ValueResourceAddress" - amount: - $ref: "#/components/schemas/Decimal" - - # ====== - # Error - # ====== - - ErrorKind: - type: string - enum: - - AddressError - - UnrecognizedAddressFormat - - SborDecodeError - - SborEncodeError - - DeserializationError - - InvalidRequestString - - UnexpectedContents - - UnexpectedReNodeContents - - InvalidType - - UnknownTypeId - - ParseError - - TransactionCompileError - - TransactionDecompileError - - UnsupportedTransactionVersion - - GeneratorError - - RequestResponseConversionError - - UnrecognizedCompiledIntentFormat - - TransactionValidationError - - NetworkMismatchError - - ErrorResponse: - oneOf: - - $ref: "#/components/schemas/AddressError" - - $ref: "#/components/schemas/UnrecognizedAddressFormat" - - $ref: "#/components/schemas/SborDecodeError" - - $ref: "#/components/schemas/SborEncodeError" - - $ref: "#/components/schemas/DeserializationError" - - $ref: "#/components/schemas/InvalidRequestString" - - $ref: "#/components/schemas/UnexpectedContents" - - $ref: "#/components/schemas/UnexpectedReNodeContents" - - $ref: "#/components/schemas/InvalidType" - - $ref: "#/components/schemas/UnknownTypeId" - - $ref: "#/components/schemas/ParseError" - - $ref: "#/components/schemas/TransactionCompileError" - - $ref: "#/components/schemas/TransactionDecompileError" - - $ref: "#/components/schemas/UnsupportedTransactionVersion" - - $ref: "#/components/schemas/GeneratorError" - - $ref: "#/components/schemas/RequestResponseConversionError" - - $ref: "#/components/schemas/UnrecognizedCompiledIntentFormat" - - $ref: "#/components/schemas/TransactionValidationError" - - $ref: "#/components/schemas/NetworkMismatchError" - discriminator: - propertyName: error - mapping: - AddressError: "#/components/schemas/AddressError" - UnrecognizedAddressFormat: "#/components/schemas/UnrecognizedAddressFormat" - SborDecodeError: "#/components/schemas/SborDecodeError" - SborEncodeError: "#/components/schemas/SborEncodeError" - DeserializationError: "#/components/schemas/DeserializationError" - InvalidRequestString: "#/components/schemas/InvalidRequestString" - UnexpectedContents: "#/components/schemas/UnexpectedContents" - UnexpectedReNodeContents: "#/components/schemas/UnexpectedReNodeContents" - InvalidType: "#/components/schemas/InvalidType" - UnknownTypeId: "#/components/schemas/UnknownTypeId" - ParseError: "#/components/schemas/ParseError" - TransactionCompileError: "#/components/schemas/TransactionCompileError" - TransactionDecompileError: "#/components/schemas/TransactionDecompileError" - UnsupportedTransactionVersion: "#/components/schemas/UnsupportedTransactionVersion" - GeneratorError: "#/components/schemas/GeneratorError" - RequestResponseConversionError: "#/components/schemas/RequestResponseConversionError" - UnrecognizedCompiledIntentFormat: "#/components/schemas/UnrecognizedCompiledIntentFormat" - TransactionValidationError: "#/components/schemas/TransactionValidationError" - NetworkMismatchError: "#/components/schemas/NetworkMismatchError" - - AddressError: - type: object - description: "An error emitted if the encoding or decoding of Bech32 addresses fails." - required: - - error - - value - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - value: - type: string - UnrecognizedAddressFormat: - type: object - description: An error emitted when attempting to get information on an address but its format could not be established. Typically, this means that the entity byte is invalid or unknown. - required: - - error - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - SborDecodeError: - type: object - description: An error emitted when the decoding of SBOR fails. - required: - - error - - value - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - value: - type: string - SborEncodeError: - type: object - description: An error emitted when the decoding of SBOR fails. - required: - - error - - value - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - value: - type: string - DeserializationError: - type: object - description: An error emitted when deserialization of a JSON payload fails. - required: - - error - - value - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - value: - type: string - InvalidRequestString: - type: object - description: An error emitted when the contents of the request string pointer could not be loaded. - required: - - error - - value - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - value: - type: string - UnexpectedContents: - type: object - description: An error emitted during the conversion from radix_transaction::ast::Value => crate::Value. This error typically means that the contents of some value were unexpected. An example of this is a package address being found inside of a [`radix_transaction::manifest::ast::Value::Decimal`]. - required: - - error - - kind_being_parsed - - allowed_children_kinds - - found_child_kind - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - kind_being_parsed: - $ref: "#/components/schemas/ValueKind" - allowed_children_kinds: - type: array - items: - $ref: "#/components/schemas/ValueKind" - found_child_kind: - $ref: "#/components/schemas/ValueKind" - UnexpectedReNodeContents: - type: object - description: An error emitted during the conversion of [`crate::model::RENode`] into the AST's native type. This error signals that unexpected contents were found when parsing the contents of RENode. For example, for the case where we are parsing a [`crate::model::RENode::Bucket`], we expect that it consists of a [`radix_transaction::manifest::ast::Value::String`] or a [`radix_transaction::manifest::ast::Value::U32`]. If when parsing this `RENode`, we encounter anything else that is not the types we expect, then this error is emitted. - required: - - error - - kind_being_parsed - - allowed_children_kinds - - found_child_kind - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - kind_being_parsed: - $ref: "#/components/schemas/RENodeKind" - allowed_children_kinds: - type: array - items: - $ref: "#/components/schemas/ValueKind" - found_child_kind: - $ref: "#/components/schemas/ValueKind" - InvalidType: - type: object - description: An error emitted when validating the type of `Value` objects. - required: - - error - - expected_types - - actual_type - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - expected_types: - type: array - items: - $ref: "#/components/schemas/ValueKind" - actual_type: - $ref: "#/components/schemas/ValueKind" - UnknownTypeId: - type: object - description: An error emitted when encountering an unknown SBOR type id during value conversion. - required: - - error - - type_id - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - type_id: - type: integer - ParseError: - type: object - description: An error emitted when the parsing of a value from string fails. - required: - - error - - kind - - message - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - kind: - $ref: "#/components/schemas/ValueKind" - message: - type: string - TransactionCompileError: - type: object - description: An error emitted when an error is encountered during transaction compilation. - required: - - error - - value - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - value: - type: string - TransactionDecompileError: - type: object - description: An error when an error encountered during transaction manifest decompilation. - required: - - error - - value - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - value: - type: string - UnsupportedTransactionVersion: - type: object - description: An error emitted when a transaction version is specified but the library has no support for this transaction version. - required: - - error - - value - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - value: - type: number - GeneratorError: - type: object - description: An error emitted during the conversion of ast::Instructions to a `TransactionManifest` - required: - - error - - value - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - value: - type: string - RequestResponseConversionError: - type: object - description: An error emitted when the conversion to a specific request or response type fails - required: - - error - - value - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - value: - type: string - UnrecognizedCompiledIntentFormat: - type: object - description: An error emitted when attempting to decompile a transaction intent but the format is not known to the library. - required: - - error - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - TransactionValidationError: - type: object - description: An error emitted when attempting to validate a transaction fails. - required: - - error - - value - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - value: - type: string - NetworkMismatchError: - type: object - description: An error emitted when there is a network mismatch between addresses and the header network - required: - - error - - expected - - found - properties: - error: - $ref: "#/components/schemas/ErrorKind" - readOnly: true - expected: - $ref: "#/components/schemas/Byte" - found: - $ref: "#/components/schemas/Byte" diff --git a/test.sh b/test.sh deleted file mode 100755 index 5454eaf5..00000000 --- a/test.sh +++ /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. - -(cd radix-engine-toolkit-core; cargo nextest run --release) - -(cd radix-engine-toolkit-native; cargo nextest run --release) -(cd radix-engine-toolkit-wasm; cargo nextest run --release) -(cd radix-engine-toolkit-jni; cargo nextest run --release) \ No newline at end of file From 05568f78aada0e75ab477000b1208d51ba4ed743 Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 13 Jan 2023 03:56:52 +0300 Subject: [PATCH 022/110] Initial value model --- .vscode/settings.json | 11 - Cargo.toml | 6 + core/Cargo.toml | 31 + core/src/error.rs | 89 ++ core/src/lib.rs | 24 + core/src/model/address/coder.rs | 157 +++ core/src/model/address/mod.rs | 26 + .../model/address/network_aware_address.rs | 83 ++ .../src/model/address/non_fungible_address.rs | 67 + core/src/model/address/non_fungible_id.rs | 81 ++ core/src/model/constants.rs | 23 + core/src/model/engine_identifier/mod.rs | 26 + .../engine_identifier/node_identifier.rs | 68 ++ core/src/model/engine_identifier/own.rs | 71 ++ core/src/model/engine_identifier/re_node.rs | 0 .../engine_identifier/transient_identifier.rs | 90 ++ core/src/model/mod.rs | 28 + core/src/model/runtime/blob.rs | 44 + core/src/model/runtime/expression.rs | 45 + core/src/model/runtime/mod.rs | 22 + core/src/model/value.rs | 390 ++++++ core/src/utils.rs | 129 ++ schema/Cargo.toml | 16 + schema/schema.json | 1081 +++++++++++++++++ schema/src/main.rs | 48 + serializable/Cargo.toml | 12 + serializable/src/lib.rs | 35 + 27 files changed, 2692 insertions(+), 11 deletions(-) delete mode 100644 .vscode/settings.json create mode 100644 Cargo.toml create mode 100644 core/Cargo.toml create mode 100644 core/src/error.rs create mode 100644 core/src/lib.rs create mode 100644 core/src/model/address/coder.rs create mode 100644 core/src/model/address/mod.rs create mode 100644 core/src/model/address/network_aware_address.rs create mode 100644 core/src/model/address/non_fungible_address.rs create mode 100644 core/src/model/address/non_fungible_id.rs create mode 100644 core/src/model/constants.rs create mode 100644 core/src/model/engine_identifier/mod.rs create mode 100644 core/src/model/engine_identifier/node_identifier.rs create mode 100644 core/src/model/engine_identifier/own.rs create mode 100644 core/src/model/engine_identifier/re_node.rs create mode 100644 core/src/model/engine_identifier/transient_identifier.rs create mode 100644 core/src/model/mod.rs create mode 100644 core/src/model/runtime/blob.rs create mode 100644 core/src/model/runtime/expression.rs create mode 100644 core/src/model/runtime/mod.rs create mode 100644 core/src/model/value.rs create mode 100644 core/src/utils.rs create mode 100644 schema/Cargo.toml create mode 100644 schema/schema.json create mode 100644 schema/src/main.rs create mode 100644 serializable/Cargo.toml create mode 100644 serializable/src/lib.rs diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index d5a2737e..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "rust-analyzer.linkedProjects": [ - "radix-engine-toolkit-core/Cargo.toml", - - "radix-engine-toolkit-native/Cargo.toml", - "radix-engine-toolkit-wasm/Cargo.toml", - "radix-engine-toolkit-jni/Cargo.toml", - - "docs-examples-generator/Cargo.toml", - ] -} \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000..50daa44d --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,6 @@ +[workspace] +members = [ + "core", + "schema", + "serializable" +] \ No newline at end of file diff --git a/core/Cargo.toml b/core/Cargo.toml new file mode 100644 index 00000000..c2be3565 --- /dev/null +++ b/core/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "core" +version = "0.1.0" +edition = "2021" + +[dependencies] +# Crates for Serde serialization. +serde = { version = "1.0.152" } +serde_with = { version = "2.2.0", features = ["hex"] } + +# A fork of a library that allows us to derive a JSON schema for models. This fork adds partial +# support for serde_with +schemars = { git = "https://github.com/radixdlt/schemars", branch = "feature/partial-serde_with-support" } + +# An attribute macro to setup a model to be serializable and also to have a JSON schema. +serializable = { path = "../serializable" } + +# Scrypto dependencies required for the core-toolkit +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-e497a8" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-e497a8" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-e497a8", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-e497a8", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-e497a8" } + +# 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 } + +# 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 } \ No newline at end of file diff --git a/core/src/error.rs b/core/src/error.rs new file mode 100644 index 00000000..0f9e889a --- /dev/null +++ b/core/src/error.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 std::fmt::Display; + +use hex::FromHexError; +use scrypto::radix_engine_interface::address::AddressError; +use serializable::serializable; + +use crate::ValueKind; + +#[serializable] +#[serde(tag = "error")] +/// 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. +pub enum Error { + /// An error emitted when the toolkit attempts to decode some string as a hex string and fails + FailedToDecodeHex { value: 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 { value: 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 `ValueKind`s for a given request or operation (this set forms an + /// 'or' and not an 'and'). + expected: Vec, + + /// The `ValueKind` that was found. + found: ValueKind, + }, +} + +impl Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:?}", self) + } +} + +macro_rules! to_debug_string { + ($expression: expr) => { + format!("{:?}", $expression) + }; +} + +macro_rules! generate_from_error { + ($error: ident as $variant: ident) => { + impl From<$error> for Error { + fn from(value: $error) -> Self { + Self::$variant { + value: to_debug_string!(value), + } + } + } + }; +} + +generate_from_error!(FromHexError as FailedToDecodeHex); +generate_from_error!(AddressError as AddressError); + +/// 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/core/src/lib.rs b/core/src/lib.rs new file mode 100644 index 00000000..567aa386 --- /dev/null +++ b/core/src/lib.rs @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT 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 model; +pub mod utils; + +pub use error::*; +pub use model::*; +pub use utils::*; diff --git a/core/src/model/address/coder.rs b/core/src/model/address/coder.rs new file mode 100644 index 00000000..4e61d2af --- /dev/null +++ b/core/src/model/address/coder.rs @@ -0,0 +1,157 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::address::network_aware_address::*; +use crate::error::Result; +use crate::utils::{ + network_definition_from_network_id, network_id_from_address_string, network_id_from_hrp, +}; +use crate::Error; +use scrypto::prelude::{ComponentAddress, PackageAddress, ResourceAddress, SystemAddress}; +use scrypto::radix_engine_interface::address::{Bech32Decoder, Bech32Encoder}; +use scrypto::radix_engine_interface::node::NetworkDefinition; + +/// A Bech32m encoder and decoder used in the Radix Engine Toolkit for all of it's address encoding +/// and decoding needs +pub struct Bech32Coder { + network_id: u8, + 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 { + network_id: network_definition.id, + encoder: Bech32Encoder::new(network_definition), + decoder: Bech32Decoder::new(network_definition), + } + } + + pub fn network_id(&self) -> u8 { + self.network_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: &ComponentAddress) -> String { + self.encoder + .encode_component_address_to_string(component_address) + } + + pub fn encode_resource_address(&self, resource_address: &ResourceAddress) -> String { + self.encoder + .encode_resource_address_to_string(resource_address) + } + + pub fn encode_system_address(&self, system_address: &SystemAddress) -> String { + self.encoder.encode_system_address_to_string(system_address) + } + + pub fn encode_package_address(&self, package_address: &PackageAddress) -> String { + self.encoder + .encode_package_address_to_string(package_address) + } + + 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_system_address>(&self, system_address: S) -> Result { + self.decoder + .validate_and_decode_system_address(system_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_system_address>( + &self, + system_address: S, + ) -> Result { + self.decode_system_address(system_address) + .map(|system_address| NetworkAwareSystemAddress { + network_id: self.network_id, + address: system_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/core/src/model/address/mod.rs b/core/src/model/address/mod.rs new file mode 100644 index 00000000..fdd6d26d --- /dev/null +++ b/core/src/model/address/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 coder; +pub mod network_aware_address; +pub mod non_fungible_address; +pub mod non_fungible_id; + +pub use coder::*; +pub use network_aware_address::*; +pub use non_fungible_address::*; +pub use non_fungible_id::*; diff --git a/core/src/model/address/network_aware_address.rs b/core/src/model/address/network_aware_address.rs new file mode 100644 index 00000000..ba392dfe --- /dev/null +++ b/core/src/model/address/network_aware_address.rs @@ -0,0 +1,83 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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::address::Bech32Coder; +use crate::error::{Error, Result}; + +// 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, 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 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(), + }) + } + } + }; +} + +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 +); +define_network_aware_address!( + scrypto::prelude::SystemAddress => NetworkAwareSystemAddress, + encode_system_address, + decode_system_address +); diff --git a/core/src/model/address/non_fungible_address.rs b/core/src/model/address/non_fungible_address.rs new file mode 100644 index 00000000..6baccbef --- /dev/null +++ b/core/src/model/address/non_fungible_address.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 scrypto::prelude::{ + FromPublicKey, NonFungibleAddress as NativeNonFungibleAddress, NonFungibleId, PublicKey, +}; +use serializable::serializable; + +use crate::model::NetworkAwareResourceAddress; + +#[serializable] +/// 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. +pub struct NonFungibleAddress { + #[serde_as(as = "serde_with::TryFromInto")] + pub resource_address: NetworkAwareResourceAddress, + + #[serde_as(as = "serde_with::TryFromInto")] + pub non_fungible_id: NonFungibleId, +} + +impl NonFungibleAddress { + pub fn new( + resource_address: NetworkAwareResourceAddress, + non_fungible_id: NonFungibleId, + ) -> Self { + Self { + resource_address, + non_fungible_id, + } + } + + pub fn from_public_key + Clone>(public_key: &P, network_id: u8) -> Self { + let native_non_fungible_address = NativeNonFungibleAddress::from_public_key(public_key); + Self { + resource_address: NetworkAwareResourceAddress { + network_id, + address: native_non_fungible_address.resource_address(), + }, + non_fungible_id: native_non_fungible_address.non_fungible_id().clone(), + } + } +} + +impl From for scrypto::prelude::NonFungibleAddress { + fn from(value: NonFungibleAddress) -> Self { + scrypto::prelude::NonFungibleAddress::new( + value.resource_address.address, + value.non_fungible_id, + ) + } +} diff --git a/core/src/model/address/non_fungible_id.rs b/core/src/model/address/non_fungible_id.rs new file mode 100644 index 00000000..4b4ac32b --- /dev/null +++ b/core/src/model/address/non_fungible_id.rs @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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::NonFungibleId as ScryptoNonFungibleId; +use serializable::serializable; + +#[serializable] +#[serde(tag = "variant", content = "value")] +/// Represents non-fungible ids which is a discriminated union of the different types that +/// non-fungible ids may be. +pub enum NonFungibleId { + /// A 32 bit unsigned integer non-fungible id type which is serialized as a string + U32( + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + u32, + ), + + /// A 64 bit unsigned integer non-fungible id type which is serialized as a string + U64( + #[schemars(regex(pattern = "[0-9]+"))] + #[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 + UUID( + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + u128, + ), + + /// An byte array non-fungible id type which is serialized as a hex string + Bytes( + #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[serde_as(as = "serde_with::hex::Hex")] + Vec, + ), + + /// A string non-fungible id + String(String), +} + +impl From for NonFungibleId { + fn from(value: ScryptoNonFungibleId) -> Self { + match value { + ScryptoNonFungibleId::U32(value) => Self::U32(value), + ScryptoNonFungibleId::U64(value) => Self::U64(value), + ScryptoNonFungibleId::UUID(value) => Self::UUID(value), + ScryptoNonFungibleId::String(value) => Self::String(value), + ScryptoNonFungibleId::Bytes(value) => Self::Bytes(value), + } + } +} + +impl From for ScryptoNonFungibleId { + fn from(value: NonFungibleId) -> Self { + match value { + NonFungibleId::U32(value) => Self::U32(value), + NonFungibleId::U64(value) => Self::U64(value), + NonFungibleId::UUID(value) => Self::UUID(value), + NonFungibleId::String(value) => Self::String(value), + NonFungibleId::Bytes(value) => Self::Bytes(value), + } + } +} diff --git a/core/src/model/constants.rs b/core/src/model/constants.rs new file mode 100644 index 00000000..216f799d --- /dev/null +++ b/core/src/model/constants.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. + +/// A constant representing the length of Radix Engine Node Identifiers (`RENodeId`s) +pub const RADIX_ENGINE_NODE_IDENTIFIER_LENGTH: usize = 36; + +/// A constant representing the length of hashes uses by the Radix Engine and Scrypto. This is +/// defined as a constant to allow for easy changes if the hashing algorithm uses is changed. +pub const RADIX_ENGINE_HASH_LENGTH: usize = 32; diff --git a/core/src/model/engine_identifier/mod.rs b/core/src/model/engine_identifier/mod.rs new file mode 100644 index 00000000..79c970b1 --- /dev/null +++ b/core/src/model/engine_identifier/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 node_identifier; +pub mod own; +pub mod re_node; +pub mod transient_identifier; + +pub use node_identifier::*; +pub use own::*; +pub use re_node::*; +pub use transient_identifier::*; diff --git a/core/src/model/engine_identifier/node_identifier.rs b/core/src/model/engine_identifier/node_identifier.rs new file mode 100644 index 00000000..e3d98738 --- /dev/null +++ b/core/src/model/engine_identifier/node_identifier.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::fmt::Display; +use std::str::FromStr; + +use scrypto_utils::copy_u8_array; +use serializable::serializable; + +use crate::constants::RADIX_ENGINE_NODE_IDENTIFIER_LENGTH; +use crate::error::{Error, Result}; + +// ================= +// Model Definition +// ================= + +#[serializable] +/// Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a +/// hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.) +pub struct NodeIdentifier( + #[serde_as(as = "serde_with::hex::Hex")] + #[schemars(length(equal = 72))] + #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + pub [u8; RADIX_ENGINE_NODE_IDENTIFIER_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() != RADIX_ENGINE_NODE_IDENTIFIER_LENGTH { + Err(Error::InvalidLength { + expected: RADIX_ENGINE_NODE_IDENTIFIER_LENGTH, + found: bytes.len(), + }) + } else { + Ok(NodeIdentifier(copy_u8_array(&bytes))) + } + } +} diff --git a/core/src/model/engine_identifier/own.rs b/core/src/model/engine_identifier/own.rs new file mode 100644 index 00000000..ae009b56 --- /dev/null +++ b/core/src/model/engine_identifier/own.rs @@ -0,0 +1,71 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::NodeIdentifier; +use scrypto::runtime::Own as ScryptoOwn; +use serializable::serializable; + +// ================= +// Model Definition +// ================= + +#[serializable] +#[serde(tag = "variant", 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 Component + Component(NodeIdentifier), + + /// Represents an owned Vault + Vault(NodeIdentifier), + + /// Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized + /// as a string + Bucket(#[serde_as(as = "serde_with::DisplayFromStr")] u32), + + /// Represents an owned Proof identified through an unsigned 32-bit integer which is serialized + /// as a string + Proof(#[serde_as(as = "serde_with::DisplayFromStr")] u32), +} + +impl From for Own { + fn from(value: ScryptoOwn) -> Self { + match value { + ScryptoOwn::Bucket(v) => Self::Bucket(v), + ScryptoOwn::Proof(v) => Self::Proof(v), + ScryptoOwn::KeyValueStore(v) => Self::KeyValueStore(NodeIdentifier(v)), + ScryptoOwn::Component(v) => Self::Component(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), + Own::Proof(v) => Self::Proof(v), + Own::KeyValueStore(v) => Self::KeyValueStore(v.0), + Own::Component(v) => Self::Component(v.0), + Own::Vault(v) => Self::Vault(v.0), + } + } +} diff --git a/core/src/model/engine_identifier/re_node.rs b/core/src/model/engine_identifier/re_node.rs new file mode 100644 index 00000000..e69de29b diff --git a/core/src/model/engine_identifier/transient_identifier.rs b/core/src/model/engine_identifier/transient_identifier.rs new file mode 100644 index 00000000..c3f59b5c --- /dev/null +++ b/core/src/model/engine_identifier/transient_identifier.rs @@ -0,0 +1,90 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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 serializable::serializable; +use std::str::FromStr; + +// ================= +// Model Definition +// ================= + +#[serializable] +#[serde(untagged)] +/// Represents an untagged 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 { + String(String), + U32(u32), +} + +#[serializable] +/// Represents a BucketId which uses a transient identifier. +pub struct BucketId(pub TransientIdentifier); + +#[serializable] +/// 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(s.to_owned())) + } +} + +impl From for TransientIdentifier { + fn from(value: String) -> Self { + Self::String(value) + } +} + +impl From for TransientIdentifier { + fn from(value: u32) -> Self { + Self::U32(value) + } +} + +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/core/src/model/mod.rs b/core/src/model/mod.rs new file mode 100644 index 00000000..5878dda1 --- /dev/null +++ b/core/src/model/mod.rs @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +pub mod address; +pub mod constants; +pub mod engine_identifier; +pub mod runtime; +pub mod value; + +pub use address::*; +pub use constants::*; +pub use engine_identifier::*; +pub use runtime::*; +pub use value::*; diff --git a/core/src/model/runtime/blob.rs b/core/src/model/runtime/blob.rs new file mode 100644 index 00000000..cc593e42 --- /dev/null +++ b/core/src/model/runtime/blob.rs @@ -0,0 +1,44 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use scrypto::prelude::Hash; +use scrypto::runtime::ManifestBlobRef; +use serializable::serializable; + +use crate::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(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 .0) + } +} + +impl From for ManifestBlobRef { + fn from(value: Blob) -> Self { + Self(Hash(value.0)) + } +} diff --git a/core/src/model/runtime/expression.rs b/core/src/model/runtime/expression.rs new file mode 100644 index 00000000..14bcca3f --- /dev/null +++ b/core/src/model/runtime/expression.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 scrypto::runtime::ManifestExpression; +use serializable::serializable; + +#[serializable] +#[serde(rename_all = "SCREAMING_SNAKE_CASE")] +/// Represents a transaction manifest expression. +pub enum Expression { + EntireWorktop, + EntireAuthZone, +} + +impl From for Expression { + fn from(value: ManifestExpression) -> Self { + match value { + ManifestExpression::EntireAuthZone => Self::EntireAuthZone, + ManifestExpression::EntireWorktop => Self::EntireWorktop, + } + } +} + +impl From for ManifestExpression { + fn from(value: Expression) -> Self { + match value { + Expression::EntireAuthZone => Self::EntireAuthZone, + Expression::EntireWorktop => Self::EntireWorktop, + } + } +} diff --git a/core/src/model/runtime/mod.rs b/core/src/model/runtime/mod.rs new file mode 100644 index 00000000..00167204 --- /dev/null +++ b/core/src/model/runtime/mod.rs @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +pub mod blob; +pub mod expression; + +pub use blob::*; +pub use expression::*; diff --git a/core/src/model/value.rs b/core/src/model/value.rs new file mode 100644 index 00000000..ffdeed40 --- /dev/null +++ b/core/src/model/value.rs @@ -0,0 +1,390 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::address::network_aware_address::*; +use crate::engine_identifier::{BucketId, ProofId}; +use crate::NonFungibleAddress; + +use scrypto::prelude::{ + Decimal, EcdsaSecp256k1PublicKey, EcdsaSecp256k1Signature, EddsaEd25519PublicKey, + EddsaEd25519Signature, Hash, NonFungibleId, PreciseDecimal, +}; +use scrypto::runtime::{ManifestBlobRef, ManifestExpression, Own}; +use serde_with::serde_as; +use serializable::serializable; + +#[serializable] +#[serde(tag = "type")] +/// The Value model used to describe all of the types that the Radix Engine Toolkit accepts and +/// returns. +pub enum Value { + /// A boolean value which can either be true or false + Bool { value: bool }, + + /// An 8-bit unsigned integer which is serialized and deserialized as a string. + U8 { + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u8, + }, + + /// A 16-bit unsigned integer which is serialized and deserialized as a string. + U16 { + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u16, + }, + + /// A 32-bit unsigned integer which is serialized and deserialized as a string. + U32 { + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u32, + }, + + /// A 64-bit unsigned integer which is serialized and deserialized as a string. + U64 { + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u64, + }, + + /// A 128-bit unsigned integer which is serialized and deserialized as a string. + U128 { + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u128, + }, + + /// An 8-bit signed integer which is serialized and deserialized as a string. + I8 { + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i8, + }, + + /// A 16-bit signed integer which is serialized and deserialized as a string. + I16 { + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i16, + }, + + /// A 32-bit signed integer which is serialized and deserialized as a string. + I32 { + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i32, + }, + + /// A 64-bit signed integer which is serialized and deserialized as a string. + I64 { + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i64, + }, + + /// A 128-bit signed integer which is serialized and deserialized as a string. + I128 { + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i128, + }, + + /// A type representing a string + String { value: String }, + + /// A Rust-style Enum which has a variant and can optionally also have a list of values (acting + /// in a way similar to discriminated algebraic sum types) + Enum { + /// The name of the variant of the enum + variant: String, + + /// Optional fields that the enum may have + #[serde(default, skip_serializing_if = "Option::is_none")] + fields: Option>, + }, + + /// The `Some` case of Rust Options where the value is some Value + Some { value: Box }, + + /// The `None` case of Rust Options where there is value + None, + + /// The `Ok` case of Rust Results where the value is some Value + Ok { value: Box }, + + /// The `Err` case of Rust Results where the value is some Value + Err { value: Box }, + + /// An array values of a single value kind + Array { + /// The kind of elements that the array contains. An array will be validated to ensure that + /// it contains a single element kind. + element_kind: ValueKind, + + /// The elements of the array which may contain 0 or more elements. + elements: Vec, + }, + + /// An array of elements where elements could be of different kinds. + Tuple { elements: Vec }, + + /// A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum + /// of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and + /// -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively + Decimal { + #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: Decimal, + }, + + /// A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and + /// minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042047 + /// and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 + /// respectively + PreciseDecimal { + #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: PreciseDecimal, + }, + + /// Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of + /// the transaction manifest. + Own { + #[serde(flatten)] + #[serde_as(as = "serde_with::FromInto")] + value: Own, + }, + + /// Represents a Bech32m encoded human-readable component address + ComponentAddress { + #[serde_as(as = "serde_with::DisplayFromStr")] + address: NetworkAwareComponentAddress, + }, + + /// Represents a Bech32m encoded human-readable resource address + ResourceAddress { + #[serde_as(as = "serde_with::DisplayFromStr")] + address: NetworkAwareResourceAddress, + }, + + /// Represents a Bech32m encoded human-readable system address + SystemAddress { + #[serde_as(as = "serde_with::DisplayFromStr")] + address: NetworkAwareSystemAddress, + }, + + /// Represents a Bech32m encoded human-readable package address + PackageAddress { + #[serde_as(as = "serde_with::DisplayFromStr")] + address: NetworkAwarePackageAddress, + }, + + /// Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The + /// hashing function that they use is SHA256 which produces 32 byte long hashes which are + /// serialized as a 64 character long hex string (since hex encoding doubles the number of bytes + /// needed) + Hash { + #[schemars(length(equal = 64))] + #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: Hash, + }, + + /// A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string + /// representing a public key from the ECDSA Secp256k1 elliptic curve. + EcdsaSecp256k1PublicKey { + #[schemars(length(equal = 66))] + #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + public_key: EcdsaSecp256k1PublicKey, + }, + + /// A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string + /// representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on + /// ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] + /// where `v` is the recovery id and is a single byte and `r` and `s` are the signature results + /// and are 32 bytes each. The use of other signature format + EcdsaSecp256k1Signature { + #[schemars(length(equal = 130))] + #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + signature: EcdsaSecp256k1Signature, + }, + + /// A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string + /// representing a public key from the EDDSA Ed25519 edwards curve. + EddsaEd25519PublicKey { + #[schemars(length(equal = 64))] + #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + public_key: EddsaEd25519PublicKey, + }, + + /// A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string + /// representing a signature from the EDDSA Ed25519 edwards curve. + EddsaEd25519Signature { + #[schemars(length(equal = 128))] + #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + signature: EddsaEd25519Signature, + }, + + /// Represents a Scrypto bucket which is identified through a transient identifier which is + /// either a string or an unsigned 32-bit integer which is serialized as a number. + 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 number. + Proof { identifier: ProofId }, + + /// Represents non-fungible ids which is a discriminated union of the different types that + /// non-fungible ids may be. + NonFungibleId { + #[serde(flatten)] + #[serde_as(as = "serde_with::FromInto")] + value: NonFungibleId, + }, + + /// 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. + NonFungibleAddress { + #[serde(flatten)] + address: NonFungibleAddress, + }, + + /// Represents a transaction manifest expression. + Expression { + #[serde_as(as = "serde_with::FromInto")] + value: ManifestExpression, + }, + + /// Represents the hash of a blob provided as part of a transaction manifest. This is represented as + /// a byte array of 32 bytes which is serialized as a hex string. + Blob { + #[serde_as(as = "serde_with::FromInto")] + hash: ManifestBlobRef, + }, + + /// Represents a byte array of an unknown size which is serialized as a hex string + Bytes { + #[serde_as(as = "serde_with::hex::Hex")] + value: Vec, + }, +} + +#[serializable] +/// An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is +/// essentially the `type` tags used for the value model. +pub enum ValueKind { + Unit, + Bool, + + I8, + I16, + I32, + I64, + I128, + + U8, + U16, + U32, + U64, + U128, + + String, + + Enum, + + Some, + None, + Ok, + Err, + + Array, + Tuple, + + Decimal, + PreciseDecimal, + + Component, + PackageAddress, + ComponentAddress, + ResourceAddress, + SystemAddress, + + Hash, + + Bucket, + Proof, + Vault, + + NonFungibleId, + NonFungibleAddress, + + KeyValueStore, + + EcdsaSecp256k1PublicKey, + EcdsaSecp256k1Signature, + EddsaEd25519PublicKey, + EddsaEd25519Signature, + + Blob, + Expression, + Bytes, +} + +impl Value { + pub fn kind(&self) -> ValueKind { + todo!() + } +} + +// ============ +// Conversions +// ============ + +macro_rules! value_invertible { + ($variant_name: ident, $underlying_type: ident, $field: ident) => { + impl TryFrom<$underlying_type> for Value { + type Error = $crate::error::Error; + + fn try_from($field: $underlying_type) -> $crate::error::Result { + Ok(Value::$variant_name { $field }) + } + } + + impl TryFrom for $underlying_type { + type Error = $crate::error::Error; + + fn try_from(val: Value) -> $crate::error::Result { + match val { + Value::$variant_name { $field } => Ok($field), + _ => Err($crate::error::Error::InvalidKind { + expected: vec![ValueKind::$variant_name], + found: val.kind(), + }), + } + } + } + }; +} + +value_invertible! {NonFungibleId, NonFungibleId, value} +value_invertible! {ResourceAddress, NetworkAwareResourceAddress, address} diff --git a/core/src/utils.rs b/core/src/utils.rs new file mode 100644 index 00000000..5bc00be7 --- /dev/null +++ b/core/src/utils.rs @@ -0,0 +1,129 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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 bech32; +use scrypto::radix_engine_interface::address::AddressError; +use scrypto::radix_engine_interface::node::NetworkDefinition; + +/// 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), + }, + + 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), + }, + + 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 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), + } + }?; + + // 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), + } + }?, + }; + 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) +} diff --git a/schema/Cargo.toml b/schema/Cargo.toml new file mode 100644 index 00000000..7c81db04 --- /dev/null +++ b/schema/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "schema" +version = "0.1.0" +edition = "2021" + +[dependencies] +# A fork of a library that allows us to derive a JSON schema for models. This fork adds partial +# support for serde_with +schemars = { git = "https://github.com/radixdlt/schemars", branch = "feature/partial-serde_with-support" } + +# Used to serialize the schema to JSON +serde_json = "1.0.91" + +# Importing core to get the models to generate it +core = { path = "../core" } +serde = "1.0.152" diff --git a/schema/schema.json b/schema/schema.json new file mode 100644 index 00000000..8d4aa4f5 --- /dev/null +++ b/schema/schema.json @@ -0,0 +1,1081 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "RadixEngineToolkit", + "description": "This schema describes the types that the Radix Engine Toolkit accepts and returns. In this schema you will find a number of models, the most basic one of them is the `Value` model which describes how primitive types and Scrypto values are represented when communicating with the Radix Engine Toolkit. In addition to that, there are additional models which describe what instructions look like, transactions, and any other models.\n\nThis schema has been automatically generated and therefore should hopefully always be the ground truth for the Radix Engine Toolkit models", + "anyOf": [ + { + "$ref": "#/definitions/Value" + } + ], + "definitions": { + "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]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "Expression": { + "description": "Represents a transaction manifest expression.", + "type": "string", + "enum": [ + "ENTIRE_WORKTOP", + "ENTIRE_AUTH_ZONE" + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + }, + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + }, + "type": { + "type": "string", + "enum": [ + "Array" + ] + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + }, + "type": { + "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", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "value": { + "$ref": "#/definitions/NodeIdentifier" + }, + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "value": { + "$ref": "#/definitions/NodeIdentifier" + }, + "variant": { + "type": "string", + "enum": [ + "Component" + ] + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "value": { + "$ref": "#/definitions/NodeIdentifier" + }, + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "value": { + "type": "string" + }, + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "value": { + "type": "string" + }, + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "address": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "address": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "address": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "address": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + }, + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + } + } + }, + { + "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. The use of other signature format", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + }, + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + }, + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + }, + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + } + } + }, + { + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "identifier": { + "$ref": "#/definitions/BucketId" + }, + "type": { + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "identifier": { + "$ref": "#/definitions/ProofId" + }, + "type": { + "type": "string", + "enum": [ + "Proof" + ] + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "value": { + "type": "string", + "pattern": "[0-9]+" + }, + "variant": { + "type": "string", + "enum": [ + "U32" + ] + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "value": { + "type": "string", + "pattern": "[0-9]+" + }, + "variant": { + "type": "string", + "enum": [ + "U64" + ] + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "value": { + "type": "string", + "pattern": "[0-9]+" + }, + "variant": { + "type": "string", + "enum": [ + "UUID" + ] + } + } + }, + { + "description": "An byte array non-fungible id type which is serialized as a hex string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + }, + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "value": { + "type": "string" + }, + "variant": { + "type": "string", + "enum": [ + "String" + ] + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "non_fungible_id": { + "$ref": "#/definitions/Value" + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "hash": { + "$ref": "#/definitions/Blob" + }, + "type": { + "type": "string", + "enum": [ + "Blob" + ] + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Unit", + "Bool", + "I8", + "I16", + "I32", + "I64", + "I128", + "U8", + "U16", + "U32", + "U64", + "U128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Component", + "PackageAddress", + "ComponentAddress", + "ResourceAddress", + "SystemAddress", + "Hash", + "Bucket", + "Proof", + "Vault", + "NonFungibleId", + "NonFungibleAddress", + "KeyValueStore", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Blob", + "Expression", + "Bytes" + ] + } + } +} \ No newline at end of file diff --git a/schema/src/main.rs b/schema/src/main.rs new file mode 100644 index 00000000..fbea3461 --- /dev/null +++ b/schema/src/main.rs @@ -0,0 +1,48 @@ +use core::Value; +use std::io::Write; + +use schemars::{schema_for, JsonSchema}; + +fn main() { + generate_json_schema().expect("Failed to generate schema") +} + +pub fn generate_json_schema() -> Result<(), JsonSchemaGenerationError> { + // This type includes all of the top level interfaces that the Radix Engine Toolkit has. + + #[allow(dead_code)] + #[derive(JsonSchema, serde::Serialize)] + #[serde(untagged)] + /// This schema describes the types that the Radix Engine Toolkit accepts and returns. In this + /// schema you will find a number of models, the most basic one of them is the `Value` model + /// which describes how primitive types and Scrypto values are represented when communicating + /// with the Radix Engine Toolkit. In addition to that, there are additional models which + /// describe what instructions look like, transactions, and any other models. + /// + /// This schema has been automatically generated and therefore should hopefully always be the + /// ground truth for the Radix Engine Toolkit models + pub enum RadixEngineToolkit { + Value(Value), + } + + // Generating the Radix Engine Toolkit schema + let schema = schema_for!(RadixEngineToolkit); + + // Serialize the Schema to a JSON pretty (formatted) text + let serialized_schema = serde_json::to_string_pretty(&schema) + .map_err(JsonSchemaGenerationError::SerializationError)?; + + // Write the Schema to a file + std::fs::File::create("schema.json") + .map_err(JsonSchemaGenerationError::IOError)? + .write_all(serialized_schema.as_bytes()) + .map_err(JsonSchemaGenerationError::IOError)?; + + Ok(()) +} + +#[derive(Debug)] +pub enum JsonSchemaGenerationError { + IOError(std::io::Error), + SerializationError(serde_json::Error), +} diff --git a/serializable/Cargo.toml b/serializable/Cargo.toml new file mode 100644 index 00000000..9bcd270c --- /dev/null +++ b/serializable/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "serializable" +version = "0.1.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/serializable/src/lib.rs b/serializable/src/lib.rs new file mode 100644 index 00000000..dedaf76c --- /dev/null +++ b/serializable/src/lib.rs @@ -0,0 +1,35 @@ +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 debug_attribute = token_stream!("#[derive(Debug)]"); + + TokenStream::from(quote! { + #json_schema_attribute + + #serde_as_attribute + + #default_derive_attributes + + #debug_attribute + + #input + }) +} From 46ac76d40589db070b32a628e2a7c213603aa458 Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 13 Jan 2023 04:08:41 +0300 Subject: [PATCH 023/110] Use original schemars instead of fork --- core/Cargo.toml | 7 +++-- .../src/model/address/non_fungible_address.rs | 2 ++ core/src/model/address/non_fungible_id.rs | 4 +++ .../engine_identifier/node_identifier.rs | 3 ++- core/src/model/engine_identifier/own.rs | 12 +++++++-- core/src/model/value.rs | 26 +++++++++++++++++++ schema/Cargo.toml | 5 ++-- schema/schema.json | 12 ++++++--- 8 files changed, 57 insertions(+), 14 deletions(-) diff --git a/core/Cargo.toml b/core/Cargo.toml index c2be3565..f332751d 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -8,9 +8,8 @@ edition = "2021" serde = { version = "1.0.152" } serde_with = { version = "2.2.0", features = ["hex"] } -# A fork of a library that allows us to derive a JSON schema for models. This fork adds partial -# support for serde_with -schemars = { git = "https://github.com/radixdlt/schemars", branch = "feature/partial-serde_with-support" } +# A library which allows us to generate a JSON schema from Rust models +schemars = { version = "0.8.11" } # An attribute macro to setup a model to be serializable and also to have a JSON schema. serializable = { path = "../serializable" } @@ -28,4 +27,4 @@ hex = { version = "0.4.3", default-features = false } # 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 } \ No newline at end of file +bech32 = { version = "0.9.0", default-features = false } diff --git a/core/src/model/address/non_fungible_address.rs b/core/src/model/address/non_fungible_address.rs index 6baccbef..14ab4c8c 100644 --- a/core/src/model/address/non_fungible_address.rs +++ b/core/src/model/address/non_fungible_address.rs @@ -27,10 +27,12 @@ use crate::model::NetworkAwareResourceAddress; /// non-fungible unit as it contains both the resource address and the non-fungible id for that /// unit. pub struct NonFungibleAddress { + #[schemars(with = "crate::Value")] #[serde_as(as = "serde_with::TryFromInto")] pub resource_address: NetworkAwareResourceAddress, #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "crate::Value")] pub non_fungible_id: NonFungibleId, } diff --git a/core/src/model/address/non_fungible_id.rs b/core/src/model/address/non_fungible_id.rs index 4b4ac32b..3b08ad70 100644 --- a/core/src/model/address/non_fungible_id.rs +++ b/core/src/model/address/non_fungible_id.rs @@ -26,6 +26,7 @@ pub enum NonFungibleId { /// A 32 bit unsigned integer non-fungible id type which is serialized as a string U32( #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] u32, ), @@ -33,6 +34,7 @@ pub enum NonFungibleId { /// A 64 bit unsigned integer non-fungible id type which is serialized as a string U64( #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] u64, ), @@ -41,6 +43,7 @@ pub enum NonFungibleId { /// A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string UUID( #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] u128, ), @@ -48,6 +51,7 @@ pub enum NonFungibleId { /// An byte array non-fungible id type which is serialized as a hex string Bytes( #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::hex::Hex")] Vec, ), diff --git a/core/src/model/engine_identifier/node_identifier.rs b/core/src/model/engine_identifier/node_identifier.rs index e3d98738..e8f52282 100644 --- a/core/src/model/engine_identifier/node_identifier.rs +++ b/core/src/model/engine_identifier/node_identifier.rs @@ -32,9 +32,10 @@ use crate::error::{Error, Result}; /// Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a /// hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.) pub struct NodeIdentifier( - #[serde_as(as = "serde_with::hex::Hex")] #[schemars(length(equal = 72))] #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::hex::Hex")] pub [u8; RADIX_ENGINE_NODE_IDENTIFIER_LENGTH], ); diff --git a/core/src/model/engine_identifier/own.rs b/core/src/model/engine_identifier/own.rs index ae009b56..bd22ae97 100644 --- a/core/src/model/engine_identifier/own.rs +++ b/core/src/model/engine_identifier/own.rs @@ -39,11 +39,19 @@ pub enum Own { /// Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized /// as a string - Bucket(#[serde_as(as = "serde_with::DisplayFromStr")] u32), + Bucket( + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + u32, + ), /// Represents an owned Proof identified through an unsigned 32-bit integer which is serialized /// as a string - Proof(#[serde_as(as = "serde_with::DisplayFromStr")] u32), + Proof( + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + u32, + ), } impl From for Own { diff --git a/core/src/model/value.rs b/core/src/model/value.rs index ffdeed40..ba9064b6 100644 --- a/core/src/model/value.rs +++ b/core/src/model/value.rs @@ -38,6 +38,7 @@ pub enum Value { /// An 8-bit unsigned integer which is serialized and deserialized as a string. U8 { #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] value: u8, }, @@ -45,6 +46,7 @@ pub enum Value { /// A 16-bit unsigned integer which is serialized and deserialized as a string. U16 { #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] value: u16, }, @@ -52,6 +54,7 @@ pub enum Value { /// A 32-bit unsigned integer which is serialized and deserialized as a string. U32 { #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] value: u32, }, @@ -59,6 +62,7 @@ pub enum Value { /// A 64-bit unsigned integer which is serialized and deserialized as a string. U64 { #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] value: u64, }, @@ -66,6 +70,7 @@ pub enum Value { /// A 128-bit unsigned integer which is serialized and deserialized as a string. U128 { #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] value: u128, }, @@ -73,6 +78,7 @@ pub enum Value { /// An 8-bit signed integer which is serialized and deserialized as a string. I8 { #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] value: i8, }, @@ -80,6 +86,7 @@ pub enum Value { /// A 16-bit signed integer which is serialized and deserialized as a string. I16 { #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] value: i16, }, @@ -87,6 +94,7 @@ pub enum Value { /// A 32-bit signed integer which is serialized and deserialized as a string. I32 { #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] value: i32, }, @@ -94,6 +102,7 @@ pub enum Value { /// A 64-bit signed integer which is serialized and deserialized as a string. I64 { #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] value: i64, }, @@ -101,6 +110,7 @@ pub enum Value { /// A 128-bit signed integer which is serialized and deserialized as a string. I128 { #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] value: i128, }, @@ -149,6 +159,7 @@ pub enum Value { /// -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively Decimal { #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] value: Decimal, }, @@ -159,6 +170,7 @@ pub enum Value { /// respectively PreciseDecimal { #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] value: PreciseDecimal, }, @@ -167,30 +179,35 @@ pub enum Value { /// the transaction manifest. Own { #[serde(flatten)] + #[schemars(with = "crate::Own")] #[serde_as(as = "serde_with::FromInto")] value: Own, }, /// Represents a Bech32m encoded human-readable component address ComponentAddress { + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] address: NetworkAwareComponentAddress, }, /// Represents a Bech32m encoded human-readable resource address ResourceAddress { + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] address: NetworkAwareResourceAddress, }, /// Represents a Bech32m encoded human-readable system address SystemAddress { + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] address: NetworkAwareSystemAddress, }, /// Represents a Bech32m encoded human-readable package address PackageAddress { + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] address: NetworkAwarePackageAddress, }, @@ -202,6 +219,7 @@ pub enum Value { Hash { #[schemars(length(equal = 64))] #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] value: Hash, }, @@ -211,6 +229,7 @@ pub enum Value { EcdsaSecp256k1PublicKey { #[schemars(length(equal = 66))] #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] public_key: EcdsaSecp256k1PublicKey, }, @@ -223,6 +242,7 @@ pub enum Value { EcdsaSecp256k1Signature { #[schemars(length(equal = 130))] #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] signature: EcdsaSecp256k1Signature, }, @@ -232,6 +252,7 @@ pub enum Value { EddsaEd25519PublicKey { #[schemars(length(equal = 64))] #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] public_key: EddsaEd25519PublicKey, }, @@ -241,6 +262,7 @@ pub enum Value { EddsaEd25519Signature { #[schemars(length(equal = 128))] #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] signature: EddsaEd25519Signature, }, @@ -257,6 +279,7 @@ pub enum Value { /// non-fungible ids may be. NonFungibleId { #[serde(flatten)] + #[schemars(with = "crate::NonFungibleId")] #[serde_as(as = "serde_with::FromInto")] value: NonFungibleId, }, @@ -271,6 +294,7 @@ pub enum Value { /// Represents a transaction manifest expression. Expression { + #[schemars(with = "crate::Expression")] #[serde_as(as = "serde_with::FromInto")] value: ManifestExpression, }, @@ -278,6 +302,7 @@ pub enum Value { /// Represents the hash of a blob provided as part of a transaction manifest. This is represented as /// a byte array of 32 bytes which is serialized as a hex string. Blob { + #[schemars(with = "crate::Blob")] #[serde_as(as = "serde_with::FromInto")] hash: ManifestBlobRef, }, @@ -285,6 +310,7 @@ pub enum Value { /// Represents a byte array of an unknown size which is serialized as a hex string Bytes { #[serde_as(as = "serde_with::hex::Hex")] + #[schemars(with = "String")] value: Vec, }, } diff --git a/schema/Cargo.toml b/schema/Cargo.toml index 7c81db04..6a3ba2a7 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -4,9 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -# A fork of a library that allows us to derive a JSON schema for models. This fork adds partial -# support for serde_with -schemars = { git = "https://github.com/radixdlt/schemars", branch = "feature/partial-serde_with-support" } +# A library which allows us to generate a JSON schema from Rust models +schemars = { version = "0.8.11" } # Used to serialize the schema to JSON serde_json = "1.0.91" diff --git a/schema/schema.json b/schema/schema.json index 8d4aa4f5..8baaf09a 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -10,10 +10,14 @@ "definitions": { "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]+" + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "maxItems": 64, + "minItems": 64 }, "BucketId": { "description": "Represents a BucketId which uses a transient identifier.", From 8149455eb3392b39175610027efb8acf88e267f2 Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 13 Jan 2023 04:10:52 +0300 Subject: [PATCH 024/110] Preserve JSON Schema order --- core/Cargo.toml | 2 +- schema/Cargo.toml | 2 +- schema/schema.json | 324 ++++++++++++++++++++++----------------------- 3 files changed, 164 insertions(+), 164 deletions(-) diff --git a/core/Cargo.toml b/core/Cargo.toml index f332751d..4368989f 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -9,7 +9,7 @@ serde = { version = "1.0.152" } serde_with = { version = "2.2.0", features = ["hex"] } # A library which allows us to generate a JSON schema from Rust models -schemars = { version = "0.8.11" } +schemars = { version = "0.8.11", features = ["preserve_order"] } # An attribute macro to setup a model to be serializable and also to have a JSON schema. serializable = { path = "../serializable" } diff --git a/schema/Cargo.toml b/schema/Cargo.toml index 6a3ba2a7..13cc6882 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] # A library which allows us to generate a JSON schema from Rust models -schemars = { version = "0.8.11" } +schemars = { version = "0.8.11", features = ["preserve_order"] } # Used to serialize the schema to JSON serde_json = "1.0.91" diff --git a/schema/schema.json b/schema/schema.json index 8baaf09a..62a30fed 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -8,61 +8,6 @@ } ], "definitions": { - "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": "array", - "items": { - "type": "integer", - "format": "uint8", - "minimum": 0.0 - }, - "maxItems": 64, - "minItems": 64 - }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" - ] - }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ - { - "type": "string" - }, - { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, "Value": { "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", "oneOf": [ @@ -312,16 +257,6 @@ "variant" ], "properties": { - "fields": { - "description": "Optional fields that the enum may have", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } - }, "type": { "type": "string", "enum": [ @@ -331,6 +266,16 @@ "variant": { "description": "The name of the variant of the enum", "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } } } }, @@ -415,6 +360,12 @@ "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": [ @@ -429,12 +380,6 @@ "items": { "$ref": "#/definitions/Value" } - }, - "type": { - "type": "string", - "enum": [ - "Array" - ] } } }, @@ -446,17 +391,17 @@ "type" ], "properties": { - "elements": { - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - }, "type": { "type": "string", "enum": [ "Tuple" ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } } } }, @@ -512,14 +457,14 @@ "variant" ], "properties": { - "value": { - "$ref": "#/definitions/NodeIdentifier" - }, "variant": { "type": "string", "enum": [ "KeyValueStore" ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" } } }, @@ -531,14 +476,14 @@ "variant" ], "properties": { - "value": { - "$ref": "#/definitions/NodeIdentifier" - }, "variant": { "type": "string", "enum": [ "Component" ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" } } }, @@ -550,14 +495,14 @@ "variant" ], "properties": { - "value": { - "$ref": "#/definitions/NodeIdentifier" - }, "variant": { "type": "string", "enum": [ "Vault" ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" } } }, @@ -569,14 +514,14 @@ "variant" ], "properties": { - "value": { - "type": "string" - }, "variant": { "type": "string", "enum": [ "Bucket" ] + }, + "value": { + "type": "string" } } }, @@ -588,14 +533,14 @@ "variant" ], "properties": { - "value": { - "type": "string" - }, "variant": { "type": "string", "enum": [ "Proof" ] + }, + "value": { + "type": "string" } } } @@ -620,14 +565,14 @@ "type" ], "properties": { - "address": { - "type": "string" - }, "type": { "type": "string", "enum": [ "ComponentAddress" ] + }, + "address": { + "type": "string" } } }, @@ -639,14 +584,14 @@ "type" ], "properties": { - "address": { - "type": "string" - }, "type": { "type": "string", "enum": [ "ResourceAddress" ] + }, + "address": { + "type": "string" } } }, @@ -658,14 +603,14 @@ "type" ], "properties": { - "address": { - "type": "string" - }, "type": { "type": "string", "enum": [ "SystemAddress" ] + }, + "address": { + "type": "string" } } }, @@ -677,14 +622,14 @@ "type" ], "properties": { - "address": { - "type": "string" - }, "type": { "type": "string", "enum": [ "PackageAddress" ] + }, + "address": { + "type": "string" } } }, @@ -718,17 +663,17 @@ "type" ], "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - }, "type": { "type": "string", "enum": [ "EcdsaSecp256k1PublicKey" ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } }, @@ -740,17 +685,17 @@ "type" ], "properties": { - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - }, "type": { "type": "string", "enum": [ "EcdsaSecp256k1Signature" ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" } } }, @@ -762,17 +707,17 @@ "type" ], "properties": { - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - }, "type": { "type": "string", "enum": [ "EddsaEd25519PublicKey" ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" } } }, @@ -784,17 +729,17 @@ "type" ], "properties": { - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - }, "type": { "type": "string", "enum": [ "EddsaEd25519Signature" ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" } } }, @@ -806,14 +751,14 @@ "type" ], "properties": { - "identifier": { - "$ref": "#/definitions/BucketId" - }, "type": { "type": "string", "enum": [ "Bucket" ] + }, + "identifier": { + "$ref": "#/definitions/BucketId" } } }, @@ -825,14 +770,14 @@ "type" ], "properties": { - "identifier": { - "$ref": "#/definitions/ProofId" - }, "type": { "type": "string", "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, @@ -848,15 +793,15 @@ "variant" ], "properties": { - "value": { - "type": "string", - "pattern": "[0-9]+" - }, "variant": { "type": "string", "enum": [ "U32" ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, @@ -868,15 +813,15 @@ "variant" ], "properties": { - "value": { - "type": "string", - "pattern": "[0-9]+" - }, "variant": { "type": "string", "enum": [ "U64" ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, @@ -888,15 +833,15 @@ "variant" ], "properties": { - "value": { - "type": "string", - "pattern": "[0-9]+" - }, "variant": { "type": "string", "enum": [ "UUID" ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, @@ -908,15 +853,15 @@ "variant" ], "properties": { - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - }, "variant": { "type": "string", "enum": [ "Bytes" ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" } } }, @@ -928,14 +873,14 @@ "variant" ], "properties": { - "value": { - "type": "string" - }, "variant": { "type": "string", "enum": [ "String" ] + }, + "value": { + "type": "string" } } } @@ -961,17 +906,17 @@ "type" ], "properties": { - "non_fungible_id": { - "$ref": "#/definitions/Value" - }, - "resource_address": { - "$ref": "#/definitions/Value" - }, "type": { "type": "string", "enum": [ "NonFungibleAddress" ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" } } }, @@ -1002,14 +947,14 @@ "type" ], "properties": { - "hash": { - "$ref": "#/definitions/Blob" - }, "type": { "type": "string", "enum": [ "Blob" ] + }, + "hash": { + "$ref": "#/definitions/Blob" } } }, @@ -1080,6 +1025,61 @@ "Expression", "Bytes" ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "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": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "maxItems": 64, + "minItems": 64 } } } \ No newline at end of file From 6c8a925bcfb94a470800e3c680ead741ba8cc6bd Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 13 Jan 2023 13:38:29 +0300 Subject: [PATCH 025/110] Update ValueKind enum --- core/src/model/value.rs | 33 +++++++++++++++------------------ schema/schema.json | 27 ++++++++++++--------------- 2 files changed, 27 insertions(+), 33 deletions(-) diff --git a/core/src/model/value.rs b/core/src/model/value.rs index ba9064b6..c47df540 100644 --- a/core/src/model/value.rs +++ b/core/src/model/value.rs @@ -319,21 +319,20 @@ pub enum Value { /// An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is /// essentially the `type` tags used for the value model. pub enum ValueKind { - Unit, Bool, - I8, - I16, - I32, - I64, - I128, - U8, U16, U32, U64, U128, + I8, + I16, + I32, + I64, + I128, + String, Enum, @@ -349,30 +348,28 @@ pub enum ValueKind { Decimal, PreciseDecimal, - Component, - PackageAddress, + Own, + ComponentAddress, ResourceAddress, SystemAddress, + PackageAddress, Hash, + EcdsaSecp256k1PublicKey, + EcdsaSecp256k1Signature, + EddsaEd25519PublicKey, + EddsaEd25519Signature, + Bucket, Proof, - Vault, NonFungibleId, NonFungibleAddress, - KeyValueStore, - - EcdsaSecp256k1PublicKey, - EcdsaSecp256k1Signature, - EddsaEd25519PublicKey, - EddsaEd25519Signature, - - Blob, Expression, + Blob, Bytes, } diff --git a/schema/schema.json b/schema/schema.json index 62a30fed..fdea01d9 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -983,18 +983,17 @@ "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", "enum": [ - "Unit", "Bool", - "I8", - "I16", - "I32", - "I64", - "I128", "U8", "U16", "U32", "U64", "U128", + "I8", + "I16", + "I32", + "I64", + "I128", "String", "Enum", "Some", @@ -1005,24 +1004,22 @@ "Tuple", "Decimal", "PreciseDecimal", - "Component", - "PackageAddress", + "Own", "ComponentAddress", "ResourceAddress", "SystemAddress", + "PackageAddress", "Hash", - "Bucket", - "Proof", - "Vault", - "NonFungibleId", - "NonFungibleAddress", - "KeyValueStore", "EcdsaSecp256k1PublicKey", "EcdsaSecp256k1Signature", "EddsaEd25519PublicKey", "EddsaEd25519Signature", - "Blob", + "Bucket", + "Proof", + "NonFungibleId", + "NonFungibleAddress", "Expression", + "Blob", "Bytes" ] }, From d561f03356a7fcc9c91a80d954b243c224297467 Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 13 Jan 2023 18:11:05 +0300 Subject: [PATCH 026/110] New instructions model --- core/src/model/address/entity_address.rs | 44 + core/src/model/address/mod.rs | 2 + .../src/model/address/non_fungible_address.rs | 1 + core/src/model/engine_identifier/own.rs | 4 +- core/src/model/engine_identifier/re_node.rs | 1 + .../engine_identifier/transient_identifier.rs | 3 + core/src/model/instruction.rs | 658 +++++++ core/src/model/mod.rs | 2 + core/src/model/value.rs | 128 +- core/src/utils.rs | 4 +- format.sh | 1 + rustfmt.toml | 3 + schema/schema.json | 1541 ++++++++++++++++- schema/src/main.rs | 5 +- 14 files changed, 2373 insertions(+), 24 deletions(-) create mode 100644 core/src/model/address/entity_address.rs create mode 100644 core/src/model/instruction.rs create mode 100755 format.sh create mode 100644 rustfmt.toml diff --git a/core/src/model/address/entity_address.rs b/core/src/model/address/entity_address.rs new file mode 100644 index 00000000..6bb62229 --- /dev/null +++ b/core/src/model/address/entity_address.rs @@ -0,0 +1,44 @@ +// ================= +// Model Definition +// ================= + +use crate::model::address::network_aware_address::*; +use serializable::serializable; + +#[serializable] +#[serde(tag = "type", content = "address")] +/// A discriminated union of entity addresses where addresses are serialized as a Bech32m encoded +/// string. +pub enum EntityAddress { + /// Represents a Bech32m encoded human-readable component address. This address is serialized + /// as a human-readable bech32m encoded string. + ComponentAddress { + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + address: NetworkAwareComponentAddress, + }, + + /// Represents a Bech32m encoded human-readable resource address. This address is serialized + /// as a human-readable bech32m encoded string. + ResourceAddress { + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + address: NetworkAwareResourceAddress, + }, + + /// Represents a Bech32m encoded human-readable system address. This address is serialized + /// as a human-readable bech32m encoded string. + SystemAddress { + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + address: NetworkAwareSystemAddress, + }, + + /// Represents a Bech32m encoded human-readable package address. This address is serialized + /// as a human-readable bech32m encoded string. + PackageAddress { + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + address: NetworkAwarePackageAddress, + }, +} diff --git a/core/src/model/address/mod.rs b/core/src/model/address/mod.rs index fdd6d26d..e058c2cf 100644 --- a/core/src/model/address/mod.rs +++ b/core/src/model/address/mod.rs @@ -16,11 +16,13 @@ // under the License. pub mod coder; +pub mod entity_address; pub mod network_aware_address; pub mod non_fungible_address; pub mod non_fungible_id; pub use coder::*; +pub use entity_address::*; pub use network_aware_address::*; pub use non_fungible_address::*; pub use non_fungible_id::*; diff --git a/core/src/model/address/non_fungible_address.rs b/core/src/model/address/non_fungible_address.rs index 14ab4c8c..9f2769bf 100644 --- a/core/src/model/address/non_fungible_address.rs +++ b/core/src/model/address/non_fungible_address.rs @@ -23,6 +23,7 @@ use serializable::serializable; use crate::model::NetworkAwareResourceAddress; #[serializable] +#[derive(Clone)] /// 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. diff --git a/core/src/model/engine_identifier/own.rs b/core/src/model/engine_identifier/own.rs index bd22ae97..7ad1b8c6 100644 --- a/core/src/model/engine_identifier/own.rs +++ b/core/src/model/engine_identifier/own.rs @@ -37,8 +37,8 @@ pub enum Own { /// Represents an owned Vault Vault(NodeIdentifier), - /// Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized - /// as a string + /// Represents an owned Bucket identified through an unsigned 32-bit integer which is + /// serialized as a string Bucket( #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] diff --git a/core/src/model/engine_identifier/re_node.rs b/core/src/model/engine_identifier/re_node.rs index e69de29b..8b137891 100644 --- a/core/src/model/engine_identifier/re_node.rs +++ b/core/src/model/engine_identifier/re_node.rs @@ -0,0 +1 @@ + diff --git a/core/src/model/engine_identifier/transient_identifier.rs b/core/src/model/engine_identifier/transient_identifier.rs index c3f59b5c..ee9efdf3 100644 --- a/core/src/model/engine_identifier/transient_identifier.rs +++ b/core/src/model/engine_identifier/transient_identifier.rs @@ -25,6 +25,7 @@ use std::str::FromStr; #[serializable] #[serde(untagged)] +#[derive(Clone)] /// Represents an untagged 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) @@ -34,10 +35,12 @@ pub enum TransientIdentifier { } #[serializable] +#[derive(Clone)] /// Represents a BucketId which uses a transient identifier. pub struct BucketId(pub TransientIdentifier); #[serializable] +#[derive(Clone)] /// Represents a ProofId which uses a transient identifier. pub struct ProofId(pub TransientIdentifier); diff --git a/core/src/model/instruction.rs b/core/src/model/instruction.rs new file mode 100644 index 00000000..8a2a7cbd --- /dev/null +++ b/core/src/model/instruction.rs @@ -0,0 +1,658 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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::{BTreeMap, HashSet}; + +use crate::engine_identifier::{BucketId, ProofId}; +use crate::model::address::entity_address::*; +use crate::model::address::network_aware_address::*; +use crate::NonFungibleAddress; +use scrypto::prelude::{ + AccessRule, AccessRuleKey, AccessRules, Decimal, EcdsaSecp256k1PublicKey, NonFungibleId, + NonFungibleIdType, ResourceMethodAuthKey, RoyaltyConfig, +}; +use scrypto::runtime::{ManifestBlobRef, Own}; +use serializable::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. +// https://github.com/radixdlt/radixdlt-scrypto/compare/old_commit_hash..new_commit_hash + +/// 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")] +pub enum Instruction { + /// An instruction to call a function with the given list of arguments on the given package + /// address and blueprint name. + CallFunction { + /// The address of the package containing the blueprint that contains the desired function. + /// This package address is serialized as the `PackageAddress` variant of the `Value` + /// model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + package_address: NetworkAwarePackageAddress, + + /// A string of the name of the blueprint containing the desired function. This field is + /// serialized as a `String` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + blueprint_name: String, + + /// A string of the name of the function to call. This field is serialized as a `String` + /// from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + function_name: String, + + /// An optional array of `Value` arguments to call the function with. If this array is + /// empty or is not provided, then the function is called with no arguments. + #[serde(default, skip_serializing_if = "Option::is_none")] + arguments: Option>, + }, + + /// An instruction to call a method with a given name on a given component address with the + /// given list of arguments. + CallMethod { + /// The address of the component which contains the method to be invoked. This field is + /// serialized as a `ComponentAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + component_address: NetworkAwareComponentAddress, + + /// A string of the name of the method to call. his field is serialized as a `String` from + /// the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + method_name: String, + + /// An optional array of `Value` arguments to call the method with. If this array is empty + /// or is not provided, then the method is called with no arguments. + #[serde(default, skip_serializing_if = "Option::is_none")] + arguments: Option>, + }, + + /// An instruction to take the entire amount of a given resource address from the worktop and + /// put it in a bucket. + TakeFromWorktop { + /// The address of the resource to take from the worktop. This field is serialized as a + /// `ResourceAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + resource_address: NetworkAwareResourceAddress, + + /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from + /// the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + into_bucket: BucketId, + }, + + /// An instruction to take the an amount of a given resource address from the worktop and put + /// it in a bucket. + TakeFromWorktopByAmount { + /// The address of the resource to take from the worktop. This field is serialized as a + /// `ResourceAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + resource_address: NetworkAwareResourceAddress, + + /// The amount of the resource to take from the worktop. This field is serialized as a + /// `Decimal` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + amount: Decimal, + + /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from + /// the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + into_bucket: BucketId, + }, + + /// 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. + TakeFromWorktopByIds { + /// The address of the resource to take from the worktop. This field is serialized as a + /// `ResourceAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + resource_address: NetworkAwareResourceAddress, + + /// The non-fungible ids to take from the worktop. This is a set (serialized as a JSON + /// array) of `NonFungibleId`s from the Value model. + #[schemars(with = "HashSet")] + #[serde_as(as = "HashSet>")] + ids: HashSet, + + /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from + /// the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + into_bucket: BucketId, + }, + + /// Returns a bucket of tokens to the worktop. + ReturnToWorktop { + /// The bucket to return to the worktop. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + bucket: BucketId, + }, + + /// An instruction to assert that a given resource exists in the worktop. + AssertWorktopContains { + /// The address of the resource to perform the assertion on. This field is serialized as a + /// `ResourceAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + resource_address: NetworkAwareResourceAddress, + }, + + /// An instruction to assert that a specific amount of a specific resource address exists in + /// the worktop. + AssertWorktopContainsByAmount { + /// The address of the resource to perform the assertion on. This field is serialized as a + /// `ResourceAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + resource_address: NetworkAwareResourceAddress, + + /// The amount of the resource to assert their existence in the worktop. This field is + /// serialized as a `Decimal` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + amount: Decimal, + }, + + /// An instruction to assert that a set ids of a specific resource address exists in the + /// worktop. + AssertWorktopContainsByIds { + /// The address of the resource to perform the assertion on. This field is serialized as a + /// `ResourceAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + resource_address: NetworkAwareResourceAddress, + + /// The non-fungible ids of the resource to assert their existence in the worktop. This is + /// a set (serialized as a JSON array) of `NonFungibleId`s from the Value model. + #[schemars(with = "HashSet")] + #[serde_as(as = "HashSet>")] + ids: HashSet, + }, + + /// An instruction which pops a proof from the AuthZone stack and into an identifiable proof + PopFromAuthZone { + /// The proof to put the popped proof into. This is serialized as a `Proof` from the Value + /// model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + into_proof: ProofId, + }, + + /// An instruction that pushes a proof to the auth zone stack. + PushToAuthZone { + /// The proof to push to the auth zone stack. This is serialized as a `Proof` from the + /// Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + proof: ProofId, + }, + + /// An instruction which clears the auth zone stack by dropping all of the proofs in that + /// stack. + ClearAuthZone, + + /// An instruction to create a proof of the entire amount of a given resource address from the + /// auth zone. + CreateProofFromAuthZone { + /// The address of the resource to create a proof of. This field is serialized as a + /// `ResourceAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + resource_address: NetworkAwareResourceAddress, + + /// A proof to put the resource proof into. This field is serialized as a `Proof` from the + /// Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + into_proof: ProofId, + }, + + /// An instruction to create a proof of the an amount of a given resource address from the auth + /// zone. + CreateProofFromAuthZoneByAmount { + /// The address of the resource to create a proof of. This field is serialized as a + /// `ResourceAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + resource_address: NetworkAwareResourceAddress, + + /// The amount of the resource to create a proof of. This field is serialized as a + /// `Decimal` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + amount: Decimal, + + /// A proof to put the resource proof into. This field is serialized as a `Proof` from the + /// Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + into_proof: ProofId, + }, + + /// An instruction to create a proof of the a set of non-fungible ids of a given resource + /// address from the auth zone. + CreateProofFromAuthZoneByIds { + /// The address of the resource to create a proof of. This field is serialized as a + /// `ResourceAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + resource_address: NetworkAwareResourceAddress, + + /// The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) + /// of `NonFungibleId`s from the Value model. + #[schemars(with = "HashSet")] + #[serde_as(as = "HashSet>")] + ids: HashSet, + + /// A proof to put the resource proof into. This field is serialized as a `Proof` from the + /// Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + into_proof: ProofId, + }, + + /// An instruction to create a proof given a bucket of some resources + CreateProofFromBucket { + /// The bucket of resources to create a proof from. This field is serialized as a `Bucket` + /// from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + bucket: BucketId, + + /// The proof variable that the proof should go to. This field is serialized as a `Proof` + /// from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + into_proof: ProofId, + }, + + /// An instruction to clone a proof creating a second proof identical to the original + CloneProof { + /// The original proof, or the proof to be cloned. This field is serialized as a `Proof` + /// from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + proof: ProofId, + + /// The proof variable that the proof should go to. This field is serialized as a `Proof` + /// from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + into_proof: ProofId, + }, + + /// An instruction to drop a proof. + DropProof { + /// The proof to drop. This field is serialized as a `Proof` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + proof: ProofId, + }, + + /// An instruction to drop all proofs currently present in the transaction context. + DropAllProofs, + + /// An instruction to publish a package and set it's associated royalty configs, metadata, + /// and access rules. + PublishPackage { + /// The blob of the package code. This field is serialized as a `Blob` from the Value + /// model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + code: ManifestBlobRef, + + /// The blob of the package ABI. This field is serialized as a `Blob` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + abi: ManifestBlobRef, + + /// 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 `Array` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + royalty_config: BTreeMap, + + /// 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 `Array` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + metadata: BTreeMap, + + /// The access rules to use for the package. This is serialized as a `Tuple` from the Value + /// model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + access_rules: AccessRules, + }, + + /// An instruction to publish a package with an associated "owner" badge where all of the + /// authority on the package is in the hands of said owner. + PublishPackageWithOwner { + /// The blob of the package code. This field is serialized as a `Blob` from the Value + /// model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + code: ManifestBlobRef, + + /// The blob of the package ABI. This field is serialized as a `Blob` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + abi: ManifestBlobRef, + + /// The non-fungible address of the owner badge of this package. This field is serialized + /// as a `NonFungibleAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + owner_badge: NonFungibleAddress, + }, + + /// An instruction to burn a bucket of tokens. + BurnResource { + /// The bucket of tokens to burn. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + bucket: BucketId, + }, + + /// An instruction ot recall resources from a known vault. + 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`. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + vault_id: Own, + + /// The amount of tokens to recall from the vault. This field is serialized as a `Decimal` + /// field from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + amount: Decimal, + }, + + /// An instruction to set the metadata on an entity. + 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 `SystemAddress`. + entity_address: EntityAddress, + + /// A string of the key to set the metadata for. This field is serialized as a `String` + /// from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + key: String, + + /// A string of the value to set the metadata for. This field is serialized as a `String` + /// from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + value: String, + }, + + /// An instruction to modify the royalties of a package. + SetPackageRoyaltyConfig { + /// The address of the package to set the royalty on. This is serialized as a + /// `PackageAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + package_address: NetworkAwarePackageAddress, + + /// 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 `Array` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + royalty_config: BTreeMap, + }, + + /// An instruction to modify the royalties on a component + SetComponentRoyaltyConfig { + /// The component address of the component to modify royalties for. This field is + /// serialized as a `ComponentAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + component_address: NetworkAwareComponentAddress, + + /// The royalty config to set on the component. This is an `Enum` from the `Value` model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + royalty_config: RoyaltyConfig, + }, + + /// An instruction to claim royalties of a package + ClaimPackageRoyalty { + /// The package address of the package to claim royalties for. This field is serialized as + /// a `PackageAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + package_address: NetworkAwarePackageAddress, + }, + + /// An instruction to claim royalties of a component + ClaimComponentRoyalty { + /// The component address of the component to claim royalties for. This field is serialized + /// as a `ComponentAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + component_address: NetworkAwareComponentAddress, + }, + + /// An instruction to modify the access rules of a method that an entity has. + SetMethodAccessRule { + /// The entity address of the entity to modify the access rules for. + entity_address: EntityAddress, + + /// Entity access rules is a stack of access rules, this index allows referring to a + /// specific "layer" in said stack. This field is serialized as a `U32` from the `Value` + /// model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + index: u32, + + /// The method key for the method to set the access rule of. This field is serialized as an + /// `Enum` from the Value model + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + key: AccessRuleKey, + + /// The new access rule to set in-place of the old one. This field is serialized as an + /// `Enum` from the Value model + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + rule: AccessRule, + }, + + /// An instruction to mint fungible resources + MintFungible { + /// The address of the resource to mint tokens of. This field is serialized as a + /// `ResourceAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + resource_address: NetworkAwareResourceAddress, + + /// The amount of fungible tokens to mint of this resource. This field is serialized as a + /// `Decimal` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + amount: Decimal, + }, + + /// An instruction to mind non-fungibles of a resource + MintNonFungible { + /// The address of the resource to mint tokens of. This field is serialized as a + /// `ResourceAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + resource_address: NetworkAwareResourceAddress, + + /// The non-fungible tokens to mint. The underlying type of this is a map which maps a + /// `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of + /// the immutable and mutable parts of the non-fungible data. + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + entries: BTreeMap, + }, + + /// An instruction to create a new fungible resource. + CreateFungibleResource { + /// The divisibility of the resource. This field is serialized as a `U8` from the Value + /// model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + divisibility: u8, + + /// 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 `Array` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + metadata: BTreeMap, + + /// 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 `Array` from the + /// Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + access_rules: BTreeMap, + + /// An optional decimal value of the initial supply to mint during resource creation. If + /// present, this is serialized as a `Decimal` from the value model. + #[schemars(with = "Option")] + #[serde_as(as = "Option>")] + initial_supply: Option, + }, + + /// An instruction to create a fungible resource with an associated "owner" badge where all of + /// the authority on the resource is in the hands of said owner. + CreateFungibleResourceWithOwner { + /// The divisibility of the resource. This field is serialized as a `U8` from the Value + /// model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + divisibility: u8, + + /// 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 `Array` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + metadata: BTreeMap, + + /// The non-fungible address of the owner badge of this resource. This field is serialized + /// as a `NonFungibleAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + owner_badge: NonFungibleAddress, + + /// An optional decimal value of the initial supply to mint during resource creation. If + /// present, this is serialized as a `Decimal` from the value model. + #[schemars(with = "Option")] + #[serde_as(as = "Option>")] + initial_supply: Option, + }, + + /// An instruction to create a new non-fungible resource. + CreateNonFungibleResource { + /// The type of the non-fungible id to use for this resource. This field is serialized as + /// an `Enum` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + id_type: NonFungibleIdType, + + /// 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 `Array` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + metadata: BTreeMap, + + /// 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 `Array` from the + /// Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + access_rules: BTreeMap, + + /// An optional initial supply for the non-fungible resource being created. The underlying + /// type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` + /// elements where each element is a struct of the immutable and mutable parts of + /// the non-fungible data. + #[schemars(with = "Option")] + #[serde_as(as = "Option")] + initial_supply: Option>, + }, + + /// An instruction to create a non-fungible resource with an associated "owner" badge where all + /// of the authority on the resource is in the hands of said owner. + CreateNonFungibleResourceWithOwner { + /// The type of the non-fungible id to use for this resource. This field is serialized as + /// an `Enum` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + id_type: NonFungibleIdType, + + /// 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 `Array` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "crate::SborValueProxy")] + metadata: BTreeMap, + + /// The non-fungible address of the owner badge of this resource. This field is serialized + /// as a `NonFungibleAddress` from the Value model. + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + owner_badge: NonFungibleAddress, + + /// An optional initial supply for the non-fungible resource being created. The underlying + /// type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` + /// elements where each element is a struct of the immutable and mutable parts of + /// the non-fungible data. + #[schemars(with = "Option")] + #[serde_as(as = "Option")] + initial_supply: Option>, + }, + + /// An instruction to registers a new validator given the public key of the validator + RegisterValidator { + /// The public key of the validator + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + validator: EcdsaSecp256k1PublicKey, + }, + + /// An instruction to unregister a validator given it's public key + UnregisterValidator { + /// The public key of the validator to unregister + #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + validator: EcdsaSecp256k1PublicKey, + }, +} diff --git a/core/src/model/mod.rs b/core/src/model/mod.rs index 5878dda1..276bd861 100644 --- a/core/src/model/mod.rs +++ b/core/src/model/mod.rs @@ -18,11 +18,13 @@ pub mod address; pub mod constants; pub mod engine_identifier; +pub mod instruction; pub mod runtime; pub mod value; pub use address::*; pub use constants::*; pub use engine_identifier::*; +pub use instruction::*; pub use runtime::*; pub use value::*; diff --git a/core/src/model/value.rs b/core/src/model/value.rs index c47df540..d969da2d 100644 --- a/core/src/model/value.rs +++ b/core/src/model/value.rs @@ -19,12 +19,17 @@ use crate::address::network_aware_address::*; use crate::engine_identifier::{BucketId, ProofId}; use crate::NonFungibleAddress; +use sbor::{Decode, Encode}; use scrypto::prelude::{ - Decimal, EcdsaSecp256k1PublicKey, EcdsaSecp256k1Signature, EddsaEd25519PublicKey, - EddsaEd25519Signature, Hash, NonFungibleId, PreciseDecimal, + scrypto_decode, scrypto_encode, Decimal, EcdsaSecp256k1PublicKey, EcdsaSecp256k1Signature, + EddsaEd25519PublicKey, EddsaEd25519Signature, Hash, NonFungibleId, PreciseDecimal, + ScryptoCustomValueKind, ScryptoDecode, ScryptoDecoder, ScryptoEncode, ScryptoEncoder, }; use scrypto::runtime::{ManifestBlobRef, ManifestExpression, Own}; -use serde_with::serde_as; +use serde::de::Error as DeserializationError; +use serde::ser::Error as SerializationError; +use serde::{Deserialize, Serialize}; +use serde_with::{serde_as, DeserializeAs, SerializeAs}; use serializable::serializable; #[serializable] @@ -156,7 +161,8 @@ pub enum Value { /// A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum /// of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and - /// -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively + /// -57896044618658097711785492504343953926634992332820282019728.792003956564819968 + /// respectively Decimal { #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] #[schemars(with = "String")] @@ -165,7 +171,9 @@ pub enum Value { }, /// A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and - /// minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042047 + /// minimum of + /// 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. + /// 9083451713845015929093243025426876941405973284973216824503042047 /// and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 /// respectively PreciseDecimal { @@ -184,28 +192,32 @@ pub enum Value { value: Own, }, - /// Represents a Bech32m encoded human-readable component address + /// Represents a Bech32m encoded human-readable component address. This address is serialized + /// as a human-readable bech32m encoded string. ComponentAddress { #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] address: NetworkAwareComponentAddress, }, - /// Represents a Bech32m encoded human-readable resource address + /// Represents a Bech32m encoded human-readable resource address. This address is serialized + /// as a human-readable bech32m encoded string. ResourceAddress { #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] address: NetworkAwareResourceAddress, }, - /// Represents a Bech32m encoded human-readable system address + /// Represents a Bech32m encoded human-readable system address. This address is serialized + /// as a human-readable bech32m encoded string. SystemAddress { #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] address: NetworkAwareSystemAddress, }, - /// Represents a Bech32m encoded human-readable package address + /// Represents a Bech32m encoded human-readable package address. This address is serialized + /// as a human-readable bech32m encoded string. PackageAddress { #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] @@ -214,8 +226,8 @@ pub enum Value { /// Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The /// hashing function that they use is SHA256 which produces 32 byte long hashes which are - /// serialized as a 64 character long hex string (since hex encoding doubles the number of bytes - /// needed) + /// serialized as a 64 character long hex string (since hex encoding doubles the number of + /// bytes needed) Hash { #[schemars(length(equal = 64))] #[schemars(regex(pattern = "[0-9a-fA-F]+"))] @@ -299,8 +311,8 @@ pub enum Value { 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. + /// Represents the hash of a blob provided as part of a transaction manifest. This is + /// represented as a byte array of 32 bytes which is serialized as a hex string. Blob { #[schemars(with = "crate::Blob")] #[serde_as(as = "serde_with::FromInto")] @@ -379,6 +391,32 @@ impl Value { } } +// ===== +// SBOR +// ===== + +impl<'a> Encode> for Value { + fn encode_value_kind( + &self, + _encoder: &mut ScryptoEncoder<'a>, + ) -> Result<(), sbor::EncodeError> { + todo!() + } + + fn encode_body(&self, _encoder: &mut ScryptoEncoder<'a>) -> Result<(), sbor::EncodeError> { + todo!() + } +} + +impl<'a> Decode> for Value { + fn decode_body_with_value_kind( + _decoder: &mut ScryptoDecoder<'a>, + _value_kind: sbor::ValueKind, + ) -> Result { + todo!() + } +} + // ============ // Conversions // ============ @@ -409,5 +447,69 @@ macro_rules! value_invertible { }; } +value_invertible! {U8, u8, value} +value_invertible! {U32, u32, value} +value_invertible! {Own, Own, value} +value_invertible! {String, String, value} +value_invertible! {Decimal, Decimal, value} +value_invertible! {Proof, ProofId, identifier} +value_invertible! {Blob, ManifestBlobRef, hash} +value_invertible! {Bucket, BucketId, identifier} value_invertible! {NonFungibleId, NonFungibleId, value} +value_invertible! {NonFungibleAddress, NonFungibleAddress, address} +value_invertible! {SystemAddress, NetworkAwareSystemAddress, address} +value_invertible! {PackageAddress, NetworkAwarePackageAddress, address} value_invertible! {ResourceAddress, NetworkAwareResourceAddress, address} +value_invertible! {ComponentAddress, NetworkAwareComponentAddress, address} +value_invertible! {EcdsaSecp256k1PublicKey, EcdsaSecp256k1PublicKey, public_key} + +/// A value proxy allowing any SBOR encodable and decodable type to be represented and serialized as +/// a [`Value`]. +/// +/// # Known Side Effects +/// +/// * Say we have an instruction that accepts a `NonFungibleIdType` and somebody provided a value of +/// `Enum("HashMap")` instead of the supported types. This will result in an SBOR decode error which +/// doesn't quite tell the caller what went wrong, it just tells them that something went wrong. Is +/// this a reasonable price to pay for strong validation? +pub struct SborValueProxy; + +impl SerializeAs for SborValueProxy +where + T: ScryptoEncode, +{ + fn serialize_as(source: &T, serializer: S) -> Result + where + S: serde::Serializer, + { + // Encode the passed value to a byte array + let sbor_bytes = + scrypto_encode(source).map_err(|err| S::Error::custom(format!("{:?}", err)))?; + + // Decode the SBOR bytes as a Value + let value = scrypto_decode::(&sbor_bytes) + .map_err(|err| S::Error::custom(format!("{:?}", err)))?; + + value.serialize(serializer) + } +} + +impl<'de, T> DeserializeAs<'de, T> for SborValueProxy +where + T: ScryptoDecode, +{ + fn deserialize_as(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + // Deserialize it as a value + let value = Value::deserialize(deserializer)?; + + // SBOR encode the deserialized value + let sbor_bytes = + scrypto_encode(&value).map_err(|err| D::Error::custom(format!("{:?}", err)))?; + + // Attempt to decode the SBOR bytes as the type + scrypto_decode::(&sbor_bytes).map_err(|err| D::Error::custom(format!("{:?}", err))) + } +} diff --git a/core/src/utils.rs b/core/src/utils.rs index 5bc00be7..59a6b889 100644 --- a/core/src/utils.rs +++ b/core/src/utils.rs @@ -20,8 +20,8 @@ use bech32; use scrypto::radix_engine_interface::address::AddressError; use scrypto::radix_engine_interface::node::NetworkDefinition; -/// 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 +/// 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(), diff --git a/format.sh b/format.sh new file mode 100755 index 00000000..0b7cef21 --- /dev/null +++ b/format.sh @@ -0,0 +1 @@ +cargo +nightly fmt \ No newline at end of file diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 00000000..a735b984 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,3 @@ +unstable_features = true +wrap_comments = true +comment_width = 100 \ No newline at end of file diff --git a/schema/schema.json b/schema/schema.json index fdea01d9..7431b3f6 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -5,6 +5,12 @@ "anyOf": [ { "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Error" + }, + { + "$ref": "#/definitions/Instruction" } ], "definitions": { @@ -426,7 +432,7 @@ } }, { - "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", "type": "object", "required": [ "type", @@ -558,7 +564,7 @@ } }, { - "description": "Represents a Bech32m encoded human-readable component address", + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", "required": [ "address", @@ -577,7 +583,7 @@ } }, { - "description": "Represents a Bech32m encoded human-readable resource address", + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", "required": [ "address", @@ -596,7 +602,7 @@ } }, { - "description": "Represents a Bech32m encoded human-readable system address", + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", "required": [ "address", @@ -615,7 +621,7 @@ } }, { - "description": "Represents a Bech32m encoded human-readable package address", + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", "required": [ "address", @@ -1077,6 +1083,1531 @@ }, "maxItems": 64, "minItems": 64 + }, + "Error": { + "description": "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.", + "oneOf": [ + { + "description": "An error emitted when the toolkit attempts to decode some string as a hex string and fails", + "type": "object", + "required": [ + "error", + "value" + ], + "properties": { + "error": { + "type": "string", + "enum": [ + "FailedToDecodeHex" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A generic error where an operation expected something to be of one length but it was found to be of a different length", + "type": "object", + "required": [ + "error", + "expected", + "found" + ], + "properties": { + "error": { + "type": "string", + "enum": [ + "InvalidLength" + ] + }, + "expected": { + "description": "The length that the object was expected to be.", + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "found": { + "description": "The length that the object was found to be.", + "type": "integer", + "format": "uint", + "minimum": 0.0 + } + } + }, + { + "description": "Represents an address error encountered during the Bech32 encoding or decoding phase", + "type": "object", + "required": [ + "error", + "value" + ], + "properties": { + "error": { + "type": "string", + "enum": [ + "AddressError" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "An error emitted when the passed `Value` is not one of the accepted value types for a given request or operation.", + "type": "object", + "required": [ + "error", + "expected", + "found" + ], + "properties": { + "error": { + "type": "string", + "enum": [ + "InvalidKind" + ] + }, + "expected": { + "description": "A set of the expected `ValueKind`s for a given request or operation (this set forms an 'or' and not an 'and').", + "type": "array", + "items": { + "$ref": "#/definitions/ValueKind" + } + }, + "found": { + "description": "The `ValueKind` that was found.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + } + } + } + ] + }, + "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.", + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "blueprint_name": { + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "function_name": { + "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "method_name": { + "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + }, + "uniqueItems": true + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "Returns a bucket of tokens to the 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/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a given resource exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + }, + "uniqueItems": true + } + } + }, + { + "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction that pushes a proof to the auth zone stack.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_AUTH_ZONE" + ] + } + } + }, + { + "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "type": "object", + "required": [ + "ids", + "instruction", + "into_proof", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" + ] + }, + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + }, + "uniqueItems": true + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof given a bucket of some resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to clone a proof creating a second proof identical to the original", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop a 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop all proofs currently present in the transaction context.", + "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.", + "type": "object", + "required": [ + "abi", + "access_rules", + "code", + "instruction", + "metadata", + "royalty_config" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "metadata": { + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + "type": "object", + "required": [ + "abi", + "code", + "instruction", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE_WITH_OWNER" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to burn a bucket of tokens.", + "type": "object", + "required": [ + "bucket", + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "BURN_RESOURCE" + ] + }, + "bucket": { + "description": "The bucket of tokens to burn.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction ot recall resources from a known vault.", + "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/Value" + } + ] + }, + "amount": { + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "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 `SystemAddress`.", + "allOf": [ + { + "$ref": "#/definitions/EntityAddress" + } + ] + }, + "key": { + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "value": { + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties of a package.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties on a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a package", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the access rules of a method that an entity has.", + "type": "object", + "required": [ + "entity_address", + "index", + "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/EntityAddress" + } + ] + }, + "index": { + "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "rule": { + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mint fungible resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mind non-fungibles of a resource", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new fungible resource.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "anyOf": [ + { + "$ref": "#/definitions/Value" + }, + { + "type": "null" + } + ] + } + } + }, + { + "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "divisibility", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "divisibility": { + "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "anyOf": [ + { + "$ref": "#/definitions/Value" + }, + { + "type": "null" + } + ] + } + } + }, + { + "description": "An instruction to create a new non-fungible resource.", + "type": "object", + "required": [ + "access_rules", + "id_type", + "instruction", + "metadata" + ], + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "anyOf": [ + { + "$ref": "#/definitions/Value" + }, + { + "type": "null" + } + ] + } + } + }, + { + "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "id_type", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "id_type": { + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "anyOf": [ + { + "$ref": "#/definitions/Value" + }, + { + "type": "null" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to unregister a validator given it's public key", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "UNREGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator to unregister", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + } + ] + }, + "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.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + } + } + ] } } } \ No newline at end of file diff --git a/schema/src/main.rs b/schema/src/main.rs index fbea3461..61c346bd 100644 --- a/schema/src/main.rs +++ b/schema/src/main.rs @@ -1,4 +1,3 @@ -use core::Value; use std::io::Write; use schemars::{schema_for, JsonSchema}; @@ -22,7 +21,9 @@ pub fn generate_json_schema() -> Result<(), JsonSchemaGenerationError> { /// This schema has been automatically generated and therefore should hopefully always be the /// ground truth for the Radix Engine Toolkit models pub enum RadixEngineToolkit { - Value(Value), + Value(core::Value), + Error(core::Error), + Instruction(core::Instruction), } // Generating the Radix Engine Toolkit schema From 4eadcdf8f7d6ff436398e1647a72e1f910ff402c Mon Sep 17 00:00:00 2001 From: Omar Date: Sat, 14 Jan 2023 03:06:35 +0300 Subject: [PATCH 027/110] License --- core/src/model/address/entity_address.rs | 17 +++++++++++++++++ core/src/model/instruction.rs | 2 +- core/src/model/transaction/mod.rs | 0 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 core/src/model/transaction/mod.rs diff --git a/core/src/model/address/entity_address.rs b/core/src/model/address/entity_address.rs index 6bb62229..b28efbda 100644 --- a/core/src/model/address/entity_address.rs +++ b/core/src/model/address/entity_address.rs @@ -1,3 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + // ================= // Model Definition // ================= diff --git a/core/src/model/instruction.rs b/core/src/model/instruction.rs index 8a2a7cbd..17a64650 100644 --- a/core/src/model/instruction.rs +++ b/core/src/model/instruction.rs @@ -31,7 +31,7 @@ use serializable::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. +// 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 /// The Instruction model defines the structure that transaction manifest instructions follow during diff --git a/core/src/model/transaction/mod.rs b/core/src/model/transaction/mod.rs new file mode 100644 index 00000000..e69de29b From 62fa4fbc2cd328dc869362b6c9dd67fcc78b7bce Mon Sep 17 00:00:00 2001 From: Omar Date: Sat, 14 Jan 2023 04:13:42 +0300 Subject: [PATCH 028/110] transaction and crypto models --- core/src/model/crypto/mod.rs | 24 +++++ core/src/model/crypto/public_key.rs | 74 +++++++++++++ core/src/model/crypto/signature.rs | 78 ++++++++++++++ .../model/crypto/signature_with_public_key.rs | 101 ++++++++++++++++++ core/src/model/mod.rs | 4 + core/src/model/transaction/header.rs | 74 +++++++++++++ core/src/model/transaction/instructions.rs | 30 ++++++ core/src/model/transaction/intent.rs | 31 ++++++ core/src/model/transaction/manifest.rs | 32 ++++++ core/src/model/transaction/mod.rs | 30 ++++++ .../src/model/transaction/notarized_intent.rs | 34 ++++++ core/src/model/transaction/signed_intent.rs | 33 ++++++ core/src/model/value.rs | 6 +- 13 files changed, 548 insertions(+), 3 deletions(-) create mode 100644 core/src/model/crypto/mod.rs create mode 100644 core/src/model/crypto/public_key.rs create mode 100644 core/src/model/crypto/signature.rs create mode 100644 core/src/model/crypto/signature_with_public_key.rs create mode 100644 core/src/model/transaction/header.rs create mode 100644 core/src/model/transaction/instructions.rs create mode 100644 core/src/model/transaction/intent.rs create mode 100644 core/src/model/transaction/manifest.rs create mode 100644 core/src/model/transaction/notarized_intent.rs create mode 100644 core/src/model/transaction/signed_intent.rs diff --git a/core/src/model/crypto/mod.rs b/core/src/model/crypto/mod.rs new file mode 100644 index 00000000..953320a9 --- /dev/null +++ b/core/src/model/crypto/mod.rs @@ -0,0 +1,24 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT 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 public_key; +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/core/src/model/crypto/public_key.rs b/core/src/model/crypto/public_key.rs new file mode 100644 index 00000000..5d05e588 --- /dev/null +++ b/core/src/model/crypto/public_key.rs @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use scrypto::prelude::{EcdsaSecp256k1PublicKey, EddsaEd25519PublicKey}; +use serializable::serializable; + +// ================= +// Model Definition +// ================= + +/// A discriminated union of the possible public keys used by Scrypto and the Radix Engine. +#[serializable] +#[serde(tag = "curve", content = "public_key")] +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. + 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. + 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/core/src/model/crypto/signature.rs b/core/src/model/crypto/signature.rs new file mode 100644 index 00000000..d7237423 --- /dev/null +++ b/core/src/model/crypto/signature.rs @@ -0,0 +1,78 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use scrypto::prelude::{EcdsaSecp256k1Signature, EddsaEd25519Signature}; +use serializable::serializable; + +// ================= +// Model Definition +// ================= + +/// A discriminated union of the possible cryptographic signatures used by Scrypto and the Radix +/// Engine. +#[serializable] +#[serde(tag = "curve", content = "signature")] +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. + 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. + 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 scrypto::prelude::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: scrypto::prelude::Signature) -> Self { + match value { + scrypto::prelude::Signature::EcdsaSecp256k1(signature) => { + Self::EcdsaSecp256k1 { signature } + } + scrypto::prelude::Signature::EddsaEd25519(signature) => { + Self::EddsaEd25519 { signature } + } + } + } +} diff --git a/core/src/model/crypto/signature_with_public_key.rs b/core/src/model/crypto/signature_with_public_key.rs new file mode 100644 index 00000000..58c51efd --- /dev/null +++ b/core/src/model/crypto/signature_with_public_key.rs @@ -0,0 +1,101 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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::{EcdsaSecp256k1Signature, EddsaEd25519PublicKey, EddsaEd25519Signature}; +use serializable::serializable; + +// ================= +// Model Definition +// ================= + +/// A discriminated union of the possible pairs of signatures and public keys used by Scrypto and +/// the Radix Engine. +#[serializable] +pub enum SignatureWithPublicKey { + /// Cryptographic signature and public key for Ecdsa Secp256k1 + 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 + 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 scrypto::prelude::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: scrypto::prelude::SignatureWithPublicKey) -> Self { + match value { + scrypto::prelude::SignatureWithPublicKey::EcdsaSecp256k1 { signature } => { + Self::EcdsaSecp256k1 { signature } + } + scrypto::prelude::SignatureWithPublicKey::EddsaEd25519 { + signature, + public_key, + } => Self::EddsaEd25519 { + signature, + public_key, + }, + } + } +} diff --git a/core/src/model/mod.rs b/core/src/model/mod.rs index 276bd861..5c6e1402 100644 --- a/core/src/model/mod.rs +++ b/core/src/model/mod.rs @@ -17,14 +17,18 @@ pub mod address; pub mod constants; +pub mod crypto; pub mod engine_identifier; pub mod instruction; pub mod runtime; +pub mod transaction; pub mod value; pub use address::*; pub use constants::*; +pub use crypto::*; pub use engine_identifier::*; pub use instruction::*; pub use runtime::*; +pub use transaction::*; pub use value::*; diff --git a/core/src/model/transaction/header.rs b/core/src/model/transaction/header.rs new file mode 100644 index 00000000..e29d6bfe --- /dev/null +++ b/core/src/model/transaction/header.rs @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use serializable::serializable; + +/// A transaction header containing metadata and other transaction information. +#[serializable] +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, +} diff --git a/core/src/model/transaction/instructions.rs b/core/src/model/transaction/instructions.rs new file mode 100644 index 00000000..f91ea45d --- /dev/null +++ b/core/src/model/transaction/instructions.rs @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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; +use serializable::serializable; + +/// 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 ManifestInstructions { + String(String), + Parsed(Vec), +} diff --git a/core/src/model/transaction/intent.rs b/core/src/model/transaction/intent.rs new file mode 100644 index 00000000..752d4c46 --- /dev/null +++ b/core/src/model/transaction/intent.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 serializable::serializable; + +use crate::{TransactionHeader, TransactionManifest}; + +/// A transaction intent which is made of the header containing the transaction metadata and a +/// manifest consisting of the instructions and blobs. +#[serializable] +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, +} diff --git a/core/src/model/transaction/manifest.rs b/core/src/model/transaction/manifest.rs new file mode 100644 index 00000000..6a67becd --- /dev/null +++ b/core/src/model/transaction/manifest.rs @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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::ManifestInstructions; +use serializable::serializable; + +/// A transaction intent consisting of instructions as well as blobs +#[serializable] +pub struct TransactionManifest { + /// The transaction manifest instructions to be executed in the transaction. + pub instructions: ManifestInstructions, + + /// 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>, +} diff --git a/core/src/model/transaction/mod.rs b/core/src/model/transaction/mod.rs index e69de29b..68ab9d0a 100644 --- a/core/src/model/transaction/mod.rs +++ b/core/src/model/transaction/mod.rs @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT 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 instructions; +pub mod intent; +pub mod manifest; +pub mod notarized_intent; +pub mod signed_intent; + +pub use header::*; +pub use instructions::*; +pub use intent::*; +pub use manifest::*; +pub use notarized_intent::*; +pub use signed_intent::*; diff --git a/core/src/model/transaction/notarized_intent.rs b/core/src/model/transaction/notarized_intent.rs new file mode 100644 index 00000000..7b670cf6 --- /dev/null +++ b/core/src/model/transaction/notarized_intent.rs @@ -0,0 +1,34 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use scrypto::prelude::Signature; +use serializable::serializable; + +use crate::SignedTransactionIntent; + +/// A notarized transaction intent which is made up of a signed transaction intent and the notary +/// intent on said signed intent. +#[serializable] +pub struct NotarizedTransactionIntent { + /// 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: Signature, +} diff --git a/core/src/model/transaction/signed_intent.rs b/core/src/model/transaction/signed_intent.rs new file mode 100644 index 00000000..13adfcd8 --- /dev/null +++ b/core/src/model/transaction/signed_intent.rs @@ -0,0 +1,33 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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::SignatureWithPublicKey; +use serializable::serializable; + +use crate::TransactionIntent; + +/// A signed transaction intent which is made up of the intent as well as the intent signatures. +#[serializable] +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, +} diff --git a/core/src/model/value.rs b/core/src/model/value.rs index d969da2d..3d8f4cbf 100644 --- a/core/src/model/value.rs +++ b/core/src/model/value.rs @@ -32,10 +32,10 @@ use serde::{Deserialize, Serialize}; use serde_with::{serde_as, DeserializeAs, SerializeAs}; use serializable::serializable; -#[serializable] -#[serde(tag = "type")] /// The Value model used to describe all of the types that the Radix Engine Toolkit accepts and /// returns. +#[serializable] +#[serde(tag = "type")] pub enum Value { /// A boolean value which can either be true or false Bool { value: bool }, @@ -250,7 +250,7 @@ pub enum Value { /// 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. The use of other signature format + /// and are 32 bytes each. EcdsaSecp256k1Signature { #[schemars(length(equal = 130))] #[schemars(regex(pattern = "[0-9a-fA-F]+"))] From 2010c7b17ba286c68963a591e2a20973e325d8e6 Mon Sep 17 00:00:00 2001 From: Omar Date: Sun, 15 Jan 2023 14:53:22 +0300 Subject: [PATCH 029/110] Remove SBOR serialization proxy --- core/src/error.rs | 25 +- .../engine_identifier/transient_identifier.rs | 62 ++ core/src/model/instruction.rs | 61 +- core/src/model/value.rs | 575 +++++++++++++++--- 4 files changed, 598 insertions(+), 125 deletions(-) diff --git a/core/src/error.rs b/core/src/error.rs index 0f9e889a..4e4a497b 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -17,8 +17,6 @@ use std::fmt::Display; -use hex::FromHexError; -use scrypto::radix_engine_interface::address::AddressError; use serializable::serializable; use crate::ValueKind; @@ -56,6 +54,21 @@ pub enum Error { /// The `ValueKind` that was found. found: ValueKind, }, + + // ===== + // SBOR + // ===== + /// An error emitted when some object of some value kind can not be encoded in SBOR without + /// additional context. This error is typically seen in situations when trying to encode either + /// a `Bucket("some_string")` or a `Proof("some_string")` as buckets or proofs with String + /// identifiers can not be encoded in SBOR without an ID Allocator. + BucketOrProofSBORError { value_kind: ValueKind }, + + /// Represents an error when trying to encode some object in SBOR. + SborEncodeError { value: String }, + + /// Represents an error when trying to decode some object in SBOR. + SborDecodeError { value: String }, } impl Display for Error { @@ -71,7 +84,7 @@ macro_rules! to_debug_string { } macro_rules! generate_from_error { - ($error: ident as $variant: ident) => { + ($error: ty as $variant: ident) => { impl From<$error> for Error { fn from(value: $error) -> Self { Self::$variant { @@ -82,8 +95,10 @@ macro_rules! generate_from_error { }; } -generate_from_error!(FromHexError as FailedToDecodeHex); -generate_from_error!(AddressError as AddressError); +generate_from_error!(hex::FromHexError as FailedToDecodeHex); +generate_from_error!(scrypto::radix_engine_interface::address::AddressError as AddressError); +generate_from_error!(sbor::EncodeError as SborEncodeError); +generate_from_error!(sbor::DecodeError as SborDecodeError); /// 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/core/src/model/engine_identifier/transient_identifier.rs b/core/src/model/engine_identifier/transient_identifier.rs index ee9efdf3..962b1335 100644 --- a/core/src/model/engine_identifier/transient_identifier.rs +++ b/core/src/model/engine_identifier/transient_identifier.rs @@ -16,6 +16,8 @@ // under the License. use crate::{Error, Result}; +use scrypto::prelude::ScryptoCustomValue; +use scrypto::runtime::{ManifestBucket, ManifestProof}; use serializable::serializable; use std::str::FromStr; @@ -91,3 +93,63 @@ impl From for TransientIdentifier { proof_id.0 } } + +impl TryFrom for ScryptoCustomValue { + type Error = Error; + + fn try_from(value: BucketId) -> std::result::Result { + match value.0 { + TransientIdentifier::U32(identifier) => { + Ok(ScryptoCustomValue::Bucket(ManifestBucket(identifier))) + } + TransientIdentifier::String(..) => Err(Error::BucketOrProofSBORError { + value_kind: crate::ValueKind::Bucket, + }), + } + } +} + +impl TryFrom<&BucketId> for ScryptoCustomValue { + type Error = Error; + + fn try_from(value: &BucketId) -> std::result::Result { + match &value.0 { + TransientIdentifier::U32(identifier) => { + Ok(ScryptoCustomValue::Bucket(ManifestBucket(*identifier))) + } + TransientIdentifier::String(..) => Err(Error::BucketOrProofSBORError { + value_kind: crate::ValueKind::Bucket, + }), + } + } +} + +impl TryFrom for ScryptoCustomValue { + type Error = Error; + + fn try_from(value: ProofId) -> std::result::Result { + match value.0 { + TransientIdentifier::U32(identifier) => { + Ok(ScryptoCustomValue::Proof(ManifestProof(identifier))) + } + TransientIdentifier::String(..) => Err(Error::BucketOrProofSBORError { + value_kind: crate::ValueKind::Proof, + }), + } + } +} + +impl TryFrom<&ProofId> for ScryptoCustomValue { + type Error = Error; + + fn try_from(value: &ProofId) -> std::result::Result { + match &value.0 { + TransientIdentifier::U32(identifier) => { + Ok(ScryptoCustomValue::Proof(ManifestProof(*identifier))) + } + TransientIdentifier::String(..) => Err(Error::BucketOrProofSBORError { + value_kind: crate::ValueKind::Proof, + }), + } + } +} diff --git a/core/src/model/instruction.rs b/core/src/model/instruction.rs index 17a64650..6ca1923b 100644 --- a/core/src/model/instruction.rs +++ b/core/src/model/instruction.rs @@ -15,16 +15,13 @@ // specific language governing permissions and limitations // under the License. -use std::collections::{BTreeMap, HashSet}; +use std::collections::HashSet; use crate::engine_identifier::{BucketId, ProofId}; use crate::model::address::entity_address::*; use crate::model::address::network_aware_address::*; use crate::NonFungibleAddress; -use scrypto::prelude::{ - AccessRule, AccessRuleKey, AccessRules, Decimal, EcdsaSecp256k1PublicKey, NonFungibleId, - NonFungibleIdType, ResourceMethodAuthKey, RoyaltyConfig, -}; +use scrypto::prelude::{Decimal, EcdsaSecp256k1PublicKey, NonFungibleId}; use scrypto::runtime::{ManifestBlobRef, Own}; use serializable::serializable; @@ -338,20 +335,17 @@ pub enum Instruction { /// where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. /// This is serialized as an `Array` from the Value model. #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - royalty_config: BTreeMap, + royalty_config: crate::Value, /// 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 `Array` from the Value model. #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - metadata: BTreeMap, + metadata: crate::Value, /// The access rules to use for the package. This is serialized as a `Tuple` from the Value /// model. #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - access_rules: AccessRules, + access_rules: crate::Value, }, /// An instruction to publish a package with an associated "owner" badge where all of the @@ -430,8 +424,7 @@ pub enum Instruction { /// where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. /// This is serialized as an `Array` from the Value model. #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - royalty_config: BTreeMap, + royalty_config: crate::Value, }, /// An instruction to modify the royalties on a component @@ -444,8 +437,7 @@ pub enum Instruction { /// The royalty config to set on the component. This is an `Enum` from the `Value` model. #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - royalty_config: RoyaltyConfig, + royalty_config: crate::Value, }, /// An instruction to claim royalties of a package @@ -481,14 +473,12 @@ pub enum Instruction { /// The method key for the method to set the access rule of. This field is serialized as an /// `Enum` from the Value model #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - key: AccessRuleKey, + key: crate::Value, /// The new access rule to set in-place of the old one. This field is serialized as an /// `Enum` from the Value model #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - rule: AccessRule, + rule: crate::Value, }, /// An instruction to mint fungible resources @@ -518,8 +508,7 @@ pub enum Instruction { /// `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of /// the immutable and mutable parts of the non-fungible data. #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - entries: BTreeMap, + entries: crate::Value, }, /// An instruction to create a new fungible resource. @@ -533,16 +522,14 @@ pub enum Instruction { /// 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 `Array` from the Value model. #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - metadata: BTreeMap, + metadata: crate::Value, /// The access rules to use for the resource. The underlying type of this is a map which /// maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the /// current behavior and the mutability. This is serialized as an `Array` from the /// Value model. #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - access_rules: BTreeMap, + access_rules: crate::Value, /// An optional decimal value of the initial supply to mint during resource creation. If /// present, this is serialized as a `Decimal` from the value model. @@ -563,8 +550,7 @@ pub enum Instruction { /// 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 `Array` from the Value model. #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - metadata: BTreeMap, + metadata: crate::Value, /// The non-fungible address of the owner badge of this resource. This field is serialized /// as a `NonFungibleAddress` from the Value model. @@ -584,30 +570,26 @@ pub enum Instruction { /// The type of the non-fungible id to use for this resource. This field is serialized as /// an `Enum` from the Value model. #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - id_type: NonFungibleIdType, + id_type: crate::Value, /// 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 `Array` from the Value model. #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - metadata: BTreeMap, + metadata: crate::Value, /// The access rules to use for the resource. The underlying type of this is a map which /// maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the /// current behavior and the mutability. This is serialized as an `Array` from the /// Value model. #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - access_rules: BTreeMap, + access_rules: crate::Value, /// An optional initial supply for the non-fungible resource being created. The underlying /// type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` /// elements where each element is a struct of the immutable and mutable parts of /// the non-fungible data. #[schemars(with = "Option")] - #[serde_as(as = "Option")] - initial_supply: Option>, + initial_supply: crate::Value, }, /// An instruction to create a non-fungible resource with an associated "owner" badge where all @@ -616,14 +598,12 @@ pub enum Instruction { /// The type of the non-fungible id to use for this resource. This field is serialized as /// an `Enum` from the Value model. #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - id_type: NonFungibleIdType, + id_type: crate::Value, /// 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 `Array` from the Value model. #[schemars(with = "crate::Value")] - #[serde_as(as = "crate::SborValueProxy")] - metadata: BTreeMap, + metadata: crate::Value, /// The non-fungible address of the owner badge of this resource. This field is serialized /// as a `NonFungibleAddress` from the Value model. @@ -636,8 +616,7 @@ pub enum Instruction { /// elements where each element is a struct of the immutable and mutable parts of /// the non-fungible data. #[schemars(with = "Option")] - #[serde_as(as = "Option")] - initial_supply: Option>, + initial_supply: crate::Value, }, /// An instruction to registers a new validator given the public key of the validator diff --git a/core/src/model/value.rs b/core/src/model/value.rs index 3d8f4cbf..2569c35e 100644 --- a/core/src/model/value.rs +++ b/core/src/model/value.rs @@ -15,27 +15,26 @@ // specific language governing permissions and limitations // under the License. -use crate::address::network_aware_address::*; +use crate::address::*; use crate::engine_identifier::{BucketId, ProofId}; -use crate::NonFungibleAddress; +use crate::error::{Error, Result}; +use crate::TransientIdentifier; -use sbor::{Decode, Encode}; +use scrypto::prelude::ScryptoCustomValue; use scrypto::prelude::{ scrypto_decode, scrypto_encode, Decimal, EcdsaSecp256k1PublicKey, EcdsaSecp256k1Signature, EddsaEd25519PublicKey, EddsaEd25519Signature, Hash, NonFungibleId, PreciseDecimal, - ScryptoCustomValueKind, ScryptoDecode, ScryptoDecoder, ScryptoEncode, ScryptoEncoder, + ScryptoCustomValueKind, ScryptoValue, ScryptoValueKind, }; use scrypto::runtime::{ManifestBlobRef, ManifestExpression, Own}; -use serde::de::Error as DeserializationError; -use serde::ser::Error as SerializationError; -use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, DeserializeAs, SerializeAs}; +use serde_with::serde_as; use serializable::serializable; /// The Value model used to describe all of the types that the Radix Engine Toolkit accepts and /// returns. #[serializable] #[serde(tag = "type")] +#[derive(Clone)] pub enum Value { /// A boolean value which can either be true or false Bool { value: bool }, @@ -327,9 +326,10 @@ pub enum Value { }, } -#[serializable] /// An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is /// essentially the `type` tags used for the value model. +#[serializable] +#[derive(Clone, Copy)] pub enum ValueKind { Bool, @@ -386,34 +386,502 @@ pub enum ValueKind { } impl Value { + /// SBOR Encodes a [`Value`]. + pub fn encode(&self) -> Result> { + // Convert the value first to a Scrypto value + let scrypto_value = self.to_scrypto_value()?; + + // SBOR encode the Scrypto Value and return the result + scrypto_encode(&scrypto_value).map_err(Error::from) + } + + /// Decodes an SBOR payload to a [`Value`] given the network context. + pub fn decode>(bytes: T, network_id: u8) -> Result { + scrypto_decode::(bytes.as_ref()) + .map(|scrypto_value| Self::from_scrypto_value(&scrypto_value, network_id)) + .map_err(Error::from) + } + + /// Gets the [`ValueKind`] for the given value pub fn kind(&self) -> ValueKind { - todo!() + match self { + Self::Bool { .. } => ValueKind::Bool, + + Self::I8 { .. } => ValueKind::I8, + Self::I16 { .. } => ValueKind::I16, + Self::I32 { .. } => ValueKind::I32, + Self::I64 { .. } => ValueKind::I64, + Self::I128 { .. } => ValueKind::I128, + + Self::U8 { .. } => ValueKind::U8, + Self::U16 { .. } => ValueKind::U16, + Self::U32 { .. } => ValueKind::U32, + Self::U64 { .. } => ValueKind::U64, + Self::U128 { .. } => ValueKind::U128, + + Self::String { .. } => ValueKind::String, + + Self::Enum { .. } => ValueKind::Enum, + + Self::Some { .. } => ValueKind::Some, + Self::None => ValueKind::None, + Self::Ok { .. } => ValueKind::Ok, + Self::Err { .. } => ValueKind::Err, + + Self::Array { .. } => ValueKind::Array, + Self::Tuple { .. } => ValueKind::Tuple, + + Self::Decimal { .. } => ValueKind::Decimal, + Self::PreciseDecimal { .. } => ValueKind::PreciseDecimal, + + Self::PackageAddress { .. } => ValueKind::PackageAddress, + Self::ComponentAddress { .. } => ValueKind::ComponentAddress, + Self::ResourceAddress { .. } => ValueKind::ResourceAddress, + Self::SystemAddress { .. } => ValueKind::SystemAddress, + + Self::Hash { .. } => ValueKind::Hash, + + Self::Bucket { .. } => ValueKind::Bucket, + Self::Proof { .. } => ValueKind::Proof, + + Self::NonFungibleId { .. } => ValueKind::NonFungibleId, + Self::NonFungibleAddress { .. } => ValueKind::NonFungibleAddress, + + Self::EcdsaSecp256k1PublicKey { .. } => ValueKind::EcdsaSecp256k1PublicKey, + Self::EcdsaSecp256k1Signature { .. } => ValueKind::EcdsaSecp256k1Signature, + Self::EddsaEd25519PublicKey { .. } => ValueKind::EddsaEd25519PublicKey, + Self::EddsaEd25519Signature { .. } => ValueKind::EddsaEd25519Signature, + + Self::Blob { .. } => ValueKind::Blob, + Self::Expression { .. } => ValueKind::Expression, + Self::Bytes { .. } => ValueKind::Bytes, + Self::Own { .. } => ValueKind::Own, + } } -} -// ===== -// SBOR -// ===== + /// Converts a [`Value`] to a [`ScryptoValue`]. + pub fn to_scrypto_value(&self) -> Result { + let value = match self { + Self::Bool { value } => ScryptoValue::Bool { value: *value }, + + Self::U8 { value } => ScryptoValue::U8 { value: *value }, + Self::U16 { value } => ScryptoValue::U16 { value: *value }, + Self::U32 { value } => ScryptoValue::U32 { value: *value }, + Self::U64 { value } => ScryptoValue::U64 { value: *value }, + Self::U128 { value } => ScryptoValue::U128 { value: *value }, + + Self::I8 { value } => ScryptoValue::I8 { value: *value }, + Self::I16 { value } => ScryptoValue::I16 { value: *value }, + Self::I32 { value } => ScryptoValue::I32 { value: *value }, + Self::I64 { value } => ScryptoValue::I64 { value: *value }, + Self::I128 { value } => ScryptoValue::I128 { value: *value }, + + Self::String { value } => ScryptoValue::String { + value: value.clone(), + }, + Self::Enum { variant, fields } => ScryptoValue::Enum { + discriminator: variant.clone(), + fields: fields + .clone() + .unwrap_or_default() + .into_iter() + .map(|value| value.to_scrypto_value()) + .collect::>>()?, + }, + Self::Some { value } => ScryptoValue::Enum { + discriminator: "Some".into(), + fields: vec![value.to_scrypto_value()?], + }, + Self::None => ScryptoValue::Enum { + discriminator: "None".into(), + fields: Vec::new(), + }, + Self::Ok { value } => ScryptoValue::Enum { + discriminator: "Ok".into(), + fields: vec![value.to_scrypto_value()?], + }, + Self::Err { value } => ScryptoValue::Enum { + discriminator: "Err".into(), + fields: vec![value.to_scrypto_value()?], + }, + Self::Array { + element_kind, + elements, + } => ScryptoValue::Array { + element_value_kind: (*element_kind).into(), + elements: elements + .clone() + .into_iter() + .map(|value| value.to_scrypto_value()) + .collect::>>()?, + }, + Self::Tuple { elements } => ScryptoValue::Tuple { + fields: elements + .clone() + .into_iter() + .map(|value| value.to_scrypto_value()) + .collect::>>()?, + }, + + Self::Decimal { value } => ScryptoValue::Custom { + value: ScryptoCustomValue::Decimal(*value), + }, + Self::PreciseDecimal { value } => ScryptoValue::Custom { + value: ScryptoCustomValue::PreciseDecimal(*value), + }, + Self::ComponentAddress { address } => ScryptoValue::Custom { + value: ScryptoCustomValue::ComponentAddress(address.address), + }, + Self::PackageAddress { address } => ScryptoValue::Custom { + value: ScryptoCustomValue::PackageAddress(address.address), + }, + Self::ResourceAddress { address } => ScryptoValue::Custom { + value: ScryptoCustomValue::ResourceAddress(address.address), + }, + Self::SystemAddress { address } => ScryptoValue::Custom { + value: ScryptoCustomValue::SystemAddress(address.address), + }, + + Self::Hash { value } => ScryptoValue::Custom { + value: ScryptoCustomValue::Hash(*value), + }, + + Self::EcdsaSecp256k1PublicKey { public_key } => ScryptoValue::Custom { + value: ScryptoCustomValue::EcdsaSecp256k1PublicKey(*public_key), + }, + Self::EddsaEd25519PublicKey { public_key } => ScryptoValue::Custom { + value: ScryptoCustomValue::EddsaEd25519PublicKey(*public_key), + }, + + Self::EcdsaSecp256k1Signature { signature } => ScryptoValue::Custom { + value: ScryptoCustomValue::EcdsaSecp256k1Signature(*signature), + }, + Self::EddsaEd25519Signature { signature } => ScryptoValue::Custom { + value: ScryptoCustomValue::EddsaEd25519Signature(*signature), + }, + + Self::Bucket { identifier } => ScryptoValue::Custom { + value: identifier.try_into()?, + }, + Self::Proof { identifier } => ScryptoValue::Custom { + value: identifier.try_into()?, + }, + + Self::NonFungibleId { value } => ScryptoValue::Custom { + value: ScryptoCustomValue::NonFungibleId(value.clone()), + }, + Self::NonFungibleAddress { address } => ScryptoValue::Tuple { + fields: vec![ + Self::ResourceAddress { + address: address.resource_address.clone(), + } + .to_scrypto_value()?, + Self::NonFungibleId { + value: address.non_fungible_id.clone(), + } + .to_scrypto_value()?, + ], + }, + + Self::Blob { hash } => ScryptoValue::Custom { + value: ScryptoCustomValue::Blob(hash.clone()), + }, + Self::Expression { value } => ScryptoValue::Custom { + value: ScryptoCustomValue::Expression(value.clone()), + }, + Self::Bytes { value } => ScryptoValue::Array { + element_value_kind: ScryptoValueKind::U8, + elements: value + .clone() + .into_iter() + .map(|value| ScryptoValue::U8 { value }) + .collect(), + }, + + Self::Own { value } => ScryptoValue::Custom { + value: ScryptoCustomValue::Own(value.clone()), + }, + }; + Ok(value) + } -impl<'a> Encode> for Value { - fn encode_value_kind( - &self, - _encoder: &mut ScryptoEncoder<'a>, - ) -> Result<(), sbor::EncodeError> { - todo!() + /// Converts a [`ScryptoValue`] to a [`Value`] given the network id as context. + pub fn from_scrypto_value(scrypto_value: &ScryptoValue, network_id: u8) -> Self { + match scrypto_value { + ScryptoValue::Bool { value } => Self::Bool { value: *value }, + + ScryptoValue::U8 { value } => Self::U8 { value: *value }, + ScryptoValue::U16 { value } => Self::U16 { value: *value }, + ScryptoValue::U32 { value } => Self::U32 { value: *value }, + ScryptoValue::U64 { value } => Self::U64 { value: *value }, + ScryptoValue::U128 { value } => Self::U128 { value: *value }, + + ScryptoValue::I8 { value } => Self::I8 { value: *value }, + ScryptoValue::I16 { value } => Self::I16 { value: *value }, + ScryptoValue::I32 { value } => Self::I32 { value: *value }, + ScryptoValue::I64 { value } => Self::I64 { value: *value }, + ScryptoValue::I128 { value } => Self::I128 { value: *value }, + + ScryptoValue::String { value } => Self::String { + value: value.clone(), + }, + + ScryptoValue::Enum { + discriminator, + fields, + } => Self::Enum { + variant: discriminator.clone(), + fields: if fields.is_empty() { + None + } else { + Some( + fields + .clone() + .into_iter() + .map(|value| Self::from_scrypto_value(&value, network_id)) + .collect(), + ) + }, + }, + ScryptoValue::Array { + element_value_kind, + elements, + } => Self::Array { + element_kind: (*element_value_kind).into(), + elements: elements + .clone() + .into_iter() + .map(|value| Self::from_scrypto_value(&value, network_id)) + .collect(), + }, + ScryptoValue::Tuple { fields } => Self::Tuple { + elements: fields + .clone() + .into_iter() + .map(|value| Self::from_scrypto_value(&value, network_id)) + .collect(), + }, + + ScryptoValue::Custom { + value: ScryptoCustomValue::PackageAddress(address), + } => Self::PackageAddress { + address: NetworkAwarePackageAddress { + network_id, + address: *address, + }, + }, + ScryptoValue::Custom { + value: ScryptoCustomValue::ResourceAddress(address), + } => Self::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id, + address: *address, + }, + }, + ScryptoValue::Custom { + value: ScryptoCustomValue::ComponentAddress(address), + } => Self::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id, + address: *address, + }, + }, + ScryptoValue::Custom { + value: ScryptoCustomValue::SystemAddress(address), + } => Self::SystemAddress { + address: NetworkAwareSystemAddress { + network_id, + address: *address, + }, + }, + + ScryptoValue::Custom { + value: ScryptoCustomValue::Bucket(identifier), + } => Self::Bucket { + identifier: TransientIdentifier::U32(identifier.0).into(), + }, + ScryptoValue::Custom { + value: ScryptoCustomValue::Proof(identifier), + } => Self::Proof { + identifier: TransientIdentifier::U32(identifier.0).into(), + }, + + ScryptoValue::Custom { + value: ScryptoCustomValue::Expression(value), + } => Self::Expression { + value: value.clone(), + }, + ScryptoValue::Custom { + value: ScryptoCustomValue::Blob(value), + } => Self::Blob { + hash: value.clone(), + }, + ScryptoValue::Custom { + value: ScryptoCustomValue::Hash(value), + } => Self::Hash { value: *value }, + + ScryptoValue::Custom { + value: ScryptoCustomValue::EcdsaSecp256k1PublicKey(value), + } => Self::EcdsaSecp256k1PublicKey { public_key: *value }, + ScryptoValue::Custom { + value: ScryptoCustomValue::EddsaEd25519PublicKey(value), + } => Self::EddsaEd25519PublicKey { public_key: *value }, + ScryptoValue::Custom { + value: ScryptoCustomValue::EcdsaSecp256k1Signature(value), + } => Self::EcdsaSecp256k1Signature { signature: *value }, + ScryptoValue::Custom { + value: ScryptoCustomValue::EddsaEd25519Signature(value), + } => Self::EddsaEd25519Signature { signature: *value }, + + ScryptoValue::Custom { + value: ScryptoCustomValue::Decimal(value), + } => Self::Decimal { value: *value }, + ScryptoValue::Custom { + value: ScryptoCustomValue::PreciseDecimal(value), + } => Self::PreciseDecimal { value: *value }, + + ScryptoValue::Custom { + value: ScryptoCustomValue::NonFungibleId(value), + } => Self::NonFungibleId { + value: value.clone(), + }, + + ScryptoValue::Custom { + value: ScryptoCustomValue::Own(value), + } => Self::Own { + value: value.clone(), + }, + } } +} + +impl From for ValueKind { + fn from(value: ScryptoValueKind) -> Self { + match value { + ScryptoValueKind::Bool => ValueKind::Bool, + + ScryptoValueKind::U8 => ValueKind::U8, + ScryptoValueKind::U16 => ValueKind::U16, + ScryptoValueKind::U32 => ValueKind::U32, + ScryptoValueKind::U64 => ValueKind::U64, + ScryptoValueKind::U128 => ValueKind::U128, + + ScryptoValueKind::I8 => ValueKind::I8, + ScryptoValueKind::I16 => ValueKind::I16, + ScryptoValueKind::I32 => ValueKind::I32, + ScryptoValueKind::I64 => ValueKind::I64, + ScryptoValueKind::I128 => ValueKind::I128, + + ScryptoValueKind::String => ValueKind::String, + + ScryptoValueKind::Enum => ValueKind::Enum, + ScryptoValueKind::Array => ValueKind::Array, + ScryptoValueKind::Tuple => ValueKind::Tuple, + + ScryptoValueKind::Custom(custom_type_id) => match custom_type_id { + ScryptoCustomValueKind::PackageAddress => ValueKind::PackageAddress, + ScryptoCustomValueKind::ComponentAddress => ValueKind::ComponentAddress, + ScryptoCustomValueKind::ResourceAddress => ValueKind::ResourceAddress, + ScryptoCustomValueKind::SystemAddress => ValueKind::SystemAddress, + + ScryptoCustomValueKind::Bucket => ValueKind::Bucket, + ScryptoCustomValueKind::Proof => ValueKind::Proof, + + ScryptoCustomValueKind::Expression => ValueKind::Expression, + ScryptoCustomValueKind::Blob => ValueKind::Blob, - fn encode_body(&self, _encoder: &mut ScryptoEncoder<'a>) -> Result<(), sbor::EncodeError> { - todo!() + ScryptoCustomValueKind::Hash => ValueKind::Hash, + ScryptoCustomValueKind::EcdsaSecp256k1PublicKey => { + ValueKind::EcdsaSecp256k1PublicKey + } + ScryptoCustomValueKind::EcdsaSecp256k1Signature => { + ValueKind::EcdsaSecp256k1Signature + } + ScryptoCustomValueKind::EddsaEd25519PublicKey => ValueKind::EddsaEd25519PublicKey, + ScryptoCustomValueKind::EddsaEd25519Signature => ValueKind::EddsaEd25519Signature, + + ScryptoCustomValueKind::Decimal => ValueKind::Decimal, + ScryptoCustomValueKind::PreciseDecimal => ValueKind::PreciseDecimal, + + ScryptoCustomValueKind::NonFungibleId => ValueKind::NonFungibleId, + ScryptoCustomValueKind::Own => ValueKind::Own, + }, + } } } -impl<'a> Decode> for Value { - fn decode_body_with_value_kind( - _decoder: &mut ScryptoDecoder<'a>, - _value_kind: sbor::ValueKind, - ) -> Result { - todo!() +impl From for ScryptoValueKind { + fn from(value: ValueKind) -> Self { + match value { + ValueKind::Bool => ScryptoValueKind::Bool, + + ValueKind::U8 => ScryptoValueKind::U8, + ValueKind::U16 => ScryptoValueKind::U16, + ValueKind::U32 => ScryptoValueKind::U32, + ValueKind::U64 => ScryptoValueKind::U64, + ValueKind::U128 => ScryptoValueKind::U128, + + ValueKind::I8 => ScryptoValueKind::I8, + ValueKind::I16 => ScryptoValueKind::I16, + ValueKind::I32 => ScryptoValueKind::I32, + ValueKind::I64 => ScryptoValueKind::I64, + ValueKind::I128 => ScryptoValueKind::I128, + + ValueKind::String => ScryptoValueKind::String, + + ValueKind::Enum => ScryptoValueKind::Enum, + + ValueKind::Some => ScryptoValueKind::Enum, + ValueKind::None => ScryptoValueKind::Enum, + ValueKind::Ok => ScryptoValueKind::Enum, + ValueKind::Err => ScryptoValueKind::Enum, + + ValueKind::Array => ScryptoValueKind::Array, + ValueKind::Bytes => ScryptoValueKind::Array, + ValueKind::Tuple => ScryptoValueKind::Tuple, + + ValueKind::SystemAddress => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::SystemAddress) + } + ValueKind::PackageAddress => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::PackageAddress) + } + ValueKind::ResourceAddress => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::ResourceAddress) + } + ValueKind::ComponentAddress => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::ComponentAddress) + } + + ValueKind::Proof => ScryptoValueKind::Custom(ScryptoCustomValueKind::Proof), + ValueKind::Bucket => ScryptoValueKind::Custom(ScryptoCustomValueKind::Bucket), + + ValueKind::Expression => ScryptoValueKind::Custom(ScryptoCustomValueKind::Expression), + ValueKind::Blob => ScryptoValueKind::Custom(ScryptoCustomValueKind::Blob), + ValueKind::NonFungibleAddress => ScryptoValueKind::Tuple, + + ValueKind::Hash => ScryptoValueKind::Custom(ScryptoCustomValueKind::Hash), + ValueKind::EcdsaSecp256k1PublicKey => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::EcdsaSecp256k1PublicKey) + } + ValueKind::EcdsaSecp256k1Signature => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::EcdsaSecp256k1Signature) + } + ValueKind::EddsaEd25519PublicKey => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::EddsaEd25519PublicKey) + } + ValueKind::EddsaEd25519Signature => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::EddsaEd25519Signature) + } + ValueKind::Decimal => ScryptoValueKind::Custom(ScryptoCustomValueKind::Decimal), + ValueKind::PreciseDecimal => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::PreciseDecimal) + } + ValueKind::NonFungibleId => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::NonFungibleId) + } + ValueKind::Own => ScryptoValueKind::Custom(ScryptoCustomValueKind::Own), + } } } @@ -462,54 +930,3 @@ value_invertible! {PackageAddress, NetworkAwarePackageAddress, address} value_invertible! {ResourceAddress, NetworkAwareResourceAddress, address} value_invertible! {ComponentAddress, NetworkAwareComponentAddress, address} value_invertible! {EcdsaSecp256k1PublicKey, EcdsaSecp256k1PublicKey, public_key} - -/// A value proxy allowing any SBOR encodable and decodable type to be represented and serialized as -/// a [`Value`]. -/// -/// # Known Side Effects -/// -/// * Say we have an instruction that accepts a `NonFungibleIdType` and somebody provided a value of -/// `Enum("HashMap")` instead of the supported types. This will result in an SBOR decode error which -/// doesn't quite tell the caller what went wrong, it just tells them that something went wrong. Is -/// this a reasonable price to pay for strong validation? -pub struct SborValueProxy; - -impl SerializeAs for SborValueProxy -where - T: ScryptoEncode, -{ - fn serialize_as(source: &T, serializer: S) -> Result - where - S: serde::Serializer, - { - // Encode the passed value to a byte array - let sbor_bytes = - scrypto_encode(source).map_err(|err| S::Error::custom(format!("{:?}", err)))?; - - // Decode the SBOR bytes as a Value - let value = scrypto_decode::(&sbor_bytes) - .map_err(|err| S::Error::custom(format!("{:?}", err)))?; - - value.serialize(serializer) - } -} - -impl<'de, T> DeserializeAs<'de, T> for SborValueProxy -where - T: ScryptoDecode, -{ - fn deserialize_as(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - // Deserialize it as a value - let value = Value::deserialize(deserializer)?; - - // SBOR encode the deserialized value - let sbor_bytes = - scrypto_encode(&value).map_err(|err| D::Error::custom(format!("{:?}", err)))?; - - // Attempt to decode the SBOR bytes as the type - scrypto_decode::(&sbor_bytes).map_err(|err| D::Error::custom(format!("{:?}", err))) - } -} From 49ac743465af29586027e2bf9092bdb1de0cee0d Mon Sep 17 00:00:00 2001 From: Omar Date: Sun, 15 Jan 2023 15:18:28 +0300 Subject: [PATCH 030/110] Value aliasing --- .../model/address/network_aware_address.rs | 2 +- core/src/model/value.rs | 77 ++++++++++++++++++- 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/core/src/model/address/network_aware_address.rs b/core/src/model/address/network_aware_address.rs index ba392dfe..eebfdde6 100644 --- a/core/src/model/address/network_aware_address.rs +++ b/core/src/model/address/network_aware_address.rs @@ -29,7 +29,7 @@ macro_rules! define_network_aware_address { $encoding_method_ident: ident, $decoding_method_ident: ident ) => { - #[derive(Debug, Clone, Hash, Eq, PartialEq, PartialOrd, Ord)] + #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, PartialOrd, Ord)] pub struct $network_aware_struct_ident { pub network_id: u8, pub address: $underlying_type, diff --git a/core/src/model/value.rs b/core/src/model/value.rs index 2569c35e..089d3583 100644 --- a/core/src/model/value.rs +++ b/core/src/model/value.rs @@ -573,7 +573,7 @@ impl Value { Self::NonFungibleAddress { address } => ScryptoValue::Tuple { fields: vec![ Self::ResourceAddress { - address: address.resource_address.clone(), + address: address.resource_address, } .to_scrypto_value()?, Self::NonFungibleId { @@ -753,6 +753,81 @@ impl Value { }, } } + + /// Handles the aliasing of certain [`Value`] kinds such as [`Value::Enum`] and + /// [`Value::NonFungibleAddress`] + pub fn alias(self) -> Self { + match self { + // Case: Some - An enum with a discriminator of "Some" which has a single field. + Self::Enum { variant, fields } + if variant == "Some" && fields.as_ref().map_or(0, |fields| fields.len()) == 1 => + { + Self::Some { + value: Box::new( + fields + .unwrap_or_default() + .get(0) + .expect("Illegal State!") + .clone(), + ), + } + } + // Case: None - An enum with a discriminator of "None" which has no fields. + Self::Enum { variant, fields } + if variant == "None" && fields.as_ref().map_or(0, |fields| fields.len()) == 0 => + { + Self::None + } + // Case: Ok - An enum with a discriminator of "Ok" which has a single field. + Self::Enum { variant, fields } + if variant == "Ok" && fields.as_ref().map_or(0, |fields| fields.len()) == 1 => + { + Self::Ok { + value: Box::new( + fields + .unwrap_or_default() + .get(0) + .expect("Illegal State!") + .clone(), + ), + } + } + // Case: Err - An enum with a discriminator of "Err" which has a single field. + Self::Enum { variant, fields } + if variant == "Err" && fields.as_ref().map_or(0, |fields| fields.len()) == 1 => + { + Self::Err { + value: Box::new( + fields + .unwrap_or_default() + .get(0) + .expect("Illegal State!") + .clone(), + ), + } + } + Self::Tuple { ref elements } => { + // Case: NonFungibleAddress - A tuple of ResourceAddress and NonFungibleId + match (elements.get(0), elements.get(1)) { + ( + Some(Value::ResourceAddress { + address: resource_address, + }), + Some(Value::NonFungibleId { + value: non_fungible_id, + }), + ) if elements.len() == 2 => Value::NonFungibleAddress { + address: NonFungibleAddress { + resource_address: *resource_address, + non_fungible_id: non_fungible_id.clone(), + }, + }, + _ => self, + } + } + v => v, + } + } } impl From for ValueKind { From 6ad2c040f5f264e0c9e0375f0f34080522e78e5d Mon Sep 17 00:00:00 2001 From: Omar Date: Sun, 15 Jan 2023 15:22:11 +0300 Subject: [PATCH 031/110] remove RENode mod --- core/src/model/engine_identifier/mod.rs | 2 -- core/src/model/engine_identifier/re_node.rs | 1 - 2 files changed, 3 deletions(-) delete mode 100644 core/src/model/engine_identifier/re_node.rs diff --git a/core/src/model/engine_identifier/mod.rs b/core/src/model/engine_identifier/mod.rs index 79c970b1..25c0bc86 100644 --- a/core/src/model/engine_identifier/mod.rs +++ b/core/src/model/engine_identifier/mod.rs @@ -17,10 +17,8 @@ pub mod node_identifier; pub mod own; -pub mod re_node; pub mod transient_identifier; pub use node_identifier::*; pub use own::*; -pub use re_node::*; pub use transient_identifier::*; diff --git a/core/src/model/engine_identifier/re_node.rs b/core/src/model/engine_identifier/re_node.rs deleted file mode 100644 index 8b137891..00000000 --- a/core/src/model/engine_identifier/re_node.rs +++ /dev/null @@ -1 +0,0 @@ - From 695a4176c0020d478063743bdb9d0acf8e89320f Mon Sep 17 00:00:00 2001 From: Omar Date: Sun, 15 Jan 2023 17:54:53 +0300 Subject: [PATCH 032/110] Value AST conversions --- core/src/error.rs | 50 ++++ core/src/model/value.rs | 576 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 625 insertions(+), 1 deletion(-) diff --git a/core/src/error.rs b/core/src/error.rs index 4e4a497b..e293685d 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -69,6 +69,28 @@ pub enum Error { /// Represents an error when trying to decode some object in SBOR. SborDecodeError { value: String }, + + // ==== + // 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: ValueKind, + expected: Vec, + found: ValueKind, + }, + + /// An error emitted when the parsing of a value from string fails. + ParseError { kind: ValueKind, message: String }, + + /// An error emitted when an invalid expression string is encountered. + InvalidExpressionString { + found: String, + excepted: Vec, + }, } impl Display for Error { @@ -100,5 +122,33 @@ generate_from_error!(scrypto::radix_engine_interface::address::AddressError as A generate_from_error!(sbor::EncodeError as SborEncodeError); generate_from_error!(sbor::DecodeError as SborDecodeError); +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: ValueKind::$kind, + message: format!("{:?}", error) + } + } + } + )* + }; +} + +impl_from_parse_error! { + scrypto::prelude::ParseDecimalError => Decimal, + scrypto::prelude::ParsePreciseDecimalError => PreciseDecimal, + scrypto::prelude::ParseHashError => Hash, + scrypto::prelude::ParseNonFungibleIdError => NonFungibleId, + scrypto::prelude::ParseNonFungibleAddressError => NonFungibleAddress, + scrypto::prelude::ParseManifestBlobRefError => Blob, + scrypto::prelude::ParseEcdsaSecp256k1PublicKeyError => EcdsaSecp256k1PublicKey, + scrypto::prelude::ParseEcdsaSecp256k1SignatureError => EcdsaSecp256k1Signature, + scrypto::prelude::ParseEddsaEd25519PublicKeyError => EddsaEd25519PublicKey, + scrypto::prelude::ParseEddsaEd25519SignatureError => EddsaEd25519Signature, +} + /// The result type used by the Radix Engine Toolkit where all errors are of a single type. pub type Result = std::result::Result; diff --git a/core/src/model/value.rs b/core/src/model/value.rs index 089d3583..26b37e99 100644 --- a/core/src/model/value.rs +++ b/core/src/model/value.rs @@ -19,6 +19,7 @@ use crate::address::*; use crate::engine_identifier::{BucketId, ProofId}; use crate::error::{Error, Result}; use crate::TransientIdentifier; +use native_transaction::manifest::ast; use scrypto::prelude::ScryptoCustomValue; use scrypto::prelude::{ @@ -459,6 +460,452 @@ impl Value { } } + /// Converts a [`Value`] to Scrypto's tx compiler's [`ast::Value`] given a bech32 coder as + /// context. + pub fn to_ast_value(&self, bech32_coder: &Bech32Coder) -> Result { + let value = match self { + Value::Bool { value } => ast::Value::Bool(*value), + + Value::I8 { value } => ast::Value::I8(*value), + Value::I16 { value } => ast::Value::I16(*value), + Value::I32 { value } => ast::Value::I32(*value), + Value::I64 { value } => ast::Value::I64(*value), + Value::I128 { value } => ast::Value::I128(*value), + + Value::U8 { value } => ast::Value::U8(*value), + Value::U16 { value } => ast::Value::U16(*value), + Value::U32 { value } => ast::Value::U32(*value), + Value::U64 { value } => ast::Value::U64(*value), + Value::U128 { value } => ast::Value::U128(*value), + + Value::String { value } => ast::Value::String(value.clone()), + + Value::Enum { variant, fields } => ast::Value::Enum( + variant.clone(), + fields + .clone() + .unwrap_or_default() + .iter() + .map(|value| value.to_ast_value(bech32_coder)) + .collect::>>()?, + ), + Value::Some { value } => ast::Value::Some(Box::new(value.to_ast_value(bech32_coder)?)), + Value::None => ast::Value::None, + Value::Ok { value } => ast::Value::Ok(Box::new(value.to_ast_value(bech32_coder)?)), + Value::Err { value } => ast::Value::Err(Box::new(value.to_ast_value(bech32_coder)?)), + + Value::Array { + element_kind, + elements, + } => ast::Value::Array( + (*element_kind).into(), + elements + .iter() + .map(|id| id.to_ast_value(bech32_coder)) + .collect::>>()?, + ), + Value::Tuple { elements } => ast::Value::Tuple( + elements + .iter() + .map(|v| v.to_ast_value(bech32_coder)) + .collect::>>()?, + ), + + Value::Decimal { value } => { + ast::Value::Decimal(Box::new(ast::Value::String(value.to_string()))) + } + Value::PreciseDecimal { value } => { + ast::Value::PreciseDecimal(Box::new(ast::Value::String(value.to_string()))) + } + + Value::PackageAddress { address: value } => ast::Value::PackageAddress(Box::new( + ast::Value::String(bech32_coder.encode_package_address(&value.address)), + )), + Value::ComponentAddress { address: value } => ast::Value::ComponentAddress(Box::new( + ast::Value::String(bech32_coder.encode_component_address(&value.address)), + )), + Value::ResourceAddress { address: value } => ast::Value::ResourceAddress(Box::new( + ast::Value::String(bech32_coder.encode_resource_address(&value.address)), + )), + Value::SystemAddress { address: value } => ast::Value::SystemAddress(Box::new( + ast::Value::String(bech32_coder.encode_system_address(&value.address)), + )), + + Value::Hash { value } => { + ast::Value::Hash(Box::new(ast::Value::String(value.to_string()))) + } + Value::Bucket { identifier } => ast::Value::Bucket(Box::new(match identifier.0 { + TransientIdentifier::String(ref string) => ast::Value::String(string.clone()), + TransientIdentifier::U32(number) => ast::Value::U32(number), + })), + Value::Proof { identifier } => ast::Value::Proof(Box::new(match identifier.0 { + TransientIdentifier::String(ref string) => ast::Value::String(string.clone()), + TransientIdentifier::U32(number) => ast::Value::U32(number), + })), + + Value::NonFungibleId { value } => ast::Value::NonFungibleId(Box::new(match value { + NonFungibleId::U32(value) => ast::Value::U32(*value), + NonFungibleId::U64(value) => ast::Value::U64(*value), + NonFungibleId::UUID(value) => ast::Value::U128(*value), + NonFungibleId::String(ref value) => ast::Value::String(value.clone()), + NonFungibleId::Bytes(ref value) => { + ast::Value::Bytes(Box::new(ast::Value::String(hex::encode(value)))) + } + })), + Value::NonFungibleAddress { address } => { + let resource_address_string = address.resource_address.to_string(); + let resource_address = ast::Value::String(resource_address_string); + + let non_fungible_id = match address.non_fungible_id { + NonFungibleId::U32(value) => ast::Value::U32(value), + NonFungibleId::U64(value) => ast::Value::U64(value), + NonFungibleId::UUID(value) => ast::Value::U128(value), + NonFungibleId::String(ref value) => ast::Value::String(value.clone()), + NonFungibleId::Bytes(ref value) => { + ast::Value::Bytes(Box::new(ast::Value::String(hex::encode(value)))) + } + }; + + ast::Value::NonFungibleAddress( + Box::new(resource_address), + Box::new(non_fungible_id), + ) + } + + Value::Blob { hash } => { + ast::Value::Blob(Box::new(ast::Value::String(hash.0.to_string()))) + } + Value::Expression { value } => { + ast::Value::Expression(Box::new(ast::Value::String(match value { + ManifestExpression::EntireWorktop => "ENTIRE_WORKTOP".into(), + ManifestExpression::EntireAuthZone => "ENTIRE_AUTH_ZONE".into(), + }))) + } + + Value::EcdsaSecp256k1PublicKey { public_key } => ast::Value::EcdsaSecp256k1PublicKey( + Box::new(ast::Value::String(public_key.to_string())), + ), + Value::EcdsaSecp256k1Signature { signature } => ast::Value::EcdsaSecp256k1Signature( + Box::new(ast::Value::String(signature.to_string())), + ), + + Value::EddsaEd25519PublicKey { public_key } => ast::Value::EddsaEd25519PublicKey( + Box::new(ast::Value::String(public_key.to_string())), + ), + Value::EddsaEd25519Signature { signature } => ast::Value::EddsaEd25519Signature( + Box::new(ast::Value::String(signature.to_string())), + ), + Value::Bytes { value } => { + ast::Value::Bytes(Box::new(ast::Value::String(hex::encode(value)))) + } + + Value::Own { value } => { + // TODO: Once the Scrypto codebase is updated for a better "own" representation we + // should also update this + ast::Value::Own(Box::new(ast::Value::String(format!("{:?}", value)))) + } + }; + Ok(value) + } + + /// Converts Scrypto's tx compiler's [`ast::Value`] to a [`Value`] given a bech32 coder as + /// context. + pub fn from_ast_value(value: &ast::Value, bech32_coder: &Bech32Coder) -> Result { + let parsing = ValueKind::from(value.type_id()); + 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: variant.clone(), + fields: { + if fields.len() == 0 { + 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::Array(ast_type, elements) => Self::Array { + element_kind: (*ast_type).into(), + elements: elements + .iter() + .map(|value| Self::from_ast_value(value, bech32_coder)) + .collect::>>()?, + }, + ast::Value::Tuple(elements) => Self::Tuple { + elements: elements + .iter() + .map(|value| Self::from_ast_value(value, bech32_coder)) + .collect::>>()?, + }, + ast::Value::Decimal(value) => map_if_value_string(parsing, value, |string| { + string + .parse() + .map(|value| Self::Decimal { value }) + .map_err(Error::from) + })?, + ast::Value::PreciseDecimal(value) => map_if_value_string(parsing, value, |string| { + string + .parse() + .map(|value| Self::PreciseDecimal { value }) + .map_err(Error::from) + })?, + ast::Value::PackageAddress(address) => { + map_if_value_string(parsing, address, |address_string| { + bech32_coder + .decode_to_network_aware_package_address(address_string) + .map(|address| Value::PackageAddress { address }) + })? + } + ast::Value::ResourceAddress(address) => { + map_if_value_string(parsing, address, |address_string| { + bech32_coder + .decode_to_network_aware_resource_address(address_string) + .map(|address| Value::ResourceAddress { address }) + })? + } + ast::Value::ComponentAddress(address) => { + map_if_value_string(parsing, address, |address_string| { + bech32_coder + .decode_to_network_aware_component_address(address_string) + .map(|address| Value::ComponentAddress { address }) + })? + } + ast::Value::SystemAddress(address) => { + map_if_value_string(parsing, address, |address_string| { + bech32_coder + .decode_to_network_aware_system_address(address_string) + .map(|address| Value::SystemAddress { address }) + })? + } + ast::Value::Hash(value) => map_if_value_string(parsing, value, |string| { + string + .parse() + .map(|value| Self::Hash { value }) + .map_err(Error::from) + })?, + + ast::Value::Bucket(value) => { + if let ast::Value::U32(value) = &**value { + Self::Bucket { + identifier: TransientIdentifier::U32(*value).into(), + } + } else if let ast::Value::String(value) = &**value { + Self::Bucket { + identifier: TransientIdentifier::String(value.clone()).into(), + } + } else { + Err(Error::UnexpectedAstContents { + parsing: ValueKind::Bucket, + expected: vec![ValueKind::U32, ValueKind::String], + found: value.type_id().into(), + })? + } + } + ast::Value::Proof(value) => { + if let ast::Value::U32(value) = &**value { + Self::Proof { + identifier: TransientIdentifier::U32(*value).into(), + } + } else if let ast::Value::String(value) = &**value { + Self::Proof { + identifier: TransientIdentifier::String(value.clone()).into(), + } + } else { + Err(Error::UnexpectedAstContents { + parsing: ValueKind::Proof, + expected: vec![ValueKind::U32, ValueKind::String], + found: value.type_id().into(), + })? + } + } + + ast::Value::NonFungibleId(value) => Self::NonFungibleId { + value: match &**value { + ast::Value::U32(value) => NonFungibleId::U32(*value), + ast::Value::U64(value) => NonFungibleId::U64(*value), + ast::Value::U128(value) => NonFungibleId::UUID(*value), + ast::Value::String(value) => NonFungibleId::String(value.clone()), + ast::Value::Bytes(value) => { + if let ast::Value::String(value) = &**value { + NonFungibleId::Bytes(hex::decode(value)?) + } else { + Err(Error::UnexpectedAstContents { + parsing: ValueKind::NonFungibleId, + expected: vec![ValueKind::String], + found: value.type_id().into(), + })? + } + } + _ => Err(Error::UnexpectedAstContents { + parsing: ValueKind::NonFungibleId, + expected: vec![ + ValueKind::U32, + ValueKind::U64, + ValueKind::U128, + ValueKind::String, + ValueKind::Bytes, + ], + found: value.type_id().into(), + })?, + }, + }, + ast::Value::NonFungibleAddress(resource_address, non_fungible_id) => { + let resource_address = + if let ast::Value::String(address_string) = &**resource_address { + bech32_coder.decode_to_network_aware_resource_address(address_string)? + } else { + Err(Error::UnexpectedAstContents { + parsing: ValueKind::NonFungibleAddress, + expected: vec![ValueKind::String], + found: resource_address.type_id().into(), + })? + }; + + // TODO: de-duplicate. Refactor out + let non_fungible_id = match &**non_fungible_id { + ast::Value::U32(value) => NonFungibleId::U32(*value), + ast::Value::U64(value) => NonFungibleId::U64(*value), + ast::Value::U128(value) => NonFungibleId::UUID(*value), + ast::Value::String(value) => NonFungibleId::String(value.clone()), + ast::Value::Bytes(value) => { + if let ast::Value::String(value) = &**value { + NonFungibleId::Bytes(hex::decode(value)?) + } else { + Err(Error::UnexpectedAstContents { + parsing: ValueKind::NonFungibleAddress, + expected: vec![ValueKind::String], + found: value.type_id().into(), + })? + } + } + value => Err(Error::UnexpectedAstContents { + parsing: ValueKind::NonFungibleAddress, + expected: vec![ + ValueKind::U32, + ValueKind::U64, + ValueKind::U128, + ValueKind::String, + ValueKind::Bytes, + ], + found: value.type_id().into(), + })?, + }; + + let non_fungible_address = NonFungibleAddress { + resource_address, + non_fungible_id, + }; + Value::NonFungibleAddress { + address: non_fungible_address, + } + } + + ast::Value::Blob(value) => map_if_value_string(parsing, value, |blob_string| { + let bytes = hex::decode(blob_string)?; + ManifestBlobRef::try_from(bytes.as_slice()) + .map(|manifest_blob| Self::Blob { + hash: manifest_blob, + }) + .map_err(Error::from) + })?, + ast::Value::Expression(value) => map_if_value_string( + parsing, + value, + |expression_string| match expression_string { + "ENTIRE_WORKTOP" => Ok(Self::Expression { + value: ManifestExpression::EntireWorktop, + }), + "ENTIRE_AUTH_ZONE" => Ok(Self::Expression { + value: ManifestExpression::EntireAuthZone, + }), + string => Err(Error::InvalidExpressionString { + found: string.to_owned(), + excepted: vec![ + String::from("ENTIRE_WORKTOP"), + String::from("ENTIRE_AUTH_ZONE"), + ], + }), + }, + )?, + + ast::Value::EcdsaSecp256k1PublicKey(value) => { + map_if_value_string(parsing, value, |string| { + string + .parse() + .map(|public_key| Self::EcdsaSecp256k1PublicKey { public_key }) + .map_err(Error::from) + })? + } + ast::Value::EcdsaSecp256k1Signature(value) => { + map_if_value_string(parsing, value, |string| { + string + .parse() + .map(|signature| Self::EcdsaSecp256k1Signature { signature }) + .map_err(Error::from) + })? + } + ast::Value::EddsaEd25519PublicKey(value) => { + map_if_value_string(parsing, value, |string| { + string + .parse() + .map(|public_key| Self::EddsaEd25519PublicKey { public_key }) + .map_err(Error::from) + })? + } + ast::Value::EddsaEd25519Signature(value) => { + map_if_value_string(parsing, value, |string| { + string + .parse() + .map(|signature| Self::EddsaEd25519Signature { signature }) + .map_err(Error::from) + })? + } + + ast::Value::Bytes(value) => map_if_value_string(parsing, value, |string| { + hex::decode(string) + .map_err(Error::from) + .map(|value| Self::Bytes { value }) + })?, + + ast::Value::Own(..) => todo!(), // TODO: Implement this once we've agreed on the format that own is represented in manifests + }; + Ok(value) + } + /// Converts a [`Value`] to a [`ScryptoValue`]. pub fn to_scrypto_value(&self) -> Result { let value = match self { @@ -755,7 +1202,8 @@ impl Value { } /// Handles the aliasing of certain [`Value`] kinds such as [`Value::Enum`] and - /// [`Value::NonFungibleAddress`] + /// [`Value::NonFungibleAddress`]. This is typically used during request post processing to + /// ensure that all responses include aliased values pub fn alias(self) -> Self { match self { // Case: Some - An enum with a discriminator of "Some" which has a single field. @@ -830,6 +1278,113 @@ impl Value { } } +impl From for ast::Type { + fn from(value: ValueKind) -> ast::Type { + match value { + ValueKind::Bool => ast::Type::Bool, + ValueKind::I8 => ast::Type::I8, + ValueKind::I16 => ast::Type::I16, + ValueKind::I32 => ast::Type::I32, + ValueKind::I64 => ast::Type::I64, + ValueKind::I128 => ast::Type::I128, + + ValueKind::U8 => ast::Type::U8, + ValueKind::U16 => ast::Type::U16, + ValueKind::U32 => ast::Type::U32, + ValueKind::U64 => ast::Type::U64, + ValueKind::U128 => ast::Type::U128, + + ValueKind::String => ast::Type::String, + + ValueKind::Enum => ast::Type::Enum, + ValueKind::Some => ast::Type::Enum, + ValueKind::None => ast::Type::Enum, + ValueKind::Ok => ast::Type::Enum, + ValueKind::Err => ast::Type::Enum, + + ValueKind::Array => ast::Type::Array, + ValueKind::Tuple => ast::Type::Tuple, + + ValueKind::Decimal => ast::Type::Decimal, + ValueKind::PreciseDecimal => ast::Type::PreciseDecimal, + + ValueKind::PackageAddress => ast::Type::PackageAddress, + ValueKind::ComponentAddress => ast::Type::ComponentAddress, + ValueKind::ResourceAddress => ast::Type::ResourceAddress, + ValueKind::SystemAddress => ast::Type::SystemAddress, + + ValueKind::Hash => ast::Type::Hash, + + ValueKind::Bucket => ast::Type::Bucket, + ValueKind::Proof => ast::Type::Proof, + + ValueKind::NonFungibleId => ast::Type::NonFungibleId, + ValueKind::NonFungibleAddress => ast::Type::NonFungibleAddress, + + ValueKind::Blob => ast::Type::Blob, + ValueKind::Bytes => ast::Type::Bytes, + ValueKind::Expression => ast::Type::Expression, + + ValueKind::EcdsaSecp256k1PublicKey => ast::Type::EcdsaSecp256k1PublicKey, + ValueKind::EcdsaSecp256k1Signature => ast::Type::EcdsaSecp256k1Signature, + ValueKind::EddsaEd25519PublicKey => ast::Type::EddsaEd25519PublicKey, + ValueKind::EddsaEd25519Signature => ast::Type::EddsaEd25519Signature, + ValueKind::Own => ast::Type::Own, + } + } +} + +impl From for ValueKind { + fn from(value: ast::Type) -> ValueKind { + match value { + ast::Type::Bool => Self::Bool, + + ast::Type::I8 => Self::I8, + ast::Type::I16 => Self::I16, + ast::Type::I32 => Self::I32, + ast::Type::I64 => Self::I64, + ast::Type::I128 => Self::I128, + ast::Type::U8 => Self::U8, + ast::Type::U16 => Self::U16, + ast::Type::U32 => Self::U32, + ast::Type::U64 => Self::U64, + ast::Type::U128 => Self::U128, + + ast::Type::String => Self::String, + + ast::Type::Enum => Self::Enum, + + ast::Type::Array => Self::Array, + ast::Type::Tuple => Self::Tuple, + + ast::Type::Decimal => Self::Decimal, + ast::Type::PreciseDecimal => Self::PreciseDecimal, + + ast::Type::PackageAddress => Self::PackageAddress, + ast::Type::ComponentAddress => Self::ComponentAddress, + ast::Type::ResourceAddress => Self::ResourceAddress, + ast::Type::SystemAddress => Self::SystemAddress, + + ast::Type::Hash => Self::Hash, + ast::Type::EcdsaSecp256k1PublicKey => Self::EcdsaSecp256k1PublicKey, + ast::Type::EcdsaSecp256k1Signature => Self::EcdsaSecp256k1Signature, + ast::Type::EddsaEd25519PublicKey => Self::EddsaEd25519PublicKey, + ast::Type::EddsaEd25519Signature => Self::EddsaEd25519Signature, + + ast::Type::Bucket => Self::Bucket, + ast::Type::Proof => Self::Proof, + + ast::Type::NonFungibleId => Self::NonFungibleId, + ast::Type::NonFungibleAddress => Self::NonFungibleAddress, + + ast::Type::Blob => Self::Blob, + ast::Type::Expression => Self::Expression, + ast::Type::Bytes => Self::Bytes, + ast::Type::Own => Self::Own, + } + } +} + impl From for ValueKind { fn from(value: ScryptoValueKind) -> Self { match value { @@ -1005,3 +1560,22 @@ value_invertible! {PackageAddress, NetworkAwarePackageAddress, address} value_invertible! {ResourceAddress, NetworkAwareResourceAddress, address} value_invertible! {ComponentAddress, NetworkAwareComponentAddress, address} value_invertible! {EcdsaSecp256k1PublicKey, EcdsaSecp256k1PublicKey, public_key} + +// ======== +// Helpers +// ======== + +fn map_if_value_string(parsing: ValueKind, value: &ast::Value, map: F) -> Result +where + F: FnOnce(&str) -> Result, +{ + if let ast::Value::String(value) = value { + map(value) + } else { + Err(Error::UnexpectedAstContents { + parsing, + expected: vec![ValueKind::String], + found: value.type_id().into(), + }) + } +} From 91c9ead51bd5ed68ed4f0acfe536e70527482063 Mon Sep 17 00:00:00 2001 From: Omar Date: Sun, 15 Jan 2023 17:58:52 +0300 Subject: [PATCH 033/110] Minor change --- core/src/model/value.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/model/value.rs b/core/src/model/value.rs index 26b37e99..f954ef00 100644 --- a/core/src/model/value.rs +++ b/core/src/model/value.rs @@ -634,7 +634,7 @@ impl Value { ast::Value::Enum(variant, fields) => Self::Enum { variant: variant.clone(), fields: { - if fields.len() == 0 { + if fields.is_empty() { None } else { Some( From d146f10f374363565ed5ebe16ddbe0b69f47ed2b Mon Sep 17 00:00:00 2001 From: Omar Date: Sun, 15 Jan 2023 19:14:17 +0300 Subject: [PATCH 034/110] Instruction conversion methods --- core/src/model/address/entity_address.rs | 5 +- core/src/model/instruction.rs | 988 +++++++++++++++++++---- core/src/model/value.rs | 37 + 3 files changed, 865 insertions(+), 165 deletions(-) diff --git a/core/src/model/address/entity_address.rs b/core/src/model/address/entity_address.rs index b28efbda..8405ff40 100644 --- a/core/src/model/address/entity_address.rs +++ b/core/src/model/address/entity_address.rs @@ -22,10 +22,11 @@ use crate::model::address::network_aware_address::*; use serializable::serializable; -#[serializable] -#[serde(tag = "type", content = "address")] /// A discriminated union of entity addresses where addresses are serialized as a Bech32m encoded /// string. +#[serializable] +#[serde(tag = "type", content = "address")] +#[derive(Clone)] pub enum EntityAddress { /// Represents a Bech32m encoded human-readable component address. This address is serialized /// as a human-readable bech32m encoded string. diff --git a/core/src/model/instruction.rs b/core/src/model/instruction.rs index 6ca1923b..78b1378d 100644 --- a/core/src/model/instruction.rs +++ b/core/src/model/instruction.rs @@ -17,12 +17,17 @@ use std::collections::HashSet; +use crate::address::{Bech32Coder, NonFungibleAddress}; use crate::engine_identifier::{BucketId, ProofId}; +use crate::error::Result; use crate::model::address::entity_address::*; use crate::model::address::network_aware_address::*; -use crate::NonFungibleAddress; +use crate::Value; + +use native_transaction::manifest::ast; use scrypto::prelude::{Decimal, EcdsaSecp256k1PublicKey, NonFungibleId}; -use scrypto::runtime::{ManifestBlobRef, Own}; +use scrypto::runtime::ManifestBlobRef; + use serializable::serializable; // NOTE: The model below should ALWAYS be kept up to date with that present in the Scrypto repo. @@ -31,10 +36,15 @@ use serializable::serializable; // 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(Clone)] pub enum Instruction { /// An instruction to call a function with the given list of arguments on the given package /// address and blueprint name. @@ -42,26 +52,26 @@ pub enum Instruction { /// The address of the package containing the blueprint that contains the desired function. /// This package address is serialized as the `PackageAddress` variant of the `Value` /// model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] package_address: NetworkAwarePackageAddress, /// A string of the name of the blueprint containing the desired function. This field is /// serialized as a `String` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] blueprint_name: String, /// A string of the name of the function to call. This field is serialized as a `String` /// from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] function_name: String, /// An optional array of `Value` arguments to call the function with. If this array is /// empty or is not provided, then the function is called with no arguments. #[serde(default, skip_serializing_if = "Option::is_none")] - arguments: Option>, + arguments: Option>, }, /// An instruction to call a method with a given name on a given component address with the @@ -69,20 +79,20 @@ pub enum Instruction { CallMethod { /// The address of the component which contains the method to be invoked. This field is /// serialized as a `ComponentAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] component_address: NetworkAwareComponentAddress, /// A string of the name of the method to call. his field is serialized as a `String` from /// the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] method_name: String, /// An optional array of `Value` arguments to call the method with. If this array is empty /// or is not provided, then the method is called with no arguments. #[serde(default, skip_serializing_if = "Option::is_none")] - arguments: Option>, + arguments: Option>, }, /// An instruction to take the entire amount of a given resource address from the worktop and @@ -90,14 +100,14 @@ pub enum Instruction { TakeFromWorktop { /// The address of the resource to take from the worktop. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] resource_address: NetworkAwareResourceAddress, /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from /// the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] into_bucket: BucketId, }, @@ -106,20 +116,20 @@ pub enum Instruction { TakeFromWorktopByAmount { /// The address of the resource to take from the worktop. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] resource_address: NetworkAwareResourceAddress, /// The amount of the resource to take from the worktop. This field is serialized as a /// `Decimal` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] amount: Decimal, /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from /// the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] into_bucket: BucketId, }, @@ -128,28 +138,28 @@ pub enum Instruction { TakeFromWorktopByIds { /// The address of the resource to take from the worktop. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] resource_address: NetworkAwareResourceAddress, /// The non-fungible ids to take from the worktop. This is a set (serialized as a JSON /// array) of `NonFungibleId`s from the Value model. - #[schemars(with = "HashSet")] - #[serde_as(as = "HashSet>")] + #[schemars(with = "HashSet")] + #[serde_as(as = "HashSet>")] ids: HashSet, /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from /// the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] into_bucket: BucketId, }, /// Returns a bucket of tokens to the worktop. ReturnToWorktop { /// The bucket to return to the worktop. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] bucket: BucketId, }, @@ -157,8 +167,8 @@ pub enum Instruction { AssertWorktopContains { /// The address of the resource to perform the assertion on. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] resource_address: NetworkAwareResourceAddress, }, @@ -167,14 +177,14 @@ pub enum Instruction { AssertWorktopContainsByAmount { /// The address of the resource to perform the assertion on. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] resource_address: NetworkAwareResourceAddress, /// The amount of the resource to assert their existence in the worktop. This field is /// serialized as a `Decimal` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] amount: Decimal, }, @@ -183,14 +193,14 @@ pub enum Instruction { AssertWorktopContainsByIds { /// The address of the resource to perform the assertion on. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] resource_address: NetworkAwareResourceAddress, /// The non-fungible ids of the resource to assert their existence in the worktop. This is /// a set (serialized as a JSON array) of `NonFungibleId`s from the Value model. - #[schemars(with = "HashSet")] - #[serde_as(as = "HashSet>")] + #[schemars(with = "HashSet")] + #[serde_as(as = "HashSet>")] ids: HashSet, }, @@ -198,8 +208,8 @@ pub enum Instruction { PopFromAuthZone { /// The proof to put the popped proof into. This is serialized as a `Proof` from the Value /// model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] into_proof: ProofId, }, @@ -207,8 +217,8 @@ pub enum Instruction { PushToAuthZone { /// The proof to push to the auth zone stack. This is serialized as a `Proof` from the /// Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] proof: ProofId, }, @@ -221,14 +231,14 @@ pub enum Instruction { CreateProofFromAuthZone { /// The address of the resource to create a proof of. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] resource_address: NetworkAwareResourceAddress, /// A proof to put the resource proof into. This field is serialized as a `Proof` from the /// Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] into_proof: ProofId, }, @@ -237,20 +247,20 @@ pub enum Instruction { CreateProofFromAuthZoneByAmount { /// The address of the resource to create a proof of. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] resource_address: NetworkAwareResourceAddress, /// The amount of the resource to create a proof of. This field is serialized as a /// `Decimal` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] amount: Decimal, /// A proof to put the resource proof into. This field is serialized as a `Proof` from the /// Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] into_proof: ProofId, }, @@ -259,20 +269,20 @@ pub enum Instruction { CreateProofFromAuthZoneByIds { /// The address of the resource to create a proof of. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] resource_address: NetworkAwareResourceAddress, /// The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) /// of `NonFungibleId`s from the Value model. - #[schemars(with = "HashSet")] - #[serde_as(as = "HashSet>")] + #[schemars(with = "HashSet")] + #[serde_as(as = "HashSet>")] ids: HashSet, /// A proof to put the resource proof into. This field is serialized as a `Proof` from the /// Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] into_proof: ProofId, }, @@ -280,14 +290,14 @@ pub enum Instruction { CreateProofFromBucket { /// The bucket of resources to create a proof from. This field is serialized as a `Bucket` /// from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] bucket: BucketId, /// The proof variable that the proof should go to. This field is serialized as a `Proof` /// from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] into_proof: ProofId, }, @@ -295,22 +305,22 @@ pub enum Instruction { CloneProof { /// The original proof, or the proof to be cloned. This field is serialized as a `Proof` /// from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] proof: ProofId, /// The proof variable that the proof should go to. This field is serialized as a `Proof` /// from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] into_proof: ProofId, }, /// An instruction to drop a proof. DropProof { /// The proof to drop. This field is serialized as a `Proof` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] proof: ProofId, }, @@ -322,30 +332,30 @@ pub enum Instruction { PublishPackage { /// The blob of the package code. This field is serialized as a `Blob` from the Value /// model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] code: ManifestBlobRef, /// The blob of the package ABI. This field is serialized as a `Blob` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] abi: ManifestBlobRef, /// 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 `Array` from the Value model. - #[schemars(with = "crate::Value")] - royalty_config: crate::Value, + #[schemars(with = "Value")] + royalty_config: Value, /// 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 `Array` from the Value model. - #[schemars(with = "crate::Value")] - metadata: crate::Value, + #[schemars(with = "Value")] + metadata: Value, /// The access rules to use for the package. This is serialized as a `Tuple` from the Value /// model. - #[schemars(with = "crate::Value")] - access_rules: crate::Value, + #[schemars(with = "Value")] + access_rules: Value, }, /// An instruction to publish a package with an associated "owner" badge where all of the @@ -353,27 +363,27 @@ pub enum Instruction { PublishPackageWithOwner { /// The blob of the package code. This field is serialized as a `Blob` from the Value /// model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] code: ManifestBlobRef, /// The blob of the package ABI. This field is serialized as a `Blob` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] abi: ManifestBlobRef, /// The non-fungible address of the owner badge of this package. This field is serialized /// as a `NonFungibleAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] owner_badge: NonFungibleAddress, }, /// An instruction to burn a bucket of tokens. BurnResource { /// The bucket of tokens to burn. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] bucket: BucketId, }, @@ -381,14 +391,14 @@ pub enum Instruction { 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`. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] - vault_id: Own, + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] + vault_id: Value, /// The amount of tokens to recall from the vault. This field is serialized as a `Decimal` /// field from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] amount: Decimal, }, @@ -397,18 +407,20 @@ pub enum Instruction { /// 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 `SystemAddress`. + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] entity_address: EntityAddress, /// A string of the key to set the metadata for. This field is serialized as a `String` /// from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] key: String, /// A string of the value to set the metadata for. This field is serialized as a `String` /// from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] value: String, }, @@ -416,36 +428,36 @@ pub enum Instruction { SetPackageRoyaltyConfig { /// The address of the package to set the royalty on. This is serialized as a /// `PackageAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] package_address: NetworkAwarePackageAddress, /// 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 `Array` from the Value model. - #[schemars(with = "crate::Value")] - royalty_config: crate::Value, + #[schemars(with = "Value")] + royalty_config: Value, }, /// An instruction to modify the royalties on a component SetComponentRoyaltyConfig { /// The component address of the component to modify royalties for. This field is /// serialized as a `ComponentAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] component_address: NetworkAwareComponentAddress, /// The royalty config to set on the component. This is an `Enum` from the `Value` model. - #[schemars(with = "crate::Value")] - royalty_config: crate::Value, + #[schemars(with = "Value")] + royalty_config: Value, }, /// An instruction to claim royalties of a package ClaimPackageRoyalty { /// The package address of the package to claim royalties for. This field is serialized as /// a `PackageAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] package_address: NetworkAwarePackageAddress, }, @@ -453,46 +465,48 @@ pub enum Instruction { ClaimComponentRoyalty { /// The component address of the component to claim royalties for. This field is serialized /// as a `ComponentAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] component_address: NetworkAwareComponentAddress, }, /// An instruction to modify the access rules of a method that an entity has. SetMethodAccessRule { /// The entity address of the entity to modify the access rules for. + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] entity_address: EntityAddress, /// Entity access rules is a stack of access rules, this index allows referring to a /// specific "layer" in said stack. This field is serialized as a `U32` from the `Value` /// model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] index: u32, /// The method key for the method to set the access rule of. This field is serialized as an /// `Enum` from the Value model - #[schemars(with = "crate::Value")] - key: crate::Value, + #[schemars(with = "Value")] + key: Value, /// The new access rule to set in-place of the old one. This field is serialized as an /// `Enum` from the Value model - #[schemars(with = "crate::Value")] - rule: crate::Value, + #[schemars(with = "Value")] + rule: Value, }, /// An instruction to mint fungible resources MintFungible { /// The address of the resource to mint tokens of. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] resource_address: NetworkAwareResourceAddress, /// The amount of fungible tokens to mint of this resource. This field is serialized as a /// `Decimal` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] amount: Decimal, }, @@ -500,42 +514,41 @@ pub enum Instruction { MintNonFungible { /// The address of the resource to mint tokens of. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] resource_address: NetworkAwareResourceAddress, /// The non-fungible tokens to mint. The underlying type of this is a map which maps a /// `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of /// the immutable and mutable parts of the non-fungible data. - #[schemars(with = "crate::Value")] - entries: crate::Value, + #[schemars(with = "Value")] + entries: Value, }, /// An instruction to create a new fungible resource. CreateFungibleResource { /// The divisibility of the resource. This field is serialized as a `U8` from the Value /// model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] divisibility: u8, /// 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 `Array` from the Value model. - #[schemars(with = "crate::Value")] - metadata: crate::Value, + #[schemars(with = "Value")] + metadata: Value, /// The access rules to use for the resource. The underlying type of this is a map which /// maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the /// current behavior and the mutability. This is serialized as an `Array` from the /// Value model. - #[schemars(with = "crate::Value")] - access_rules: crate::Value, + #[schemars(with = "Value")] + access_rules: Value, /// An optional decimal value of the initial supply to mint during resource creation. If /// present, this is serialized as a `Decimal` from the value model. - #[schemars(with = "Option")] - #[serde_as(as = "Option>")] - initial_supply: Option, + #[schemars(with = "Value")] + initial_supply: Value, }, /// An instruction to create a fungible resource with an associated "owner" badge where all of @@ -543,53 +556,52 @@ pub enum Instruction { CreateFungibleResourceWithOwner { /// The divisibility of the resource. This field is serialized as a `U8` from the Value /// model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] divisibility: u8, /// 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 `Array` from the Value model. - #[schemars(with = "crate::Value")] - metadata: crate::Value, + #[schemars(with = "Value")] + metadata: Value, /// The non-fungible address of the owner badge of this resource. This field is serialized /// as a `NonFungibleAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] owner_badge: NonFungibleAddress, /// An optional decimal value of the initial supply to mint during resource creation. If /// present, this is serialized as a `Decimal` from the value model. - #[schemars(with = "Option")] - #[serde_as(as = "Option>")] - initial_supply: Option, + #[schemars(with = "Option")] + initial_supply: Value, }, /// An instruction to create a new non-fungible resource. CreateNonFungibleResource { /// The type of the non-fungible id to use for this resource. This field is serialized as /// an `Enum` from the Value model. - #[schemars(with = "crate::Value")] - id_type: crate::Value, + #[schemars(with = "Value")] + id_type: Value, /// 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 `Array` from the Value model. - #[schemars(with = "crate::Value")] - metadata: crate::Value, + #[schemars(with = "Value")] + metadata: Value, /// The access rules to use for the resource. The underlying type of this is a map which /// maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the /// current behavior and the mutability. This is serialized as an `Array` from the /// Value model. - #[schemars(with = "crate::Value")] - access_rules: crate::Value, + #[schemars(with = "Value")] + access_rules: Value, /// An optional initial supply for the non-fungible resource being created. The underlying /// type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` /// elements where each element is a struct of the immutable and mutable parts of /// the non-fungible data. - #[schemars(with = "Option")] - initial_supply: crate::Value, + #[schemars(with = "Option")] + initial_supply: Value, }, /// An instruction to create a non-fungible resource with an associated "owner" badge where all @@ -597,41 +609,691 @@ pub enum Instruction { CreateNonFungibleResourceWithOwner { /// The type of the non-fungible id to use for this resource. This field is serialized as /// an `Enum` from the Value model. - #[schemars(with = "crate::Value")] - id_type: crate::Value, + #[schemars(with = "Value")] + id_type: Value, /// 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 `Array` from the Value model. - #[schemars(with = "crate::Value")] - metadata: crate::Value, + #[schemars(with = "Value")] + metadata: Value, /// The non-fungible address of the owner badge of this resource. This field is serialized /// as a `NonFungibleAddress` from the Value model. - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] owner_badge: NonFungibleAddress, /// An optional initial supply for the non-fungible resource being created. The underlying /// type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` /// elements where each element is a struct of the immutable and mutable parts of /// the non-fungible data. - #[schemars(with = "Option")] - initial_supply: crate::Value, + #[schemars(with = "Option")] + initial_supply: Value, }, /// An instruction to registers a new validator given the public key of the validator RegisterValidator { /// The public key of the validator - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] validator: EcdsaSecp256k1PublicKey, }, /// An instruction to unregister a validator given it's public key UnregisterValidator { /// The public key of the validator to unregister - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "Value")] + #[serde_as(as = "serde_with::TryFromInto")] validator: EcdsaSecp256k1PublicKey, }, } + +// ============ +// Conversions +// ============ + +impl Instruction { + pub fn to_ast_instruction(&self, bech32_coder: &Bech32Coder) -> Result { + let ast_instruction = match self.clone() { + Self::CallFunction { + package_address, + blueprint_name, + function_name, + arguments, + } => ast::Instruction::CallFunction { + package_address: Value::try_from(package_address)?.to_ast_value(bech32_coder)?, + blueprint_name: Value::try_from(blueprint_name)?.to_ast_value(bech32_coder)?, + function_name: Value::try_from(function_name)?.to_ast_value(bech32_coder)?, + args: arguments + .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: Value::try_from(component_address)? + .to_ast_value(bech32_coder)?, + method_name: Value::try_from(method_name)?.to_ast_value(bech32_coder)?, + args: arguments + .unwrap_or_default() + .iter() + .map(|value| value.to_ast_value(bech32_coder)) + .collect::>>()?, + }, + Self::TakeFromWorktop { + resource_address, + into_bucket, + } => ast::Instruction::TakeFromWorktop { + resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, + new_bucket: Value::try_from(into_bucket)?.to_ast_value(bech32_coder)?, + }, + Self::TakeFromWorktopByAmount { + amount, + resource_address, + into_bucket, + } => ast::Instruction::TakeFromWorktopByAmount { + amount: Value::try_from(amount)?.to_ast_value(bech32_coder)?, + resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, + new_bucket: Value::try_from(into_bucket)?.to_ast_value(bech32_coder)?, + }, + Self::TakeFromWorktopByIds { + ids, + resource_address, + into_bucket, + } => ast::Instruction::TakeFromWorktopByIds { + ids: Value::Array { + element_kind: crate::model::value::ValueKind::NonFungibleId, + elements: ids + .into_iter() + .map(Value::try_from) + .collect::>>()?, + } + .to_ast_value(bech32_coder)?, + resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, + new_bucket: Value::try_from(into_bucket)?.to_ast_value(bech32_coder)?, + }, + Self::ReturnToWorktop { bucket } => ast::Instruction::ReturnToWorktop { + bucket: Value::try_from(bucket)?.to_ast_value(bech32_coder)?, + }, + + Self::AssertWorktopContains { resource_address } => { + ast::Instruction::AssertWorktopContains { + resource_address: Value::try_from(resource_address)? + .to_ast_value(bech32_coder)?, + } + } + Self::AssertWorktopContainsByAmount { + amount, + resource_address, + } => ast::Instruction::AssertWorktopContainsByAmount { + amount: Value::try_from(amount)?.to_ast_value(bech32_coder)?, + resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, + }, + Self::AssertWorktopContainsByIds { + ids, + resource_address, + } => ast::Instruction::AssertWorktopContainsByIds { + ids: Value::Array { + // TODO: This was `ValueKind::Bucket` by mistake. What kind of test can we + // introduce to catch this? + element_kind: crate::model::value::ValueKind::NonFungibleId, + elements: ids + .into_iter() + .map(Value::try_from) + .collect::>>()?, + } + .to_ast_value(bech32_coder)?, + resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, + }, + + Self::PopFromAuthZone { into_proof } => ast::Instruction::PopFromAuthZone { + new_proof: Value::try_from(into_proof)?.to_ast_value(bech32_coder)?, + }, + Self::PushToAuthZone { proof } => ast::Instruction::PushToAuthZone { + proof: Value::try_from(proof)?.to_ast_value(bech32_coder)?, + }, + Self::ClearAuthZone => ast::Instruction::ClearAuthZone, + + Self::CreateProofFromAuthZone { + resource_address, + into_proof, + } => ast::Instruction::CreateProofFromAuthZone { + resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, + new_proof: Value::try_from(into_proof)?.to_ast_value(bech32_coder)?, + }, + Self::CreateProofFromAuthZoneByAmount { + amount, + resource_address, + into_proof, + } => ast::Instruction::CreateProofFromAuthZoneByAmount { + amount: Value::try_from(amount)?.to_ast_value(bech32_coder)?, + resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, + new_proof: Value::try_from(into_proof)?.to_ast_value(bech32_coder)?, + }, + Self::CreateProofFromAuthZoneByIds { + ids, + resource_address, + into_proof, + } => ast::Instruction::CreateProofFromAuthZoneByIds { + ids: Value::Array { + element_kind: crate::model::value::ValueKind::NonFungibleId, + elements: ids + .into_iter() + .map(Value::try_from) + .collect::>>()?, + } + .to_ast_value(bech32_coder)?, + resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, + new_proof: Value::try_from(into_proof)?.to_ast_value(bech32_coder)?, + }, + Self::CreateProofFromBucket { bucket, into_proof } => { + ast::Instruction::CreateProofFromBucket { + bucket: Value::try_from(bucket)?.to_ast_value(bech32_coder)?, + new_proof: Value::try_from(into_proof)?.to_ast_value(bech32_coder)?, + } + } + + Self::CloneProof { proof, into_proof } => ast::Instruction::CloneProof { + proof: Value::try_from(proof)?.to_ast_value(bech32_coder)?, + new_proof: Value::try_from(into_proof)?.to_ast_value(bech32_coder)?, + }, + + Self::DropProof { proof } => ast::Instruction::DropProof { + proof: Value::try_from(proof)?.to_ast_value(bech32_coder)?, + }, + Self::DropAllProofs => ast::Instruction::DropAllProofs, + Self::PublishPackageWithOwner { + code, + abi, + owner_badge, + } => ast::Instruction::PublishPackageWithOwner { + owner_badge: Value::try_from(owner_badge)?.to_ast_value(bech32_coder)?, + code: Value::try_from(code)?.to_ast_value(bech32_coder)?, + abi: Value::try_from(abi)?.to_ast_value(bech32_coder)?, + }, + Self::BurnResource { bucket } => ast::Instruction::BurnResource { + bucket: Value::try_from(bucket)?.to_ast_value(bech32_coder)?, + }, + Self::PublishPackage { + code, + abi, + royalty_config, + metadata, + access_rules, + } => ast::Instruction::PublishPackage { + code: Value::try_from(code)?.to_ast_value(bech32_coder)?, + abi: Value::try_from(abi)?.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: Value::try_from(amount)?.to_ast_value(bech32_coder)?, + }, + + Self::SetMetadata { + entity_address, + key, + value, + } => ast::Instruction::SetMetadata { + entity_address: Value::try_from(entity_address)?.to_ast_value(bech32_coder)?, + key: Value::try_from(key)?.to_ast_value(bech32_coder)?, + value: Value::try_from(value)?.to_ast_value(bech32_coder)?, + }, + + Self::SetPackageRoyaltyConfig { + package_address, + royalty_config, + } => ast::Instruction::SetPackageRoyaltyConfig { + package_address: Value::try_from(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: Value::try_from(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: Value::try_from(package_address)? + .to_ast_value(bech32_coder)?, + } + } + + Self::ClaimComponentRoyalty { component_address } => { + ast::Instruction::ClaimComponentRoyalty { + component_address: Value::try_from(component_address)? + .to_ast_value(bech32_coder)?, + } + } + + Self::SetMethodAccessRule { + entity_address, + index, + key, + rule, + } => ast::Instruction::SetMethodAccessRule { + entity_address: Value::try_from(entity_address)?.to_ast_value(bech32_coder)?, + index: Value::try_from(index)?.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, + initial_supply, + } => ast::Instruction::CreateFungibleResource { + divisibility: Value::try_from(divisibility)?.to_ast_value(bech32_coder)?, + metadata: metadata.to_ast_value(bech32_coder)?, + access_rules: access_rules.to_ast_value(bech32_coder)?, + initial_supply: initial_supply.to_ast_value(bech32_coder)?, + }, + Self::CreateFungibleResourceWithOwner { + divisibility, + metadata, + owner_badge, + initial_supply, + } => ast::Instruction::CreateFungibleResourceWithOwner { + divisibility: Value::try_from(divisibility)?.to_ast_value(bech32_coder)?, + metadata: metadata.to_ast_value(bech32_coder)?, + owner_badge: Value::try_from(owner_badge)?.to_ast_value(bech32_coder)?, + initial_supply: initial_supply.to_ast_value(bech32_coder)?, + }, + Self::CreateNonFungibleResource { + id_type, + metadata, + access_rules, + initial_supply, + } => ast::Instruction::CreateNonFungibleResource { + id_type: id_type.to_ast_value(bech32_coder)?, + metadata: metadata.to_ast_value(bech32_coder)?, + access_rules: access_rules.to_ast_value(bech32_coder)?, + initial_supply: initial_supply.to_ast_value(bech32_coder)?, + }, + Self::CreateNonFungibleResourceWithOwner { + id_type, + metadata, + owner_badge, + initial_supply, + } => ast::Instruction::CreateNonFungibleResourceWithOwner { + id_type: id_type.to_ast_value(bech32_coder)?, + metadata: metadata.to_ast_value(bech32_coder)?, + owner_badge: Value::try_from(owner_badge)?.to_ast_value(bech32_coder)?, + initial_supply: initial_supply.to_ast_value(bech32_coder)?, + }, + Self::MintFungible { + resource_address, + amount, + } => ast::Instruction::MintFungible { + resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, + amount: Value::try_from(amount)?.to_ast_value(bech32_coder)?, + }, + Self::MintNonFungible { + resource_address, + entries, + } => ast::Instruction::MintNonFungible { + resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, + entries: entries.to_ast_value(bech32_coder)?, + }, + Self::RegisterValidator { validator } => ast::Instruction::RegisterValidator { + validator: Value::try_from(validator)?.to_ast_value(bech32_coder)?, + }, + Self::UnregisterValidator { validator } => ast::Instruction::RegisterValidator { + validator: Value::try_from(validator)?.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: Value::from_ast_value(package_address, bech32_coder)? + .try_into()?, + blueprint_name: Value::from_ast_value(blueprint_name, bech32_coder)?.try_into()?, + function_name: Value::from_ast_value(function_name, bech32_coder)?.try_into()?, + arguments: { + let arguments = args + .iter() + .map(|v| Value::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: Value::from_ast_value(component_address, bech32_coder)? + .try_into()?, + method_name: Value::from_ast_value(method_name, bech32_coder)?.try_into()?, + arguments: { + let arguments = args + .iter() + .map(|v| Value::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: Value::from_ast_value(resource_address, bech32_coder)? + .try_into()?, + into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?.try_into()?, + }, + ast::Instruction::TakeFromWorktopByAmount { + amount, + resource_address, + new_bucket, + } => Self::TakeFromWorktopByAmount { + amount: Value::from_ast_value(amount, bech32_coder)?.try_into()?, + resource_address: Value::from_ast_value(resource_address, bech32_coder)? + .try_into()?, + into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?.try_into()?, + }, + ast::Instruction::TakeFromWorktopByIds { + ids, + resource_address, + new_bucket, + } => Self::TakeFromWorktopByIds { + ids: if let Value::Array { + element_kind: _, + elements, + } = Value::from_ast_value(ids, bech32_coder)? + { + elements + .into_iter() + .map(NonFungibleId::try_from) + .collect::>>()? + } else { + panic!("Expected type Array!") + }, + resource_address: Value::from_ast_value(resource_address, bech32_coder)? + .try_into()?, + into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?.try_into()?, + }, + ast::Instruction::ReturnToWorktop { bucket } => Self::ReturnToWorktop { + bucket: Value::from_ast_value(bucket, bech32_coder)?.try_into()?, + }, + + ast::Instruction::AssertWorktopContains { resource_address } => { + Self::AssertWorktopContains { + resource_address: Value::from_ast_value(resource_address, bech32_coder)? + .try_into()?, + } + } + ast::Instruction::AssertWorktopContainsByAmount { + amount, + resource_address, + } => Self::AssertWorktopContainsByAmount { + amount: Value::from_ast_value(amount, bech32_coder)?.try_into()?, + resource_address: Value::from_ast_value(resource_address, bech32_coder)? + .try_into()?, + }, + ast::Instruction::AssertWorktopContainsByIds { + ids, + resource_address, + } => Self::AssertWorktopContainsByIds { + ids: if let Value::Array { + element_kind: _, + elements, + } = Value::from_ast_value(ids, bech32_coder)? + { + elements + .into_iter() + .map(NonFungibleId::try_from) + .collect::>>()? + } else { + panic!("Expected type Array!") + }, + resource_address: Value::from_ast_value(resource_address, bech32_coder)? + .try_into()?, + }, + + ast::Instruction::PopFromAuthZone { new_proof } => Self::PopFromAuthZone { + into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, + }, + ast::Instruction::PushToAuthZone { proof } => Self::PushToAuthZone { + proof: Value::from_ast_value(proof, bech32_coder)?.try_into()?, + }, + ast::Instruction::ClearAuthZone => Self::ClearAuthZone, + + ast::Instruction::CreateProofFromAuthZone { + resource_address, + new_proof, + } => Self::CreateProofFromAuthZone { + resource_address: Value::from_ast_value(resource_address, bech32_coder)? + .try_into()?, + into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, + }, + ast::Instruction::CreateProofFromAuthZoneByAmount { + amount, + resource_address, + new_proof, + } => Self::CreateProofFromAuthZoneByAmount { + amount: Value::from_ast_value(amount, bech32_coder)?.try_into()?, + resource_address: Value::from_ast_value(resource_address, bech32_coder)? + .try_into()?, + into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, + }, + ast::Instruction::CreateProofFromAuthZoneByIds { + ids, + resource_address, + new_proof, + } => Self::CreateProofFromAuthZoneByIds { + ids: if let Value::Array { + element_kind: _, + elements, + } = Value::from_ast_value(ids, bech32_coder)? + { + elements + .into_iter() + .map(NonFungibleId::try_from) + .collect::>>()? + } else { + panic!("Expected type Array!") + }, + resource_address: Value::from_ast_value(resource_address, bech32_coder)? + .try_into()?, + into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, + }, + ast::Instruction::CreateProofFromBucket { bucket, new_proof } => { + Self::CreateProofFromBucket { + bucket: Value::from_ast_value(bucket, bech32_coder)?.try_into()?, + into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, + } + } + + ast::Instruction::CloneProof { proof, new_proof } => Self::CloneProof { + proof: Value::from_ast_value(proof, bech32_coder)?.try_into()?, + into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, + }, + ast::Instruction::DropProof { proof } => Self::DropProof { + proof: Value::from_ast_value(proof, bech32_coder)?.try_into()?, + }, + ast::Instruction::DropAllProofs => Self::DropAllProofs, + ast::Instruction::PublishPackageWithOwner { + code, + abi, + owner_badge, + } => Self::PublishPackageWithOwner { + owner_badge: Value::from_ast_value(owner_badge, bech32_coder)?.try_into()?, + code: Value::from_ast_value(code, bech32_coder)?.try_into()?, + abi: Value::from_ast_value(abi, bech32_coder)?.try_into()?, + }, + ast::Instruction::BurnResource { bucket } => Self::BurnResource { + bucket: Value::from_ast_value(bucket, bech32_coder)?.try_into()?, + }, + ast::Instruction::PublishPackage { + code, + abi, + royalty_config, + metadata, + access_rules, + } => Self::PublishPackage { + code: Value::from_ast_value(code, bech32_coder)?.try_into()?, + abi: Value::from_ast_value(abi, bech32_coder)?.try_into()?, + royalty_config: Value::from_ast_value(royalty_config, bech32_coder)?, + metadata: Value::from_ast_value(metadata, bech32_coder)?, + access_rules: Value::from_ast_value(access_rules, bech32_coder)?, + }, + ast::Instruction::RecallResource { vault_id, amount } => Self::RecallResource { + vault_id: Value::from_ast_value(vault_id, bech32_coder)?, + amount: Value::from_ast_value(amount, bech32_coder)?.try_into()?, + }, + ast::Instruction::SetMetadata { + entity_address, + key, + value, + } => Self::SetMetadata { + entity_address: Value::from_ast_value(entity_address, bech32_coder)?.try_into()?, + key: Value::from_ast_value(key, bech32_coder)?.try_into()?, + value: Value::from_ast_value(value, bech32_coder)?.try_into()?, + }, + + ast::Instruction::SetPackageRoyaltyConfig { + package_address, + royalty_config, + } => Self::SetPackageRoyaltyConfig { + package_address: Value::from_ast_value(package_address, bech32_coder)? + .try_into()?, + royalty_config: Value::from_ast_value(royalty_config, bech32_coder)?, + }, + + ast::Instruction::SetComponentRoyaltyConfig { + component_address, + royalty_config, + } => Self::SetComponentRoyaltyConfig { + component_address: Value::from_ast_value(component_address, bech32_coder)? + .try_into()?, + royalty_config: Value::from_ast_value(royalty_config, bech32_coder)?, + }, + + ast::Instruction::ClaimPackageRoyalty { package_address } => { + Self::ClaimPackageRoyalty { + package_address: Value::from_ast_value(package_address, bech32_coder)? + .try_into()?, + } + } + + ast::Instruction::ClaimComponentRoyalty { component_address } => { + Self::ClaimComponentRoyalty { + component_address: Value::from_ast_value(component_address, bech32_coder)? + .try_into()?, + } + } + + ast::Instruction::SetMethodAccessRule { + entity_address, + index, + key, + rule, + } => Self::SetMethodAccessRule { + entity_address: Value::from_ast_value(entity_address, bech32_coder)?.try_into()?, + index: Value::from_ast_value(index, bech32_coder)?.try_into()?, + key: Value::from_ast_value(key, bech32_coder)?, + rule: Value::from_ast_value(rule, bech32_coder)?, + }, + + ast::Instruction::CreateFungibleResource { + divisibility, + metadata, + access_rules, + initial_supply, + } => Self::CreateFungibleResource { + divisibility: Value::from_ast_value(divisibility, bech32_coder)?.try_into()?, + metadata: Value::from_ast_value(metadata, bech32_coder)?, + access_rules: Value::from_ast_value(access_rules, bech32_coder)?, + initial_supply: Value::from_ast_value(initial_supply, bech32_coder)?, + }, + ast::Instruction::CreateFungibleResourceWithOwner { + divisibility, + metadata, + owner_badge, + initial_supply, + } => Self::CreateFungibleResourceWithOwner { + divisibility: Value::from_ast_value(divisibility, bech32_coder)?.try_into()?, + metadata: Value::from_ast_value(metadata, bech32_coder)?, + owner_badge: Value::from_ast_value(owner_badge, bech32_coder)?.try_into()?, + initial_supply: Value::from_ast_value(initial_supply, bech32_coder)?, + }, + ast::Instruction::CreateNonFungibleResource { + id_type, + metadata, + access_rules, + initial_supply, + } => Self::CreateNonFungibleResource { + id_type: Value::from_ast_value(id_type, bech32_coder)?, + metadata: Value::from_ast_value(metadata, bech32_coder)?, + access_rules: Value::from_ast_value(access_rules, bech32_coder)?, + initial_supply: Value::from_ast_value(initial_supply, bech32_coder)?, + }, + ast::Instruction::CreateNonFungibleResourceWithOwner { + id_type, + metadata, + owner_badge, + initial_supply, + } => Self::CreateNonFungibleResourceWithOwner { + id_type: Value::from_ast_value(id_type, bech32_coder)?, + metadata: Value::from_ast_value(metadata, bech32_coder)?, + owner_badge: Value::from_ast_value(owner_badge, bech32_coder)?.try_into()?, + initial_supply: Value::from_ast_value(initial_supply, bech32_coder)?, + }, + + ast::Instruction::MintFungible { + resource_address, + amount, + } => Self::MintFungible { + resource_address: Value::from_ast_value(resource_address, bech32_coder)? + .try_into()?, + amount: Value::from_ast_value(amount, bech32_coder)?.try_into()?, + }, + ast::Instruction::MintNonFungible { + resource_address, + entries, + } => Self::MintNonFungible { + resource_address: Value::from_ast_value(resource_address, bech32_coder)? + .try_into()?, + entries: Value::from_ast_value(entries, bech32_coder)?, + }, + ast::Instruction::RegisterValidator { validator } => Self::RegisterValidator { + validator: Value::from_ast_value(validator, bech32_coder)?.try_into()?, + }, + ast::Instruction::UnregisterValidator { validator } => Self::UnregisterValidator { + validator: Value::from_ast_value(validator, bech32_coder)?.try_into()?, + }, + }; + Ok(instruction) + } +} diff --git a/core/src/model/value.rs b/core/src/model/value.rs index f954ef00..5c1556e1 100644 --- a/core/src/model/value.rs +++ b/core/src/model/value.rs @@ -1521,6 +1521,8 @@ impl From for ScryptoValueKind { macro_rules! value_invertible { ($variant_name: ident, $underlying_type: ident, $field: ident) => { + // Doesn't actually need to be a TryFrom, could be a From. It's only TryFrom to work with + // serde_with impl TryFrom<$underlying_type> for Value { type Error = $crate::error::Error; @@ -1561,6 +1563,41 @@ value_invertible! {ResourceAddress, NetworkAwareResourceAddress, address} value_invertible! {ComponentAddress, NetworkAwareComponentAddress, address} value_invertible! {EcdsaSecp256k1PublicKey, EcdsaSecp256k1PublicKey, public_key} +impl TryFrom for Value { + type Error = Error; + + fn try_from(value: EntityAddress) -> Result { + match value { + EntityAddress::ComponentAddress { address } => Ok(Value::ComponentAddress { address }), + EntityAddress::ResourceAddress { address } => Ok(Value::ResourceAddress { address }), + EntityAddress::PackageAddress { address } => Ok(Value::PackageAddress { address }), + EntityAddress::SystemAddress { address } => Ok(Value::SystemAddress { address }), + } + } +} + +impl TryFrom for EntityAddress { + type Error = Error; + + fn try_from(value: Value) -> Result { + match value { + Value::ComponentAddress { address } => Ok(EntityAddress::ComponentAddress { address }), + Value::ResourceAddress { address } => Ok(EntityAddress::ResourceAddress { address }), + Value::PackageAddress { address } => Ok(EntityAddress::PackageAddress { address }), + Value::SystemAddress { address } => Ok(EntityAddress::SystemAddress { address }), + _ => Err(Error::InvalidKind { + expected: vec![ + ValueKind::ComponentAddress, + ValueKind::ResourceAddress, + ValueKind::PackageAddress, + ValueKind::SystemAddress, + ], + found: value.kind(), + }), + } + } +} + // ======== // Helpers // ======== From b3b81a38e18cb9734d449e21fefe2fad19975579 Mon Sep 17 00:00:00 2001 From: Omar Date: Sun, 15 Jan 2023 19:24:35 +0300 Subject: [PATCH 035/110] Manifest conversion logic --- core/src/error.rs | 51 ++++++- core/src/model/address/coder.rs | 34 +++-- core/src/model/transaction/instructions.rs | 167 ++++++++++++++++++++- core/src/model/value.rs | 3 +- 4 files changed, 234 insertions(+), 21 deletions(-) diff --git a/core/src/error.rs b/core/src/error.rs index e293685d..884a9d54 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -27,7 +27,9 @@ use crate::ValueKind; /// Radix Engine Toolkit may return for a request. pub enum Error { /// An error emitted when the toolkit attempts to decode some string as a hex string and fails - FailedToDecodeHex { value: String }, + 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 @@ -42,7 +44,9 @@ pub enum Error { }, /// Represents an address error encountered during the Bech32 encoding or decoding phase - AddressError { value: String }, + AddressError { + message: String, + }, /// An error emitted when the passed `Value` is not one of the accepted value types for a given /// request or operation. @@ -62,13 +66,19 @@ pub enum Error { /// additional context. This error is typically seen in situations when trying to encode either /// a `Bucket("some_string")` or a `Proof("some_string")` as buckets or proofs with String /// identifiers can not be encoded in SBOR without an ID Allocator. - BucketOrProofSBORError { value_kind: ValueKind }, + BucketOrProofSBORError { + value_kind: ValueKind, + }, /// Represents an error when trying to encode some object in SBOR. - SborEncodeError { value: String }, + SborEncodeError { + message: String, + }, /// Represents an error when trying to decode some object in SBOR. - SborDecodeError { value: String }, + SborDecodeError { + message: String, + }, // ==== // AST @@ -84,13 +94,33 @@ pub enum Error { }, /// An error emitted when the parsing of a value from string fails. - ParseError { kind: ValueKind, message: String }, + ParseError { + kind: ValueKind, + 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, + }, } impl Display for Error { @@ -108,9 +138,9 @@ macro_rules! to_debug_string { macro_rules! generate_from_error { ($error: ty as $variant: ident) => { impl From<$error> for Error { - fn from(value: $error) -> Self { + fn from(message: $error) -> Self { Self::$variant { - value: to_debug_string!(value), + message: to_debug_string!(message), } } } @@ -121,6 +151,11 @@ generate_from_error!(hex::FromHexError as FailedToDecodeHex); generate_from_error!(scrypto::radix_engine_interface::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!( + native_transaction::manifest::generator::GeneratorError as ManifestGenerationError +); macro_rules! impl_from_parse_error { ($($error_type: ty => $kind: ident,)*) => { diff --git a/core/src/model/address/coder.rs b/core/src/model/address/coder.rs index 4e61d2af..b5e43d3b 100644 --- a/core/src/model/address/coder.rs +++ b/core/src/model/address/coder.rs @@ -28,27 +28,39 @@ use scrypto::radix_engine_interface::node::NetworkDefinition; /// A Bech32m encoder and decoder used in the Radix Engine Toolkit for all of it's address encoding /// and decoding needs pub struct Bech32Coder { - network_id: u8, + 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); + 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 { + pub fn new_with_network_definition(network_definition: NetworkDefinition) -> Self { Self { - network_id: network_definition.id, - encoder: Bech32Encoder::new(network_definition), - decoder: Bech32Decoder::new(network_definition), + 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_id + self.network_definition.id } pub fn new_from_hrp>(hrp: S) -> Result { @@ -117,7 +129,7 @@ impl Bech32Coder { ) -> Result { self.decode_component_address(component_address) .map(|component_address| NetworkAwareComponentAddress { - network_id: self.network_id, + network_id: self.network_id(), address: component_address, }) } @@ -128,7 +140,7 @@ impl Bech32Coder { ) -> Result { self.decode_resource_address(resource_address) .map(|resource_address| NetworkAwareResourceAddress { - network_id: self.network_id, + network_id: self.network_id(), address: resource_address, }) } @@ -139,7 +151,7 @@ impl Bech32Coder { ) -> Result { self.decode_system_address(system_address) .map(|system_address| NetworkAwareSystemAddress { - network_id: self.network_id, + network_id: self.network_id(), address: system_address, }) } @@ -150,7 +162,7 @@ impl Bech32Coder { ) -> Result { self.decode_package_address(package_address) .map(|package_address| NetworkAwarePackageAddress { - network_id: self.network_id, + network_id: self.network_id(), address: package_address, }) } diff --git a/core/src/model/transaction/instructions.rs b/core/src/model/transaction/instructions.rs index f91ea45d..9babd268 100644 --- a/core/src/model/transaction/instructions.rs +++ b/core/src/model/transaction/instructions.rs @@ -15,16 +15,181 @@ // specific language governing permissions and limitations // under the License. -use crate::Instruction; +use crate::address::Bech32Coder; +use crate::error::Result; +use crate::model::Instruction; +use native_transaction::manifest::{ast, decompile}; +use native_transaction::model as transaction; +use scrypto::prelude::hash; use serializable::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")] +#[derive(Clone)] pub enum ManifestInstructions { String(String), Parsed(Vec), } + +/// An enum which describes the kind of manifest instructions. +pub enum InstructionKind { + String, + Parsed, +} + +// =============== +// Implementation +// =============== + +impl ManifestInstructions { + 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::BasicInstruction conversion + // and skip the ast::Instruction phase? + // A. Because the IdValidator and id validation in general takes place when the + // instruction is being converted from ast::Instruction -> transaction::BasicInstruction. + // If i implement my own conversion (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) -> 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::>>()?; + Ok(Self::Parsed(instructions)) + } + } + } + + 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), + } + } +} diff --git a/core/src/model/value.rs b/core/src/model/value.rs index 5c1556e1..16d153fb 100644 --- a/core/src/model/value.rs +++ b/core/src/model/value.rs @@ -901,7 +901,8 @@ impl Value { .map(|value| Self::Bytes { value }) })?, - ast::Value::Own(..) => todo!(), // TODO: Implement this once we've agreed on the format that own is represented in manifests + ast::Value::Own(..) => todo!(), /* TODO: Implement this once we've agreed on the + * format that own is represented in manifests */ }; Ok(value) } From cf80e01122cfdb09adb27b086f2b23511a8dba96 Mon Sep 17 00:00:00 2001 From: Omar Date: Sun, 15 Jan 2023 22:25:32 +0300 Subject: [PATCH 036/110] Initial request architecture --- core/src/error.rs | 9 ++ core/src/lib.rs | 2 + core/src/model/transaction/instructions.rs | 21 ++-- core/src/model/transaction/manifest.rs | 4 +- core/src/model/value.rs | 94 ++++++++++++--- core/src/request/convert_manifest_request.rs | 119 +++++++++++++++++++ core/src/request/mod.rs | 22 ++++ core/src/request/traits.rs | 41 +++++++ 8 files changed, 284 insertions(+), 28 deletions(-) create mode 100644 core/src/request/convert_manifest_request.rs create mode 100644 core/src/request/mod.rs create mode 100644 core/src/request/traits.rs diff --git a/core/src/error.rs b/core/src/error.rs index 884a9d54..b80dfb22 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -121,6 +121,15 @@ pub enum Error { ManifestGenerationError { message: String, }, + + // =========== + // Validation + // =========== + /// An error emitted when there is a network mismatch between addresses and the header network + NetworkMismatchError { + found: u8, + expected: u8, + }, } impl Display for Error { diff --git a/core/src/lib.rs b/core/src/lib.rs index 567aa386..83fd6183 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -17,8 +17,10 @@ pub mod error; pub mod model; +pub mod request; pub mod utils; pub use error::*; pub use model::*; +pub use request::*; pub use utils::*; diff --git a/core/src/model/transaction/instructions.rs b/core/src/model/transaction/instructions.rs index 9babd268..ed017642 100644 --- a/core/src/model/transaction/instructions.rs +++ b/core/src/model/transaction/instructions.rs @@ -34,12 +34,14 @@ use serializable::serializable; #[serializable] #[serde(tag = "type", content = "value")] #[derive(Clone)] -pub enum ManifestInstructions { +pub enum InstructionsList { String(String), Parsed(Vec), } /// An enum which describes the kind of manifest instructions. +#[serializable] +#[derive(Clone, Copy)] pub enum InstructionKind { String, Parsed, @@ -49,7 +51,7 @@ pub enum InstructionKind { // Implementation // =============== -impl ManifestInstructions { +impl InstructionsList { pub fn kind(&self) -> InstructionKind { match self { Self::String(..) => InstructionKind::String, @@ -106,18 +108,19 @@ impl ManifestInstructions { // understood by the radix transaction manifest compiler is by going through a // series of steps: // - // Vec -> Vec -> Vec -> - // String + // Vec -> Vec -> Vec + // -> String // // This long conversion is because we would like to use the decompiler provided by // the Scrypto repo. // - // Q. Why not just implement a Instruction -> transaction::BasicInstruction conversion - // and skip the ast::Instruction phase? + // Q. Why not just implement a Instruction -> transaction::BasicInstruction + // conversion and skip the ast::Instruction phase? // A. Because the IdValidator and id validation in general takes place when the - // instruction is being converted from ast::Instruction -> transaction::BasicInstruction. - // If i implement my own conversion (which is easy) then I lose out on the benefits - // of running the id validator on transactions and the validation that it performs. + // instruction is being converted from ast::Instruction -> + // transaction::BasicInstruction. 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? diff --git a/core/src/model/transaction/manifest.rs b/core/src/model/transaction/manifest.rs index 6a67becd..18753014 100644 --- a/core/src/model/transaction/manifest.rs +++ b/core/src/model/transaction/manifest.rs @@ -15,14 +15,14 @@ // specific language governing permissions and limitations // under the License. -use crate::ManifestInstructions; +use crate::InstructionsList; use serializable::serializable; /// A transaction intent consisting of instructions as well as blobs #[serializable] pub struct TransactionManifest { /// The transaction manifest instructions to be executed in the transaction. - pub instructions: ManifestInstructions, + pub instructions: InstructionsList, /// An array of byte arrays which is serialized as an array of hex strings which represents the /// blobs included in the transaction. diff --git a/core/src/model/value.rs b/core/src/model/value.rs index 16d153fb..b2e0df26 100644 --- a/core/src/model/value.rs +++ b/core/src/model/value.rs @@ -330,7 +330,7 @@ pub enum Value { /// An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is /// essentially the `type` tags used for the value model. #[serializable] -#[derive(Clone, Copy)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub enum ValueKind { Bool, @@ -1205,16 +1205,17 @@ impl Value { /// Handles the aliasing of certain [`Value`] kinds such as [`Value::Enum`] and /// [`Value::NonFungibleAddress`]. This is typically used during request post processing to /// ensure that all responses include aliased values - pub fn alias(self) -> Self { + pub fn alias(&mut self) { match self { // Case: Some - An enum with a discriminator of "Some" which has a single field. Self::Enum { variant, fields } if variant == "Some" && fields.as_ref().map_or(0, |fields| fields.len()) == 1 => { - Self::Some { + *self = Self::Some { value: Box::new( fields - .unwrap_or_default() + .as_ref() + .expect("Illegal State!") .get(0) .expect("Illegal State!") .clone(), @@ -1225,16 +1226,17 @@ impl Value { Self::Enum { variant, fields } if variant == "None" && fields.as_ref().map_or(0, |fields| fields.len()) == 0 => { - Self::None + *self = Self::None } // Case: Ok - An enum with a discriminator of "Ok" which has a single field. Self::Enum { variant, fields } if variant == "Ok" && fields.as_ref().map_or(0, |fields| fields.len()) == 1 => { - Self::Ok { + *self = Self::Ok { value: Box::new( fields - .unwrap_or_default() + .as_ref() + .expect("Illegal State!") .get(0) .expect("Illegal State!") .clone(), @@ -1245,10 +1247,11 @@ impl Value { Self::Enum { variant, fields } if variant == "Err" && fields.as_ref().map_or(0, |fields| fields.len()) == 1 => { - Self::Err { + *self = Self::Err { value: Box::new( fields - .unwrap_or_default() + .as_ref() + .expect("Illegal State!") .get(0) .expect("Illegal State!") .clone(), @@ -1265,16 +1268,73 @@ impl Value { Some(Value::NonFungibleId { value: non_fungible_id, }), - ) if elements.len() == 2 => Value::NonFungibleAddress { - address: NonFungibleAddress { - resource_address: *resource_address, - non_fungible_id: non_fungible_id.clone(), - }, - }, - _ => self, + ) if elements.len() == 2 => { + *self = Value::NonFungibleAddress { + address: NonFungibleAddress { + resource_address: *resource_address, + non_fungible_id: non_fungible_id.clone(), + }, + }; + } + _ => {} + } + } + _ => {} + } + } + + /// Top-level method for performing [`Value`] validation. + pub fn validate(&self, network_id: Option) -> Result<()> { + if let Some(network_id) = network_id { + self.validate_network(network_id)? + } + self.validate_collections()?; + Ok(()) + } + + /// Validates the network of all network aware types against a given network id + fn validate_network(&self, expected_network_id: u8) -> Result<()> { + let found_network_id = match self { + Self::ComponentAddress { address } => address.network_id, + Self::PackageAddress { address } => address.network_id, + Self::ResourceAddress { address } => address.network_id, + Self::SystemAddress { address } => address.network_id, + Self::NonFungibleAddress { address } => address.resource_address.network_id, + _ => return Ok(()), + }; + + if found_network_id == expected_network_id { + Ok(()) + } else { + Err(Error::NetworkMismatchError { + found: found_network_id, + expected: expected_network_id, + }) + } + } + + /// Validates [`Value`] collections to ensure that they're of a single kind. + fn validate_collections(&self) -> Result<()> { + match self { + Self::Array { + element_kind, + elements, + } => { + if let Some(offending_value_kind) = elements + .iter() + .map(|value| value.kind()) + .find(|kind| *kind != *element_kind) + { + Err(Error::UnexpectedAstContents { + parsing: ValueKind::Array, + expected: vec![*element_kind], + found: offending_value_kind, + }) + } else { + Ok(()) } } - v => v, + _ => Ok(()), } } } diff --git a/core/src/request/convert_manifest_request.rs b/core/src/request/convert_manifest_request.rs new file mode 100644 index 00000000..3c785770 --- /dev/null +++ b/core/src/request/convert_manifest_request.rs @@ -0,0 +1,119 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +//! Defines the request and response models for the convert manifest request. This request is made +//! when the client has a manifest in one format (JSON as an example) and they wish to convert +//! the manifest to another format (String as an example). The conversion between the supported +//! formats is dependent on two main factors: the transaction version, and the network id. + +use crate::error::Result; +use crate::model::address::Bech32Coder; +use crate::model::instructions::InstructionKind; +use crate::model::TransactionManifest; +use crate::{Handler, InstructionsList}; +use serializable::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 { + /// The version of the passed transaction manifest. Used to determine how the manifest is + /// interpreted by the library. + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + pub transaction_version: u8, + + /// The network id of the network that this transaction manifest is meant for. This is used for + /// the Bech32 address encoding and decoding. + #[schemars(with = "String")] + #[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_format: InstructionKind, + + /// The manifest to convert to the format described by `instructions_output_format` + pub manifest: TransactionManifest, +} + +/// The response of the [`ConvertManifestRequest`] +#[serializable] +pub struct ConvertManifestResponse { + /// The converted manifest + #[serde(flatten)] + pub manifest: TransactionManifest, +} + +// =============== +// Implementation +// =============== + +struct ConvertManifestHandler; + +impl Handler for ConvertManifestHandler { + fn pre_process(request: ConvertManifestRequest) -> Result { + // TODO: Validate the value collections + // TODO: Validate the value network id + // TODO: Validate the instruction values + Ok(request) + } + + fn handle(request: &ConvertManifestRequest) -> Result { + request + .manifest + .instructions + .convert_to_manifest_instructions_kind( + request.instructions_output_format, + &Bech32Coder::new(request.network_id), + request.manifest.blobs.clone(), + ) + .map(|instructions| ConvertManifestResponse { + manifest: TransactionManifest { + instructions, + blobs: request.manifest.blobs.clone(), + }, + }) + } + + fn post_process( + request: &ConvertManifestRequest, + mut response: ConvertManifestResponse, + ) -> ConvertManifestResponse { + // TODO: Get all values and alias them. + response + } +} diff --git a/core/src/request/mod.rs b/core/src/request/mod.rs new file mode 100644 index 00000000..4750d366 --- /dev/null +++ b/core/src/request/mod.rs @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +pub mod convert_manifest_request; +pub mod traits; + +pub use convert_manifest_request::*; +pub use traits::*; diff --git a/core/src/request/traits.rs b/core/src/request/traits.rs new file mode 100644 index 00000000..c64053f8 --- /dev/null +++ b/core/src/request/traits.rs @@ -0,0 +1,41 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::error::Result; + +/// 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) -> O; + + /// 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).map(|response| Self::post_process(&request, response)) + } +} From 425fb295aef63770f67f0ae3bb1c0d8e98f5a242 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 16 Jan 2023 00:32:18 +0300 Subject: [PATCH 037/110] Refactor instructions to unstructured model --- core/src/error.rs | 5 +- core/src/lib.rs | 2 + .../src/model/address/non_fungible_address.rs | 4 +- .../engine_identifier/transient_identifier.rs | 6 +- core/src/model/instruction.rs | 1056 +++++++++++------ .../{instructions.rs => instruction_list.rs} | 50 +- core/src/model/transaction/manifest.rs | 22 +- core/src/model/transaction/mod.rs | 4 +- core/src/model/value.rs | 4 +- core/src/request/convert_manifest_request.rs | 41 +- core/src/traits.rs | 10 + 11 files changed, 812 insertions(+), 392 deletions(-) rename core/src/model/transaction/{instructions.rs => instruction_list.rs} (85%) create mode 100644 core/src/traits.rs diff --git a/core/src/error.rs b/core/src/error.rs index b80dfb22..3f55fe8a 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -21,10 +21,11 @@ use serializable::serializable; use crate::ValueKind; -#[serializable] -#[serde(tag = "error")] /// 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(Clone)] pub enum Error { /// An error emitted when the toolkit attempts to decode some string as a hex string and fails FailedToDecodeHex { diff --git a/core/src/lib.rs b/core/src/lib.rs index 83fd6183..921e6fb0 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -18,9 +18,11 @@ pub mod error; pub mod model; pub mod request; +pub mod traits; pub mod utils; pub use error::*; pub use model::*; pub use request::*; +pub use traits::*; pub use utils::*; diff --git a/core/src/model/address/non_fungible_address.rs b/core/src/model/address/non_fungible_address.rs index 9f2769bf..0be9e841 100644 --- a/core/src/model/address/non_fungible_address.rs +++ b/core/src/model/address/non_fungible_address.rs @@ -22,11 +22,11 @@ use serializable::serializable; use crate::model::NetworkAwareResourceAddress; -#[serializable] -#[derive(Clone)] /// 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(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct NonFungibleAddress { #[schemars(with = "crate::Value")] #[serde_as(as = "serde_with::TryFromInto")] diff --git a/core/src/model/engine_identifier/transient_identifier.rs b/core/src/model/engine_identifier/transient_identifier.rs index 962b1335..8aed3319 100644 --- a/core/src/model/engine_identifier/transient_identifier.rs +++ b/core/src/model/engine_identifier/transient_identifier.rs @@ -27,7 +27,7 @@ use std::str::FromStr; #[serializable] #[serde(untagged)] -#[derive(Clone)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] /// Represents an untagged 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) @@ -37,12 +37,12 @@ pub enum TransientIdentifier { } #[serializable] -#[derive(Clone)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] /// Represents a BucketId which uses a transient identifier. pub struct BucketId(pub TransientIdentifier); #[serializable] -#[derive(Clone)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] /// Represents a ProofId which uses a transient identifier. pub struct ProofId(pub TransientIdentifier); diff --git a/core/src/model/instruction.rs b/core/src/model/instruction.rs index 78b1378d..aaaa3df7 100644 --- a/core/src/model/instruction.rs +++ b/core/src/model/instruction.rs @@ -17,16 +17,11 @@ use std::collections::HashSet; -use crate::address::{Bech32Coder, NonFungibleAddress}; -use crate::engine_identifier::{BucketId, ProofId}; +use crate::address::Bech32Coder; use crate::error::Result; -use crate::model::address::entity_address::*; -use crate::model::address::network_aware_address::*; -use crate::Value; +use crate::{Value, ValueRef}; use native_transaction::manifest::ast; -use scrypto::prelude::{Decimal, EcdsaSecp256k1PublicKey, NonFungibleId}; -use scrypto::runtime::ManifestBlobRef; use serializable::serializable; @@ -52,25 +47,18 @@ pub enum Instruction { /// The address of the package containing the blueprint that contains the desired function. /// This package address is serialized as the `PackageAddress` variant of the `Value` /// model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - package_address: NetworkAwarePackageAddress, + package_address: Value, /// A string of the name of the blueprint containing the desired function. This field is /// serialized as a `String` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - blueprint_name: String, + blueprint_name: Value, /// A string of the name of the function to call. This field is serialized as a `String` /// from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - function_name: String, + function_name: Value, /// An optional array of `Value` arguments to call the function with. If this array is /// empty or is not provided, then the function is called with no arguments. - #[serde(default, skip_serializing_if = "Option::is_none")] arguments: Option>, }, @@ -79,19 +67,14 @@ pub enum Instruction { CallMethod { /// The address of the component which contains the method to be invoked. This field is /// serialized as a `ComponentAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - component_address: NetworkAwareComponentAddress, + component_address: Value, /// A string of the name of the method to call. his field is serialized as a `String` from /// the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - method_name: String, + method_name: Value, /// An optional array of `Value` arguments to call the method with. If this array is empty /// or is not provided, then the method is called with no arguments. - #[serde(default, skip_serializing_if = "Option::is_none")] arguments: Option>, }, @@ -100,15 +83,11 @@ pub enum Instruction { TakeFromWorktop { /// The address of the resource to take from the worktop. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - resource_address: NetworkAwareResourceAddress, + resource_address: Value, /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from /// the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - into_bucket: BucketId, + into_bucket: Value, }, /// An instruction to take the an amount of a given resource address from the worktop and put @@ -116,21 +95,15 @@ pub enum Instruction { TakeFromWorktopByAmount { /// The address of the resource to take from the worktop. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - resource_address: NetworkAwareResourceAddress, + resource_address: Value, /// The amount of the resource to take from the worktop. This field is serialized as a /// `Decimal` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - amount: Decimal, + amount: Value, /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from /// the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - into_bucket: BucketId, + into_bucket: Value, }, /// An instruction to take the a set of non-fungible ids of a given resource address from the @@ -138,38 +111,29 @@ pub enum Instruction { TakeFromWorktopByIds { /// The address of the resource to take from the worktop. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - resource_address: NetworkAwareResourceAddress, + resource_address: Value, /// The non-fungible ids to take from the worktop. This is a set (serialized as a JSON /// array) of `NonFungibleId`s from the Value model. - #[schemars(with = "HashSet")] - #[serde_as(as = "HashSet>")] - ids: HashSet, + #[schemars(with = "HashSet")] + ids: Vec, /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from /// the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - into_bucket: BucketId, + into_bucket: Value, }, /// Returns a bucket of tokens to the worktop. ReturnToWorktop { /// The bucket to return to the worktop. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - bucket: BucketId, + bucket: Value, }, /// An instruction to assert that a given resource exists in the worktop. AssertWorktopContains { /// The address of the resource to perform the assertion on. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - resource_address: NetworkAwareResourceAddress, + resource_address: Value, }, /// An instruction to assert that a specific amount of a specific resource address exists in @@ -177,15 +141,11 @@ pub enum Instruction { AssertWorktopContainsByAmount { /// The address of the resource to perform the assertion on. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - resource_address: NetworkAwareResourceAddress, + resource_address: Value, /// The amount of the resource to assert their existence in the worktop. This field is /// serialized as a `Decimal` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - amount: Decimal, + amount: Value, }, /// An instruction to assert that a set ids of a specific resource address exists in the @@ -193,33 +153,26 @@ pub enum Instruction { AssertWorktopContainsByIds { /// The address of the resource to perform the assertion on. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - resource_address: NetworkAwareResourceAddress, + resource_address: Value, /// The non-fungible ids of the resource to assert their existence in the worktop. This is /// a set (serialized as a JSON array) of `NonFungibleId`s from the Value model. - #[schemars(with = "HashSet")] - #[serde_as(as = "HashSet>")] - ids: HashSet, + #[schemars(with = "HashSet")] + ids: Vec, }, /// An instruction which pops a proof from the AuthZone stack and into an identifiable proof PopFromAuthZone { /// The proof to put the popped proof into. This is serialized as a `Proof` from the Value /// model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - into_proof: ProofId, + into_proof: Value, }, /// An instruction that pushes a proof to the auth zone stack. PushToAuthZone { /// The proof to push to the auth zone stack. This is serialized as a `Proof` from the /// Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - proof: ProofId, + proof: Value, }, /// An instruction which clears the auth zone stack by dropping all of the proofs in that @@ -231,15 +184,11 @@ pub enum Instruction { CreateProofFromAuthZone { /// The address of the resource to create a proof of. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - resource_address: NetworkAwareResourceAddress, + resource_address: Value, /// A proof to put the resource proof into. This field is serialized as a `Proof` from the /// Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - into_proof: ProofId, + into_proof: Value, }, /// An instruction to create a proof of the an amount of a given resource address from the auth @@ -247,21 +196,15 @@ pub enum Instruction { CreateProofFromAuthZoneByAmount { /// The address of the resource to create a proof of. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - resource_address: NetworkAwareResourceAddress, + resource_address: Value, /// The amount of the resource to create a proof of. This field is serialized as a /// `Decimal` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - amount: Decimal, + amount: Value, /// A proof to put the resource proof into. This field is serialized as a `Proof` from the /// Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - into_proof: ProofId, + into_proof: Value, }, /// An instruction to create a proof of the a set of non-fungible ids of a given resource @@ -269,59 +212,44 @@ pub enum Instruction { CreateProofFromAuthZoneByIds { /// The address of the resource to create a proof of. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - resource_address: NetworkAwareResourceAddress, + resource_address: Value, /// The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) /// of `NonFungibleId`s from the Value model. - #[schemars(with = "HashSet")] - #[serde_as(as = "HashSet>")] - ids: HashSet, + #[schemars(with = "HashSet")] + ids: Vec, /// A proof to put the resource proof into. This field is serialized as a `Proof` from the /// Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - into_proof: ProofId, + into_proof: Value, }, /// An instruction to create a proof given a bucket of some resources CreateProofFromBucket { /// The bucket of resources to create a proof from. This field is serialized as a `Bucket` /// from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - bucket: BucketId, + bucket: Value, /// The proof variable that the proof should go to. This field is serialized as a `Proof` /// from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - into_proof: ProofId, + into_proof: Value, }, /// An instruction to clone a proof creating a second proof identical to the original CloneProof { /// The original proof, or the proof to be cloned. This field is serialized as a `Proof` /// from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - proof: ProofId, + proof: Value, /// The proof variable that the proof should go to. This field is serialized as a `Proof` /// from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - into_proof: ProofId, + into_proof: Value, }, /// An instruction to drop a proof. DropProof { /// The proof to drop. This field is serialized as a `Proof` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - proof: ProofId, + proof: Value, }, /// An instruction to drop all proofs currently present in the transaction context. @@ -332,29 +260,22 @@ pub enum Instruction { PublishPackage { /// The blob of the package code. This field is serialized as a `Blob` from the Value /// model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - code: ManifestBlobRef, + code: Value, /// The blob of the package ABI. This field is serialized as a `Blob` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - abi: ManifestBlobRef, + abi: Value, /// 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 `Array` from the Value model. - #[schemars(with = "Value")] royalty_config: Value, /// 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 `Array` from the Value model. - #[schemars(with = "Value")] metadata: Value, /// The access rules to use for the package. This is serialized as a `Tuple` from the Value /// model. - #[schemars(with = "Value")] access_rules: Value, }, @@ -363,43 +284,31 @@ pub enum Instruction { PublishPackageWithOwner { /// The blob of the package code. This field is serialized as a `Blob` from the Value /// model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - code: ManifestBlobRef, + code: Value, /// The blob of the package ABI. This field is serialized as a `Blob` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - abi: ManifestBlobRef, + abi: Value, /// The non-fungible address of the owner badge of this package. This field is serialized /// as a `NonFungibleAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - owner_badge: NonFungibleAddress, + owner_badge: Value, }, /// An instruction to burn a bucket of tokens. BurnResource { /// The bucket of tokens to burn. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - bucket: BucketId, + bucket: Value, }, /// An instruction ot recall resources from a known vault. 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`. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] vault_id: Value, /// The amount of tokens to recall from the vault. This field is serialized as a `Decimal` /// field from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - amount: Decimal, + amount: Value, }, /// An instruction to set the metadata on an entity. @@ -407,35 +316,26 @@ pub enum Instruction { /// 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 `SystemAddress`. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - entity_address: EntityAddress, + entity_address: Value, /// A string of the key to set the metadata for. This field is serialized as a `String` /// from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - key: String, + key: Value, /// A string of the value to set the metadata for. This field is serialized as a `String` /// from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - value: String, + value: Value, }, /// An instruction to modify the royalties of a package. SetPackageRoyaltyConfig { /// The address of the package to set the royalty on. This is serialized as a /// `PackageAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - package_address: NetworkAwarePackageAddress, + package_address: Value, /// 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 `Array` from the Value model. - #[schemars(with = "Value")] royalty_config: Value, }, @@ -443,12 +343,9 @@ pub enum Instruction { SetComponentRoyaltyConfig { /// The component address of the component to modify royalties for. This field is /// serialized as a `ComponentAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - component_address: NetworkAwareComponentAddress, + component_address: Value, /// The royalty config to set on the component. This is an `Enum` from the `Value` model. - #[schemars(with = "Value")] royalty_config: Value, }, @@ -456,42 +353,32 @@ pub enum Instruction { ClaimPackageRoyalty { /// The package address of the package to claim royalties for. This field is serialized as /// a `PackageAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - package_address: NetworkAwarePackageAddress, + package_address: Value, }, /// An instruction to claim royalties of a component ClaimComponentRoyalty { /// The component address of the component to claim royalties for. This field is serialized /// as a `ComponentAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - component_address: NetworkAwareComponentAddress, + component_address: Value, }, /// An instruction to modify the access rules of a method that an entity has. SetMethodAccessRule { /// The entity address of the entity to modify the access rules for. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - entity_address: EntityAddress, + entity_address: Value, /// Entity access rules is a stack of access rules, this index allows referring to a /// specific "layer" in said stack. This field is serialized as a `U32` from the `Value` /// model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - index: u32, + index: Value, /// The method key for the method to set the access rule of. This field is serialized as an /// `Enum` from the Value model - #[schemars(with = "Value")] key: Value, /// The new access rule to set in-place of the old one. This field is serialized as an /// `Enum` from the Value model - #[schemars(with = "Value")] rule: Value, }, @@ -499,29 +386,22 @@ pub enum Instruction { MintFungible { /// The address of the resource to mint tokens of. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - resource_address: NetworkAwareResourceAddress, + resource_address: Value, /// The amount of fungible tokens to mint of this resource. This field is serialized as a /// `Decimal` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - amount: Decimal, + amount: Value, }, /// An instruction to mind non-fungibles of a resource MintNonFungible { /// The address of the resource to mint tokens of. This field is serialized as a /// `ResourceAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - resource_address: NetworkAwareResourceAddress, + resource_address: Value, /// The non-fungible tokens to mint. The underlying type of this is a map which maps a /// `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of /// the immutable and mutable parts of the non-fungible data. - #[schemars(with = "Value")] entries: Value, }, @@ -529,25 +409,20 @@ pub enum Instruction { CreateFungibleResource { /// The divisibility of the resource. This field is serialized as a `U8` from the Value /// model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - divisibility: u8, + divisibility: Value, /// 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 `Array` from the Value model. - #[schemars(with = "Value")] metadata: Value, /// The access rules to use for the resource. The underlying type of this is a map which /// maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the /// current behavior and the mutability. This is serialized as an `Array` from the /// Value model. - #[schemars(with = "Value")] access_rules: Value, /// An optional decimal value of the initial supply to mint during resource creation. If /// present, this is serialized as a `Decimal` from the value model. - #[schemars(with = "Value")] initial_supply: Value, }, @@ -556,24 +431,18 @@ pub enum Instruction { CreateFungibleResourceWithOwner { /// The divisibility of the resource. This field is serialized as a `U8` from the Value /// model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - divisibility: u8, + divisibility: Value, /// 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 `Array` from the Value model. - #[schemars(with = "Value")] metadata: Value, /// The non-fungible address of the owner badge of this resource. This field is serialized /// as a `NonFungibleAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - owner_badge: NonFungibleAddress, + owner_badge: Value, /// An optional decimal value of the initial supply to mint during resource creation. If /// present, this is serialized as a `Decimal` from the value model. - #[schemars(with = "Option")] initial_supply: Value, }, @@ -581,26 +450,22 @@ pub enum Instruction { CreateNonFungibleResource { /// The type of the non-fungible id to use for this resource. This field is serialized as /// an `Enum` from the Value model. - #[schemars(with = "Value")] id_type: Value, /// 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 `Array` from the Value model. - #[schemars(with = "Value")] metadata: Value, /// The access rules to use for the resource. The underlying type of this is a map which /// maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the /// current behavior and the mutability. This is serialized as an `Array` from the /// Value model. - #[schemars(with = "Value")] access_rules: Value, /// An optional initial supply for the non-fungible resource being created. The underlying /// type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` /// elements where each element is a struct of the immutable and mutable parts of /// the non-fungible data. - #[schemars(with = "Option")] initial_supply: Value, }, @@ -609,42 +474,33 @@ pub enum Instruction { CreateNonFungibleResourceWithOwner { /// The type of the non-fungible id to use for this resource. This field is serialized as /// an `Enum` from the Value model. - #[schemars(with = "Value")] id_type: Value, /// 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 `Array` from the Value model. - #[schemars(with = "Value")] metadata: Value, /// The non-fungible address of the owner badge of this resource. This field is serialized /// as a `NonFungibleAddress` from the Value model. - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - owner_badge: NonFungibleAddress, + owner_badge: Value, /// An optional initial supply for the non-fungible resource being created. The underlying /// type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` /// elements where each element is a struct of the immutable and mutable parts of /// the non-fungible data. - #[schemars(with = "Option")] initial_supply: Value, }, /// An instruction to registers a new validator given the public key of the validator RegisterValidator { /// The public key of the validator - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - validator: EcdsaSecp256k1PublicKey, + validator: Value, }, /// An instruction to unregister a validator given it's public key UnregisterValidator { /// The public key of the validator to unregister - #[schemars(with = "Value")] - #[serde_as(as = "serde_with::TryFromInto")] - validator: EcdsaSecp256k1PublicKey, + validator: Value, }, } @@ -661,9 +517,9 @@ impl Instruction { function_name, arguments, } => ast::Instruction::CallFunction { - package_address: Value::try_from(package_address)?.to_ast_value(bech32_coder)?, - blueprint_name: Value::try_from(blueprint_name)?.to_ast_value(bech32_coder)?, - function_name: Value::try_from(function_name)?.to_ast_value(bech32_coder)?, + 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 .unwrap_or_default() .iter() @@ -675,9 +531,8 @@ impl Instruction { method_name, arguments, } => ast::Instruction::CallMethod { - component_address: Value::try_from(component_address)? - .to_ast_value(bech32_coder)?, - method_name: Value::try_from(method_name)?.to_ast_value(bech32_coder)?, + component_address: component_address.to_ast_value(bech32_coder)?, + method_name: method_name.to_ast_value(bech32_coder)?, args: arguments .unwrap_or_default() .iter() @@ -688,17 +543,17 @@ impl Instruction { resource_address, into_bucket, } => ast::Instruction::TakeFromWorktop { - resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, - new_bucket: Value::try_from(into_bucket)?.to_ast_value(bech32_coder)?, + 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: Value::try_from(amount)?.to_ast_value(bech32_coder)?, - resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, - new_bucket: Value::try_from(into_bucket)?.to_ast_value(bech32_coder)?, + 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, @@ -707,31 +562,27 @@ impl Instruction { } => ast::Instruction::TakeFromWorktopByIds { ids: Value::Array { element_kind: crate::model::value::ValueKind::NonFungibleId, - elements: ids - .into_iter() - .map(Value::try_from) - .collect::>>()?, + elements: ids.into_iter().collect::>(), } .to_ast_value(bech32_coder)?, - resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, - new_bucket: Value::try_from(into_bucket)?.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: Value::try_from(bucket)?.to_ast_value(bech32_coder)?, + bucket: bucket.to_ast_value(bech32_coder)?, }, Self::AssertWorktopContains { resource_address } => { ast::Instruction::AssertWorktopContains { - resource_address: Value::try_from(resource_address)? - .to_ast_value(bech32_coder)?, + resource_address: resource_address.to_ast_value(bech32_coder)?, } } Self::AssertWorktopContainsByAmount { amount, resource_address, } => ast::Instruction::AssertWorktopContainsByAmount { - amount: Value::try_from(amount)?.to_ast_value(bech32_coder)?, - resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, + amount: amount.to_ast_value(bech32_coder)?, + resource_address: resource_address.to_ast_value(bech32_coder)?, }, Self::AssertWorktopContainsByIds { ids, @@ -741,20 +592,17 @@ impl Instruction { // TODO: This was `ValueKind::Bucket` by mistake. What kind of test can we // introduce to catch this? element_kind: crate::model::value::ValueKind::NonFungibleId, - elements: ids - .into_iter() - .map(Value::try_from) - .collect::>>()?, + elements: ids.into_iter().collect::>(), } .to_ast_value(bech32_coder)?, - resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, + resource_address: resource_address.to_ast_value(bech32_coder)?, }, Self::PopFromAuthZone { into_proof } => ast::Instruction::PopFromAuthZone { - new_proof: Value::try_from(into_proof)?.to_ast_value(bech32_coder)?, + new_proof: into_proof.to_ast_value(bech32_coder)?, }, Self::PushToAuthZone { proof } => ast::Instruction::PushToAuthZone { - proof: Value::try_from(proof)?.to_ast_value(bech32_coder)?, + proof: proof.to_ast_value(bech32_coder)?, }, Self::ClearAuthZone => ast::Instruction::ClearAuthZone, @@ -762,17 +610,17 @@ impl Instruction { resource_address, into_proof, } => ast::Instruction::CreateProofFromAuthZone { - resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, - new_proof: Value::try_from(into_proof)?.to_ast_value(bech32_coder)?, + 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: Value::try_from(amount)?.to_ast_value(bech32_coder)?, - resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, - new_proof: Value::try_from(into_proof)?.to_ast_value(bech32_coder)?, + 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, @@ -781,29 +629,26 @@ impl Instruction { } => ast::Instruction::CreateProofFromAuthZoneByIds { ids: Value::Array { element_kind: crate::model::value::ValueKind::NonFungibleId, - elements: ids - .into_iter() - .map(Value::try_from) - .collect::>>()?, + elements: ids.into_iter().collect::>(), } .to_ast_value(bech32_coder)?, - resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, - new_proof: Value::try_from(into_proof)?.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: Value::try_from(bucket)?.to_ast_value(bech32_coder)?, - new_proof: Value::try_from(into_proof)?.to_ast_value(bech32_coder)?, + 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: Value::try_from(proof)?.to_ast_value(bech32_coder)?, - new_proof: Value::try_from(into_proof)?.to_ast_value(bech32_coder)?, + proof: proof.to_ast_value(bech32_coder)?, + new_proof: into_proof.to_ast_value(bech32_coder)?, }, Self::DropProof { proof } => ast::Instruction::DropProof { - proof: Value::try_from(proof)?.to_ast_value(bech32_coder)?, + proof: proof.to_ast_value(bech32_coder)?, }, Self::DropAllProofs => ast::Instruction::DropAllProofs, Self::PublishPackageWithOwner { @@ -811,12 +656,12 @@ impl Instruction { abi, owner_badge, } => ast::Instruction::PublishPackageWithOwner { - owner_badge: Value::try_from(owner_badge)?.to_ast_value(bech32_coder)?, - code: Value::try_from(code)?.to_ast_value(bech32_coder)?, - abi: Value::try_from(abi)?.to_ast_value(bech32_coder)?, + owner_badge: owner_badge.to_ast_value(bech32_coder)?, + code: code.to_ast_value(bech32_coder)?, + abi: abi.to_ast_value(bech32_coder)?, }, Self::BurnResource { bucket } => ast::Instruction::BurnResource { - bucket: Value::try_from(bucket)?.to_ast_value(bech32_coder)?, + bucket: bucket.to_ast_value(bech32_coder)?, }, Self::PublishPackage { code, @@ -825,8 +670,8 @@ impl Instruction { metadata, access_rules, } => ast::Instruction::PublishPackage { - code: Value::try_from(code)?.to_ast_value(bech32_coder)?, - abi: Value::try_from(abi)?.to_ast_value(bech32_coder)?, + code: code.to_ast_value(bech32_coder)?, + abi: abi.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)?, @@ -834,7 +679,7 @@ impl Instruction { Self::RecallResource { vault_id, amount } => ast::Instruction::RecallResource { vault_id: vault_id.to_ast_value(bech32_coder)?, - amount: Value::try_from(amount)?.to_ast_value(bech32_coder)?, + amount: amount.to_ast_value(bech32_coder)?, }, Self::SetMetadata { @@ -842,16 +687,16 @@ impl Instruction { key, value, } => ast::Instruction::SetMetadata { - entity_address: Value::try_from(entity_address)?.to_ast_value(bech32_coder)?, - key: Value::try_from(key)?.to_ast_value(bech32_coder)?, - value: Value::try_from(value)?.to_ast_value(bech32_coder)?, + entity_address: entity_address.to_ast_value(bech32_coder)?, + key: key.to_ast_value(bech32_coder)?, + value: value.to_ast_value(bech32_coder)?, }, Self::SetPackageRoyaltyConfig { package_address, royalty_config, } => ast::Instruction::SetPackageRoyaltyConfig { - package_address: Value::try_from(package_address)?.to_ast_value(bech32_coder)?, + package_address: package_address.to_ast_value(bech32_coder)?, royalty_config: royalty_config.to_ast_value(bech32_coder)?, }, @@ -859,22 +704,19 @@ impl Instruction { component_address, royalty_config, } => ast::Instruction::SetComponentRoyaltyConfig { - component_address: Value::try_from(component_address)? - .to_ast_value(bech32_coder)?, + 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: Value::try_from(package_address)? - .to_ast_value(bech32_coder)?, + package_address: package_address.to_ast_value(bech32_coder)?, } } Self::ClaimComponentRoyalty { component_address } => { ast::Instruction::ClaimComponentRoyalty { - component_address: Value::try_from(component_address)? - .to_ast_value(bech32_coder)?, + component_address: component_address.to_ast_value(bech32_coder)?, } } @@ -884,8 +726,8 @@ impl Instruction { key, rule, } => ast::Instruction::SetMethodAccessRule { - entity_address: Value::try_from(entity_address)?.to_ast_value(bech32_coder)?, - index: Value::try_from(index)?.to_ast_value(bech32_coder)?, + entity_address: entity_address.to_ast_value(bech32_coder)?, + index: index.to_ast_value(bech32_coder)?, key: key.to_ast_value(bech32_coder)?, rule: rule.to_ast_value(bech32_coder)?, }, @@ -896,7 +738,7 @@ impl Instruction { access_rules, initial_supply, } => ast::Instruction::CreateFungibleResource { - divisibility: Value::try_from(divisibility)?.to_ast_value(bech32_coder)?, + 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)?, @@ -907,9 +749,9 @@ impl Instruction { owner_badge, initial_supply, } => ast::Instruction::CreateFungibleResourceWithOwner { - divisibility: Value::try_from(divisibility)?.to_ast_value(bech32_coder)?, + divisibility: divisibility.to_ast_value(bech32_coder)?, metadata: metadata.to_ast_value(bech32_coder)?, - owner_badge: Value::try_from(owner_badge)?.to_ast_value(bech32_coder)?, + owner_badge: owner_badge.to_ast_value(bech32_coder)?, initial_supply: initial_supply.to_ast_value(bech32_coder)?, }, Self::CreateNonFungibleResource { @@ -931,28 +773,28 @@ impl Instruction { } => ast::Instruction::CreateNonFungibleResourceWithOwner { id_type: id_type.to_ast_value(bech32_coder)?, metadata: metadata.to_ast_value(bech32_coder)?, - owner_badge: Value::try_from(owner_badge)?.to_ast_value(bech32_coder)?, + owner_badge: owner_badge.to_ast_value(bech32_coder)?, initial_supply: initial_supply.to_ast_value(bech32_coder)?, }, Self::MintFungible { resource_address, amount, } => ast::Instruction::MintFungible { - resource_address: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, - amount: Value::try_from(amount)?.to_ast_value(bech32_coder)?, + 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: Value::try_from(resource_address)?.to_ast_value(bech32_coder)?, + resource_address: resource_address.to_ast_value(bech32_coder)?, entries: entries.to_ast_value(bech32_coder)?, }, Self::RegisterValidator { validator } => ast::Instruction::RegisterValidator { - validator: Value::try_from(validator)?.to_ast_value(bech32_coder)?, + validator: validator.to_ast_value(bech32_coder)?, }, Self::UnregisterValidator { validator } => ast::Instruction::RegisterValidator { - validator: Value::try_from(validator)?.to_ast_value(bech32_coder)?, + validator: validator.to_ast_value(bech32_coder)?, }, }; Ok(ast_instruction) @@ -969,10 +811,9 @@ impl Instruction { function_name, args, } => Self::CallFunction { - package_address: Value::from_ast_value(package_address, bech32_coder)? - .try_into()?, - blueprint_name: Value::from_ast_value(blueprint_name, bech32_coder)?.try_into()?, - function_name: Value::from_ast_value(function_name, bech32_coder)?.try_into()?, + package_address: Value::from_ast_value(package_address, bech32_coder)?, + blueprint_name: Value::from_ast_value(blueprint_name, bech32_coder)?, + function_name: Value::from_ast_value(function_name, bech32_coder)?, arguments: { let arguments = args .iter() @@ -989,9 +830,8 @@ impl Instruction { method_name, args, } => Self::CallMethod { - component_address: Value::from_ast_value(component_address, bech32_coder)? - .try_into()?, - method_name: Value::from_ast_value(method_name, bech32_coder)?.try_into()?, + component_address: Value::from_ast_value(component_address, bech32_coder)?, + method_name: Value::from_ast_value(method_name, bech32_coder)?, arguments: { let arguments = args .iter() @@ -1008,19 +848,17 @@ impl Instruction { resource_address, new_bucket, } => Self::TakeFromWorktop { - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?.try_into()?, + resource_address: Value::from_ast_value(resource_address, bech32_coder)?, + into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?, }, ast::Instruction::TakeFromWorktopByAmount { amount, resource_address, new_bucket, } => Self::TakeFromWorktopByAmount { - amount: Value::from_ast_value(amount, bech32_coder)?.try_into()?, - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?.try_into()?, + amount: Value::from_ast_value(amount, bech32_coder)?, + resource_address: Value::from_ast_value(resource_address, bech32_coder)?, + into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?, }, ast::Instruction::TakeFromWorktopByIds { ids, @@ -1032,34 +870,28 @@ impl Instruction { elements, } = Value::from_ast_value(ids, bech32_coder)? { - elements - .into_iter() - .map(NonFungibleId::try_from) - .collect::>>()? + elements.into_iter().collect::>() } else { panic!("Expected type Array!") }, - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?.try_into()?, + resource_address: Value::from_ast_value(resource_address, bech32_coder)?, + into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?, }, ast::Instruction::ReturnToWorktop { bucket } => Self::ReturnToWorktop { - bucket: Value::from_ast_value(bucket, bech32_coder)?.try_into()?, + bucket: Value::from_ast_value(bucket, bech32_coder)?, }, ast::Instruction::AssertWorktopContains { resource_address } => { Self::AssertWorktopContains { - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, + resource_address: Value::from_ast_value(resource_address, bech32_coder)?, } } ast::Instruction::AssertWorktopContainsByAmount { amount, resource_address, } => Self::AssertWorktopContainsByAmount { - amount: Value::from_ast_value(amount, bech32_coder)?.try_into()?, - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, + amount: Value::from_ast_value(amount, bech32_coder)?, + resource_address: Value::from_ast_value(resource_address, bech32_coder)?, }, ast::Instruction::AssertWorktopContainsByIds { ids, @@ -1070,22 +902,18 @@ impl Instruction { elements, } = Value::from_ast_value(ids, bech32_coder)? { - elements - .into_iter() - .map(NonFungibleId::try_from) - .collect::>>()? + elements.into_iter().collect::>() } else { panic!("Expected type Array!") }, - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, + resource_address: Value::from_ast_value(resource_address, bech32_coder)?, }, ast::Instruction::PopFromAuthZone { new_proof } => Self::PopFromAuthZone { - into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, + into_proof: Value::from_ast_value(new_proof, bech32_coder)?, }, ast::Instruction::PushToAuthZone { proof } => Self::PushToAuthZone { - proof: Value::from_ast_value(proof, bech32_coder)?.try_into()?, + proof: Value::from_ast_value(proof, bech32_coder)?, }, ast::Instruction::ClearAuthZone => Self::ClearAuthZone, @@ -1093,19 +921,17 @@ impl Instruction { resource_address, new_proof, } => Self::CreateProofFromAuthZone { - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, + resource_address: Value::from_ast_value(resource_address, bech32_coder)?, + into_proof: Value::from_ast_value(new_proof, bech32_coder)?, }, ast::Instruction::CreateProofFromAuthZoneByAmount { amount, resource_address, new_proof, } => Self::CreateProofFromAuthZoneByAmount { - amount: Value::from_ast_value(amount, bech32_coder)?.try_into()?, - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, + amount: Value::from_ast_value(amount, bech32_coder)?, + resource_address: Value::from_ast_value(resource_address, bech32_coder)?, + into_proof: Value::from_ast_value(new_proof, bech32_coder)?, }, ast::Instruction::CreateProofFromAuthZoneByIds { ids, @@ -1117,30 +943,26 @@ impl Instruction { elements, } = Value::from_ast_value(ids, bech32_coder)? { - elements - .into_iter() - .map(NonFungibleId::try_from) - .collect::>>()? + elements.into_iter().collect::>() } else { panic!("Expected type Array!") }, - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, + resource_address: Value::from_ast_value(resource_address, bech32_coder)?, + into_proof: Value::from_ast_value(new_proof, bech32_coder)?, }, ast::Instruction::CreateProofFromBucket { bucket, new_proof } => { Self::CreateProofFromBucket { - bucket: Value::from_ast_value(bucket, bech32_coder)?.try_into()?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, + bucket: Value::from_ast_value(bucket, bech32_coder)?, + into_proof: Value::from_ast_value(new_proof, bech32_coder)?, } } ast::Instruction::CloneProof { proof, new_proof } => Self::CloneProof { - proof: Value::from_ast_value(proof, bech32_coder)?.try_into()?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?.try_into()?, + proof: Value::from_ast_value(proof, bech32_coder)?, + into_proof: Value::from_ast_value(new_proof, bech32_coder)?, }, ast::Instruction::DropProof { proof } => Self::DropProof { - proof: Value::from_ast_value(proof, bech32_coder)?.try_into()?, + proof: Value::from_ast_value(proof, bech32_coder)?, }, ast::Instruction::DropAllProofs => Self::DropAllProofs, ast::Instruction::PublishPackageWithOwner { @@ -1148,12 +970,12 @@ impl Instruction { abi, owner_badge, } => Self::PublishPackageWithOwner { - owner_badge: Value::from_ast_value(owner_badge, bech32_coder)?.try_into()?, - code: Value::from_ast_value(code, bech32_coder)?.try_into()?, - abi: Value::from_ast_value(abi, bech32_coder)?.try_into()?, + owner_badge: Value::from_ast_value(owner_badge, bech32_coder)?, + code: Value::from_ast_value(code, bech32_coder)?, + abi: Value::from_ast_value(abi, bech32_coder)?, }, ast::Instruction::BurnResource { bucket } => Self::BurnResource { - bucket: Value::from_ast_value(bucket, bech32_coder)?.try_into()?, + bucket: Value::from_ast_value(bucket, bech32_coder)?, }, ast::Instruction::PublishPackage { code, @@ -1162,32 +984,31 @@ impl Instruction { metadata, access_rules, } => Self::PublishPackage { - code: Value::from_ast_value(code, bech32_coder)?.try_into()?, - abi: Value::from_ast_value(abi, bech32_coder)?.try_into()?, + code: Value::from_ast_value(code, bech32_coder)?, + abi: Value::from_ast_value(abi, bech32_coder)?, royalty_config: Value::from_ast_value(royalty_config, bech32_coder)?, metadata: Value::from_ast_value(metadata, bech32_coder)?, access_rules: Value::from_ast_value(access_rules, bech32_coder)?, }, ast::Instruction::RecallResource { vault_id, amount } => Self::RecallResource { vault_id: Value::from_ast_value(vault_id, bech32_coder)?, - amount: Value::from_ast_value(amount, bech32_coder)?.try_into()?, + amount: Value::from_ast_value(amount, bech32_coder)?, }, ast::Instruction::SetMetadata { entity_address, key, value, } => Self::SetMetadata { - entity_address: Value::from_ast_value(entity_address, bech32_coder)?.try_into()?, - key: Value::from_ast_value(key, bech32_coder)?.try_into()?, - value: Value::from_ast_value(value, bech32_coder)?.try_into()?, + entity_address: Value::from_ast_value(entity_address, bech32_coder)?, + key: Value::from_ast_value(key, bech32_coder)?, + value: Value::from_ast_value(value, bech32_coder)?, }, ast::Instruction::SetPackageRoyaltyConfig { package_address, royalty_config, } => Self::SetPackageRoyaltyConfig { - package_address: Value::from_ast_value(package_address, bech32_coder)? - .try_into()?, + package_address: Value::from_ast_value(package_address, bech32_coder)?, royalty_config: Value::from_ast_value(royalty_config, bech32_coder)?, }, @@ -1195,22 +1016,19 @@ impl Instruction { component_address, royalty_config, } => Self::SetComponentRoyaltyConfig { - component_address: Value::from_ast_value(component_address, bech32_coder)? - .try_into()?, + component_address: Value::from_ast_value(component_address, bech32_coder)?, royalty_config: Value::from_ast_value(royalty_config, bech32_coder)?, }, ast::Instruction::ClaimPackageRoyalty { package_address } => { Self::ClaimPackageRoyalty { - package_address: Value::from_ast_value(package_address, bech32_coder)? - .try_into()?, + package_address: Value::from_ast_value(package_address, bech32_coder)?, } } ast::Instruction::ClaimComponentRoyalty { component_address } => { Self::ClaimComponentRoyalty { - component_address: Value::from_ast_value(component_address, bech32_coder)? - .try_into()?, + component_address: Value::from_ast_value(component_address, bech32_coder)?, } } @@ -1220,8 +1038,8 @@ impl Instruction { key, rule, } => Self::SetMethodAccessRule { - entity_address: Value::from_ast_value(entity_address, bech32_coder)?.try_into()?, - index: Value::from_ast_value(index, bech32_coder)?.try_into()?, + entity_address: Value::from_ast_value(entity_address, bech32_coder)?, + index: Value::from_ast_value(index, bech32_coder)?, key: Value::from_ast_value(key, bech32_coder)?, rule: Value::from_ast_value(rule, bech32_coder)?, }, @@ -1232,7 +1050,7 @@ impl Instruction { access_rules, initial_supply, } => Self::CreateFungibleResource { - divisibility: Value::from_ast_value(divisibility, bech32_coder)?.try_into()?, + divisibility: Value::from_ast_value(divisibility, bech32_coder)?, metadata: Value::from_ast_value(metadata, bech32_coder)?, access_rules: Value::from_ast_value(access_rules, bech32_coder)?, initial_supply: Value::from_ast_value(initial_supply, bech32_coder)?, @@ -1243,9 +1061,9 @@ impl Instruction { owner_badge, initial_supply, } => Self::CreateFungibleResourceWithOwner { - divisibility: Value::from_ast_value(divisibility, bech32_coder)?.try_into()?, + divisibility: Value::from_ast_value(divisibility, bech32_coder)?, metadata: Value::from_ast_value(metadata, bech32_coder)?, - owner_badge: Value::from_ast_value(owner_badge, bech32_coder)?.try_into()?, + owner_badge: Value::from_ast_value(owner_badge, bech32_coder)?, initial_supply: Value::from_ast_value(initial_supply, bech32_coder)?, }, ast::Instruction::CreateNonFungibleResource { @@ -1267,7 +1085,7 @@ impl Instruction { } => Self::CreateNonFungibleResourceWithOwner { id_type: Value::from_ast_value(id_type, bech32_coder)?, metadata: Value::from_ast_value(metadata, bech32_coder)?, - owner_badge: Value::from_ast_value(owner_badge, bech32_coder)?.try_into()?, + owner_badge: Value::from_ast_value(owner_badge, bech32_coder)?, initial_supply: Value::from_ast_value(initial_supply, bech32_coder)?, }, @@ -1275,25 +1093,531 @@ impl Instruction { resource_address, amount, } => Self::MintFungible { - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, - amount: Value::from_ast_value(amount, bech32_coder)?.try_into()?, + resource_address: Value::from_ast_value(resource_address, bech32_coder)?, + amount: Value::from_ast_value(amount, bech32_coder)?, }, ast::Instruction::MintNonFungible { resource_address, entries, } => Self::MintNonFungible { - resource_address: Value::from_ast_value(resource_address, bech32_coder)? - .try_into()?, + resource_address: Value::from_ast_value(resource_address, bech32_coder)?, entries: Value::from_ast_value(entries, bech32_coder)?, }, ast::Instruction::RegisterValidator { validator } => Self::RegisterValidator { - validator: Value::from_ast_value(validator, bech32_coder)?.try_into()?, + validator: Value::from_ast_value(validator, bech32_coder)?, }, ast::Instruction::UnregisterValidator { validator } => Self::UnregisterValidator { - validator: Value::from_ast_value(validator, bech32_coder)?.try_into()?, + validator: Value::from_ast_value(validator, bech32_coder)?, }, }; Ok(instruction) } } + +impl ValueRef for Instruction { + /// Mutably borrow all [`Value`]s that make up the instructions + fn borrow_values_mut(&mut self) -> Vec<&mut Value> { + let mut values = Vec::new(); + match self { + Self::CallFunction { + package_address, + blueprint_name, + function_name, + arguments, + } => { + values.push(package_address); + values.push(blueprint_name); + values.push(function_name); + if let Some(arguments) = arguments { + values.extend(arguments) + } + } + Self::CallMethod { + component_address, + method_name, + arguments, + } => { + values.push(component_address); + values.push(method_name); + if let Some(arguments) = arguments { + values.extend(arguments) + } + } + + Self::TakeFromWorktop { + resource_address, + into_bucket, + } => { + values.push(resource_address); + values.push(into_bucket) + } + Self::TakeFromWorktopByAmount { + resource_address, + amount, + into_bucket, + } => { + values.push(resource_address); + values.push(amount); + values.push(into_bucket) + } + Self::TakeFromWorktopByIds { + resource_address, + ids, + into_bucket, + } => { + values.push(resource_address); + values.push(into_bucket); + values.extend(ids); + } + + Self::ReturnToWorktop { bucket } => values.push(bucket), + + Self::AssertWorktopContains { resource_address } => values.push(resource_address), + Self::AssertWorktopContainsByAmount { + resource_address, + amount, + } => { + values.push(resource_address); + values.push(amount); + } + Self::AssertWorktopContainsByIds { + resource_address, + ids, + } => { + values.push(resource_address); + values.extend(ids) + } + + Self::PopFromAuthZone { into_proof } => values.push(into_proof), + Self::PushToAuthZone { proof } => values.push(proof), + + Self::CreateProofFromAuthZone { + resource_address, + into_proof, + } => { + values.push(resource_address); + values.push(into_proof); + } + Self::CreateProofFromAuthZoneByAmount { + resource_address, + amount, + into_proof, + } => { + values.push(resource_address); + values.push(amount); + values.push(into_proof); + } + Self::CreateProofFromAuthZoneByIds { + resource_address, + ids, + into_proof, + } => { + values.push(resource_address); + values.push(into_proof); + values.extend(ids); + } + + Self::CreateProofFromBucket { bucket, into_proof } => { + values.push(bucket); + values.push(into_proof); + } + + Self::CloneProof { proof, into_proof } => { + values.push(proof); + values.push(into_proof); + } + + Self::PublishPackage { + code, + abi, + royalty_config, + metadata, + access_rules, + } => { + values.push(code); + values.push(abi); + values.push(royalty_config); + values.push(metadata); + values.push(access_rules); + } + + Self::PublishPackageWithOwner { + code, + abi, + owner_badge, + } => { + values.push(code); + values.push(abi); + values.push(owner_badge); + } + + Self::BurnResource { bucket } => values.push(bucket), + Self::RecallResource { vault_id, amount } => { + values.push(vault_id); + values.push(amount); + } + + Self::SetMetadata { + entity_address, + key, + value, + } => { + values.push(entity_address); + values.push(key); + values.push(value) + } + + Self::SetPackageRoyaltyConfig { + package_address, + royalty_config, + } => { + values.push(package_address); + values.push(royalty_config); + } + + Self::SetComponentRoyaltyConfig { + component_address, + royalty_config, + } => { + values.push(component_address); + values.push(royalty_config); + } + + Self::ClaimPackageRoyalty { package_address } => values.push(package_address), + Self::ClaimComponentRoyalty { component_address } => values.push(component_address), + + Self::SetMethodAccessRule { + entity_address, + index, + key, + rule, + } => { + values.push(entity_address); + values.push(index); + values.push(key); + values.push(rule); + } + + Self::MintFungible { + resource_address, + amount, + } => { + values.push(resource_address); + values.push(amount); + } + Self::MintNonFungible { + resource_address, + entries, + } => { + values.push(resource_address); + values.push(entries); + } + + Self::CreateFungibleResource { + divisibility, + metadata, + access_rules, + initial_supply, + } => { + values.push(divisibility); + values.push(metadata); + values.push(access_rules); + values.push(initial_supply); + } + Self::CreateFungibleResourceWithOwner { + divisibility, + metadata, + owner_badge, + initial_supply, + } => { + values.push(divisibility); + values.push(metadata); + values.push(owner_badge); + values.push(initial_supply); + } + Self::CreateNonFungibleResource { + id_type, + metadata, + access_rules, + initial_supply, + } => { + values.push(id_type); + values.push(metadata); + values.push(access_rules); + values.push(initial_supply); + } + Self::CreateNonFungibleResourceWithOwner { + id_type, + metadata, + owner_badge, + initial_supply, + } => { + values.push(id_type); + values.push(metadata); + values.push(owner_badge); + values.push(initial_supply); + } + + Self::RegisterValidator { validator } => values.push(validator), + Self::UnregisterValidator { validator } => values.push(validator), + + Self::DropProof { proof } => values.push(proof), + + Self::DropAllProofs | Self::ClearAuthZone => {} + } + values + } + + /// Immutably borrow all [`Value`]s that make up the instructions + fn borrow_values(&self) -> Vec<&Value> { + let mut values = Vec::new(); + match self { + Self::CallFunction { + package_address, + blueprint_name, + function_name, + arguments, + } => { + values.push(package_address); + values.push(blueprint_name); + values.push(function_name); + if let Some(arguments) = arguments { + values.extend(arguments) + } + } + Self::CallMethod { + component_address, + method_name, + arguments, + } => { + values.push(component_address); + values.push(method_name); + if let Some(arguments) = arguments { + values.extend(arguments) + } + } + + Self::TakeFromWorktop { + resource_address, + into_bucket, + } => { + values.push(resource_address); + values.push(into_bucket) + } + Self::TakeFromWorktopByAmount { + resource_address, + amount, + into_bucket, + } => { + values.push(resource_address); + values.push(amount); + values.push(into_bucket) + } + Self::TakeFromWorktopByIds { + resource_address, + ids, + into_bucket, + } => { + values.push(resource_address); + values.push(into_bucket); + values.extend(ids); + } + + Self::ReturnToWorktop { bucket } => values.push(bucket), + + Self::AssertWorktopContains { resource_address } => values.push(resource_address), + Self::AssertWorktopContainsByAmount { + resource_address, + amount, + } => { + values.push(resource_address); + values.push(amount); + } + Self::AssertWorktopContainsByIds { + resource_address, + ids, + } => { + values.push(resource_address); + values.extend(ids) + } + + Self::PopFromAuthZone { into_proof } => values.push(into_proof), + Self::PushToAuthZone { proof } => values.push(proof), + + Self::CreateProofFromAuthZone { + resource_address, + into_proof, + } => { + values.push(resource_address); + values.push(into_proof); + } + Self::CreateProofFromAuthZoneByAmount { + resource_address, + amount, + into_proof, + } => { + values.push(resource_address); + values.push(amount); + values.push(into_proof); + } + Self::CreateProofFromAuthZoneByIds { + resource_address, + ids, + into_proof, + } => { + values.push(resource_address); + values.push(into_proof); + values.extend(ids); + } + + Self::CreateProofFromBucket { bucket, into_proof } => { + values.push(bucket); + values.push(into_proof); + } + + Self::CloneProof { proof, into_proof } => { + values.push(proof); + values.push(into_proof); + } + + Self::PublishPackage { + code, + abi, + royalty_config, + metadata, + access_rules, + } => { + values.push(code); + values.push(abi); + values.push(royalty_config); + values.push(metadata); + values.push(access_rules); + } + + Self::PublishPackageWithOwner { + code, + abi, + owner_badge, + } => { + values.push(code); + values.push(abi); + values.push(owner_badge); + } + + Self::BurnResource { bucket } => values.push(bucket), + Self::RecallResource { vault_id, amount } => { + values.push(vault_id); + values.push(amount); + } + + Self::SetMetadata { + entity_address, + key, + value, + } => { + values.push(entity_address); + values.push(key); + values.push(value) + } + + Self::SetPackageRoyaltyConfig { + package_address, + royalty_config, + } => { + values.push(package_address); + values.push(royalty_config); + } + + Self::SetComponentRoyaltyConfig { + component_address, + royalty_config, + } => { + values.push(component_address); + values.push(royalty_config); + } + + Self::ClaimPackageRoyalty { package_address } => values.push(package_address), + Self::ClaimComponentRoyalty { component_address } => values.push(component_address), + + Self::SetMethodAccessRule { + entity_address, + index, + key, + rule, + } => { + values.push(entity_address); + values.push(index); + values.push(key); + values.push(rule); + } + + Self::MintFungible { + resource_address, + amount, + } => { + values.push(resource_address); + values.push(amount); + } + Self::MintNonFungible { + resource_address, + entries, + } => { + values.push(resource_address); + values.push(entries); + } + + Self::CreateFungibleResource { + divisibility, + metadata, + access_rules, + initial_supply, + } => { + values.push(divisibility); + values.push(metadata); + values.push(access_rules); + values.push(initial_supply); + } + Self::CreateFungibleResourceWithOwner { + divisibility, + metadata, + owner_badge, + initial_supply, + } => { + values.push(divisibility); + values.push(metadata); + values.push(owner_badge); + values.push(initial_supply); + } + Self::CreateNonFungibleResource { + id_type, + metadata, + access_rules, + initial_supply, + } => { + values.push(id_type); + values.push(metadata); + values.push(access_rules); + values.push(initial_supply); + } + Self::CreateNonFungibleResourceWithOwner { + id_type, + metadata, + owner_badge, + initial_supply, + } => { + values.push(id_type); + values.push(metadata); + values.push(owner_badge); + values.push(initial_supply); + } + + Self::RegisterValidator { validator } => values.push(validator), + Self::UnregisterValidator { validator } => values.push(validator), + + Self::DropProof { proof } => values.push(proof), + + Self::DropAllProofs | Self::ClearAuthZone => {} + } + values + } +} diff --git a/core/src/model/transaction/instructions.rs b/core/src/model/transaction/instruction_list.rs similarity index 85% rename from core/src/model/transaction/instructions.rs rename to core/src/model/transaction/instruction_list.rs index ed017642..e2cf0fd5 100644 --- a/core/src/model/transaction/instructions.rs +++ b/core/src/model/transaction/instruction_list.rs @@ -18,6 +18,7 @@ use crate::address::Bech32Coder; use crate::error::Result; use crate::model::Instruction; +use crate::ValueRef; use native_transaction::manifest::{ast, decompile}; use native_transaction::model as transaction; use scrypto::prelude::hash; @@ -34,7 +35,7 @@ use serializable::serializable; #[serializable] #[serde(tag = "type", content = "value")] #[derive(Clone)] -pub enum InstructionsList { +pub enum InstructionList { String(String), Parsed(Vec), } @@ -51,7 +52,7 @@ pub enum InstructionKind { // Implementation // =============== -impl InstructionsList { +impl InstructionList { pub fn kind(&self) -> InstructionKind { match self { Self::String(..) => InstructionKind::String, @@ -156,7 +157,11 @@ impl InstructionsList { } } - pub fn convert_to_parsed(&self, bech32_coder: &Bech32Coder) -> Result { + pub fn convert_to_parsed( + &self, + bech32_coder: &Bech32Coder, + blobs: Vec>, + ) -> Result { match self { Self::Parsed(_) => Ok(self.clone()), Self::String(_) => { @@ -176,8 +181,19 @@ impl InstructionsList { let instructions = ast_instruction .iter() .map(|instruction| Instruction::from_ast_instruction(instruction, bech32_coder)) - .collect::>>()?; - Ok(Self::Parsed(instructions)) + .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), + } } } } @@ -192,7 +208,29 @@ impl InstructionsList { ) -> Result { match manifest_instructions_kind { InstructionKind::String => self.convert_to_string(bech32_coder, blobs), - InstructionKind::Parsed => self.convert_to_parsed(bech32_coder), + InstructionKind::Parsed => self.convert_to_parsed(bech32_coder, blobs), + } + } +} + +impl ValueRef for InstructionList { + fn borrow_values(&self) -> Vec<&crate::Value> { + match self { + Self::Parsed(parsed_instructions) => parsed_instructions + .iter() + .flat_map(|instruction| instruction.borrow_values()) + .collect(), + Self::String(..) => Vec::new(), + } + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + match self { + Self::Parsed(parsed_instructions) => parsed_instructions + .iter_mut() + .flat_map(|instruction| instruction.borrow_values_mut()) + .collect(), + Self::String(..) => Vec::new(), } } } diff --git a/core/src/model/transaction/manifest.rs b/core/src/model/transaction/manifest.rs index 18753014..d55c2377 100644 --- a/core/src/model/transaction/manifest.rs +++ b/core/src/model/transaction/manifest.rs @@ -15,14 +15,18 @@ // specific language governing permissions and limitations // under the License. -use crate::InstructionsList; +use crate::{InstructionList, ValueRef}; use serializable::serializable; +// ================= +// Model Definition +// ================= + /// A transaction intent consisting of instructions as well as blobs #[serializable] pub struct TransactionManifest { /// The transaction manifest instructions to be executed in the transaction. - pub instructions: InstructionsList, + 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. @@ -30,3 +34,17 @@ pub struct TransactionManifest { #[serde_as(as = "Vec")] pub blobs: Vec>, } + +// =============== +// Implementation +// =============== + +impl ValueRef for TransactionManifest { + fn borrow_values(&self) -> Vec<&crate::Value> { + self.instructions.borrow_values() + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + self.instructions.borrow_values_mut() + } +} diff --git a/core/src/model/transaction/mod.rs b/core/src/model/transaction/mod.rs index 68ab9d0a..f299791a 100644 --- a/core/src/model/transaction/mod.rs +++ b/core/src/model/transaction/mod.rs @@ -16,14 +16,14 @@ // under the License. pub mod header; -pub mod instructions; +pub mod instruction_list; pub mod intent; pub mod manifest; pub mod notarized_intent; pub mod signed_intent; pub use header::*; -pub use instructions::*; +pub use instruction_list::*; pub use intent::*; pub use manifest::*; pub use notarized_intent::*; diff --git a/core/src/model/value.rs b/core/src/model/value.rs index b2e0df26..7bea876a 100644 --- a/core/src/model/value.rs +++ b/core/src/model/value.rs @@ -35,7 +35,7 @@ use serializable::serializable; /// returns. #[serializable] #[serde(tag = "type")] -#[derive(Clone)] +#[derive(Clone, PartialEq, Eq, Hash)] pub enum Value { /// A boolean value which can either be true or false Bool { value: bool }, @@ -330,7 +330,7 @@ pub enum Value { /// An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is /// essentially the `type` tags used for the value model. #[serializable] -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum ValueKind { Bool, diff --git a/core/src/request/convert_manifest_request.rs b/core/src/request/convert_manifest_request.rs index 3c785770..8f0714c5 100644 --- a/core/src/request/convert_manifest_request.rs +++ b/core/src/request/convert_manifest_request.rs @@ -22,9 +22,9 @@ use crate::error::Result; use crate::model::address::Bech32Coder; -use crate::model::instructions::InstructionKind; +use crate::model::instruction_list::InstructionKind; use crate::model::TransactionManifest; -use crate::{Handler, InstructionsList}; +use crate::{Handler, ValueRef}; use serializable::serializable; // ================= @@ -86,9 +86,14 @@ struct ConvertManifestHandler; impl Handler for ConvertManifestHandler { fn pre_process(request: ConvertManifestRequest) -> Result { - // TODO: Validate the value collections - // TODO: Validate the value network id - // TODO: Validate the instruction values + // Validate all `Value`s in the request. Ensure that: + // 1. All addresses are of the network provided in the request. + // 2. All single-type collections are of a single kind. + request + .borrow_values() + .iter() + .map(|value| value.validate(Some(request.network_id))) + .collect::>>()?; Ok(request) } @@ -110,10 +115,32 @@ impl Handler for ConvertManifes } fn post_process( - request: &ConvertManifestRequest, + _: &ConvertManifestRequest, mut response: ConvertManifestResponse, ) -> ConvertManifestResponse { - // TODO: Get all values and alias them. + for value in response.borrow_values_mut().iter_mut() { + value.alias(); + } response } } + +impl ValueRef for ConvertManifestRequest { + fn borrow_values(&self) -> Vec<&crate::Value> { + self.manifest.borrow_values() + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + self.manifest.borrow_values_mut() + } +} + +impl ValueRef for ConvertManifestResponse { + fn borrow_values(&self) -> Vec<&crate::Value> { + self.manifest.borrow_values() + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + self.manifest.borrow_values_mut() + } +} diff --git a/core/src/traits.rs b/core/src/traits.rs new file mode 100644 index 00000000..c4334bfe --- /dev/null +++ b/core/src/traits.rs @@ -0,0 +1,10 @@ +use crate::model::Value; + +/// A trait that defines a set of methods for aggregating value refs from objects +pub trait ValueRef { + /// Used to borrow all values immutably + fn borrow_values(&self) -> Vec<&Value>; + + /// Borrows all values mutably + fn borrow_values_mut(&mut self) -> Vec<&mut Value>; +} From dafcdab729a6f2f46b528b98e92de97dfe2e502c Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 16 Jan 2023 00:55:36 +0300 Subject: [PATCH 038/110] Information request --- ...anifest_request.rs => convert_manifest.rs} | 2 +- core/src/request/information.rs | 61 +++++++++++++++++++ core/src/request/mod.rs | 8 ++- 3 files changed, 68 insertions(+), 3 deletions(-) rename core/src/request/{convert_manifest_request.rs => convert_manifest.rs} (99%) create mode 100644 core/src/request/information.rs diff --git a/core/src/request/convert_manifest_request.rs b/core/src/request/convert_manifest.rs similarity index 99% rename from core/src/request/convert_manifest_request.rs rename to core/src/request/convert_manifest.rs index 8f0714c5..a3f9f129 100644 --- a/core/src/request/convert_manifest_request.rs +++ b/core/src/request/convert_manifest.rs @@ -82,7 +82,7 @@ pub struct ConvertManifestResponse { // Implementation // =============== -struct ConvertManifestHandler; +pub struct ConvertManifestHandler; impl Handler for ConvertManifestHandler { fn pre_process(request: ConvertManifestRequest) -> Result { diff --git a/core/src/request/information.rs b/core/src/request/information.rs new file mode 100644 index 00000000..02bec7a9 --- /dev/null +++ b/core/src/request/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. + +use crate::error::Result; +use serializable::serializable; + +use crate::Handler; + +// ================= +// 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 { + pub package_version: 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(), + }; + Ok(response) + } + + fn post_process(_: &InformationRequest, response: InformationResponse) -> InformationResponse { + response + } +} diff --git a/core/src/request/mod.rs b/core/src/request/mod.rs index 4750d366..d11e9cf5 100644 --- a/core/src/request/mod.rs +++ b/core/src/request/mod.rs @@ -15,8 +15,12 @@ // specific language governing permissions and limitations // under the License. -pub mod convert_manifest_request; +pub mod convert_manifest; +pub mod information; + pub mod traits; -pub use convert_manifest_request::*; +pub use convert_manifest::*; +pub use information::*; + pub use traits::*; From ae0e116264c4fa2dbb4dc7776e3ad409e9913a06 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 16 Jan 2023 12:04:36 +0300 Subject: [PATCH 039/110] Refactor requests --- core/src/error.rs | 12 +- core/src/model/address/entity_address.rs | 96 +++++++++- core/src/model/address/entity_type.rs | 78 ++++++++ core/src/model/address/mod.rs | 2 + .../model/address/network_aware_address.rs | 13 ++ .../src/model/address/non_fungible_address.rs | 2 +- .../engine_identifier/transient_identifier.rs | 6 +- core/src/model/instruction.rs | 1 - core/src/model/transaction/header.rs | 37 ++++ .../src/model/transaction/instruction_list.rs | 3 +- core/src/model/transaction/intent.rs | 77 +++++++- core/src/model/transaction/manifest.rs | 47 ++++- core/src/model/transaction/mod.rs | 2 + .../src/model/transaction/notarized_intent.rs | 76 +++++++- core/src/model/transaction/signed_intent.rs | 72 +++++++- .../model/transaction/validation_config.rs | 80 +++++++++ core/src/model/value.rs | 4 +- .../request/compile_notarized_transaction.rs | 101 +++++++++++ .../compile_signed_transaction_intent.rs | 91 ++++++++++ .../src/request/compile_transaction_intent.rs | 91 ++++++++++ core/src/request/convert_manifest.rs | 13 +- core/src/request/decode_address.rs | 105 +++++++++++ .../decompile_notarized_transaction.rs | 93 ++++++++++ .../decompile_signed_transaction_intent.rs | 93 ++++++++++ .../request/decompile_transaction_intent.rs | 89 ++++++++++ core/src/request/decompile_unknown_intent.rs | 168 ++++++++++++++++++ .../request/derive_virtual_account_address.rs | 79 ++++++++ core/src/request/encode_address.rs | 67 +++++++ core/src/request/information.rs | 3 +- core/src/request/known_entity_addresses.rs | 142 +++++++++++++++ core/src/request/mod.rs | 39 +++- core/src/request/sbor_decode.rs | 77 ++++++++ core/src/request/sbor_encode.rs | 81 +++++++++ .../statically_validate_transaction.rs | 94 ++++++++++ core/src/traits.rs | 16 ++ serializable/src/lib.rs | 7 +- 36 files changed, 2022 insertions(+), 35 deletions(-) create mode 100644 core/src/model/address/entity_type.rs create mode 100644 core/src/model/transaction/validation_config.rs create mode 100644 core/src/request/compile_notarized_transaction.rs create mode 100644 core/src/request/compile_signed_transaction_intent.rs create mode 100644 core/src/request/compile_transaction_intent.rs create mode 100644 core/src/request/decode_address.rs create mode 100644 core/src/request/decompile_notarized_transaction.rs create mode 100644 core/src/request/decompile_signed_transaction_intent.rs create mode 100644 core/src/request/decompile_transaction_intent.rs create mode 100644 core/src/request/decompile_unknown_intent.rs create mode 100644 core/src/request/derive_virtual_account_address.rs create mode 100644 core/src/request/encode_address.rs create mode 100644 core/src/request/known_entity_addresses.rs create mode 100644 core/src/request/sbor_decode.rs create mode 100644 core/src/request/sbor_encode.rs create mode 100644 core/src/request/statically_validate_transaction.rs diff --git a/core/src/error.rs b/core/src/error.rs index 3f55fe8a..5257ba5b 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -25,8 +25,10 @@ use crate::ValueKind; /// Radix Engine Toolkit may return for a request. #[serializable] #[serde(tag = "error")] -#[derive(Clone)] pub enum Error { + // ====== + // Value + // ====== /// An error emitted when the toolkit attempts to decode some string as a hex string and fails FailedToDecodeHex { message: String, @@ -131,6 +133,14 @@ pub enum Error { 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, } impl Display for Error { diff --git a/core/src/model/address/entity_address.rs b/core/src/model/address/entity_address.rs index 8405ff40..de7b473f 100644 --- a/core/src/model/address/entity_address.rs +++ b/core/src/model/address/entity_address.rs @@ -15,18 +15,21 @@ // specific language governing permissions and limitations // under the License. +use crate::error::{Error, Result}; +use crate::model::address::network_aware_address::*; +use scrypto::radix_engine_interface::address::EntityType; +use serializable::serializable; +use std::fmt::Display; +use std::str::FromStr; + // ================= // Model Definition // ================= -use crate::model::address::network_aware_address::*; -use serializable::serializable; - /// A discriminated union of entity addresses where addresses are serialized as a Bech32m encoded /// string. #[serializable] #[serde(tag = "type", content = "address")] -#[derive(Clone)] pub enum EntityAddress { /// Represents a Bech32m encoded human-readable component address. This address is serialized /// as a human-readable bech32m encoded string. @@ -60,3 +63,88 @@ pub enum EntityAddress { address: NetworkAwarePackageAddress, }, } + +// =============== +// Implementation +// =============== + +impl EntityAddress { + pub fn kind(&self) -> EntityType { + match self { + Self::ComponentAddress { address } => match address.address { + scrypto::prelude::ComponentAddress::Normal(_) => EntityType::NormalComponent, + scrypto::prelude::ComponentAddress::Account(_) => EntityType::AccountComponent, + scrypto::prelude::ComponentAddress::EcdsaSecp256k1VirtualAccount(_) => { + EntityType::EcdsaSecp256k1VirtualAccountComponent + } + scrypto::prelude::ComponentAddress::EddsaEd25519VirtualAccount(_) => { + EntityType::EddsaEd25519VirtualAccountComponent + } + }, + Self::ResourceAddress { address } => match address.address { + scrypto::prelude::ResourceAddress::Normal(_) => EntityType::Resource, + }, + Self::PackageAddress { address } => match address.address { + scrypto::prelude::PackageAddress::Normal(_) => EntityType::Package, + }, + Self::SystemAddress { address } => match address.address { + scrypto::prelude::SystemAddress::EpochManager(_) => EntityType::EpochManager, + scrypto::prelude::SystemAddress::Clock(_) => EntityType::Clock, + }, + } + } + + 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, + Self::SystemAddress { 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 if let Ok(address) = NetworkAwareSystemAddress::from_u8_array(array, network_id) { + Ok(Self::SystemAddress { 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), + EntityAddress::SystemAddress { 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) + } + } +} diff --git a/core/src/model/address/entity_type.rs b/core/src/model/address/entity_type.rs new file mode 100644 index 00000000..defa3233 --- /dev/null +++ b/core/src/model/address/entity_type.rs @@ -0,0 +1,78 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use scrypto::radix_engine_interface::address::EntityType as NativeEntityType; +use serializable::serializable; + +// ================= +// Model Definition +// ================= + +/// An enum describing the different entity types in the Radix Engine and Scrypto +#[serializable] +pub enum EntityType { + Resource, + Package, + NormalComponent, + AccountComponent, + EcdsaSecp256k1VirtualAccountComponent, + EddsaEd25519VirtualAccountComponent, + EpochManager, + Clock, +} + +// ============ +// Conversions +// ============ + +impl From for NativeEntityType { + fn from(value: EntityType) -> Self { + match value { + EntityType::Resource => Self::Resource, + 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, + } + } +} + +impl From for EntityType { + fn from(value: NativeEntityType) -> Self { + match value { + NativeEntityType::Resource => Self::Resource, + 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, + } + } +} diff --git a/core/src/model/address/mod.rs b/core/src/model/address/mod.rs index e058c2cf..de6ff329 100644 --- a/core/src/model/address/mod.rs +++ b/core/src/model/address/mod.rs @@ -17,12 +17,14 @@ pub mod coder; pub mod entity_address; +pub mod entity_type; pub mod network_aware_address; pub mod non_fungible_address; pub mod non_fungible_id; pub use coder::*; pub use entity_address::*; +pub use entity_type::*; pub use network_aware_address::*; pub use non_fungible_address::*; pub use non_fungible_id::*; diff --git a/core/src/model/address/network_aware_address.rs b/core/src/model/address/network_aware_address.rs index eebfdde6..8b669683 100644 --- a/core/src/model/address/network_aware_address.rs +++ b/core/src/model/address/network_aware_address.rs @@ -40,6 +40,19 @@ macro_rules! define_network_aware_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); diff --git a/core/src/model/address/non_fungible_address.rs b/core/src/model/address/non_fungible_address.rs index 0be9e841..c5527eea 100644 --- a/core/src/model/address/non_fungible_address.rs +++ b/core/src/model/address/non_fungible_address.rs @@ -26,7 +26,7 @@ use crate::model::NetworkAwareResourceAddress; /// non-fungible unit as it contains both the resource address and the non-fungible id for that /// unit. #[serializable] -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct NonFungibleAddress { #[schemars(with = "crate::Value")] #[serde_as(as = "serde_with::TryFromInto")] diff --git a/core/src/model/engine_identifier/transient_identifier.rs b/core/src/model/engine_identifier/transient_identifier.rs index 8aed3319..e4dfad68 100644 --- a/core/src/model/engine_identifier/transient_identifier.rs +++ b/core/src/model/engine_identifier/transient_identifier.rs @@ -27,7 +27,7 @@ use std::str::FromStr; #[serializable] #[serde(untagged)] -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] /// Represents an untagged 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) @@ -37,12 +37,12 @@ pub enum TransientIdentifier { } #[serializable] -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] /// Represents a BucketId which uses a transient identifier. pub struct BucketId(pub TransientIdentifier); #[serializable] -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] /// Represents a ProofId which uses a transient identifier. pub struct ProofId(pub TransientIdentifier); diff --git a/core/src/model/instruction.rs b/core/src/model/instruction.rs index aaaa3df7..de21f536 100644 --- a/core/src/model/instruction.rs +++ b/core/src/model/instruction.rs @@ -39,7 +39,6 @@ use serializable::serializable; /// communication with the Radix Engine Toolkit #[serializable] #[serde(tag = "instruction", rename_all = "SCREAMING_SNAKE_CASE")] -#[derive(Clone)] pub enum Instruction { /// An instruction to call a function with the given list of arguments on the given package /// address and blueprint name. diff --git a/core/src/model/transaction/header.rs b/core/src/model/transaction/header.rs index e29d6bfe..444e3f5d 100644 --- a/core/src/model/transaction/header.rs +++ b/core/src/model/transaction/header.rs @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +use native_transaction::model as native; use serializable::serializable; /// A transaction header containing metadata and other transaction information. @@ -72,3 +73,39 @@ pub struct TransactionHeader { #[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/core/src/model/transaction/instruction_list.rs b/core/src/model/transaction/instruction_list.rs index e2cf0fd5..c877b769 100644 --- a/core/src/model/transaction/instruction_list.rs +++ b/core/src/model/transaction/instruction_list.rs @@ -34,7 +34,6 @@ use serializable::serializable; /// of instructions where each instruction is represented through the `Instruction` model. #[serializable] #[serde(tag = "type", content = "value")] -#[derive(Clone)] pub enum InstructionList { String(String), Parsed(Vec), @@ -42,7 +41,7 @@ pub enum InstructionList { /// An enum which describes the kind of manifest instructions. #[serializable] -#[derive(Clone, Copy)] +#[derive(Copy)] pub enum InstructionKind { String, Parsed, diff --git a/core/src/model/transaction/intent.rs b/core/src/model/transaction/intent.rs index 752d4c46..c1c0f0cb 100644 --- a/core/src/model/transaction/intent.rs +++ b/core/src/model/transaction/intent.rs @@ -15,9 +15,19 @@ // specific language governing permissions and limitations // under the License. +use scrypto::prelude::{scrypto_decode, scrypto_encode}; use serializable::serializable; -use crate::{TransactionHeader, TransactionManifest}; +use crate::address::Bech32Coder; +use crate::error::Result; +use crate::model::transaction::{TransactionHeader, TransactionManifest}; +use crate::traits::ValueRef; +use crate::{CompilableIntent, Error, InstructionKind}; +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. @@ -29,3 +39,68 @@ pub struct TransactionIntent { /// A transaction manifest of the transaction instructions and blobs. pub manifest: TransactionManifest, } + +// =============== +// Implementation +// =============== + +impl ValueRef for TransactionIntent { + fn borrow_values(&self) -> Vec<&crate::Value> { + self.manifest.borrow_values() + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + self.manifest.borrow_values_mut() + } +} + +impl CompilableIntent for TransactionIntent { + fn compile(&self) -> Result> { + self.to_native_transaction_intent() + .and_then(|intent| scrypto_encode(&intent).map_err(Error::from)) + } + + fn decompile(data: &T, instructions_kind: InstructionKind) -> Result + where + Self: Sized, + T: AsRef<[u8]>, + { + scrypto_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/core/src/model/transaction/manifest.rs b/core/src/model/transaction/manifest.rs index d55c2377..04348eff 100644 --- a/core/src/model/transaction/manifest.rs +++ b/core/src/model/transaction/manifest.rs @@ -15,7 +15,10 @@ // specific language governing permissions and limitations // under the License. -use crate::{InstructionList, ValueRef}; +use crate::error::Result; +use crate::{Bech32Coder, Error, InstructionKind, InstructionList, ValueRef}; +use native_transaction::manifest::decompile; +use native_transaction::model as native; use serializable::serializable; // ================= @@ -48,3 +51,45 @@ impl ValueRef for TransactionManifest { self.instructions.borrow_values_mut() } } + +// ============ +// 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/core/src/model/transaction/mod.rs b/core/src/model/transaction/mod.rs index f299791a..379cc18f 100644 --- a/core/src/model/transaction/mod.rs +++ b/core/src/model/transaction/mod.rs @@ -21,6 +21,7 @@ pub mod intent; pub mod manifest; pub mod notarized_intent; pub mod signed_intent; +pub mod validation_config; pub use header::*; pub use instruction_list::*; @@ -28,3 +29,4 @@ pub use intent::*; pub use manifest::*; pub use notarized_intent::*; pub use signed_intent::*; +pub use validation_config::*; diff --git a/core/src/model/transaction/notarized_intent.rs b/core/src/model/transaction/notarized_intent.rs index 7b670cf6..36678248 100644 --- a/core/src/model/transaction/notarized_intent.rs +++ b/core/src/model/transaction/notarized_intent.rs @@ -15,15 +15,21 @@ // specific language governing permissions and limitations // under the License. -use scrypto::prelude::Signature; +use crate::{error::Result, CompilableIntent, Error, InstructionKind}; +use native_transaction::model as native; +use scrypto::prelude::{scrypto_decode, scrypto_encode, Signature}; use serializable::serializable; -use crate::SignedTransactionIntent; +use crate::{SignedTransactionIntent, ValueRef}; + +// ================= +// Model Definition +// ================= /// A notarized transaction intent which is made up of a signed transaction intent and the notary /// intent on said signed intent. #[serializable] -pub struct NotarizedTransactionIntent { +pub struct NotarizedTransaction { /// The signed transaction intent of the transaction. pub signed_intent: SignedTransactionIntent, @@ -32,3 +38,67 @@ pub struct NotarizedTransactionIntent { #[serde_as(as = "serde_with::FromInto")] pub notary_signature: Signature, } + +// =============== +// Implementation +// =============== + +impl ValueRef for NotarizedTransaction { + fn borrow_values(&self) -> Vec<&crate::Value> { + self.signed_intent.borrow_values() + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + self.signed_intent.borrow_values_mut() + } +} + +impl CompilableIntent for NotarizedTransaction { + fn compile(&self) -> Result> { + self.to_native_notarized_transaction_intent() + .and_then(|notarized_transaction| { + scrypto_encode(¬arized_transaction).map_err(Error::from) + }) + } + + fn decompile(data: &T, instructions_kind: InstructionKind) -> Result + where + Self: Sized, + T: AsRef<[u8]>, + { + scrypto_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/core/src/model/transaction/signed_intent.rs b/core/src/model/transaction/signed_intent.rs index 13adfcd8..124ee6d2 100644 --- a/core/src/model/transaction/signed_intent.rs +++ b/core/src/model/transaction/signed_intent.rs @@ -15,10 +15,16 @@ // specific language governing permissions and limitations // under the License. -use scrypto::prelude::SignatureWithPublicKey; +use crate::{error::Result, CompilableIntent, Error}; +use native_transaction::model as native; +use scrypto::prelude::{scrypto_decode, scrypto_encode, SignatureWithPublicKey}; use serializable::serializable; -use crate::TransactionIntent; +use crate::{InstructionKind, TransactionIntent, ValueRef}; + +// ================= +// Model Definition +// ================= /// A signed transaction intent which is made up of the intent as well as the intent signatures. #[serializable] @@ -31,3 +37,65 @@ pub struct SignedTransactionIntent { #[serde_as(as = "Vec>")] pub intent_signatures: Vec, } + +// =============== +// Implementation +// =============== + +impl ValueRef for SignedTransactionIntent { + fn borrow_values(&self) -> Vec<&crate::Value> { + self.intent.borrow_values() + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + self.intent.borrow_values_mut() + } +} + +impl CompilableIntent for SignedTransactionIntent { + fn compile(&self) -> Result> { + self.to_native_signed_transaction_intent() + .and_then(|intent| scrypto_encode(&intent).map_err(Error::from)) + } + + fn decompile(data: &T, instructions_kind: InstructionKind) -> Result + where + Self: Sized, + T: AsRef<[u8]>, + { + scrypto_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/core/src/model/transaction/validation_config.rs b/core/src/model/transaction/validation_config.rs new file mode 100644 index 00000000..fe76b2a0 --- /dev/null +++ b/core/src/model/transaction/validation_config.rs @@ -0,0 +1,80 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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 serializable::serializable; + +/// Represents a set of settings to use when statically validating a notarized transaction intent. +#[serializable] +pub struct ValidationConfig { + #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "DisplayFromStr")] + pub network_id: u8, + + #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "DisplayFromStr")] + pub min_cost_unit_limit: u32, + + #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "DisplayFromStr")] + pub max_cost_unit_limit: u32, + + #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "DisplayFromStr")] + pub min_tip_percentage: u16, + + #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "DisplayFromStr")] + pub max_tip_percentage: u16, + + #[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/core/src/model/value.rs b/core/src/model/value.rs index 7bea876a..9f8e651d 100644 --- a/core/src/model/value.rs +++ b/core/src/model/value.rs @@ -35,7 +35,7 @@ use serializable::serializable; /// returns. #[serializable] #[serde(tag = "type")] -#[derive(Clone, PartialEq, Eq, Hash)] +#[derive(PartialEq, Eq, Hash)] pub enum Value { /// A boolean value which can either be true or false Bool { value: bool }, @@ -330,7 +330,7 @@ pub enum Value { /// An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is /// essentially the `type` tags used for the value model. #[serializable] -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum ValueKind { Bool, diff --git a/core/src/request/compile_notarized_transaction.rs b/core/src/request/compile_notarized_transaction.rs new file mode 100644 index 00000000..e1beb3bf --- /dev/null +++ b/core/src/request/compile_notarized_transaction.rs @@ -0,0 +1,101 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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::NotarizedTransaction; +use crate::request::Handler; +use crate::traits::{CompilableIntent, ValueRef}; +use serializable::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 { + #[serde(flatten)] + pub notarized_intent: NotarizedTransaction, +} + +/// The response from [`CompileNotarizedTransactionRequest`]. +#[serializable] +pub struct CompileNotarizedTransactionResponse { + #[serde_as(as = "serde_with::hex::Hex")] + pub compiled_intent: Vec, +} + +// =============== +// Implementation +// =============== + +struct CompileNotarizedTransactionHandler; + +impl Handler + for CompileNotarizedTransactionHandler +{ + fn pre_process( + request: CompileNotarizedTransactionRequest, + ) -> Result { + // Validate all `Value`s in the request. Ensure that: + // 1. All addresses are of the network provided in the request. + // 2. All single-type collections are of a single kind. + request + .borrow_values() + .iter() + .map(|value| { + value.validate(Some( + request + .notarized_intent + .signed_intent + .intent + .header + .network_id, + )) + }) + .collect::>>()?; + Ok(request) + } + + fn handle( + request: &CompileNotarizedTransactionRequest, + ) -> Result { + request + .notarized_intent + .compile() + .map(|compiled_intent| CompileNotarizedTransactionResponse { compiled_intent }) + } + + fn post_process( + _: &CompileNotarizedTransactionRequest, + response: CompileNotarizedTransactionResponse, + ) -> CompileNotarizedTransactionResponse { + response + } +} + +impl ValueRef for CompileNotarizedTransactionRequest { + fn borrow_values(&self) -> Vec<&crate::Value> { + self.notarized_intent.borrow_values() + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + self.notarized_intent.borrow_values_mut() + } +} diff --git a/core/src/request/compile_signed_transaction_intent.rs b/core/src/request/compile_signed_transaction_intent.rs new file mode 100644 index 00000000..e044eadd --- /dev/null +++ b/core/src/request/compile_signed_transaction_intent.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 crate::error::Result; +use crate::model::transaction::SignedTransactionIntent; +use crate::request::Handler; +use crate::traits::{CompilableIntent, ValueRef}; +use serializable::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 { + #[serde(flatten)] + pub signed_intent: SignedTransactionIntent, +} + +/// The response from [`CompileSignedTransactionIntentRequest`]. +#[serializable] +pub struct CompileSignedTransactionIntentResponse { + #[serde_as(as = "serde_with::hex::Hex")] + pub compiled_intent: Vec, +} + +// =============== +// Implementation +// =============== + +struct CompileSignedTransactionIntentHandler; + +impl Handler + for CompileSignedTransactionIntentHandler +{ + fn pre_process( + request: CompileSignedTransactionIntentRequest, + ) -> Result { + // Validate all `Value`s in the request. Ensure that: + // 1. All addresses are of the network provided in the request. + // 2. All single-type collections are of a single kind. + request + .borrow_values() + .iter() + .map(|value| value.validate(Some(request.signed_intent.intent.header.network_id))) + .collect::>>()?; + Ok(request) + } + + fn handle( + request: &CompileSignedTransactionIntentRequest, + ) -> Result { + request + .signed_intent + .compile() + .map(|compiled_intent| CompileSignedTransactionIntentResponse { compiled_intent }) + } + + fn post_process( + _: &CompileSignedTransactionIntentRequest, + response: CompileSignedTransactionIntentResponse, + ) -> CompileSignedTransactionIntentResponse { + response + } +} + +impl ValueRef for CompileSignedTransactionIntentRequest { + fn borrow_values(&self) -> Vec<&crate::Value> { + self.signed_intent.borrow_values() + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + self.signed_intent.borrow_values_mut() + } +} diff --git a/core/src/request/compile_transaction_intent.rs b/core/src/request/compile_transaction_intent.rs new file mode 100644 index 00000000..d08d9a8f --- /dev/null +++ b/core/src/request/compile_transaction_intent.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 crate::error::Result; +use crate::model::transaction::TransactionIntent; +use crate::request::Handler; +use crate::traits::{CompilableIntent, ValueRef}; +use serializable::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 { + #[serde(flatten)] + pub transaction_intent: TransactionIntent, +} + +/// The response from [`CompileTransactionIntentRequest`]. +#[serializable] +pub struct CompileTransactionIntentResponse { + #[serde_as(as = "serde_with::hex::Hex")] + pub compiled_intent: Vec, +} + +// =============== +// Implementation +// =============== + +struct CompileTransactionIntentHandler; + +impl Handler + for CompileTransactionIntentHandler +{ + fn pre_process( + request: CompileTransactionIntentRequest, + ) -> Result { + // Validate all `Value`s in the request. Ensure that: + // 1. All addresses are of the network provided in the request. + // 2. All single-type collections are of a single kind. + request + .borrow_values() + .iter() + .map(|value| value.validate(Some(request.transaction_intent.header.network_id))) + .collect::>>()?; + Ok(request) + } + + fn handle( + request: &CompileTransactionIntentRequest, + ) -> Result { + request + .transaction_intent + .compile() + .map(|compiled_intent| CompileTransactionIntentResponse { compiled_intent }) + } + + fn post_process( + _: &CompileTransactionIntentRequest, + response: CompileTransactionIntentResponse, + ) -> CompileTransactionIntentResponse { + response + } +} + +impl ValueRef for CompileTransactionIntentRequest { + fn borrow_values(&self) -> Vec<&crate::Value> { + self.transaction_intent.borrow_values() + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + self.transaction_intent.borrow_values_mut() + } +} diff --git a/core/src/request/convert_manifest.rs b/core/src/request/convert_manifest.rs index a3f9f129..36b7971b 100644 --- a/core/src/request/convert_manifest.rs +++ b/core/src/request/convert_manifest.rs @@ -15,11 +15,6 @@ // specific language governing permissions and limitations // under the License. -//! Defines the request and response models for the convert manifest request. This request is made -//! when the client has a manifest in one format (JSON as an example) and they wish to convert -//! the manifest to another format (String as an example). The conversion between the supported -//! formats is dependent on two main factors: the transaction version, and the network id. - use crate::error::Result; use crate::model::address::Bech32Coder; use crate::model::instruction_list::InstructionKind; @@ -53,20 +48,22 @@ pub struct ConvertManifestRequest { /// The version of the passed transaction manifest. Used to determine how the manifest is /// interpreted by the library. #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9]+"))] #[serde_as(as = "serde_with::DisplayFromStr")] pub transaction_version: u8, /// The network id of the network that this transaction manifest is meant for. This is used for /// the Bech32 address encoding and decoding. #[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_format: InstructionKind, + pub instructions_output_kind: InstructionKind, - /// The manifest to convert to the format described by `instructions_output_format` + /// The manifest to convert to the format described by `instructions_output_kind` pub manifest: TransactionManifest, } @@ -102,7 +99,7 @@ impl Handler for ConvertManifes .manifest .instructions .convert_to_manifest_instructions_kind( - request.instructions_output_format, + request.instructions_output_kind, &Bech32Coder::new(request.network_id), request.manifest.blobs.clone(), ) diff --git a/core/src/request/decode_address.rs b/core/src/request/decode_address.rs new file mode 100644 index 00000000..d08c4fb8 --- /dev/null +++ b/core/src/request/decode_address.rs @@ -0,0 +1,105 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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, EntityType}; +use crate::request::Handler; +use crate::utils::network_definition_from_network_id; +use bech32::{self, FromBase32, Variant}; +use scrypto::radix_engine_interface::address::AddressError; +use serializable::serializable; + +// ================= +// 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 { + pub address: String, +} + +#[serializable] +pub struct DecodeAddressResponse { + /// The network id of the network that the address is meant for - derived from the HRP. + #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + pub network_id: u8, + + /// The network name of the network that the address is meant for - derived from the HRP. + pub network_name: String, + + /// The type of entity that the address is addressing - derived from the entity byte in the + /// address + pub entity_type: EntityType, + + /// The data section 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 data: Vec, + + /// The HRP used by the address. + 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, + ) -> DecodeAddressResponse { + response + } +} diff --git a/core/src/request/decompile_notarized_transaction.rs b/core/src/request/decompile_notarized_transaction.rs new file mode 100644 index 00000000..d872d15e --- /dev/null +++ b/core/src/request/decompile_notarized_transaction.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::error::Result; +use crate::model::transaction::NotarizedTransaction; +use crate::request::Handler; +use crate::traits::{CompilableIntent, ValueRef}; +use crate::InstructionKind; +use serializable::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, + + #[serde_as(as = "serde_with::hex::Hex")] + pub compiled_notarized_intent: Vec, +} + +/// The response from [`DecompileNotarizedTransactionRequest`]. +#[serializable] +pub struct DecompileNotarizedTransactionResponse { + #[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, + ) -> DecompileNotarizedTransactionResponse { + for value in response.borrow_values_mut().iter_mut() { + value.alias(); + } + response + } +} + +impl ValueRef for DecompileNotarizedTransactionResponse { + fn borrow_values(&self) -> Vec<&crate::Value> { + self.notarized_intent.borrow_values() + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + self.notarized_intent.borrow_values_mut() + } +} diff --git a/core/src/request/decompile_signed_transaction_intent.rs b/core/src/request/decompile_signed_transaction_intent.rs new file mode 100644 index 00000000..d54f7399 --- /dev/null +++ b/core/src/request/decompile_signed_transaction_intent.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::error::Result; +use crate::model::transaction::SignedTransactionIntent; +use crate::request::Handler; +use crate::traits::{CompilableIntent, ValueRef}; +use crate::InstructionKind; +use serializable::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, + + #[serde_as(as = "serde_with::hex::Hex")] + pub compiled_signed_intent: Vec, +} + +/// The response from [`DecompileSignedTransactionIntentRequest`]. +#[serializable] +pub struct DecompileSignedTransactionIntentResponse { + #[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, + ) -> DecompileSignedTransactionIntentResponse { + for value in response.borrow_values_mut().iter_mut() { + value.alias(); + } + response + } +} + +impl ValueRef for DecompileSignedTransactionIntentResponse { + fn borrow_values(&self) -> Vec<&crate::Value> { + self.signed_intent.borrow_values() + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + self.signed_intent.borrow_values_mut() + } +} diff --git a/core/src/request/decompile_transaction_intent.rs b/core/src/request/decompile_transaction_intent.rs new file mode 100644 index 00000000..df08f1e6 --- /dev/null +++ b/core/src/request/decompile_transaction_intent.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 crate::error::Result; +use crate::model::transaction::TransactionIntent; +use crate::request::Handler; +use crate::traits::{CompilableIntent, ValueRef}; +use crate::InstructionKind; +use serializable::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, + + #[serde_as(as = "serde_with::hex::Hex")] + pub compiled_intent: Vec, +} + +/// The response from [`DecompileTransactionIntentRequest`]. +#[serializable] +pub struct DecompileTransactionIntentResponse { + #[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, + ) -> DecompileTransactionIntentResponse { + for value in response.borrow_values_mut().iter_mut() { + value.alias(); + } + response + } +} + +impl ValueRef for DecompileTransactionIntentResponse { + fn borrow_values(&self) -> Vec<&crate::Value> { + self.transaction_intent.borrow_values() + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + self.transaction_intent.borrow_values_mut() + } +} diff --git a/core/src/request/decompile_unknown_intent.rs b/core/src/request/decompile_unknown_intent.rs new file mode 100644 index 00000000..78e78666 --- /dev/null +++ b/core/src/request/decompile_unknown_intent.rs @@ -0,0 +1,168 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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::Handler; +use crate::request::{ + DecompileNotarizedTransactionRequest, DecompileNotarizedTransactionResponse, + DecompileSignedTransactionIntentRequest, DecompileSignedTransactionIntentResponse, + DecompileTransactionIntentRequest, DecompileTransactionIntentResponse, +}; +use crate::traits::ValueRef; +use crate::{ + DecompileNotarizedTransactionHandler, DecompileSignedTransactionIntentHandler, + DecompileTransactionIntentHandler, Error, InstructionKind, +}; +use serializable::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 { + pub instructions_output_kind: InstructionKind, + #[serde_as(as = "serde_with::hex::Hex")] + pub compiled_unknown_intent: Vec, +} + +/// The response from [`DecompileUnknownTransactionIntentRequest`]. +#[serializable] +#[serde(untagged)] +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 +// =============== + +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, + ) -> DecompileUnknownTransactionIntentResponse { + for value in response.borrow_values_mut().iter_mut() { + value.alias(); + } + response + } +} + +impl ValueRef for DecompileUnknownTransactionIntentResponse { + fn borrow_values(&self) -> Vec<&crate::Value> { + match self { + Self::TransactionIntent(intent) => intent.borrow_values(), + Self::SignedTransactionIntent(signed_intent) => signed_intent.borrow_values(), + Self::NotarizedTransactionIntent(notarized_intent) => notarized_intent.borrow_values(), + } + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + match self { + Self::TransactionIntent(intent) => intent.borrow_values_mut(), + Self::SignedTransactionIntent(signed_intent) => signed_intent.borrow_values_mut(), + Self::NotarizedTransactionIntent(notarized_intent) => { + notarized_intent.borrow_values_mut() + } + } + } +} diff --git a/core/src/request/derive_virtual_account_address.rs b/core/src/request/derive_virtual_account_address.rs new file mode 100644 index 00000000..49f61100 --- /dev/null +++ b/core/src/request/derive_virtual_account_address.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 scrypto::prelude::{ComponentAddress, PublicKey}; +use serializable::serializable; + +use crate::error::Result; +use crate::{Handler, NetworkAwareComponentAddress}; + +// ================= +// Model Definition +// ================= + +#[serializable] +pub struct DeriveVirtualAccountAddressRequest { + #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + pub network_id: u8, + + #[schemars(with = "crate::model::crypto::PublicKey")] + #[serde_as(as = "serde_with::FromInto")] + pub public_key: PublicKey, +} + +#[serializable] +pub struct DeriveVirtualAccountAddressResponse { + #[schemars(with = "crate::model::Value")] + #[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, + ) -> DeriveVirtualAccountAddressResponse { + response + } +} diff --git a/core/src/request/encode_address.rs b/core/src/request/encode_address.rs new file mode 100644 index 00000000..550b80b6 --- /dev/null +++ b/core/src/request/encode_address.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::{model::address::EntityAddress, Handler}; +use serializable::serializable; + +// ================= +// Model Definition +// ================= + +#[serializable] +pub struct EncodeAddressRequest { + #[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, + + #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + pub network_id: u8, +} + +#[serializable] +pub struct EncodeAddressResponse { + #[serde(flatten)] + address: EntityAddress, +} + +// =============== +// Implementation +// =============== + +struct EncodeAddressHandler; + +impl Handler for EncodeAddressHandler { + fn pre_process(request: EncodeAddressRequest) -> crate::Result { + Ok(request) + } + + fn handle(request: &EncodeAddressRequest) -> crate::Result { + EntityAddress::from_u8_array(&request.address_bytes, request.network_id) + .map(|address| EncodeAddressResponse { address }) + } + + fn post_process( + _: &EncodeAddressRequest, + response: EncodeAddressResponse, + ) -> EncodeAddressResponse { + response + } +} diff --git a/core/src/request/information.rs b/core/src/request/information.rs index 02bec7a9..602490bc 100644 --- a/core/src/request/information.rs +++ b/core/src/request/information.rs @@ -16,10 +16,9 @@ // under the License. use crate::error::Result; +use crate::request::Handler; use serializable::serializable; -use crate::Handler; - // ================= // Model Definition // ================= diff --git a/core/src/request/known_entity_addresses.rs b/core/src/request/known_entity_addresses.rs new file mode 100644 index 00000000..aecff9fb --- /dev/null +++ b/core/src/request/known_entity_addresses.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::error::Result; +use crate::request::Handler; +use crate::{ + NetworkAwareComponentAddress, NetworkAwarePackageAddress, NetworkAwareResourceAddress, + NetworkAwareSystemAddress, +}; +use scrypto::prelude::{ + ACCOUNT_PACKAGE, CLOCK, ECDSA_SECP256K1_TOKEN, EDDSA_ED25519_TOKEN, EPOCH_MANAGER, + FAUCET_COMPONENT, FAUCET_PACKAGE, RADIX_TOKEN, SYSTEM_TOKEN, +}; +use serializable::serializable; + +// ================= +// Model Definition +// ================= + +#[serializable] +pub struct KnownEntityAddressesRequest { + #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + pub network_id: u8, +} + +#[serializable] +pub struct KnownEntityAddressesResponse { + #[schemars(with = "crate::model::value::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + faucet_component_address: NetworkAwareComponentAddress, + + #[schemars(with = "crate::model::value::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + faucet_package_address: NetworkAwarePackageAddress, + + #[schemars(with = "crate::model::value::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + account_package_address: NetworkAwarePackageAddress, + + #[schemars(with = "crate::model::value::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + xrd_resource_address: NetworkAwareResourceAddress, + + #[schemars(with = "crate::model::value::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + system_token_resource_address: NetworkAwareResourceAddress, + + #[schemars(with = "crate::model::value::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + ecdsa_secp256k1_token_resource_address: NetworkAwareResourceAddress, + + #[schemars(with = "crate::model::value::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + eddsa_ed25519_token_resource_address: NetworkAwareResourceAddress, + + #[schemars(with = "crate::model::value::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + epoch_manager_system_address: NetworkAwareSystemAddress, + + #[schemars(with = "crate::model::value::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + clock_system_address: NetworkAwareSystemAddress, +} + +// =============== +// 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, + }, + epoch_manager_system_address: NetworkAwareSystemAddress { + address: EPOCH_MANAGER, + network_id, + }, + clock_system_address: NetworkAwareSystemAddress { + address: CLOCK, + network_id, + }, + }) + } + + fn post_process( + _: &KnownEntityAddressesRequest, + response: KnownEntityAddressesResponse, + ) -> KnownEntityAddressesResponse { + response + } +} diff --git a/core/src/request/mod.rs b/core/src/request/mod.rs index d11e9cf5..836a9856 100644 --- a/core/src/request/mod.rs +++ b/core/src/request/mod.rs @@ -15,12 +15,47 @@ // specific language governing permissions and limitations // under the License. -pub mod convert_manifest; 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_virtual_account_address; +pub mod known_entity_addresses; +pub mod statically_validate_transaction; + pub mod traits; +pub use compile_notarized_transaction::*; +pub use compile_signed_transaction_intent::*; +pub use compile_transaction_intent::*; pub use convert_manifest::*; +pub use decode_address::*; +pub use decompile_notarized_transaction::*; +pub use decompile_signed_transaction_intent::*; +pub use decompile_transaction_intent::*; +pub use decompile_unknown_intent::*; +pub use derive_virtual_account_address::*; +pub use encode_address::*; pub use information::*; - +pub use known_entity_addresses::*; +pub use sbor_decode::*; +pub use sbor_encode::*; +pub use statically_validate_transaction::*; pub use traits::*; diff --git a/core/src/request/sbor_decode.rs b/core/src/request/sbor_decode.rs new file mode 100644 index 00000000..9b60206c --- /dev/null +++ b/core/src/request/sbor_decode.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 crate::error::Result; +use crate::request::Handler; +use crate::traits::ValueRef; +use crate::value::Value; +use serializable::serializable; + +// ================= +// Model Definition +// ================= + +#[serializable] +pub struct SborDecodeRequest { + #[serde_as(as = "serde_with::hex::Hex")] + pub encoded_value: Vec, + + #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + pub network_id: u8, +} + +#[serializable] +pub struct SborDecodeResponse { + #[serde(flatten)] + pub value: Value, +} + +// =============== +// Implementation +// =============== + +pub struct SborDecodeHandler; + +impl Handler for SborDecodeHandler { + fn pre_process(request: SborDecodeRequest) -> Result { + Ok(request) + } + + fn handle(request: &SborDecodeRequest) -> Result { + Value::decode(&request.encoded_value, request.network_id) + .map(|value| SborDecodeResponse { value }) + } + + fn post_process(_: &SborDecodeRequest, mut response: SborDecodeResponse) -> SborDecodeResponse { + for value in response.borrow_values_mut().iter_mut() { + value.alias(); + } + response + } +} + +impl ValueRef for SborDecodeResponse { + fn borrow_values(&self) -> Vec<&Value> { + vec![&self.value] + } + + fn borrow_values_mut(&mut self) -> Vec<&mut Value> { + vec![&mut self.value] + } +} diff --git a/core/src/request/sbor_encode.rs b/core/src/request/sbor_encode.rs new file mode 100644 index 00000000..fcd6d179 --- /dev/null +++ b/core/src/request/sbor_encode.rs @@ -0,0 +1,81 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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::Handler; +use crate::traits::ValueRef; +use crate::value::Value; +use serializable::serializable; + +// ================= +// Model Definition +// ================= + +#[serializable] +pub struct SborEncodeRequest { + #[serde(flatten)] + pub value: Value, +} + +#[serializable] +pub struct SborEncodeResponse { + #[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 { + // Validate all `Value`s in the request. Ensure that: + // 1. All addresses are of the network provided in the request. + // 2. All single-type collections are of a single kind. + request + .borrow_values() + .iter() + .map(|value| value.validate(None)) + .collect::>>()?; + Ok(request) + } + + fn handle(request: &SborEncodeRequest) -> Result { + request + .value + .encode() + .map(|encoded_value| SborEncodeResponse { encoded_value }) + } + + fn post_process(_: &SborEncodeRequest, response: SborEncodeResponse) -> SborEncodeResponse { + response + } +} + +impl ValueRef for SborEncodeRequest { + fn borrow_values(&self) -> Vec<&Value> { + vec![&self.value] + } + + fn borrow_values_mut(&mut self) -> Vec<&mut Value> { + vec![&mut self.value] + } +} diff --git a/core/src/request/statically_validate_transaction.rs b/core/src/request/statically_validate_transaction.rs new file mode 100644 index 00000000..f14a8267 --- /dev/null +++ b/core/src/request/statically_validate_transaction.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::error::Result; +use crate::transaction::NotarizedTransaction; +use native_transaction::validation::{ + NotarizedTransactionValidator, TestIntentHashManager, TransactionValidator, ValidationConfig, +}; +use serializable::serializable; + +use crate::{CompilableIntent, Handler}; + +// ================= +// Model Definition +// ================= + +#[serializable] +pub struct StaticallyValidateTransactionRequest { + #[serde_as(as = "serde_with::hex::Hex")] + pub compiled_notarized_intent: Vec, + + #[schemars(with = "crate::model::transaction::ValidationConfig")] + #[serde_as(as = "serde_with::FromInto")] + pub validation_config: ValidationConfig, +} + +#[serializable] +#[serde(tag = "validity")] +pub enum StaticallyValidateTransactionResponse { + Valid, + Invalid { error: String }, +} + +// =============== +// Implementation +// =============== + +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, + crate::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, + ) -> StaticallyValidateTransactionResponse { + response + } +} diff --git a/core/src/traits.rs b/core/src/traits.rs index c4334bfe..d75aaada 100644 --- a/core/src/traits.rs +++ b/core/src/traits.rs @@ -1,4 +1,6 @@ use crate::model::Value; +use crate::{error::Result, InstructionKind}; +use scrypto::prelude::{hash, Hash}; /// A trait that defines a set of methods for aggregating value refs from objects pub trait ValueRef { @@ -8,3 +10,17 @@ pub trait ValueRef { /// Borrows all values mutably fn borrow_values_mut(&mut self) -> Vec<&mut Value>; } + +/// A trait that defines the common interface of all compile-able intents +pub trait CompilableIntent { + fn compile(&self) -> Result>; + + fn decompile(data: &T, instructions_kind: InstructionKind) -> Result + where + Self: Sized, + T: AsRef<[u8]>; + + fn hash(&self) -> Result { + self.compile().map(hash) + } +} diff --git a/serializable/src/lib.rs b/serializable/src/lib.rs index dedaf76c..6e9c6d2f 100644 --- a/serializable/src/lib.rs +++ b/serializable/src/lib.rs @@ -19,7 +19,8 @@ pub fn serializable(_: TokenStream, input: TokenStream) -> TokenStream { let serde_as_attribute = token_stream!("#[serde_with::serde_as]"); let default_derive_attributes = token_stream!("#[derive(serde::Serialize, serde::Deserialize)]"); - let debug_attribute = token_stream!("#[derive(Debug)]"); + let derive_debug_attribute = token_stream!("#[derive(Debug)]"); + let derive_clone_attribute = token_stream!("#[derive(Clone)]"); TokenStream::from(quote! { #json_schema_attribute @@ -28,7 +29,9 @@ pub fn serializable(_: TokenStream, input: TokenStream) -> TokenStream { #default_derive_attributes - #debug_attribute + #derive_debug_attribute + + #derive_clone_attribute #input }) From 609d68b9596c295609622932fb189ff882766c4e Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 16 Jan 2023 14:41:19 +0300 Subject: [PATCH 040/110] Refactor requests and add schema --- .gitignore | 1 - core/src/model/runtime/blob.rs | 1 + .../model/transaction/validation_config.rs | 12 + .../request/compile_notarized_transaction.rs | 7 +- .../compile_signed_transaction_intent.rs | 7 +- .../src/request/compile_transaction_intent.rs | 6 +- core/src/request/convert_manifest.rs | 14 +- core/src/request/decode_address.rs | 19 +- .../decompile_notarized_transaction.rs | 6 + .../decompile_signed_transaction_intent.rs | 6 + .../request/decompile_transaction_intent.rs | 6 + core/src/request/decompile_unknown_intent.rs | 14 +- .../request/derive_virtual_account_address.rs | 8 + core/src/request/encode_address.rs | 12 +- core/src/request/information.rs | 2 + core/src/request/known_entity_addresses.rs | 26 + core/src/request/sbor_decode.rs | 12 + core/src/request/sbor_encode.rs | 5 + .../statically_validate_transaction.rs | 12 +- schema/Cargo.toml | 1 + ...compile_notarized_transaction_request.json | 2870 +++++++++++++++ ...ompile_notarized_transaction_response.json | 16 + ...ile_signed_transaction_intent_request.json | 2779 +++++++++++++++ ...le_signed_transaction_intent_response.json | 16 + .../compile_transaction_intent_request.json | 2691 ++++++++++++++ .../compile_transaction_intent_response.json | 16 + .../schema/convert_manifest_request.json} | 3142 ++++++++--------- .../out/schema/convert_manifest_response.json | 2543 +++++++++++++ schema/out/schema/decode_address_request.json | 15 + .../out/schema/decode_address_response.json | 58 + ...compile_notarized_transaction_request.json | 35 + ...ompile_notarized_transaction_response.json | 2870 +++++++++++++++ ...ile_signed_transaction_intent_request.json | 35 + ...le_signed_transaction_intent_response.json | 2779 +++++++++++++++ .../decompile_transaction_intent_request.json | 35 + ...decompile_transaction_intent_response.json | 2691 ++++++++++++++ ...le_unknown_transaction_intent_request.json | 35 + ...e_unknown_transaction_intent_response.json | 2935 +++++++++++++++ ...erive_virtual_account_address_request.json | 92 + ...rive_virtual_account_address_response.json | 1087 ++++++ schema/out/schema/encode_address_request.json | 24 + .../out/schema/encode_address_response.json | 116 + schema/out/schema/information_request.json | 6 + schema/out/schema/information_response.json | 15 + .../known_entity_addresses_request.json | 16 + .../known_entity_addresses_response.json | 1159 ++++++ schema/out/schema/sbor_decode_request.json | 22 + schema/out/schema/sbor_decode_response.json | 2042 +++++++++++ schema/out/schema/sbor_encode_request.json | 2042 +++++++++++ schema/out/schema/sbor_encode_response.json | 16 + ...atically_validate_transaction_request.json | 71 + ...tically_validate_transaction_response.json | 39 + schema/src/main.rs | 124 +- 53 files changed, 30966 insertions(+), 1643 deletions(-) create mode 100644 schema/out/schema/compile_notarized_transaction_request.json create mode 100644 schema/out/schema/compile_notarized_transaction_response.json create mode 100644 schema/out/schema/compile_signed_transaction_intent_request.json create mode 100644 schema/out/schema/compile_signed_transaction_intent_response.json create mode 100644 schema/out/schema/compile_transaction_intent_request.json create mode 100644 schema/out/schema/compile_transaction_intent_response.json rename schema/{schema.json => out/schema/convert_manifest_request.json} (92%) create mode 100644 schema/out/schema/convert_manifest_response.json create mode 100644 schema/out/schema/decode_address_request.json create mode 100644 schema/out/schema/decode_address_response.json create mode 100644 schema/out/schema/decompile_notarized_transaction_request.json create mode 100644 schema/out/schema/decompile_notarized_transaction_response.json create mode 100644 schema/out/schema/decompile_signed_transaction_intent_request.json create mode 100644 schema/out/schema/decompile_signed_transaction_intent_response.json create mode 100644 schema/out/schema/decompile_transaction_intent_request.json create mode 100644 schema/out/schema/decompile_transaction_intent_response.json create mode 100644 schema/out/schema/decompile_unknown_transaction_intent_request.json create mode 100644 schema/out/schema/decompile_unknown_transaction_intent_response.json create mode 100644 schema/out/schema/derive_virtual_account_address_request.json create mode 100644 schema/out/schema/derive_virtual_account_address_response.json create mode 100644 schema/out/schema/encode_address_request.json create mode 100644 schema/out/schema/encode_address_response.json create mode 100644 schema/out/schema/information_request.json create mode 100644 schema/out/schema/information_response.json create mode 100644 schema/out/schema/known_entity_addresses_request.json create mode 100644 schema/out/schema/known_entity_addresses_response.json create mode 100644 schema/out/schema/sbor_decode_request.json create mode 100644 schema/out/schema/sbor_decode_response.json create mode 100644 schema/out/schema/sbor_encode_request.json create mode 100644 schema/out/schema/sbor_encode_response.json create mode 100644 schema/out/schema/statically_validate_transaction_request.json create mode 100644 schema/out/schema/statically_validate_transaction_response.json diff --git a/.gitignore b/.gitignore index c272c52d..55af7909 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ target node_modules -out examples/dotnet/bin examples/dotnet/obj .mypy_cache diff --git a/core/src/model/runtime/blob.rs b/core/src/model/runtime/blob.rs index cc593e42..963dc375 100644 --- a/core/src/model/runtime/blob.rs +++ b/core/src/model/runtime/blob.rs @@ -25,6 +25,7 @@ use crate::RADIX_ENGINE_HASH_LENGTH; /// 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")] diff --git a/core/src/model/transaction/validation_config.rs b/core/src/model/transaction/validation_config.rs index fe76b2a0..d843bfa3 100644 --- a/core/src/model/transaction/validation_config.rs +++ b/core/src/model/transaction/validation_config.rs @@ -22,31 +22,43 @@ use serializable::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")] diff --git a/core/src/request/compile_notarized_transaction.rs b/core/src/request/compile_notarized_transaction.rs index e1beb3bf..5fec4019 100644 --- a/core/src/request/compile_notarized_transaction.rs +++ b/core/src/request/compile_notarized_transaction.rs @@ -30,6 +30,7 @@ use serializable::serializable; /// signatures. #[serializable] pub struct CompileNotarizedTransactionRequest { + /// The notarized transaction intent to compile #[serde(flatten)] pub notarized_intent: NotarizedTransaction, } @@ -37,6 +38,10 @@ pub struct CompileNotarizedTransactionRequest { /// 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, } @@ -45,7 +50,7 @@ pub struct CompileNotarizedTransactionResponse { // Implementation // =============== -struct CompileNotarizedTransactionHandler; +pub struct CompileNotarizedTransactionHandler; impl Handler for CompileNotarizedTransactionHandler diff --git a/core/src/request/compile_signed_transaction_intent.rs b/core/src/request/compile_signed_transaction_intent.rs index e044eadd..5b29b70c 100644 --- a/core/src/request/compile_signed_transaction_intent.rs +++ b/core/src/request/compile_signed_transaction_intent.rs @@ -29,6 +29,7 @@ use serializable::serializable; /// 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, } @@ -36,6 +37,10 @@ pub struct CompileSignedTransactionIntentRequest { /// 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, } @@ -44,7 +49,7 @@ pub struct CompileSignedTransactionIntentResponse { // Implementation // =============== -struct CompileSignedTransactionIntentHandler; +pub struct CompileSignedTransactionIntentHandler; impl Handler for CompileSignedTransactionIntentHandler diff --git a/core/src/request/compile_transaction_intent.rs b/core/src/request/compile_transaction_intent.rs index d08d9a8f..272a9127 100644 --- a/core/src/request/compile_transaction_intent.rs +++ b/core/src/request/compile_transaction_intent.rs @@ -29,6 +29,7 @@ use serializable::serializable; /// caller. This is mainly useful when creating a transaction. #[serializable] pub struct CompileTransactionIntentRequest { + /// The transaction intent to compile. #[serde(flatten)] pub transaction_intent: TransactionIntent, } @@ -36,6 +37,9 @@ pub struct CompileTransactionIntentRequest { /// 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, } @@ -44,7 +48,7 @@ pub struct CompileTransactionIntentResponse { // Implementation // =============== -struct CompileTransactionIntentHandler; +pub struct CompileTransactionIntentHandler; impl Handler for CompileTransactionIntentHandler diff --git a/core/src/request/convert_manifest.rs b/core/src/request/convert_manifest.rs index 36b7971b..66b2d89c 100644 --- a/core/src/request/convert_manifest.rs +++ b/core/src/request/convert_manifest.rs @@ -45,15 +45,9 @@ use serializable::serializable; /// types: string and parsed. #[serializable] pub struct ConvertManifestRequest { - /// The version of the passed transaction manifest. Used to determine how the manifest is - /// interpreted by the library. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9]+"))] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub transaction_version: u8, - - /// The network id of the network that this transaction manifest is meant for. This is used for - /// the Bech32 address encoding and decoding. + /// 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")] @@ -70,7 +64,7 @@ pub struct ConvertManifestRequest { /// The response of the [`ConvertManifestRequest`] #[serializable] pub struct ConvertManifestResponse { - /// The converted manifest + /// The manifest after it has been converted to the instruction kind specified in the request #[serde(flatten)] pub manifest: TransactionManifest, } diff --git a/core/src/request/decode_address.rs b/core/src/request/decode_address.rs index d08c4fb8..5471c644 100644 --- a/core/src/request/decode_address.rs +++ b/core/src/request/decode_address.rs @@ -32,32 +32,39 @@ use serializable::serializable; /// 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 { - /// The network id of the network that the address is meant for - derived from the HRP. + /// 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, - /// The network name of the network that the address is meant for - derived from the HRP. + /// 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, - /// The type of entity that the address is addressing - derived from the entity byte in the - /// address + /// 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, - /// The data section of the address. + /// 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, - /// The HRP used by the address. + /// A string which represents the Bech32m Human Readable Part (HRP) of the passed address + /// string pub hrp: String, } diff --git a/core/src/request/decompile_notarized_transaction.rs b/core/src/request/decompile_notarized_transaction.rs index d872d15e..061f2337 100644 --- a/core/src/request/decompile_notarized_transaction.rs +++ b/core/src/request/decompile_notarized_transaction.rs @@ -35,6 +35,10 @@ pub struct DecompileNotarizedTransactionRequest { /// 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, } @@ -42,6 +46,8 @@ pub struct DecompileNotarizedTransactionRequest { /// 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, } diff --git a/core/src/request/decompile_signed_transaction_intent.rs b/core/src/request/decompile_signed_transaction_intent.rs index d54f7399..87b83091 100644 --- a/core/src/request/decompile_signed_transaction_intent.rs +++ b/core/src/request/decompile_signed_transaction_intent.rs @@ -35,6 +35,10 @@ pub struct DecompileSignedTransactionIntentRequest { /// 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, } @@ -42,6 +46,8 @@ pub struct DecompileSignedTransactionIntentRequest { /// 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, } diff --git a/core/src/request/decompile_transaction_intent.rs b/core/src/request/decompile_transaction_intent.rs index df08f1e6..69ee699b 100644 --- a/core/src/request/decompile_transaction_intent.rs +++ b/core/src/request/decompile_transaction_intent.rs @@ -34,6 +34,10 @@ pub struct DecompileTransactionIntentRequest { /// 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, } @@ -41,6 +45,8 @@ pub struct DecompileTransactionIntentRequest { /// 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, } diff --git a/core/src/request/decompile_unknown_intent.rs b/core/src/request/decompile_unknown_intent.rs index 78e78666..deeadc1f 100644 --- a/core/src/request/decompile_unknown_intent.rs +++ b/core/src/request/decompile_unknown_intent.rs @@ -40,12 +40,22 @@ use serializable::serializable; /// 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`]. +/// The response from [`DecompileUnknownTransactionIntentRequest`]. This is an untagged union which +/// can either be a [`DecompileTransactionIntentResponse`], +/// [`DecompileSignedTransactionIntentResponse`], or [`DecompileNotarizedTransactionResponse`] +/// depending on the passed intent. #[serializable] #[serde(untagged)] pub enum DecompileUnknownTransactionIntentResponse { @@ -107,7 +117,7 @@ impl From for DecompileUnknownTransaction // Implementation // =============== -struct DecompileUnknownTransactionIntentHandler; +pub struct DecompileUnknownTransactionIntentHandler; impl Handler for DecompileUnknownTransactionIntentHandler diff --git a/core/src/request/derive_virtual_account_address.rs b/core/src/request/derive_virtual_account_address.rs index 49f61100..125e9e10 100644 --- a/core/src/request/derive_virtual_account_address.rs +++ b/core/src/request/derive_virtual_account_address.rs @@ -25,20 +25,28 @@ use crate::{Handler, NetworkAwareComponentAddress}; // 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 = "crate::model::Value")] #[serde_as(as = "serde_with::TryFromInto")] pub virtual_account_address: NetworkAwareComponentAddress, diff --git a/core/src/request/encode_address.rs b/core/src/request/encode_address.rs index 550b80b6..d1cf8bb8 100644 --- a/core/src/request/encode_address.rs +++ b/core/src/request/encode_address.rs @@ -22,22 +22,32 @@ use serializable::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)] address: EntityAddress, } @@ -46,7 +56,7 @@ pub struct EncodeAddressResponse { // Implementation // =============== -struct EncodeAddressHandler; +pub struct EncodeAddressHandler; impl Handler for EncodeAddressHandler { fn pre_process(request: EncodeAddressRequest) -> crate::Result { diff --git a/core/src/request/information.rs b/core/src/request/information.rs index 602490bc..c489e867 100644 --- a/core/src/request/information.rs +++ b/core/src/request/information.rs @@ -33,6 +33,8 @@ 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, } diff --git a/core/src/request/known_entity_addresses.rs b/core/src/request/known_entity_addresses.rs index aecff9fb..277935d0 100644 --- a/core/src/request/known_entity_addresses.rs +++ b/core/src/request/known_entity_addresses.rs @@ -31,48 +31,74 @@ use serializable::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 = "crate::model::value::Value")] #[serde_as(as = "serde_with::TryFromInto")] faucet_component_address: NetworkAwareComponentAddress, + /// A package address serialized as a `PackageAddress` from the `Value` model which represents + /// the address of the faucet package on the requested network. #[schemars(with = "crate::model::value::Value")] #[serde_as(as = "serde_with::TryFromInto")] faucet_package_address: NetworkAwarePackageAddress, + /// A package address serialized as a `PackageAddress` from the `Value` model which represents + /// the address of the account package on the requested network. #[schemars(with = "crate::model::value::Value")] #[serde_as(as = "serde_with::TryFromInto")] account_package_address: NetworkAwarePackageAddress, + /// A resource address serialized as a `ResourceAddress` from the `Value` model which + /// represents the address of the XRD resource on the requested network. #[schemars(with = "crate::model::value::Value")] #[serde_as(as = "serde_with::TryFromInto")] xrd_resource_address: NetworkAwareResourceAddress, + /// A resource address serialized as a `ResourceAddress` from the `Value` model which + /// represents the address of the system resource on the requested network. #[schemars(with = "crate::model::value::Value")] #[serde_as(as = "serde_with::TryFromInto")] system_token_resource_address: NetworkAwareResourceAddress, + /// A resource address serialized as a `ResourceAddress` from the `Value` model which + /// represents the address of the Ecdsa Secp256k1 resource on the requested network. #[schemars(with = "crate::model::value::Value")] #[serde_as(as = "serde_with::TryFromInto")] ecdsa_secp256k1_token_resource_address: NetworkAwareResourceAddress, + /// A resource address serialized as a `ResourceAddress` from the `Value` model which + /// represents the address of the EdDSA Ed25519 resource on the requested network. #[schemars(with = "crate::model::value::Value")] #[serde_as(as = "serde_with::TryFromInto")] eddsa_ed25519_token_resource_address: NetworkAwareResourceAddress, + /// A system address serialized as a `SystemAddress` from the `Value` model which represents + /// the address of the epoch manager on the requested network. #[schemars(with = "crate::model::value::Value")] #[serde_as(as = "serde_with::TryFromInto")] epoch_manager_system_address: NetworkAwareSystemAddress, + /// A system address serialized as a `SystemAddress` from the `Value` model which represents + /// the address of the clock on the requested network. #[schemars(with = "crate::model::value::Value")] #[serde_as(as = "serde_with::TryFromInto")] clock_system_address: NetworkAwareSystemAddress, diff --git a/core/src/request/sbor_decode.rs b/core/src/request/sbor_decode.rs index 9b60206c..b735a3df 100644 --- a/core/src/request/sbor_decode.rs +++ b/core/src/request/sbor_decode.rs @@ -25,19 +25,31 @@ use serializable::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] pub struct SborDecodeResponse { + /// A value representing the SBOR decoded form of the passed SBOR buffer. #[serde(flatten)] pub value: Value, } diff --git a/core/src/request/sbor_encode.rs b/core/src/request/sbor_encode.rs index fcd6d179..f61abb38 100644 --- a/core/src/request/sbor_encode.rs +++ b/core/src/request/sbor_encode.rs @@ -25,14 +25,19 @@ use serializable::serializable; // Model Definition // ================= +/// This request takes in a [`Value`] and attempts to SBOR encode it and return back an SBOR byte +/// array. #[serializable] pub struct SborEncodeRequest { + /// The value to SBOR encode. #[serde(flatten)] pub value: Value, } +/// 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")] diff --git a/core/src/request/statically_validate_transaction.rs b/core/src/request/statically_validate_transaction.rs index f14a8267..e149fbd4 100644 --- a/core/src/request/statically_validate_transaction.rs +++ b/core/src/request/statically_validate_transaction.rs @@ -28,16 +28,26 @@ use crate::{CompilableIntent, 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")] pub enum StaticallyValidateTransactionResponse { @@ -49,7 +59,7 @@ pub enum StaticallyValidateTransactionResponse { // Implementation // =============== -struct StaticallyValidateTransactionHandler; +pub struct StaticallyValidateTransactionHandler; impl Handler for StaticallyValidateTransactionHandler diff --git a/schema/Cargo.toml b/schema/Cargo.toml index 13cc6882..704153b9 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -13,3 +13,4 @@ serde_json = "1.0.91" # Importing core to get the models to generate it core = { path = "../core" } serde = "1.0.152" +convert_case = "0.6.0" diff --git a/schema/out/schema/compile_notarized_transaction_request.json b/schema/out/schema/compile_notarized_transaction_request.json new file mode 100644 index 00000000..329cf48a --- /dev/null +++ b/schema/out/schema/compile_notarized_transaction_request.json @@ -0,0 +1,2870 @@ +{ + "$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.", + "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.", + "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.", + "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.", + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EcdsaSecp256k1" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EddsaEd25519" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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", + "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": [ + { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "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.", + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "blueprint_name": { + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "function_name": { + "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "method_name": { + "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "Returns a bucket of tokens to the 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/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a given resource exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + } + } + }, + { + "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction that pushes a proof to the auth zone stack.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_AUTH_ZONE" + ] + } + } + }, + { + "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "type": "object", + "required": [ + "ids", + "instruction", + "into_proof", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" + ] + }, + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof given a bucket of some resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to clone a proof creating a second proof identical to the original", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop a 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop all proofs currently present in the transaction context.", + "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.", + "type": "object", + "required": [ + "abi", + "access_rules", + "code", + "instruction", + "metadata", + "royalty_config" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "metadata": { + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + "type": "object", + "required": [ + "abi", + "code", + "instruction", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE_WITH_OWNER" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to burn a bucket of tokens.", + "type": "object", + "required": [ + "bucket", + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "BURN_RESOURCE" + ] + }, + "bucket": { + "description": "The bucket of tokens to burn.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction ot recall resources from a known vault.", + "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/Value" + } + ] + }, + "amount": { + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "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 `SystemAddress`.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "value": { + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties of a package.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties on a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a package", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the access rules of a method that an entity has.", + "type": "object", + "required": [ + "entity_address", + "index", + "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/Value" + } + ] + }, + "index": { + "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "rule": { + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mint fungible resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mind non-fungibles of a resource", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new fungible resource.", + "type": "object", + "required": [ + "access_rules", + "divisibility", + "initial_supply", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "divisibility", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "divisibility": { + "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new non-fungible resource.", + "type": "object", + "required": [ + "access_rules", + "id_type", + "initial_supply", + "instruction", + "metadata" + ], + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "id_type", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "id_type": { + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to unregister a validator given it's public key", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "UNREGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator to unregister", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + } + ] + }, + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "SystemAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleId", + "NonFungibleAddress", + "Expression", + "Blob", + "Bytes" + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "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]+" + }, + "NonFungibleId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "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", + "type": "object", + "required": [ + "EcdsaSecp256k1" + ], + "properties": { + "EcdsaSecp256k1": { + "type": "object", + "required": [ + "signature" + ], + "properties": { + "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]+" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Cryptographic signature and public key for EdDSA Ed25519", + "type": "object", + "required": [ + "EddsaEd25519" + ], + "properties": { + "EddsaEd25519": { + "type": "object", + "required": [ + "public_key", + "signature" + ], + "properties": { + "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]+" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "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.", + "type": "object", + "required": [ + "curve", + "signature" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EcdsaSecp256k1" + ] + }, + "signature": { + "type": "object", + "required": [ + "signature" + ], + "properties": { + "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.", + "type": "object", + "required": [ + "curve", + "signature" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EddsaEd25519" + ] + }, + "signature": { + "type": "object", + "required": [ + "signature" + ], + "properties": { + "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 new file mode 100644 index 00000000..496bd19e --- /dev/null +++ b/schema/out/schema/compile_notarized_transaction_response.json @@ -0,0 +1,16 @@ +{ + "$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 new file mode 100644 index 00000000..eb62cf60 --- /dev/null +++ b/schema/out/schema/compile_signed_transaction_intent_request.json @@ -0,0 +1,2779 @@ +{ + "$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.", + "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.", + "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.", + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EcdsaSecp256k1" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EddsaEd25519" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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", + "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": [ + { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "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.", + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "blueprint_name": { + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "function_name": { + "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "method_name": { + "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "Returns a bucket of tokens to the 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/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a given resource exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + } + } + }, + { + "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction that pushes a proof to the auth zone stack.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_AUTH_ZONE" + ] + } + } + }, + { + "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "type": "object", + "required": [ + "ids", + "instruction", + "into_proof", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" + ] + }, + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof given a bucket of some resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to clone a proof creating a second proof identical to the original", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop a 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop all proofs currently present in the transaction context.", + "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.", + "type": "object", + "required": [ + "abi", + "access_rules", + "code", + "instruction", + "metadata", + "royalty_config" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "metadata": { + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + "type": "object", + "required": [ + "abi", + "code", + "instruction", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE_WITH_OWNER" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to burn a bucket of tokens.", + "type": "object", + "required": [ + "bucket", + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "BURN_RESOURCE" + ] + }, + "bucket": { + "description": "The bucket of tokens to burn.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction ot recall resources from a known vault.", + "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/Value" + } + ] + }, + "amount": { + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "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 `SystemAddress`.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "value": { + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties of a package.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties on a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a package", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the access rules of a method that an entity has.", + "type": "object", + "required": [ + "entity_address", + "index", + "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/Value" + } + ] + }, + "index": { + "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "rule": { + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mint fungible resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mind non-fungibles of a resource", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new fungible resource.", + "type": "object", + "required": [ + "access_rules", + "divisibility", + "initial_supply", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "divisibility", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "divisibility": { + "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new non-fungible resource.", + "type": "object", + "required": [ + "access_rules", + "id_type", + "initial_supply", + "instruction", + "metadata" + ], + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "id_type", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "id_type": { + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to unregister a validator given it's public key", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "UNREGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator to unregister", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + } + ] + }, + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "SystemAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleId", + "NonFungibleAddress", + "Expression", + "Blob", + "Bytes" + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "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]+" + }, + "NonFungibleId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "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", + "type": "object", + "required": [ + "EcdsaSecp256k1" + ], + "properties": { + "EcdsaSecp256k1": { + "type": "object", + "required": [ + "signature" + ], + "properties": { + "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]+" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Cryptographic signature and public key for EdDSA Ed25519", + "type": "object", + "required": [ + "EddsaEd25519" + ], + "properties": { + "EddsaEd25519": { + "type": "object", + "required": [ + "public_key", + "signature" + ], + "properties": { + "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]+" + } + } + } + }, + "additionalProperties": false + } + ] + } + } +} \ 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 new file mode 100644 index 00000000..97030e76 --- /dev/null +++ b/schema/out/schema/compile_signed_transaction_intent_response.json @@ -0,0 +1,16 @@ +{ + "$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 new file mode 100644 index 00000000..39675e18 --- /dev/null +++ b/schema/out/schema/compile_transaction_intent_request.json @@ -0,0 +1,2691 @@ +{ + "$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.", + "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.", + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EcdsaSecp256k1" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EddsaEd25519" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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", + "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": [ + { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "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.", + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "blueprint_name": { + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "function_name": { + "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "method_name": { + "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "Returns a bucket of tokens to the 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/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a given resource exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + } + } + }, + { + "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction that pushes a proof to the auth zone stack.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_AUTH_ZONE" + ] + } + } + }, + { + "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "type": "object", + "required": [ + "ids", + "instruction", + "into_proof", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" + ] + }, + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof given a bucket of some resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to clone a proof creating a second proof identical to the original", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop a 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop all proofs currently present in the transaction context.", + "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.", + "type": "object", + "required": [ + "abi", + "access_rules", + "code", + "instruction", + "metadata", + "royalty_config" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "metadata": { + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + "type": "object", + "required": [ + "abi", + "code", + "instruction", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE_WITH_OWNER" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to burn a bucket of tokens.", + "type": "object", + "required": [ + "bucket", + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "BURN_RESOURCE" + ] + }, + "bucket": { + "description": "The bucket of tokens to burn.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction ot recall resources from a known vault.", + "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/Value" + } + ] + }, + "amount": { + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "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 `SystemAddress`.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "value": { + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties of a package.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties on a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a package", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the access rules of a method that an entity has.", + "type": "object", + "required": [ + "entity_address", + "index", + "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/Value" + } + ] + }, + "index": { + "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "rule": { + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mint fungible resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mind non-fungibles of a resource", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new fungible resource.", + "type": "object", + "required": [ + "access_rules", + "divisibility", + "initial_supply", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "divisibility", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "divisibility": { + "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new non-fungible resource.", + "type": "object", + "required": [ + "access_rules", + "id_type", + "initial_supply", + "instruction", + "metadata" + ], + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "id_type", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "id_type": { + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to unregister a validator given it's public key", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "UNREGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator to unregister", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + } + ] + }, + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "SystemAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleId", + "NonFungibleAddress", + "Expression", + "Blob", + "Bytes" + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "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]+" + }, + "NonFungibleId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ] + } + } +} \ 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 new file mode 100644 index 00000000..0d2eec79 --- /dev/null +++ b/schema/out/schema/compile_transaction_intent_response.json @@ -0,0 +1,16 @@ +{ + "$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/schema.json b/schema/out/schema/convert_manifest_request.json similarity index 92% rename from schema/schema.json rename to schema/out/schema/convert_manifest_request.json index 7431b3f6..2891aedb 100644 --- a/schema/schema.json +++ b/schema/out/schema/convert_manifest_request.json @@ -1,24 +1,74 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "RadixEngineToolkit", - "description": "This schema describes the types that the Radix Engine Toolkit accepts and returns. In this schema you will find a number of models, the most basic one of them is the `Value` model which describes how primitive types and Scrypto values are represented when communicating with the Radix Engine Toolkit. In addition to that, there are additional models which describe what instructions look like, transactions, and any other models.\n\nThis schema has been automatically generated and therefore should hopefully always be the ground truth for the Radix Engine Toolkit models", - "anyOf": [ - { - "$ref": "#/definitions/Value" + "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]+" }, - { - "$ref": "#/definitions/Error" + "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" + } + ] }, - { - "$ref": "#/definitions/Instruction" + "manifest": { + "description": "The manifest to convert to the format described by `instructions_output_kind`", + "allOf": [ + { + "$ref": "#/definitions/TransactionManifest" + } + ] } - ], + }, "definitions": { - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "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", + "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": [ { - "description": "A boolean value which can either be true or false", "type": "object", "required": [ "type", @@ -28,16 +78,15 @@ "type": { "type": "string", "enum": [ - "Bool" + "String" ] }, "value": { - "type": "boolean" + "type": "string" } } }, { - "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", "type": "object", "required": [ "type", @@ -47,1270 +96,1309 @@ "type": { "type": "string", "enum": [ - "U8" + "Parsed" ] }, "value": { - "type": "string", - "pattern": "[0-9]+" + "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": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "description": "An instruction to call a function with the given list of arguments on the given package address and blueprint name.", "type": "object", "required": [ - "type", - "value" + "blueprint_name", + "function_name", + "instruction", + "package_address" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "U16" + "CALL_FUNCTION" ] }, - "value": { - "type": "string", - "pattern": "[0-9]+" + "package_address": { + "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "blueprint_name": { + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "function_name": { + "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } } } }, { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", "type": "object", "required": [ - "type", - "value" + "component_address", + "instruction", + "method_name" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "U32" + "CALL_METHOD" ] }, - "value": { - "type": "string", - "pattern": "[0-9]+" + "component_address": { + "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "method_name": { + "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } } } }, { - "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", "type": "object", "required": [ - "type", - "value" + "instruction", + "into_bucket", + "resource_address" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "U64" + "TAKE_FROM_WORKTOP" ] }, - "value": { - "type": "string", - "pattern": "[0-9]+" + "resource_address": { + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", "type": "object", "required": [ - "type", - "value" + "amount", + "instruction", + "into_bucket", + "resource_address" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "U128" + "TAKE_FROM_WORKTOP_BY_AMOUNT" ] }, - "value": { - "type": "string", - "pattern": "[0-9]+" + "resource_address": { + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "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.", "type": "object", "required": [ - "type", - "value" + "ids", + "instruction", + "into_bucket", + "resource_address" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "I8" + "TAKE_FROM_WORKTOP_BY_IDS" ] }, - "value": { - "type": "string", - "pattern": "[0-9]+" + "resource_address": { + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "description": "Returns a bucket of tokens to the worktop.", "type": "object", "required": [ - "type", - "value" + "bucket", + "instruction" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "I16" + "RETURN_TO_WORKTOP" ] }, - "value": { - "type": "string", - "pattern": "[0-9]+" + "bucket": { + "description": "The bucket to return to the worktop.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "description": "An instruction to assert that a given resource exists in the worktop.", "type": "object", "required": [ - "type", - "value" + "instruction", + "resource_address" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "I32" + "ASSERT_WORKTOP_CONTAINS" ] }, - "value": { - "type": "string", - "pattern": "[0-9]+" + "resource_address": { + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", "type": "object", "required": [ - "type", - "value" + "amount", + "instruction", + "resource_address" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "I64" + "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT" ] }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I128" + "resource_address": { + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } ] }, - "value": { - "type": "string", - "pattern": "[0-9]+" + "amount": { + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "A type representing a string", + "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", "type": "object", "required": [ - "type", - "value" + "ids", + "instruction", + "resource_address" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "String" + "ASSERT_WORKTOP_CONTAINS_BY_IDS" ] }, - "value": { - "type": "string" + "resource_address": { + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true } } }, { - "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable proof", "type": "object", "required": [ - "type", - "variant" + "instruction", + "into_proof" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Enum" + "POP_FROM_AUTH_ZONE" ] }, - "variant": { - "description": "The name of the variant of the enum", - "type": "string" - }, - "fields": { - "description": "Optional fields that the enum may have", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } + "into_proof": { + "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "The `Some` case of Rust Options where the value is some Value", + "description": "An instruction that pushes a proof to the auth zone stack.", "type": "object", "required": [ - "type", - "value" + "instruction", + "proof" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Some" + "PUSH_TO_AUTH_ZONE" ] }, - "value": { - "$ref": "#/definitions/Value" + "proof": { + "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "The `None` case of Rust Options where there is value", + "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", "type": "object", "required": [ - "type" + "instruction" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "None" + "CLEAR_AUTH_ZONE" ] } } }, { - "description": "The `Ok` case of Rust Results where the value is some Value", + "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", "type": "object", "required": [ - "type", - "value" + "instruction", + "into_proof", + "resource_address" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Ok" + "CREATE_PROOF_FROM_AUTH_ZONE" ] }, - "value": { - "$ref": "#/definitions/Value" + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "The `Err` case of Rust Results where the value is some Value", + "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", "type": "object", "required": [ - "type", - "value" + "amount", + "instruction", + "into_proof", + "resource_address" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Err" + "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT" ] }, - "value": { - "$ref": "#/definitions/Value" + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "An array values of a single value kind", + "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", "type": "object", "required": [ - "element_kind", - "elements", - "type" + "ids", + "instruction", + "into_proof", + "resource_address" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Array" + "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" ] }, - "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.", + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/Value" } ] }, - "elements": { - "description": "The elements of the array which may contain 0 or more elements.", + "ids": { + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/Value" - } + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "An array of elements where elements could be of different kinds.", + "description": "An instruction to create a proof given a bucket of some resources", "type": "object", "required": [ - "elements", - "type" + "bucket", + "instruction", + "into_proof" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Tuple" + "CREATE_PROOF_FROM_BUCKET" ] }, - "elements": { - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } + "bucket": { + "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "description": "An instruction to clone a proof creating a second proof identical to the original", "type": "object", "required": [ - "type", - "value" + "instruction", + "into_proof", + "proof" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Decimal" + "CLONE_PROOF" ] }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" + "proof": { + "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "description": "An instruction to drop a proof.", "type": "object", "required": [ - "type", - "value" + "instruction", + "proof" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "PreciseDecimal" + "DROP_PROOF" ] }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" + "proof": { + "description": "The proof to drop. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" } - } - } - ], - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" ] } } }, { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "description": "An instruction to drop all proofs currently present in the transaction context.", "type": "object", "required": [ - "address", - "type" + "instruction" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "ComponentAddress" + "DROP_ALL_PROOFS" ] - }, - "address": { - "type": "string" } } }, { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "description": "An instruction to publish a package and set it's associated royalty configs, metadata, and access rules.", "type": "object", "required": [ - "address", - "type" + "abi", + "access_rules", + "code", + "instruction", + "metadata", + "royalty_config" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "ResourceAddress" + "PUBLISH_PACKAGE" ] }, - "address": { - "type": "string" + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "metadata": { + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", "type": "object", "required": [ - "address", - "type" + "abi", + "code", + "instruction", + "owner_badge" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "SystemAddress" + "PUBLISH_PACKAGE_WITH_OWNER" ] }, - "address": { - "type": "string" + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "description": "An instruction to burn a bucket of tokens.", "type": "object", "required": [ - "address", - "type" + "bucket", + "instruction" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "PackageAddress" + "BURN_RESOURCE" ] }, - "address": { - "type": "string" + "bucket": { + "description": "The bucket of tokens to burn.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "An instruction ot recall resources from a known vault.", "type": "object", "required": [ - "type", - "value" + "amount", + "instruction", + "vault_id" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Hash" + "RECALL_RESOURCE" ] }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "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/Value" + } + ] + }, + "amount": { + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "description": "An instruction to set the metadata on an entity.", "type": "object", "required": [ - "public_key", - "type" + "entity_address", + "instruction", + "key", + "value" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "EcdsaSecp256k1PublicKey" + "SET_METADATA" ] }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" + "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 `SystemAddress`.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "value": { + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "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. The use of other signature format", + "description": "An instruction to modify the royalties of a package.", "type": "object", "required": [ - "signature", - "type" + "instruction", + "package_address", + "royalty_config" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "EcdsaSecp256k1Signature" + "SET_PACKAGE_ROYALTY_CONFIG" ] }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" + "package_address": { + "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "description": "An instruction to modify the royalties on a component", "type": "object", "required": [ - "public_key", - "type" + "component_address", + "instruction", + "royalty_config" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "EddsaEd25519PublicKey" + "SET_COMPONENT_ROYALTY_CONFIG" ] }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "component_address": { + "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "description": "An instruction to claim royalties of a package", "type": "object", "required": [ - "signature", - "type" + "instruction", + "package_address" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "EddsaEd25519Signature" + "CLAIM_PACKAGE_ROYALTY" ] }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" + "package_address": { + "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "description": "An instruction to claim royalties of a component", "type": "object", "required": [ - "identifier", - "type" + "component_address", + "instruction" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Bucket" + "CLAIM_COMPONENT_ROYALTY" ] }, - "identifier": { - "$ref": "#/definitions/BucketId" + "component_address": { + "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "description": "An instruction to modify the access rules of a method that an entity has.", "type": "object", "required": [ - "identifier", - "type" + "entity_address", + "index", + "instruction", + "key", + "rule" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Proof" + "SET_METHOD_ACCESS_RULE" ] }, - "identifier": { - "$ref": "#/definitions/ProofId" - } - } - }, - { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" + "entity_address": { + "description": "The entity address of the entity to modify the access rules for.", + "allOf": [ + { + "$ref": "#/definitions/Value" } - } + ] }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "UUID" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" + "index": { + "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" } - } + ] }, - { - "description": "An byte array non-fungible id type which is serialized as a hex string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" + "key": { + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" } - } + ] }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" + "rule": { + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" } - } - } - ], - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleId" ] } } }, { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "description": "An instruction to mint fungible resources", "type": "object", "required": [ - "non_fungible_id", - "resource_address", - "type" + "amount", + "instruction", + "resource_address" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "NonFungibleAddress" + "MINT_FUNGIBLE" ] }, "resource_address": { - "$ref": "#/definitions/Value" + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] }, - "non_fungible_id": { - "$ref": "#/definitions/Value" + "amount": { + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "Represents a transaction manifest expression.", + "description": "An instruction to mind non-fungibles of a resource", "type": "object", "required": [ - "type", - "value" + "entries", + "instruction", + "resource_address" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Expression" + "MINT_NON_FUNGIBLE" ] }, - "value": { - "$ref": "#/definitions/Expression" + "resource_address": { + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "description": "An instruction to create a new fungible resource.", "type": "object", "required": [ - "hash", - "type" + "access_rules", + "divisibility", + "initial_supply", + "instruction", + "metadata" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Blob" + "CREATE_FUNGIBLE_RESOURCE" ] }, - "hash": { - "$ref": "#/definitions/Blob" + "divisibility": { + "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", "type": "object", "required": [ - "type", - "value" + "divisibility", + "initial_supply", + "instruction", + "metadata", + "owner_badge" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Bytes" + "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" ] }, - "value": { - "type": "string" + "divisibility": { + "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } - } - ] - }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "SystemAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleId", - "NonFungibleAddress", - "Expression", - "Blob", - "Bytes" - ] - }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ - { - "type": "string" }, { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "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": "array", - "items": { - "type": "integer", - "format": "uint8", - "minimum": 0.0 - }, - "maxItems": 64, - "minItems": 64 - }, - "Error": { - "description": "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.", - "oneOf": [ - { - "description": "An error emitted when the toolkit attempts to decode some string as a hex string and fails", + "description": "An instruction to create a new non-fungible resource.", "type": "object", "required": [ - "error", - "value" + "access_rules", + "id_type", + "initial_supply", + "instruction", + "metadata" ], "properties": { - "error": { + "instruction": { "type": "string", "enum": [ - "FailedToDecodeHex" + "CREATE_NON_FUNGIBLE_RESOURCE" ] }, - "value": { - "type": "string" - } - } - }, - { - "description": "A generic error where an operation expected something to be of one length but it was found to be of a different length", - "type": "object", - "required": [ - "error", - "expected", - "found" - ], - "properties": { - "error": { - "type": "string", - "enum": [ - "InvalidLength" + "id_type": { + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } ] }, - "expected": { - "description": "The length that the object was expected to be.", - "type": "integer", - "format": "uint", - "minimum": 0.0 - }, - "found": { - "description": "The length that the object was found to be.", - "type": "integer", - "format": "uint", - "minimum": 0.0 - } - } - }, - { - "description": "Represents an address error encountered during the Bech32 encoding or decoding phase", - "type": "object", - "required": [ - "error", - "value" - ], - "properties": { - "error": { - "type": "string", - "enum": [ - "AddressError" + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } ] }, - "value": { - "type": "string" - } - } - }, - { - "description": "An error emitted when the passed `Value` is not one of the accepted value types for a given request or operation.", - "type": "object", - "required": [ - "error", - "expected", - "found" - ], - "properties": { - "error": { - "type": "string", - "enum": [ - "InvalidKind" + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } ] }, - "expected": { - "description": "A set of the expected `ValueKind`s for a given request or operation (this set forms an 'or' and not an 'and').", - "type": "array", - "items": { - "$ref": "#/definitions/ValueKind" - } - }, - "found": { - "description": "The `ValueKind` that was found.", + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/Value" } ] } } - } - ] - }, - "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.", + "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", "type": "object", "required": [ - "blueprint_name", - "function_name", + "id_type", + "initial_supply", "instruction", - "package_address" + "metadata", + "owner_badge" ], "properties": { "instruction": { "type": "string", "enum": [ - "CALL_FUNCTION" + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" ] }, - "package_address": { - "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `Value` model.", + "id_type": { + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" } ] }, - "blueprint_name": { - "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "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 `Array` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" } ] }, - "function_name": { - "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" } ] }, - "arguments": { - "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } }, { - "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "description": "An instruction to registers a new validator given the public key of the validator", "type": "object", "required": [ - "component_address", "instruction", - "method_name" + "validator" ], "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 Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "REGISTER_VALIDATOR" ] }, - "method_name": { - "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "validator": { + "description": "The public key of the validator", "allOf": [ { "$ref": "#/definitions/Value" } ] - }, - "arguments": { - "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } } } }, { - "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "description": "An instruction to unregister a validator given it's public key", "type": "object", "required": [ "instruction", - "into_bucket", - "resource_address" + "validator" ], "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 Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "UNREGISTER_VALIDATOR" ] }, - "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "validator": { + "description": "The public key of the validator to unregister", "allOf": [ { "$ref": "#/definitions/Value" @@ -1318,1292 +1406,1174 @@ ] } } - }, + } + ] + }, + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ { - "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "description": "A boolean value which can either be true or false", "type": "object", "required": [ - "amount", - "instruction", - "into_bucket", - "resource_address" + "type", + "value" ], "properties": { - "instruction": { + "type": { "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 Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "amount": { - "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "Bool" ] }, - "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "type": "boolean" } } }, { - "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.", + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", "type": "object", "required": [ - "ids", - "instruction", - "into_bucket", - "resource_address" + "type", + "value" ], "properties": { - "instruction": { + "type": { "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 Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "U8" ] }, - "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" - }, - "uniqueItems": true - }, - "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "Returns a bucket of tokens to the worktop.", + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", "type": "object", "required": [ - "bucket", - "instruction" + "type", + "value" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "RETURN_TO_WORKTOP" + "U16" ] }, - "bucket": { - "description": "The bucket to return to the worktop.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "An instruction to assert that a given resource exists in the worktop.", + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "object", "required": [ - "instruction", - "resource_address" + "type", + "value" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "ASSERT_WORKTOP_CONTAINS" + "U32" ] }, - "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", "type": "object", "required": [ - "amount", - "instruction", - "resource_address" + "type", + "value" ], "properties": { - "instruction": { + "type": { "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 Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "U64" ] }, - "amount": { - "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", "type": "object", "required": [ - "ids", - "instruction", - "resource_address" + "type", + "value" ], "properties": { - "instruction": { + "type": { "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 Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "U128" ] }, - "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 `NonFungibleId`s from the Value model.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" - }, - "uniqueItems": true + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable proof", + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", "type": "object", "required": [ - "instruction", - "into_proof" + "type", + "value" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "POP_FROM_AUTH_ZONE" + "I8" ] }, - "into_proof": { - "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "An instruction that pushes a proof to the auth zone stack.", + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", "type": "object", "required": [ - "instruction", - "proof" + "type", + "value" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "PUSH_TO_AUTH_ZONE" + "I16" ] }, - "proof": { - "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", "type": "object", "required": [ - "instruction" + "type", + "value" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "CLEAR_AUTH_ZONE" + "I32" ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", "type": "object", "required": [ - "instruction", - "into_proof", - "resource_address" + "type", + "value" ], "properties": { - "instruction": { + "type": { "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 Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "I64" ] }, - "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", "type": "object", "required": [ - "amount", - "instruction", - "into_proof", - "resource_address" + "type", + "value" ], "properties": { - "instruction": { + "type": { "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 Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "I128" ] }, - "amount": { - "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" ] }, - "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "type": "string" } } }, { - "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", "type": "object", "required": [ - "ids", - "instruction", - "into_proof", - "resource_address" + "type", + "variant" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" + "Enum" ] }, - "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "variant": { + "description": "The name of the variant of the enum", + "type": "string" }, - "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", - "type": "array", + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], "items": { "$ref": "#/definitions/Value" - }, - "uniqueItems": true - }, - "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + } } } }, { - "description": "An instruction to create a proof given a bucket of some resources", + "description": "The `Some` case of Rust Options where the value is some Value", "type": "object", "required": [ - "bucket", - "instruction", - "into_proof" + "type", + "value" ], "properties": { - "instruction": { + "type": { "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 Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "Some" ] }, - "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "$ref": "#/definitions/Value" } } }, { - "description": "An instruction to clone a proof creating a second proof identical to the original", + "description": "The `None` case of Rust Options where there is value", "type": "object", "required": [ - "instruction", - "into_proof", - "proof" + "type" ], "properties": { - "instruction": { + "type": { "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 Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "None" ] } } }, { - "description": "An instruction to drop a proof.", + "description": "The `Ok` case of Rust Results where the value is some Value", "type": "object", "required": [ - "instruction", - "proof" + "type", + "value" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "DROP_PROOF" + "Ok" ] }, - "proof": { - "description": "The proof to drop. This field is serialized as a `Proof` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "$ref": "#/definitions/Value" } } }, { - "description": "An instruction to drop all proofs currently present in the transaction context.", + "description": "The `Err` case of Rust Results where the value is some Value", "type": "object", "required": [ - "instruction" + "type", + "value" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "DROP_ALL_PROOFS" + "Err" ] + }, + "value": { + "$ref": "#/definitions/Value" } } }, { - "description": "An instruction to publish a package and set it's associated royalty configs, metadata, and access rules.", + "description": "An array values of a single value kind", "type": "object", "required": [ - "abi", - "access_rules", - "code", - "instruction", - "metadata", - "royalty_config" + "element_kind", + "elements", + "type" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "PUBLISH_PACKAGE" - ] - }, - "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "Array" ] }, - "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 `Array` from the Value model.", + "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/Value" + "$ref": "#/definitions/ValueKind" } ] }, - "access_rules": { - "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } } } }, { - "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + "description": "An array of elements where elements could be of different kinds.", "type": "object", "required": [ - "abi", - "code", - "instruction", - "owner_badge" + "elements", + "type" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "PUBLISH_PACKAGE_WITH_OWNER" + "Tuple" ] }, - "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } } } }, { - "description": "An instruction to burn a bucket of tokens.", + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", "type": "object", "required": [ - "bucket", - "instruction" + "type", + "value" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "BURN_RESOURCE" + "Decimal" ] }, - "bucket": { - "description": "The bucket of tokens to burn.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" } } }, { - "description": "An instruction ot recall resources from a known vault.", + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", "type": "object", "required": [ - "amount", - "instruction", - "vault_id" + "type", + "value" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "RECALL_RESOURCE" + "PreciseDecimal" ] }, - "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/Value" + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" } - ] + } }, - "amount": { - "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" ] } } }, { - "description": "An instruction to set the metadata on an entity.", + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", "required": [ - "entity_address", - "instruction", - "key", - "value" + "address", + "type" ], "properties": { - "instruction": { + "type": { "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 `SystemAddress`.", - "allOf": [ - { - "$ref": "#/definitions/EntityAddress" - } - ] - }, - "key": { - "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "ComponentAddress" ] }, - "value": { - "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "address": { + "type": "string" } } }, { - "description": "An instruction to modify the royalties of a package.", + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", "required": [ - "instruction", - "package_address", - "royalty_config" + "address", + "type" ], "properties": { - "instruction": { + "type": { "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 Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "ResourceAddress" ] }, - "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 `Array` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "address": { + "type": "string" } } }, { - "description": "An instruction to modify the royalties on a component", + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", "required": [ - "component_address", - "instruction", - "royalty_config" + "address", + "type" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "SET_COMPONENT_ROYALTY_CONFIG" + "SystemAddress" ] }, - "component_address": { - "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "royalty_config": { - "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "address": { + "type": "string" } } }, { - "description": "An instruction to claim royalties of a package", + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", "required": [ - "instruction", - "package_address" + "address", + "type" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "CLAIM_PACKAGE_ROYALTY" + "PackageAddress" ] }, - "package_address": { - "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "address": { + "type": "string" } } }, { - "description": "An instruction to claim royalties of a component", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", "type": "object", "required": [ - "component_address", - "instruction" + "type", + "value" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "CLAIM_COMPONENT_ROYALTY" + "Hash" ] }, - "component_address": { - "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" } } }, { - "description": "An instruction to modify the access rules of a method that an entity has.", + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", "type": "object", "required": [ - "entity_address", - "index", - "instruction", - "key", - "rule" + "public_key", + "type" ], "properties": { - "instruction": { + "type": { "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/EntityAddress" - } - ] - }, - "index": { - "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "key": { - "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "EcdsaSecp256k1PublicKey" ] }, - "rule": { - "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } }, { - "description": "An instruction to mint fungible resources", + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", "type": "object", "required": [ - "amount", - "instruction", - "resource_address" + "signature", + "type" ], "properties": { - "instruction": { + "type": { "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 Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "EcdsaSecp256k1Signature" ] }, - "amount": { - "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" } } }, { - "description": "An instruction to mind non-fungibles of a resource", + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", "type": "object", "required": [ - "entries", - "instruction", - "resource_address" + "public_key", + "type" ], "properties": { - "instruction": { + "type": { "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 Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "EddsaEd25519PublicKey" ] }, - "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" } } }, { - "description": "An instruction to create a new fungible resource.", + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", "type": "object", "required": [ - "access_rules", - "divisibility", - "instruction", - "metadata" + "signature", + "type" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "CREATE_FUNGIBLE_RESOURCE" - ] - }, - "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "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 `Array` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "EddsaEd25519Signature" ] }, - "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 `Array` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" ] }, - "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", - "anyOf": [ - { - "$ref": "#/definitions/Value" - }, - { - "type": "null" - } - ] + "identifier": { + "$ref": "#/definitions/BucketId" } } }, { - "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "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 number.", "type": "object", "required": [ - "divisibility", - "instruction", - "metadata", - "owner_badge" + "identifier", + "type" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + "Proof" ] }, - "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" } - ] + } }, - "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 `Array` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" } - ] + } }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "UUID" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" } - ] + } }, - "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", - "anyOf": [ - { - "$ref": "#/definitions/Value" + { + "description": "An byte array non-fungible id type which is serialized as a hex string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] }, - { - "type": "null" + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" ] } } }, { - "description": "An instruction to create a new non-fungible resource.", + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "access_rules", - "id_type", - "instruction", - "metadata" + "non_fungible_id", + "resource_address", + "type" ], "properties": { - "instruction": { + "type": { "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 Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "NonFungibleAddress" ] }, - "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 `Array` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "resource_address": { + "$ref": "#/definitions/Value" }, - "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 `Array` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" ] }, - "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", - "anyOf": [ - { - "$ref": "#/definitions/Value" - }, - { - "type": "null" - } - ] + "value": { + "$ref": "#/definitions/Expression" } } }, { - "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", "type": "object", "required": [ - "id_type", - "instruction", - "metadata", - "owner_badge" + "hash", + "type" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" - ] - }, - "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "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 `Array` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } + "Blob" ] }, - "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", - "anyOf": [ - { - "$ref": "#/definitions/Value" - }, - { - "type": "null" - } - ] + "hash": { + "$ref": "#/definitions/Blob" } } }, { - "description": "An instruction to registers a new validator given the public key of the validator", + "description": "Represents a byte array of an unknown size which is serialized as a hex string", "type": "object", "required": [ - "instruction", - "validator" + "type", + "value" ], "properties": { - "instruction": { + "type": { "type": "string", "enum": [ - "REGISTER_VALIDATOR" + "Bytes" ] }, - "validator": { - "description": "The public key of the validator", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "type": "string" } } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "SystemAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleId", + "NonFungibleAddress", + "Expression", + "Blob", + "Bytes" + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" }, { - "description": "An instruction to unregister a validator given it's public key", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "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]+" + }, + "NonFungibleId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", "required": [ - "instruction", - "validator" + "value", + "variant" ], "properties": { - "instruction": { + "variant": { "type": "string", "enum": [ - "UNREGISTER_VALIDATOR" + "U32" ] }, - "validator": { - "description": "The public key of the validator to unregister", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "value": { + "type": "string", + "pattern": "[0-9]+" } } - } - ] - }, - "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.", + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", "required": [ - "address", - "type" + "value", + "variant" ], "properties": { - "type": { + "variant": { "type": "string", "enum": [ - "ComponentAddress" + "U64" ] }, - "address": { - "type": "object", - "required": [ - "address" - ], - "properties": { - "address": { - "type": "string" - } - } + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", "type": "object", "required": [ - "address", - "type" + "value", + "variant" ], "properties": { - "type": { + "variant": { "type": "string", "enum": [ - "ResourceAddress" + "UUID" ] }, - "address": { - "type": "object", - "required": [ - "address" - ], - "properties": { - "address": { - "type": "string" - } - } + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "description": "An byte array non-fungible id type which is serialized as a hex string", "type": "object", "required": [ - "address", - "type" + "value", + "variant" ], "properties": { - "type": { + "variant": { "type": "string", "enum": [ - "SystemAddress" + "Bytes" ] }, - "address": { - "type": "object", - "required": [ - "address" - ], - "properties": { - "address": { - "type": "string" - } - } + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" } } }, { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "description": "A string non-fungible id", "type": "object", "required": [ - "address", - "type" + "value", + "variant" ], "properties": { - "type": { + "variant": { "type": "string", "enum": [ - "PackageAddress" + "String" ] }, - "address": { - "type": "object", - "required": [ - "address" - ], - "properties": { - "address": { - "type": "string" - } - } + "value": { + "type": "string" } } } diff --git a/schema/out/schema/convert_manifest_response.json b/schema/out/schema/convert_manifest_response.json new file mode 100644 index 00000000..4f358ba3 --- /dev/null +++ b/schema/out/schema/convert_manifest_response.json @@ -0,0 +1,2543 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ConvertManifestResponse", + "description": "The response of the [`ConvertManifestRequest`]", + "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": [ + { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "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.", + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "blueprint_name": { + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "function_name": { + "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "method_name": { + "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "Returns a bucket of tokens to the 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/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a given resource exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + } + } + }, + { + "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction that pushes a proof to the auth zone stack.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_AUTH_ZONE" + ] + } + } + }, + { + "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "type": "object", + "required": [ + "ids", + "instruction", + "into_proof", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" + ] + }, + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof given a bucket of some resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to clone a proof creating a second proof identical to the original", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop a 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop all proofs currently present in the transaction context.", + "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.", + "type": "object", + "required": [ + "abi", + "access_rules", + "code", + "instruction", + "metadata", + "royalty_config" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "metadata": { + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + "type": "object", + "required": [ + "abi", + "code", + "instruction", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE_WITH_OWNER" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to burn a bucket of tokens.", + "type": "object", + "required": [ + "bucket", + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "BURN_RESOURCE" + ] + }, + "bucket": { + "description": "The bucket of tokens to burn.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction ot recall resources from a known vault.", + "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/Value" + } + ] + }, + "amount": { + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "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 `SystemAddress`.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "value": { + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties of a package.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties on a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a package", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the access rules of a method that an entity has.", + "type": "object", + "required": [ + "entity_address", + "index", + "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/Value" + } + ] + }, + "index": { + "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "rule": { + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mint fungible resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mind non-fungibles of a resource", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new fungible resource.", + "type": "object", + "required": [ + "access_rules", + "divisibility", + "initial_supply", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "divisibility", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "divisibility": { + "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new non-fungible resource.", + "type": "object", + "required": [ + "access_rules", + "id_type", + "initial_supply", + "instruction", + "metadata" + ], + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "id_type", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "id_type": { + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to unregister a validator given it's public key", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "UNREGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator to unregister", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + } + ] + }, + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "SystemAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleId", + "NonFungibleAddress", + "Expression", + "Blob", + "Bytes" + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "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]+" + }, + "NonFungibleId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/schema/out/schema/decode_address_request.json b/schema/out/schema/decode_address_request.json new file mode 100644 index 00000000..ba637982 --- /dev/null +++ b/schema/out/schema/decode_address_request.json @@ -0,0 +1,15 @@ +{ + "$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 new file mode 100644 index 00000000..ef1f797a --- /dev/null +++ b/schema/out/schema/decode_address_response.json @@ -0,0 +1,58 @@ +{ + "$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": [ + "Resource", + "Package", + "NormalComponent", + "AccountComponent", + "EcdsaSecp256k1VirtualAccountComponent", + "EddsaEd25519VirtualAccountComponent", + "EpochManager", + "Clock" + ] + } + } +} \ 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 new file mode 100644 index 00000000..0f4147b2 --- /dev/null +++ b/schema/out/schema/decompile_notarized_transaction_request.json @@ -0,0 +1,35 @@ +{ + "$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 new file mode 100644 index 00000000..7c8ae6ee --- /dev/null +++ b/schema/out/schema/decompile_notarized_transaction_response.json @@ -0,0 +1,2870 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "DecompileNotarizedTransactionResponse", + "description": "The response from [`DecompileNotarizedTransactionRequest`].", + "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.", + "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.", + "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.", + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EcdsaSecp256k1" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EddsaEd25519" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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", + "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": [ + { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "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.", + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "blueprint_name": { + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "function_name": { + "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "method_name": { + "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "Returns a bucket of tokens to the 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/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a given resource exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + } + } + }, + { + "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction that pushes a proof to the auth zone stack.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_AUTH_ZONE" + ] + } + } + }, + { + "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "type": "object", + "required": [ + "ids", + "instruction", + "into_proof", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" + ] + }, + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof given a bucket of some resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to clone a proof creating a second proof identical to the original", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop a 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop all proofs currently present in the transaction context.", + "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.", + "type": "object", + "required": [ + "abi", + "access_rules", + "code", + "instruction", + "metadata", + "royalty_config" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "metadata": { + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + "type": "object", + "required": [ + "abi", + "code", + "instruction", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE_WITH_OWNER" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to burn a bucket of tokens.", + "type": "object", + "required": [ + "bucket", + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "BURN_RESOURCE" + ] + }, + "bucket": { + "description": "The bucket of tokens to burn.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction ot recall resources from a known vault.", + "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/Value" + } + ] + }, + "amount": { + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "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 `SystemAddress`.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "value": { + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties of a package.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties on a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a package", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the access rules of a method that an entity has.", + "type": "object", + "required": [ + "entity_address", + "index", + "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/Value" + } + ] + }, + "index": { + "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "rule": { + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mint fungible resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mind non-fungibles of a resource", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new fungible resource.", + "type": "object", + "required": [ + "access_rules", + "divisibility", + "initial_supply", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "divisibility", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "divisibility": { + "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new non-fungible resource.", + "type": "object", + "required": [ + "access_rules", + "id_type", + "initial_supply", + "instruction", + "metadata" + ], + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "id_type", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "id_type": { + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to unregister a validator given it's public key", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "UNREGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator to unregister", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + } + ] + }, + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "SystemAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleId", + "NonFungibleAddress", + "Expression", + "Blob", + "Bytes" + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "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]+" + }, + "NonFungibleId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "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", + "type": "object", + "required": [ + "EcdsaSecp256k1" + ], + "properties": { + "EcdsaSecp256k1": { + "type": "object", + "required": [ + "signature" + ], + "properties": { + "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]+" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Cryptographic signature and public key for EdDSA Ed25519", + "type": "object", + "required": [ + "EddsaEd25519" + ], + "properties": { + "EddsaEd25519": { + "type": "object", + "required": [ + "public_key", + "signature" + ], + "properties": { + "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]+" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "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.", + "type": "object", + "required": [ + "curve", + "signature" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EcdsaSecp256k1" + ] + }, + "signature": { + "type": "object", + "required": [ + "signature" + ], + "properties": { + "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.", + "type": "object", + "required": [ + "curve", + "signature" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EddsaEd25519" + ] + }, + "signature": { + "type": "object", + "required": [ + "signature" + ], + "properties": { + "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 new file mode 100644 index 00000000..c088ffe4 --- /dev/null +++ b/schema/out/schema/decompile_signed_transaction_intent_request.json @@ -0,0 +1,35 @@ +{ + "$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 new file mode 100644 index 00000000..c4b122d9 --- /dev/null +++ b/schema/out/schema/decompile_signed_transaction_intent_response.json @@ -0,0 +1,2779 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "DecompileSignedTransactionIntentResponse", + "description": "The response from [`DecompileSignedTransactionIntentRequest`].", + "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.", + "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.", + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EcdsaSecp256k1" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EddsaEd25519" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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", + "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": [ + { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "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.", + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "blueprint_name": { + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "function_name": { + "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "method_name": { + "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "Returns a bucket of tokens to the 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/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a given resource exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + } + } + }, + { + "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction that pushes a proof to the auth zone stack.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_AUTH_ZONE" + ] + } + } + }, + { + "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "type": "object", + "required": [ + "ids", + "instruction", + "into_proof", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" + ] + }, + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof given a bucket of some resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to clone a proof creating a second proof identical to the original", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop a 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop all proofs currently present in the transaction context.", + "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.", + "type": "object", + "required": [ + "abi", + "access_rules", + "code", + "instruction", + "metadata", + "royalty_config" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "metadata": { + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + "type": "object", + "required": [ + "abi", + "code", + "instruction", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE_WITH_OWNER" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to burn a bucket of tokens.", + "type": "object", + "required": [ + "bucket", + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "BURN_RESOURCE" + ] + }, + "bucket": { + "description": "The bucket of tokens to burn.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction ot recall resources from a known vault.", + "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/Value" + } + ] + }, + "amount": { + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "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 `SystemAddress`.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "value": { + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties of a package.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties on a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a package", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the access rules of a method that an entity has.", + "type": "object", + "required": [ + "entity_address", + "index", + "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/Value" + } + ] + }, + "index": { + "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "rule": { + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mint fungible resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mind non-fungibles of a resource", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new fungible resource.", + "type": "object", + "required": [ + "access_rules", + "divisibility", + "initial_supply", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "divisibility", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "divisibility": { + "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new non-fungible resource.", + "type": "object", + "required": [ + "access_rules", + "id_type", + "initial_supply", + "instruction", + "metadata" + ], + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "id_type", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "id_type": { + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to unregister a validator given it's public key", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "UNREGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator to unregister", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + } + ] + }, + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "SystemAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleId", + "NonFungibleAddress", + "Expression", + "Blob", + "Bytes" + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "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]+" + }, + "NonFungibleId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "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", + "type": "object", + "required": [ + "EcdsaSecp256k1" + ], + "properties": { + "EcdsaSecp256k1": { + "type": "object", + "required": [ + "signature" + ], + "properties": { + "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]+" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Cryptographic signature and public key for EdDSA Ed25519", + "type": "object", + "required": [ + "EddsaEd25519" + ], + "properties": { + "EddsaEd25519": { + "type": "object", + "required": [ + "public_key", + "signature" + ], + "properties": { + "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]+" + } + } + } + }, + "additionalProperties": false + } + ] + } + } +} \ 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 new file mode 100644 index 00000000..a5fc67de --- /dev/null +++ b/schema/out/schema/decompile_transaction_intent_request.json @@ -0,0 +1,35 @@ +{ + "$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 new file mode 100644 index 00000000..763f57b3 --- /dev/null +++ b/schema/out/schema/decompile_transaction_intent_response.json @@ -0,0 +1,2691 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "DecompileTransactionIntentResponse", + "description": "The response from [`DecompileTransactionIntentRequest`].", + "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.", + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EcdsaSecp256k1" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EddsaEd25519" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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", + "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": [ + { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "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.", + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "blueprint_name": { + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "function_name": { + "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "method_name": { + "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "Returns a bucket of tokens to the 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/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a given resource exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + } + } + }, + { + "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction that pushes a proof to the auth zone stack.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_AUTH_ZONE" + ] + } + } + }, + { + "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "type": "object", + "required": [ + "ids", + "instruction", + "into_proof", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" + ] + }, + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof given a bucket of some resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to clone a proof creating a second proof identical to the original", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop a 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop all proofs currently present in the transaction context.", + "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.", + "type": "object", + "required": [ + "abi", + "access_rules", + "code", + "instruction", + "metadata", + "royalty_config" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "metadata": { + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + "type": "object", + "required": [ + "abi", + "code", + "instruction", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE_WITH_OWNER" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to burn a bucket of tokens.", + "type": "object", + "required": [ + "bucket", + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "BURN_RESOURCE" + ] + }, + "bucket": { + "description": "The bucket of tokens to burn.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction ot recall resources from a known vault.", + "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/Value" + } + ] + }, + "amount": { + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "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 `SystemAddress`.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "value": { + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties of a package.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties on a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a package", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the access rules of a method that an entity has.", + "type": "object", + "required": [ + "entity_address", + "index", + "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/Value" + } + ] + }, + "index": { + "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "rule": { + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mint fungible resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mind non-fungibles of a resource", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new fungible resource.", + "type": "object", + "required": [ + "access_rules", + "divisibility", + "initial_supply", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "divisibility", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "divisibility": { + "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new non-fungible resource.", + "type": "object", + "required": [ + "access_rules", + "id_type", + "initial_supply", + "instruction", + "metadata" + ], + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "id_type", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "id_type": { + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to unregister a validator given it's public key", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "UNREGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator to unregister", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + } + ] + }, + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "SystemAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleId", + "NonFungibleAddress", + "Expression", + "Blob", + "Bytes" + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "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]+" + }, + "NonFungibleId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ] + } + } +} \ 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 new file mode 100644 index 00000000..6fab62f3 --- /dev/null +++ b/schema/out/schema/decompile_unknown_transaction_intent_request.json @@ -0,0 +1,35 @@ +{ + "$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 new file mode 100644 index 00000000..02ad616d --- /dev/null +++ b/schema/out/schema/decompile_unknown_transaction_intent_response.json @@ -0,0 +1,2935 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "DecompileUnknownTransactionIntentResponse", + "description": "The response from [`DecompileUnknownTransactionIntentRequest`]. This is an untagged union which can either be a [`DecompileTransactionIntentResponse`], [`DecompileSignedTransactionIntentResponse`], or [`DecompileNotarizedTransactionResponse`] depending on the passed intent.", + "anyOf": [ + { + "$ref": "#/definitions/DecompileTransactionIntentResponse" + }, + { + "$ref": "#/definitions/DecompileSignedTransactionIntentResponse" + }, + { + "$ref": "#/definitions/DecompileNotarizedTransactionResponse" + } + ], + "definitions": { + "DecompileTransactionIntentResponse": { + "description": "The response from [`DecompileTransactionIntentRequest`].", + "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.", + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EcdsaSecp256k1" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EddsaEd25519" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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", + "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": [ + { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "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.", + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "blueprint_name": { + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "function_name": { + "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "method_name": { + "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "arguments": { + "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "Returns a bucket of tokens to the 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/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a given resource exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + } + } + }, + { + "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction that pushes a proof to the auth zone stack.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_AUTH_ZONE" + ] + } + } + }, + { + "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "type": "object", + "required": [ + "ids", + "instruction", + "into_proof", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" + ] + }, + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "ids": { + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleId" + }, + "uniqueItems": true + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a proof given a bucket of some resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to clone a proof creating a second proof identical to the original", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop a 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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to drop all proofs currently present in the transaction context.", + "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.", + "type": "object", + "required": [ + "abi", + "access_rules", + "code", + "instruction", + "metadata", + "royalty_config" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "metadata": { + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + "type": "object", + "required": [ + "abi", + "code", + "instruction", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE_WITH_OWNER" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "abi": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to burn a bucket of tokens.", + "type": "object", + "required": [ + "bucket", + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "BURN_RESOURCE" + ] + }, + "bucket": { + "description": "The bucket of tokens to burn.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction ot recall resources from a known vault.", + "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/Value" + } + ] + }, + "amount": { + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "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 `SystemAddress`.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "value": { + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties of a package.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties on a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "royalty_config": { + "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a package", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a component", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to modify the access rules of a method that an entity has.", + "type": "object", + "required": [ + "entity_address", + "index", + "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/Value" + } + ] + }, + "index": { + "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "key": { + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "rule": { + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mint fungible resources", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "amount": { + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to mind non-fungibles of a resource", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new fungible resource.", + "type": "object", + "required": [ + "access_rules", + "divisibility", + "initial_supply", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "divisibility", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "divisibility": { + "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "initial_supply": { + "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a new non-fungible resource.", + "type": "object", + "required": [ + "access_rules", + "id_type", + "initial_supply", + "instruction", + "metadata" + ], + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "type": "object", + "required": [ + "id_type", + "initial_supply", + "instruction", + "metadata", + "owner_badge" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + ] + }, + "id_type": { + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `Array` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "owner_badge": { + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to unregister a validator given it's public key", + "type": "object", + "required": [ + "instruction", + "validator" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "UNREGISTER_VALIDATOR" + ] + }, + "validator": { + "description": "The public key of the validator to unregister", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + } + ] + }, + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "SystemAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleId", + "NonFungibleAddress", + "Expression", + "Blob", + "Bytes" + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "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]+" + }, + "NonFungibleId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "DecompileSignedTransactionIntentResponse": { + "description": "The response from [`DecompileSignedTransactionIntentRequest`].", + "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.", + "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", + "type": "object", + "required": [ + "EcdsaSecp256k1" + ], + "properties": { + "EcdsaSecp256k1": { + "type": "object", + "required": [ + "signature" + ], + "properties": { + "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]+" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Cryptographic signature and public key for EdDSA Ed25519", + "type": "object", + "required": [ + "EddsaEd25519" + ], + "properties": { + "EddsaEd25519": { + "type": "object", + "required": [ + "public_key", + "signature" + ], + "properties": { + "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]+" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "DecompileNotarizedTransactionResponse": { + "description": "The response from [`DecompileNotarizedTransactionRequest`].", + "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.", + "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.", + "type": "object", + "required": [ + "curve", + "signature" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EcdsaSecp256k1" + ] + }, + "signature": { + "type": "object", + "required": [ + "signature" + ], + "properties": { + "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.", + "type": "object", + "required": [ + "curve", + "signature" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EddsaEd25519" + ] + }, + "signature": { + "type": "object", + "required": [ + "signature" + ], + "properties": { + "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_virtual_account_address_request.json b/schema/out/schema/derive_virtual_account_address_request.json new file mode 100644 index 00000000..cf88f218 --- /dev/null +++ b/schema/out/schema/derive_virtual_account_address_request.json @@ -0,0 +1,92 @@ +{ + "$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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EcdsaSecp256k1" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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.", + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EddsaEd25519" + ] + }, + "public_key": { + "type": "object", + "required": [ + "public_key" + ], + "properties": { + "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 new file mode 100644 index 00000000..875e8146 --- /dev/null +++ b/schema/out/schema/derive_virtual_account_address_response.json @@ -0,0 +1,1087 @@ +{ + "$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/Value" + } + ] + } + }, + "definitions": { + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "SystemAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleId", + "NonFungibleAddress", + "Expression", + "Blob", + "Bytes" + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "Expression": { + "description": "Represents a transaction manifest expression.", + "type": "string", + "enum": [ + "ENTIRE_WORKTOP", + "ENTIRE_AUTH_ZONE" + ] + }, + "Blob": { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } +} \ No newline at end of file diff --git a/schema/out/schema/encode_address_request.json b/schema/out/schema/encode_address_request.json new file mode 100644 index 00000000..21211e9c --- /dev/null +++ b/schema/out/schema/encode_address_request.json @@ -0,0 +1,24 @@ +{ + "$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 new file mode 100644 index 00000000..37902d75 --- /dev/null +++ b/schema/out/schema/encode_address_response.json @@ -0,0 +1,116 @@ +{ + "$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.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + } + } + ] +} \ No newline at end of file diff --git a/schema/out/schema/information_request.json b/schema/out/schema/information_request.json new file mode 100644 index 00000000..3699af53 --- /dev/null +++ b/schema/out/schema/information_request.json @@ -0,0 +1,6 @@ +{ + "$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": "null" +} \ No newline at end of file diff --git a/schema/out/schema/information_response.json b/schema/out/schema/information_response.json new file mode 100644 index 00000000..bca9cde0 --- /dev/null +++ b/schema/out/schema/information_response.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InformationResponse", + "description": "The response from [`InformationRequest`]s", + "type": "object", + "required": [ + "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" + } + } +} \ 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 new file mode 100644 index 00000000..633368de --- /dev/null +++ b/schema/out/schema/known_entity_addresses_request.json @@ -0,0 +1,16 @@ +{ + "$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 new file mode 100644 index 00000000..47df2a85 --- /dev/null +++ b/schema/out/schema/known_entity_addresses_response.json @@ -0,0 +1,1159 @@ +{ + "$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", + "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/Value" + } + ] + }, + "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/Value" + } + ] + }, + "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/Value" + } + ] + }, + "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/Value" + } + ] + }, + "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/Value" + } + ] + }, + "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/Value" + } + ] + }, + "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/Value" + } + ] + }, + "epoch_manager_system_address": { + "description": "A system address serialized as a `SystemAddress` from the `Value` model which represents the address of the epoch manager on the requested network.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "clock_system_address": { + "description": "A system address serialized as a `SystemAddress` from the `Value` model which represents the address of the clock on the requested network.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + }, + "definitions": { + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "SystemAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleId", + "NonFungibleAddress", + "Expression", + "Blob", + "Bytes" + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "Expression": { + "description": "Represents a transaction manifest expression.", + "type": "string", + "enum": [ + "ENTIRE_WORKTOP", + "ENTIRE_AUTH_ZONE" + ] + }, + "Blob": { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } +} \ No newline at end of file diff --git a/schema/out/schema/sbor_decode_request.json b/schema/out/schema/sbor_decode_request.json new file mode 100644 index 00000000..22c7b5d5 --- /dev/null +++ b/schema/out/schema/sbor_decode_request.json @@ -0,0 +1,22 @@ +{ + "$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 new file mode 100644 index 00000000..f271b29f --- /dev/null +++ b/schema/out/schema/sbor_decode_response.json @@ -0,0 +1,2042 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SborDecodeResponse", + "description": "The response from the [`SborDecodeRequest`].", + "type": "object", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "definitions": { + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "SystemAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleId", + "NonFungibleAddress", + "Expression", + "Blob", + "Bytes" + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "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 new file mode 100644 index 00000000..c82dbf8a --- /dev/null +++ b/schema/out/schema/sbor_encode_request.json @@ -0,0 +1,2042 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SborEncodeRequest", + "description": "This request takes in a [`Value`] and attempts to SBOR encode it and return back an SBOR byte array.", + "type": "object", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "definitions": { + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "type": "string" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SystemAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a number.", + "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 number.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "oneOf": [ + { + "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "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", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "value", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleId" + ] + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleAddress" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "SystemAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleId", + "NonFungibleAddress", + "Expression", + "Blob", + "Bytes" + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents an untagged 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)", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "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 new file mode 100644 index 00000000..e9298d20 --- /dev/null +++ b/schema/out/schema/sbor_encode_response.json @@ -0,0 +1,16 @@ +{ + "$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 new file mode 100644 index 00000000..e5235fba --- /dev/null +++ b/schema/out/schema/statically_validate_transaction_request.json @@ -0,0 +1,71 @@ +{ + "$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 new file mode 100644 index 00000000..158155dc --- /dev/null +++ b/schema/out/schema/statically_validate_transaction_response.json @@ -0,0 +1,39 @@ +{ + "$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/main.rs b/schema/src/main.rs index 61c346bd..e4f18984 100644 --- a/schema/src/main.rs +++ b/schema/src/main.rs @@ -1,43 +1,101 @@ -use std::io::Write; +use std::collections::HashMap; +use std::path::PathBuf; -use schemars::{schema_for, JsonSchema}; +use convert_case::Casing; + +/// 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") } pub fn generate_json_schema() -> Result<(), JsonSchemaGenerationError> { - // This type includes all of the top level interfaces that the Radix Engine Toolkit has. - - #[allow(dead_code)] - #[derive(JsonSchema, serde::Serialize)] - #[serde(untagged)] - /// This schema describes the types that the Radix Engine Toolkit accepts and returns. In this - /// schema you will find a number of models, the most basic one of them is the `Value` model - /// which describes how primitive types and Scrypto values are represented when communicating - /// with the Radix Engine Toolkit. In addition to that, there are additional models which - /// describe what instructions look like, transactions, and any other models. - /// - /// This schema has been automatically generated and therefore should hopefully always be the - /// ground truth for the Radix Engine Toolkit models - pub enum RadixEngineToolkit { - Value(core::Value), - Error(core::Error), - Instruction(core::Instruction), - } - - // Generating the Radix Engine Toolkit schema - let schema = schema_for!(RadixEngineToolkit); - - // Serialize the Schema to a JSON pretty (formatted) text - let serialized_schema = serde_json::to_string_pretty(&schema) - .map_err(JsonSchemaGenerationError::SerializationError)?; - - // Write the Schema to a file - std::fs::File::create("schema.json") - .map_err(JsonSchemaGenerationError::IOError)? - .write_all(serialized_schema.as_bytes()) - .map_err(JsonSchemaGenerationError::IOError)?; + // Creating the schema for all of the request and response types through the generate schema + // macro + let schema_map = generate_schema_hashmap!( + core::request::InformationRequest, + core::request::InformationResponse, + core::request::ConvertManifestRequest, + core::request::ConvertManifestResponse, + core::request::CompileTransactionIntentRequest, + core::request::CompileTransactionIntentResponse, + core::request::DecompileTransactionIntentRequest, + core::request::DecompileTransactionIntentResponse, + core::request::CompileSignedTransactionIntentRequest, + core::request::CompileSignedTransactionIntentResponse, + core::request::DecompileSignedTransactionIntentRequest, + core::request::DecompileSignedTransactionIntentResponse, + core::request::CompileNotarizedTransactionRequest, + core::request::CompileNotarizedTransactionResponse, + core::request::DecompileNotarizedTransactionRequest, + core::request::DecompileNotarizedTransactionResponse, + core::request::DecompileUnknownTransactionIntentRequest, + core::request::DecompileUnknownTransactionIntentResponse, + core::request::DecodeAddressRequest, + core::request::DecodeAddressResponse, + core::request::EncodeAddressRequest, + core::request::EncodeAddressResponse, + core::request::DecodeAddressRequest, + core::request::DecodeAddressResponse, + core::request::SborEncodeRequest, + core::request::SborEncodeResponse, + core::request::SborDecodeRequest, + core::request::SborDecodeResponse, + core::request::DeriveVirtualAccountAddressRequest, + core::request::DeriveVirtualAccountAddressResponse, + core::request::KnownEntityAddressesRequest, + core::request::KnownEntityAddressesResponse, + core::request::StaticallyValidateTransactionRequest, + core::request::StaticallyValidateTransactionResponse + ); + + // 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(JsonSchemaGenerationError::SerializationError) + .and_then(|schema_string| { + std::fs::write(path, schema_string).map_err(JsonSchemaGenerationError::IOError) + }) + }) + .collect::, _>>()?; Ok(()) } From 228921762777840e7b175696f46e6c56de604528 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 16 Jan 2023 14:52:54 +0300 Subject: [PATCH 041/110] Added license --- schema/src/main.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/schema/src/main.rs b/schema/src/main.rs index e4f18984..17ef5ffa 100644 --- a/schema/src/main.rs +++ b/schema/src/main.rs @@ -1,3 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + use std::collections::HashMap; use std::path::PathBuf; From fd99761d1ba696b23b4771e4daf5b9be44e7a930 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 16 Jan 2023 15:00:34 +0300 Subject: [PATCH 042/110] memory allocation and deallocation --- core/src/buffer.rs | 92 ++++++++++++++++++++++++++++++++++++++++++++++ core/src/lib.rs | 2 + 2 files changed, 94 insertions(+) create mode 100644 core/src/buffer.rs diff --git a/core/src/buffer.rs b/core/src/buffer.rs new file mode 100644 index 00000000..a2a6adec --- /dev/null +++ b/core/src/buffer.rs @@ -0,0 +1,92 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +//! 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/core/src/lib.rs b/core/src/lib.rs index 921e6fb0..f1368aed 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -15,12 +15,14 @@ // specific language governing permissions and limitations // under the License. +pub mod buffer; pub mod error; pub mod model; pub mod request; pub mod traits; pub mod utils; +pub use buffer::*; pub use error::*; pub use model::*; pub use request::*; From 6737df184872d2fb68d45dedb621a7bf16586d21 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 16 Jan 2023 18:04:47 +0300 Subject: [PATCH 043/110] first interface and build scripts --- Cargo.toml | 4 +- build-specific.sh | 119 ++++++++++ build.sh | 216 +++++++++++++++++ native-json-interface/Cargo.toml | 25 ++ native-json-interface/cbindgen.toml | 10 + native-json-interface/src/lib.rs | 223 ++++++++++++++++++ {core => radix-engine-toolkit}/Cargo.toml | 2 +- {core => radix-engine-toolkit}/src/buffer.rs | 0 {core => radix-engine-toolkit}/src/error.rs | 9 + {core => radix-engine-toolkit}/src/lib.rs | 0 .../src/model/address/coder.rs | 0 .../src/model/address/entity_address.rs | 0 .../src/model/address/entity_type.rs | 0 .../src/model/address/mod.rs | 0 .../model/address/network_aware_address.rs | 0 .../src/model/address/non_fungible_address.rs | 0 .../src/model/address/non_fungible_id.rs | 0 .../src/model/constants.rs | 0 .../src/model/crypto/mod.rs | 0 .../src/model/crypto/public_key.rs | 0 .../src/model/crypto/signature.rs | 0 .../model/crypto/signature_with_public_key.rs | 0 .../src/model/engine_identifier/mod.rs | 0 .../engine_identifier/node_identifier.rs | 0 .../src/model/engine_identifier/own.rs | 0 .../engine_identifier/transient_identifier.rs | 0 .../src/model/instruction.rs | 0 .../src/model/mod.rs | 0 .../src/model/runtime/blob.rs | 0 .../src/model/runtime/expression.rs | 0 .../src/model/runtime/mod.rs | 0 .../src/model/transaction/header.rs | 0 .../src/model/transaction/instruction_list.rs | 0 .../src/model/transaction/intent.rs | 0 .../src/model/transaction/manifest.rs | 0 .../src/model/transaction/mod.rs | 0 .../src/model/transaction/notarized_intent.rs | 0 .../src/model/transaction/signed_intent.rs | 0 .../model/transaction/validation_config.rs | 0 .../src/model/value.rs | 0 .../request/compile_notarized_transaction.rs | 0 .../compile_signed_transaction_intent.rs | 0 .../src/request/compile_transaction_intent.rs | 0 .../src/request/convert_manifest.rs | 0 .../src/request/decode_address.rs | 0 .../decompile_notarized_transaction.rs | 0 .../decompile_signed_transaction_intent.rs | 0 .../request/decompile_transaction_intent.rs | 0 .../src/request/decompile_unknown_intent.rs | 0 .../request/derive_virtual_account_address.rs | 0 .../src/request/encode_address.rs | 0 .../src/request/information.rs | 0 .../src/request/known_entity_addresses.rs | 0 .../src/request/mod.rs | 0 .../src/request/sbor_decode.rs | 0 .../src/request/sbor_encode.rs | 0 .../statically_validate_transaction.rs | 0 .../src/request/traits.rs | 0 {core => radix-engine-toolkit}/src/traits.rs | 0 {core => radix-engine-toolkit}/src/utils.rs | 0 schema/Cargo.toml | 2 +- schema/src/main.rs | 68 +++--- 62 files changed, 640 insertions(+), 38 deletions(-) create mode 100755 build-specific.sh create mode 100755 build.sh create mode 100644 native-json-interface/Cargo.toml create mode 100644 native-json-interface/cbindgen.toml create mode 100644 native-json-interface/src/lib.rs rename {core => radix-engine-toolkit}/Cargo.toml (97%) rename {core => radix-engine-toolkit}/src/buffer.rs (100%) rename {core => radix-engine-toolkit}/src/error.rs (96%) rename {core => radix-engine-toolkit}/src/lib.rs (100%) rename {core => radix-engine-toolkit}/src/model/address/coder.rs (100%) rename {core => radix-engine-toolkit}/src/model/address/entity_address.rs (100%) rename {core => radix-engine-toolkit}/src/model/address/entity_type.rs (100%) rename {core => radix-engine-toolkit}/src/model/address/mod.rs (100%) rename {core => radix-engine-toolkit}/src/model/address/network_aware_address.rs (100%) rename {core => radix-engine-toolkit}/src/model/address/non_fungible_address.rs (100%) rename {core => radix-engine-toolkit}/src/model/address/non_fungible_id.rs (100%) rename {core => radix-engine-toolkit}/src/model/constants.rs (100%) rename {core => radix-engine-toolkit}/src/model/crypto/mod.rs (100%) rename {core => radix-engine-toolkit}/src/model/crypto/public_key.rs (100%) rename {core => radix-engine-toolkit}/src/model/crypto/signature.rs (100%) rename {core => radix-engine-toolkit}/src/model/crypto/signature_with_public_key.rs (100%) rename {core => radix-engine-toolkit}/src/model/engine_identifier/mod.rs (100%) rename {core => radix-engine-toolkit}/src/model/engine_identifier/node_identifier.rs (100%) rename {core => radix-engine-toolkit}/src/model/engine_identifier/own.rs (100%) rename {core => radix-engine-toolkit}/src/model/engine_identifier/transient_identifier.rs (100%) rename {core => radix-engine-toolkit}/src/model/instruction.rs (100%) rename {core => radix-engine-toolkit}/src/model/mod.rs (100%) rename {core => radix-engine-toolkit}/src/model/runtime/blob.rs (100%) rename {core => radix-engine-toolkit}/src/model/runtime/expression.rs (100%) rename {core => radix-engine-toolkit}/src/model/runtime/mod.rs (100%) rename {core => radix-engine-toolkit}/src/model/transaction/header.rs (100%) rename {core => radix-engine-toolkit}/src/model/transaction/instruction_list.rs (100%) rename {core => radix-engine-toolkit}/src/model/transaction/intent.rs (100%) rename {core => radix-engine-toolkit}/src/model/transaction/manifest.rs (100%) rename {core => radix-engine-toolkit}/src/model/transaction/mod.rs (100%) rename {core => radix-engine-toolkit}/src/model/transaction/notarized_intent.rs (100%) rename {core => radix-engine-toolkit}/src/model/transaction/signed_intent.rs (100%) rename {core => radix-engine-toolkit}/src/model/transaction/validation_config.rs (100%) rename {core => radix-engine-toolkit}/src/model/value.rs (100%) rename {core => radix-engine-toolkit}/src/request/compile_notarized_transaction.rs (100%) rename {core => radix-engine-toolkit}/src/request/compile_signed_transaction_intent.rs (100%) rename {core => radix-engine-toolkit}/src/request/compile_transaction_intent.rs (100%) rename {core => radix-engine-toolkit}/src/request/convert_manifest.rs (100%) rename {core => radix-engine-toolkit}/src/request/decode_address.rs (100%) rename {core => radix-engine-toolkit}/src/request/decompile_notarized_transaction.rs (100%) rename {core => radix-engine-toolkit}/src/request/decompile_signed_transaction_intent.rs (100%) rename {core => radix-engine-toolkit}/src/request/decompile_transaction_intent.rs (100%) rename {core => radix-engine-toolkit}/src/request/decompile_unknown_intent.rs (100%) rename {core => radix-engine-toolkit}/src/request/derive_virtual_account_address.rs (100%) rename {core => radix-engine-toolkit}/src/request/encode_address.rs (100%) rename {core => radix-engine-toolkit}/src/request/information.rs (100%) rename {core => radix-engine-toolkit}/src/request/known_entity_addresses.rs (100%) rename {core => radix-engine-toolkit}/src/request/mod.rs (100%) rename {core => radix-engine-toolkit}/src/request/sbor_decode.rs (100%) rename {core => radix-engine-toolkit}/src/request/sbor_encode.rs (100%) rename {core => radix-engine-toolkit}/src/request/statically_validate_transaction.rs (100%) rename {core => radix-engine-toolkit}/src/request/traits.rs (100%) rename {core => radix-engine-toolkit}/src/traits.rs (100%) rename {core => radix-engine-toolkit}/src/utils.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 50daa44d..46d2b912 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] members = [ - "core", + "radix-engine-toolkit", "schema", - "serializable" + "serializable", ] \ No newline at end of file diff --git a/build-specific.sh b/build-specific.sh new file mode 100755 index 00000000..279efa1a --- /dev/null +++ b/build-specific.sh @@ -0,0 +1,119 @@ +#!/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.: 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. +# 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 new file mode 100755 index 00000000..9ea16c73 --- /dev/null +++ b/build.sh @@ -0,0 +1,216 @@ +#!/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="radix-engine-toolkit-native" + + # 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" "radix-engine-toolkit-native" "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/native-json-interface/Cargo.toml b/native-json-interface/Cargo.toml new file mode 100644 index 00000000..71c43b60 --- /dev/null +++ b/native-json-interface/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "native-json-interface" +version = "0.1.0" +edition = "2021" + +[dependencies] +jni = { version = "0.20.0", default-features = false, optional = true } +radix_engine_toolkit = { path = "../radix-engine-toolkit" } +serde = "1.0.152" +serde_json = "1.0.91" + +[profile.release] +panic = 'abort' +codegen-units = 1 + +[lib] +name = "radix_engine_toolkit" +crate-type = ["staticlib", "cdylib"] + +[features] +default = [] +jni = ["jni/default"] + +[workspace] +members = [] \ No newline at end of file diff --git a/native-json-interface/cbindgen.toml b/native-json-interface/cbindgen.toml new file mode 100644 index 00000000..e60d9131 --- /dev/null +++ b/native-json-interface/cbindgen.toml @@ -0,0 +1,10 @@ +documentation = false + +[parse] +clean = true +parse_deps = true +include = ["radix-engine-toolkit"] +extra_bindings = ["radix-engine-toolkit"] + +[parse.expand] +crates = ["native-json-interface"] \ No newline at end of file diff --git a/native-json-interface/src/lib.rs b/native-json-interface/src/lib.rs new file mode 100644 index 00000000..0e11a379 --- /dev/null +++ b/native-json-interface/src/lib.rs @@ -0,0 +1,223 @@ +#![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!(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!(DeriveVirtualAccountAddressHandler as derive_virtual_account_address); + + 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); +} + +#[cfg(feature = "jni")] +pub mod jni { + use radix_engine_toolkit::error::Result; + use radix_engine_toolkit::request::*; + use serde::Serialize; + + pub 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 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!( + 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!( + DeriveVirtualAccountAddressHandler + as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_deriveVirtualAccountAddress + ); + + 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 + ); +} diff --git a/core/Cargo.toml b/radix-engine-toolkit/Cargo.toml similarity index 97% rename from core/Cargo.toml rename to radix-engine-toolkit/Cargo.toml index 4368989f..41dfc408 100644 --- a/core/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "core" +name = "radix_engine_toolkit" version = "0.1.0" edition = "2021" diff --git a/core/src/buffer.rs b/radix-engine-toolkit/src/buffer.rs similarity index 100% rename from core/src/buffer.rs rename to radix-engine-toolkit/src/buffer.rs diff --git a/core/src/error.rs b/radix-engine-toolkit/src/error.rs similarity index 96% rename from core/src/error.rs rename to radix-engine-toolkit/src/error.rs index 5257ba5b..cdde7f91 100644 --- a/core/src/error.rs +++ b/radix-engine-toolkit/src/error.rs @@ -141,6 +141,14 @@ pub enum Error { /// An error emitted when an address of a unknown format is passed to the Radix Engine Toolkit /// for processing. UnrecognizedAddressFormat, + + // ========= + // Requests + // ========= + /// An error emitted when the contents of the request string pointer could not be loaded. + InvalidRequestString { + message: String, + }, } impl Display for Error { @@ -173,6 +181,7 @@ 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 ); diff --git a/core/src/lib.rs b/radix-engine-toolkit/src/lib.rs similarity index 100% rename from core/src/lib.rs rename to radix-engine-toolkit/src/lib.rs diff --git a/core/src/model/address/coder.rs b/radix-engine-toolkit/src/model/address/coder.rs similarity index 100% rename from core/src/model/address/coder.rs rename to radix-engine-toolkit/src/model/address/coder.rs diff --git a/core/src/model/address/entity_address.rs b/radix-engine-toolkit/src/model/address/entity_address.rs similarity index 100% rename from core/src/model/address/entity_address.rs rename to radix-engine-toolkit/src/model/address/entity_address.rs diff --git a/core/src/model/address/entity_type.rs b/radix-engine-toolkit/src/model/address/entity_type.rs similarity index 100% rename from core/src/model/address/entity_type.rs rename to radix-engine-toolkit/src/model/address/entity_type.rs diff --git a/core/src/model/address/mod.rs b/radix-engine-toolkit/src/model/address/mod.rs similarity index 100% rename from core/src/model/address/mod.rs rename to radix-engine-toolkit/src/model/address/mod.rs diff --git a/core/src/model/address/network_aware_address.rs b/radix-engine-toolkit/src/model/address/network_aware_address.rs similarity index 100% rename from core/src/model/address/network_aware_address.rs rename to radix-engine-toolkit/src/model/address/network_aware_address.rs diff --git a/core/src/model/address/non_fungible_address.rs b/radix-engine-toolkit/src/model/address/non_fungible_address.rs similarity index 100% rename from core/src/model/address/non_fungible_address.rs rename to radix-engine-toolkit/src/model/address/non_fungible_address.rs diff --git a/core/src/model/address/non_fungible_id.rs b/radix-engine-toolkit/src/model/address/non_fungible_id.rs similarity index 100% rename from core/src/model/address/non_fungible_id.rs rename to radix-engine-toolkit/src/model/address/non_fungible_id.rs diff --git a/core/src/model/constants.rs b/radix-engine-toolkit/src/model/constants.rs similarity index 100% rename from core/src/model/constants.rs rename to radix-engine-toolkit/src/model/constants.rs diff --git a/core/src/model/crypto/mod.rs b/radix-engine-toolkit/src/model/crypto/mod.rs similarity index 100% rename from core/src/model/crypto/mod.rs rename to radix-engine-toolkit/src/model/crypto/mod.rs diff --git a/core/src/model/crypto/public_key.rs b/radix-engine-toolkit/src/model/crypto/public_key.rs similarity index 100% rename from core/src/model/crypto/public_key.rs rename to radix-engine-toolkit/src/model/crypto/public_key.rs diff --git a/core/src/model/crypto/signature.rs b/radix-engine-toolkit/src/model/crypto/signature.rs similarity index 100% rename from core/src/model/crypto/signature.rs rename to radix-engine-toolkit/src/model/crypto/signature.rs diff --git a/core/src/model/crypto/signature_with_public_key.rs b/radix-engine-toolkit/src/model/crypto/signature_with_public_key.rs similarity index 100% rename from core/src/model/crypto/signature_with_public_key.rs rename to radix-engine-toolkit/src/model/crypto/signature_with_public_key.rs diff --git a/core/src/model/engine_identifier/mod.rs b/radix-engine-toolkit/src/model/engine_identifier/mod.rs similarity index 100% rename from core/src/model/engine_identifier/mod.rs rename to radix-engine-toolkit/src/model/engine_identifier/mod.rs diff --git a/core/src/model/engine_identifier/node_identifier.rs b/radix-engine-toolkit/src/model/engine_identifier/node_identifier.rs similarity index 100% rename from core/src/model/engine_identifier/node_identifier.rs rename to radix-engine-toolkit/src/model/engine_identifier/node_identifier.rs diff --git a/core/src/model/engine_identifier/own.rs b/radix-engine-toolkit/src/model/engine_identifier/own.rs similarity index 100% rename from core/src/model/engine_identifier/own.rs rename to radix-engine-toolkit/src/model/engine_identifier/own.rs diff --git a/core/src/model/engine_identifier/transient_identifier.rs b/radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs similarity index 100% rename from core/src/model/engine_identifier/transient_identifier.rs rename to radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs diff --git a/core/src/model/instruction.rs b/radix-engine-toolkit/src/model/instruction.rs similarity index 100% rename from core/src/model/instruction.rs rename to radix-engine-toolkit/src/model/instruction.rs diff --git a/core/src/model/mod.rs b/radix-engine-toolkit/src/model/mod.rs similarity index 100% rename from core/src/model/mod.rs rename to radix-engine-toolkit/src/model/mod.rs diff --git a/core/src/model/runtime/blob.rs b/radix-engine-toolkit/src/model/runtime/blob.rs similarity index 100% rename from core/src/model/runtime/blob.rs rename to radix-engine-toolkit/src/model/runtime/blob.rs diff --git a/core/src/model/runtime/expression.rs b/radix-engine-toolkit/src/model/runtime/expression.rs similarity index 100% rename from core/src/model/runtime/expression.rs rename to radix-engine-toolkit/src/model/runtime/expression.rs diff --git a/core/src/model/runtime/mod.rs b/radix-engine-toolkit/src/model/runtime/mod.rs similarity index 100% rename from core/src/model/runtime/mod.rs rename to radix-engine-toolkit/src/model/runtime/mod.rs diff --git a/core/src/model/transaction/header.rs b/radix-engine-toolkit/src/model/transaction/header.rs similarity index 100% rename from core/src/model/transaction/header.rs rename to radix-engine-toolkit/src/model/transaction/header.rs diff --git a/core/src/model/transaction/instruction_list.rs b/radix-engine-toolkit/src/model/transaction/instruction_list.rs similarity index 100% rename from core/src/model/transaction/instruction_list.rs rename to radix-engine-toolkit/src/model/transaction/instruction_list.rs diff --git a/core/src/model/transaction/intent.rs b/radix-engine-toolkit/src/model/transaction/intent.rs similarity index 100% rename from core/src/model/transaction/intent.rs rename to radix-engine-toolkit/src/model/transaction/intent.rs diff --git a/core/src/model/transaction/manifest.rs b/radix-engine-toolkit/src/model/transaction/manifest.rs similarity index 100% rename from core/src/model/transaction/manifest.rs rename to radix-engine-toolkit/src/model/transaction/manifest.rs diff --git a/core/src/model/transaction/mod.rs b/radix-engine-toolkit/src/model/transaction/mod.rs similarity index 100% rename from core/src/model/transaction/mod.rs rename to radix-engine-toolkit/src/model/transaction/mod.rs diff --git a/core/src/model/transaction/notarized_intent.rs b/radix-engine-toolkit/src/model/transaction/notarized_intent.rs similarity index 100% rename from core/src/model/transaction/notarized_intent.rs rename to radix-engine-toolkit/src/model/transaction/notarized_intent.rs diff --git a/core/src/model/transaction/signed_intent.rs b/radix-engine-toolkit/src/model/transaction/signed_intent.rs similarity index 100% rename from core/src/model/transaction/signed_intent.rs rename to radix-engine-toolkit/src/model/transaction/signed_intent.rs diff --git a/core/src/model/transaction/validation_config.rs b/radix-engine-toolkit/src/model/transaction/validation_config.rs similarity index 100% rename from core/src/model/transaction/validation_config.rs rename to radix-engine-toolkit/src/model/transaction/validation_config.rs diff --git a/core/src/model/value.rs b/radix-engine-toolkit/src/model/value.rs similarity index 100% rename from core/src/model/value.rs rename to radix-engine-toolkit/src/model/value.rs diff --git a/core/src/request/compile_notarized_transaction.rs b/radix-engine-toolkit/src/request/compile_notarized_transaction.rs similarity index 100% rename from core/src/request/compile_notarized_transaction.rs rename to radix-engine-toolkit/src/request/compile_notarized_transaction.rs diff --git a/core/src/request/compile_signed_transaction_intent.rs b/radix-engine-toolkit/src/request/compile_signed_transaction_intent.rs similarity index 100% rename from core/src/request/compile_signed_transaction_intent.rs rename to radix-engine-toolkit/src/request/compile_signed_transaction_intent.rs diff --git a/core/src/request/compile_transaction_intent.rs b/radix-engine-toolkit/src/request/compile_transaction_intent.rs similarity index 100% rename from core/src/request/compile_transaction_intent.rs rename to radix-engine-toolkit/src/request/compile_transaction_intent.rs diff --git a/core/src/request/convert_manifest.rs b/radix-engine-toolkit/src/request/convert_manifest.rs similarity index 100% rename from core/src/request/convert_manifest.rs rename to radix-engine-toolkit/src/request/convert_manifest.rs diff --git a/core/src/request/decode_address.rs b/radix-engine-toolkit/src/request/decode_address.rs similarity index 100% rename from core/src/request/decode_address.rs rename to radix-engine-toolkit/src/request/decode_address.rs diff --git a/core/src/request/decompile_notarized_transaction.rs b/radix-engine-toolkit/src/request/decompile_notarized_transaction.rs similarity index 100% rename from core/src/request/decompile_notarized_transaction.rs rename to radix-engine-toolkit/src/request/decompile_notarized_transaction.rs diff --git a/core/src/request/decompile_signed_transaction_intent.rs b/radix-engine-toolkit/src/request/decompile_signed_transaction_intent.rs similarity index 100% rename from core/src/request/decompile_signed_transaction_intent.rs rename to radix-engine-toolkit/src/request/decompile_signed_transaction_intent.rs diff --git a/core/src/request/decompile_transaction_intent.rs b/radix-engine-toolkit/src/request/decompile_transaction_intent.rs similarity index 100% rename from core/src/request/decompile_transaction_intent.rs rename to radix-engine-toolkit/src/request/decompile_transaction_intent.rs diff --git a/core/src/request/decompile_unknown_intent.rs b/radix-engine-toolkit/src/request/decompile_unknown_intent.rs similarity index 100% rename from core/src/request/decompile_unknown_intent.rs rename to radix-engine-toolkit/src/request/decompile_unknown_intent.rs diff --git a/core/src/request/derive_virtual_account_address.rs b/radix-engine-toolkit/src/request/derive_virtual_account_address.rs similarity index 100% rename from core/src/request/derive_virtual_account_address.rs rename to radix-engine-toolkit/src/request/derive_virtual_account_address.rs diff --git a/core/src/request/encode_address.rs b/radix-engine-toolkit/src/request/encode_address.rs similarity index 100% rename from core/src/request/encode_address.rs rename to radix-engine-toolkit/src/request/encode_address.rs diff --git a/core/src/request/information.rs b/radix-engine-toolkit/src/request/information.rs similarity index 100% rename from core/src/request/information.rs rename to radix-engine-toolkit/src/request/information.rs diff --git a/core/src/request/known_entity_addresses.rs b/radix-engine-toolkit/src/request/known_entity_addresses.rs similarity index 100% rename from core/src/request/known_entity_addresses.rs rename to radix-engine-toolkit/src/request/known_entity_addresses.rs diff --git a/core/src/request/mod.rs b/radix-engine-toolkit/src/request/mod.rs similarity index 100% rename from core/src/request/mod.rs rename to radix-engine-toolkit/src/request/mod.rs diff --git a/core/src/request/sbor_decode.rs b/radix-engine-toolkit/src/request/sbor_decode.rs similarity index 100% rename from core/src/request/sbor_decode.rs rename to radix-engine-toolkit/src/request/sbor_decode.rs diff --git a/core/src/request/sbor_encode.rs b/radix-engine-toolkit/src/request/sbor_encode.rs similarity index 100% rename from core/src/request/sbor_encode.rs rename to radix-engine-toolkit/src/request/sbor_encode.rs diff --git a/core/src/request/statically_validate_transaction.rs b/radix-engine-toolkit/src/request/statically_validate_transaction.rs similarity index 100% rename from core/src/request/statically_validate_transaction.rs rename to radix-engine-toolkit/src/request/statically_validate_transaction.rs diff --git a/core/src/request/traits.rs b/radix-engine-toolkit/src/request/traits.rs similarity index 100% rename from core/src/request/traits.rs rename to radix-engine-toolkit/src/request/traits.rs diff --git a/core/src/traits.rs b/radix-engine-toolkit/src/traits.rs similarity index 100% rename from core/src/traits.rs rename to radix-engine-toolkit/src/traits.rs diff --git a/core/src/utils.rs b/radix-engine-toolkit/src/utils.rs similarity index 100% rename from core/src/utils.rs rename to radix-engine-toolkit/src/utils.rs diff --git a/schema/Cargo.toml b/schema/Cargo.toml index 704153b9..555f7c02 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -11,6 +11,6 @@ schemars = { version = "0.8.11", features = ["preserve_order"] } serde_json = "1.0.91" # Importing core to get the models to generate it -core = { path = "../core" } +radix_engine_toolkit = { path = "../radix-engine-toolkit" } serde = "1.0.152" convert_case = "0.6.0" diff --git a/schema/src/main.rs b/schema/src/main.rs index 17ef5ffa..214f7a4e 100644 --- a/schema/src/main.rs +++ b/schema/src/main.rs @@ -51,40 +51,40 @@ pub fn generate_json_schema() -> Result<(), JsonSchemaGenerationError> { // Creating the schema for all of the request and response types through the generate schema // macro let schema_map = generate_schema_hashmap!( - core::request::InformationRequest, - core::request::InformationResponse, - core::request::ConvertManifestRequest, - core::request::ConvertManifestResponse, - core::request::CompileTransactionIntentRequest, - core::request::CompileTransactionIntentResponse, - core::request::DecompileTransactionIntentRequest, - core::request::DecompileTransactionIntentResponse, - core::request::CompileSignedTransactionIntentRequest, - core::request::CompileSignedTransactionIntentResponse, - core::request::DecompileSignedTransactionIntentRequest, - core::request::DecompileSignedTransactionIntentResponse, - core::request::CompileNotarizedTransactionRequest, - core::request::CompileNotarizedTransactionResponse, - core::request::DecompileNotarizedTransactionRequest, - core::request::DecompileNotarizedTransactionResponse, - core::request::DecompileUnknownTransactionIntentRequest, - core::request::DecompileUnknownTransactionIntentResponse, - core::request::DecodeAddressRequest, - core::request::DecodeAddressResponse, - core::request::EncodeAddressRequest, - core::request::EncodeAddressResponse, - core::request::DecodeAddressRequest, - core::request::DecodeAddressResponse, - core::request::SborEncodeRequest, - core::request::SborEncodeResponse, - core::request::SborDecodeRequest, - core::request::SborDecodeResponse, - core::request::DeriveVirtualAccountAddressRequest, - core::request::DeriveVirtualAccountAddressResponse, - core::request::KnownEntityAddressesRequest, - core::request::KnownEntityAddressesResponse, - core::request::StaticallyValidateTransactionRequest, - core::request::StaticallyValidateTransactionResponse + radix_engine_toolkit::request::InformationRequest, + radix_engine_toolkit::request::InformationResponse, + radix_engine_toolkit::request::ConvertManifestRequest, + radix_engine_toolkit::request::ConvertManifestResponse, + radix_engine_toolkit::request::CompileTransactionIntentRequest, + radix_engine_toolkit::request::CompileTransactionIntentResponse, + radix_engine_toolkit::request::DecompileTransactionIntentRequest, + radix_engine_toolkit::request::DecompileTransactionIntentResponse, + radix_engine_toolkit::request::CompileSignedTransactionIntentRequest, + radix_engine_toolkit::request::CompileSignedTransactionIntentResponse, + radix_engine_toolkit::request::DecompileSignedTransactionIntentRequest, + radix_engine_toolkit::request::DecompileSignedTransactionIntentResponse, + radix_engine_toolkit::request::CompileNotarizedTransactionRequest, + radix_engine_toolkit::request::CompileNotarizedTransactionResponse, + radix_engine_toolkit::request::DecompileNotarizedTransactionRequest, + radix_engine_toolkit::request::DecompileNotarizedTransactionResponse, + radix_engine_toolkit::request::DecompileUnknownTransactionIntentRequest, + radix_engine_toolkit::request::DecompileUnknownTransactionIntentResponse, + radix_engine_toolkit::request::DecodeAddressRequest, + radix_engine_toolkit::request::DecodeAddressResponse, + radix_engine_toolkit::request::EncodeAddressRequest, + radix_engine_toolkit::request::EncodeAddressResponse, + radix_engine_toolkit::request::DecodeAddressRequest, + radix_engine_toolkit::request::DecodeAddressResponse, + radix_engine_toolkit::request::SborEncodeRequest, + radix_engine_toolkit::request::SborEncodeResponse, + radix_engine_toolkit::request::SborDecodeRequest, + radix_engine_toolkit::request::SborDecodeResponse, + radix_engine_toolkit::request::DeriveVirtualAccountAddressRequest, + radix_engine_toolkit::request::DeriveVirtualAccountAddressResponse, + radix_engine_toolkit::request::KnownEntityAddressesRequest, + radix_engine_toolkit::request::KnownEntityAddressesResponse, + radix_engine_toolkit::request::StaticallyValidateTransactionRequest, + radix_engine_toolkit::request::StaticallyValidateTransactionResponse ); // Iterating over the HashMap, modifying the class name to be in snake case and writing the From 883a2d1aaa78fccf32e99cef63685976fe399a8b Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 16 Jan 2023 21:02:01 +0300 Subject: [PATCH 044/110] Update package version --- native-json-interface/Cargo.toml | 2 +- radix-engine-toolkit/Cargo.toml | 2 +- schema/Cargo.toml | 2 +- serializable/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/native-json-interface/Cargo.toml b/native-json-interface/Cargo.toml index 71c43b60..e240cf2d 100644 --- a/native-json-interface/Cargo.toml +++ b/native-json-interface/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "native-json-interface" -version = "0.1.0" +version = "0.7.0" edition = "2021" [dependencies] diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index 41dfc408..caa81b7b 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "radix_engine_toolkit" -version = "0.1.0" +version = "0.7.0" edition = "2021" [dependencies] diff --git a/schema/Cargo.toml b/schema/Cargo.toml index 555f7c02..0ca0d21d 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "schema" -version = "0.1.0" +version = "0.7.0" edition = "2021" [dependencies] diff --git a/serializable/Cargo.toml b/serializable/Cargo.toml index 9bcd270c..102aca5e 100644 --- a/serializable/Cargo.toml +++ b/serializable/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serializable" -version = "0.1.0" +version = "0.7.0" edition = "2021" [dependencies] From d086aeba627568a164154611592e6f9ce995c30d Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 16 Jan 2023 22:30:09 +0300 Subject: [PATCH 045/110] Update Scrypto dependency --- radix-engine-toolkit/Cargo.toml | 10 +- .../src/enum_discriminator.rs | 53 +++++ radix-engine-toolkit/src/error.rs | 7 + radix-engine-toolkit/src/lib.rs | 2 + .../src/model/address/non_fungible_id.rs | 16 +- radix-engine-toolkit/src/model/instruction.rs | 61 +++++- radix-engine-toolkit/src/model/value.rs | 185 +++++++++++------- 7 files changed, 234 insertions(+), 100 deletions(-) create mode 100644 radix-engine-toolkit/src/enum_discriminator.rs diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index caa81b7b..f2916754 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -15,11 +15,11 @@ schemars = { version = "0.8.11", features = ["preserve_order"] } serializable = { path = "../serializable" } # Scrypto dependencies required for the core-toolkit -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-e497a8" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-e497a8" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-e497a8", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-e497a8", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-e497a8" } +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6" } # Hex is used for the internal hex encoding and decoding of values - serde_with::Hex is used for the # hex representation during serialization. diff --git a/radix-engine-toolkit/src/enum_discriminator.rs b/radix-engine-toolkit/src/enum_discriminator.rs new file mode 100644 index 00000000..8383af85 --- /dev/null +++ b/radix-engine-toolkit/src/enum_discriminator.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::error::{Error, Result}; +use native_transaction::manifest::KNOWN_ENUM_DISCRIMINATORS; +use serializable::serializable; + +// ================= +// Model Definition +// ================= + +/// A union of the types of discriminators that enums may have. This may either be a string or an +/// 8-bit unsigned number. This type does not itself require a discriminator. +#[serializable] +#[serde(untagged)] +#[derive(PartialEq, Eq, Hash)] +pub enum EnumDiscriminator { + String(String), + U8(u8), +} + +// ============ +// Conversions +// ============ + +impl EnumDiscriminator { + /// Resolves the enum discriminator to a [`u8`] discriminator. + pub fn resolve_discriminator(&self) -> Result { + match self { + Self::U8(discriminator) => Ok(*discriminator), + Self::String(discriminator) => KNOWN_ENUM_DISCRIMINATORS + .get(discriminator.as_str()) + .copied() + .ok_or(Error::InvalidEnumDiscriminator { + discriminator: discriminator.clone(), + }), + } + } +} diff --git a/radix-engine-toolkit/src/error.rs b/radix-engine-toolkit/src/error.rs index cdde7f91..f171a2ff 100644 --- a/radix-engine-toolkit/src/error.rs +++ b/radix-engine-toolkit/src/error.rs @@ -62,6 +62,13 @@ pub enum Error { found: ValueKind, }, + /// 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 // ===== diff --git a/radix-engine-toolkit/src/lib.rs b/radix-engine-toolkit/src/lib.rs index f1368aed..dd698bb9 100644 --- a/radix-engine-toolkit/src/lib.rs +++ b/radix-engine-toolkit/src/lib.rs @@ -16,6 +16,7 @@ // under the License. pub mod buffer; +pub mod enum_discriminator; pub mod error; pub mod model; pub mod request; @@ -23,6 +24,7 @@ pub mod traits; pub mod utils; pub use buffer::*; +pub use enum_discriminator::*; pub use error::*; pub use model::*; pub use request::*; diff --git a/radix-engine-toolkit/src/model/address/non_fungible_id.rs b/radix-engine-toolkit/src/model/address/non_fungible_id.rs index 3b08ad70..5b131af4 100644 --- a/radix-engine-toolkit/src/model/address/non_fungible_id.rs +++ b/radix-engine-toolkit/src/model/address/non_fungible_id.rs @@ -23,16 +23,8 @@ use serializable::serializable; /// Represents non-fungible ids which is a discriminated union of the different types that /// non-fungible ids may be. pub enum NonFungibleId { - /// A 32 bit unsigned integer non-fungible id type which is serialized as a string - U32( - #[schemars(regex(pattern = "[0-9]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - u32, - ), - /// A 64 bit unsigned integer non-fungible id type which is serialized as a string - U64( + Number( #[schemars(regex(pattern = "[0-9]+"))] #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] @@ -63,8 +55,7 @@ pub enum NonFungibleId { impl From for NonFungibleId { fn from(value: ScryptoNonFungibleId) -> Self { match value { - ScryptoNonFungibleId::U32(value) => Self::U32(value), - ScryptoNonFungibleId::U64(value) => Self::U64(value), + ScryptoNonFungibleId::Number(value) => Self::Number(value), ScryptoNonFungibleId::UUID(value) => Self::UUID(value), ScryptoNonFungibleId::String(value) => Self::String(value), ScryptoNonFungibleId::Bytes(value) => Self::Bytes(value), @@ -75,8 +66,7 @@ impl From for NonFungibleId { impl From for ScryptoNonFungibleId { fn from(value: NonFungibleId) -> Self { match value { - NonFungibleId::U32(value) => Self::U32(value), - NonFungibleId::U64(value) => Self::U64(value), + NonFungibleId::Number(value) => Self::Number(value), NonFungibleId::UUID(value) => Self::UUID(value), NonFungibleId::String(value) => Self::String(value), NonFungibleId::Bytes(value) => Self::Bytes(value), diff --git a/radix-engine-toolkit/src/model/instruction.rs b/radix-engine-toolkit/src/model/instruction.rs index de21f536..20ce34fa 100644 --- a/radix-engine-toolkit/src/model/instruction.rs +++ b/radix-engine-toolkit/src/model/instruction.rs @@ -266,11 +266,11 @@ pub enum Instruction { /// 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 `Array` from the Value model. + /// This is serialized as an `Map` from the Value model. royalty_config: Value, /// 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 `Array` from the Value model. + /// of the metadata. This is serialized as an `Map` from the Value model. metadata: Value, /// The access rules to use for the package. This is serialized as a `Tuple` from the Value @@ -334,7 +334,7 @@ pub enum Instruction { /// 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 `Array` from the Value model. + /// This is serialized as an `Map` from the Value model. royalty_config: Value, }, @@ -392,7 +392,7 @@ pub enum Instruction { amount: Value, }, - /// An instruction to mind non-fungibles of a resource + /// An instruction to mint non-fungibles of a resource MintNonFungible { /// The address of the resource to mint tokens of. This field is serialized as a /// `ResourceAddress` from the Value model. @@ -404,6 +404,19 @@ pub enum Instruction { entries: Value, }, + /// An instruction to mint non-fungibles of a non-fungible resource that uses UUID as the type + /// id and perform auto incrimination of ID. + MintUuidNonFungible { + /// The address of the resource to mint tokens of. This field is serialized as a + /// `ResourceAddress` from the Value model. + resource_address: Value, + + /// The non-fungible tokens to mint. The underlying type is a vector of tuples of two + /// `Value` elements where each element is a struct of the immutable and mutable + /// parts of the non-fungible data. + entries: Value, + }, + /// An instruction to create a new fungible resource. CreateFungibleResource { /// The divisibility of the resource. This field is serialized as a `U8` from the Value @@ -411,12 +424,12 @@ pub enum Instruction { divisibility: Value, /// 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 `Array` from the Value model. + /// of the metadata. This is serialized as an `Map` from the Value model. metadata: Value, /// The access rules to use for the resource. The underlying type of this is a map which /// maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the - /// current behavior and the mutability. This is serialized as an `Array` from the + /// current behavior and the mutability. This is serialized as an `Map` from the /// Value model. access_rules: Value, @@ -433,7 +446,7 @@ pub enum Instruction { divisibility: Value, /// 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 `Array` from the Value model. + /// of the metadata. This is serialized as an `Map` from the Value model. metadata: Value, /// The non-fungible address of the owner badge of this resource. This field is serialized @@ -452,12 +465,12 @@ pub enum Instruction { id_type: Value, /// 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 `Array` from the Value model. + /// of the metadata. This is serialized as an `Map` from the Value model. metadata: Value, /// The access rules to use for the resource. The underlying type of this is a map which /// maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the - /// current behavior and the mutability. This is serialized as an `Array` from the + /// current behavior and the mutability. This is serialized as an `Map` from the /// Value model. access_rules: Value, @@ -476,7 +489,7 @@ pub enum Instruction { id_type: Value, /// 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 `Array` from the Value model. + /// of the metadata. This is serialized as an `Map` from the Value model. metadata: Value, /// The non-fungible address of the owner badge of this resource. This field is serialized @@ -789,6 +802,13 @@ impl Instruction { resource_address: resource_address.to_ast_value(bech32_coder)?, entries: entries.to_ast_value(bech32_coder)?, }, + Self::MintUuidNonFungible { + resource_address, + entries, + } => ast::Instruction::MintUuidNonFungible { + resource_address: resource_address.to_ast_value(bech32_coder)?, + entries: entries.to_ast_value(bech32_coder)?, + }, Self::RegisterValidator { validator } => ast::Instruction::RegisterValidator { validator: validator.to_ast_value(bech32_coder)?, }, @@ -1102,6 +1122,13 @@ impl Instruction { resource_address: Value::from_ast_value(resource_address, bech32_coder)?, entries: Value::from_ast_value(entries, bech32_coder)?, }, + ast::Instruction::MintUuidNonFungible { + resource_address, + entries, + } => Self::MintUuidNonFungible { + resource_address: Value::from_ast_value(resource_address, bech32_coder)?, + entries: Value::from_ast_value(entries, bech32_coder)?, + }, ast::Instruction::RegisterValidator { validator } => Self::RegisterValidator { validator: Value::from_ast_value(validator, bech32_coder)?, }, @@ -1311,6 +1338,13 @@ impl ValueRef for Instruction { values.push(resource_address); values.push(entries); } + Self::MintUuidNonFungible { + resource_address, + entries, + } => { + values.push(resource_address); + values.push(entries); + } Self::CreateFungibleResource { divisibility, @@ -1564,6 +1598,13 @@ impl ValueRef for Instruction { values.push(resource_address); values.push(entries); } + Self::MintUuidNonFungible { + resource_address, + entries, + } => { + values.push(resource_address); + values.push(entries); + } Self::CreateFungibleResource { divisibility, diff --git a/radix-engine-toolkit/src/model/value.rs b/radix-engine-toolkit/src/model/value.rs index 9f8e651d..576197a0 100644 --- a/radix-engine-toolkit/src/model/value.rs +++ b/radix-engine-toolkit/src/model/value.rs @@ -17,10 +17,12 @@ use crate::address::*; use crate::engine_identifier::{BucketId, ProofId}; +use crate::enum_discriminator::EnumDiscriminator; use crate::error::{Error, Result}; use crate::TransientIdentifier; -use native_transaction::manifest::ast; +use native_transaction::manifest::{ast, KNOWN_ENUM_DISCRIMINATORS}; +use native_transaction::manifest::generator::GeneratorError; use scrypto::prelude::ScryptoCustomValue; use scrypto::prelude::{ scrypto_decode, scrypto_encode, Decimal, EcdsaSecp256k1PublicKey, EcdsaSecp256k1Signature, @@ -127,7 +129,7 @@ pub enum Value { /// in a way similar to discriminated algebraic sum types) Enum { /// The name of the variant of the enum - variant: String, + variant: EnumDiscriminator, /// Optional fields that the enum may have #[serde(default, skip_serializing_if = "Option::is_none")] @@ -156,6 +158,22 @@ pub enum Value { elements: Vec, }, + /// A key-value map of values where all keys are of a single kind and all values are of a + /// single kind + Map { + /// The kind of the keys used for the map. A map will be validated to ensure that its keys + /// are all of a single kind. + key_value_kind: ValueKind, + + /// The kind of the values used for the map. A map will be validated to ensure that its + /// values are all of a single kind. + value_value_kind: ValueKind, + + /// A vector of tuples representing the entires in the map where each tuple is made up of + /// two elements: a key and a value. + entries: Vec<(Value, Value)>, + }, + /// An array of elements where elements could be of different kinds. Tuple { elements: Vec }, @@ -355,6 +373,7 @@ pub enum ValueKind { Ok, Err, + Map, Array, Tuple, @@ -429,6 +448,7 @@ impl Value { Self::Ok { .. } => ValueKind::Ok, Self::Err { .. } => ValueKind::Err, + Self::Map { .. } => ValueKind::Map, Self::Array { .. } => ValueKind::Array, Self::Tuple { .. } => ValueKind::Tuple, @@ -481,7 +501,7 @@ impl Value { Value::String { value } => ast::Value::String(value.clone()), Value::Enum { variant, fields } => ast::Value::Enum( - variant.clone(), + variant.resolve_discriminator()?, fields .clone() .unwrap_or_default() @@ -504,6 +524,19 @@ impl Value { .map(|id| id.to_ast_value(bech32_coder)) .collect::>>()?, ), + Value::Map { + key_value_kind, + value_value_kind, + entries, + } => ast::Value::Map( + (*key_value_kind).into(), + (*value_value_kind).into(), + entries + .iter() + .flat_map(|(x, y)| [x, y]) + .map(|value| value.to_ast_value(bech32_coder)) + .collect::>>()?, + ), Value::Tuple { elements } => ast::Value::Tuple( elements .iter() @@ -544,8 +577,7 @@ impl Value { })), Value::NonFungibleId { value } => ast::Value::NonFungibleId(Box::new(match value { - NonFungibleId::U32(value) => ast::Value::U32(*value), - NonFungibleId::U64(value) => ast::Value::U64(*value), + NonFungibleId::Number(value) => ast::Value::U64(*value), NonFungibleId::UUID(value) => ast::Value::U128(*value), NonFungibleId::String(ref value) => ast::Value::String(value.clone()), NonFungibleId::Bytes(ref value) => { @@ -557,8 +589,7 @@ impl Value { let resource_address = ast::Value::String(resource_address_string); let non_fungible_id = match address.non_fungible_id { - NonFungibleId::U32(value) => ast::Value::U32(value), - NonFungibleId::U64(value) => ast::Value::U64(value), + NonFungibleId::Number(value) => ast::Value::U64(value), NonFungibleId::UUID(value) => ast::Value::U128(value), NonFungibleId::String(ref value) => ast::Value::String(value.clone()), NonFungibleId::Bytes(ref value) => { @@ -632,7 +663,7 @@ impl Value { }, ast::Value::Enum(variant, fields) => Self::Enum { - variant: variant.clone(), + variant: EnumDiscriminator::U8(*variant), fields: { if fields.is_empty() { None @@ -658,6 +689,25 @@ impl Value { 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(); + while let Some(chunk) = entries.chunks(2).next() { + 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 @@ -755,8 +805,7 @@ impl Value { ast::Value::NonFungibleId(value) => Self::NonFungibleId { value: match &**value { - ast::Value::U32(value) => NonFungibleId::U32(*value), - ast::Value::U64(value) => NonFungibleId::U64(*value), + ast::Value::U64(value) => NonFungibleId::Number(*value), ast::Value::U128(value) => NonFungibleId::UUID(*value), ast::Value::String(value) => NonFungibleId::String(value.clone()), ast::Value::Bytes(value) => { @@ -797,8 +846,7 @@ impl Value { // TODO: de-duplicate. Refactor out let non_fungible_id = match &**non_fungible_id { - ast::Value::U32(value) => NonFungibleId::U32(*value), - ast::Value::U64(value) => NonFungibleId::U64(*value), + ast::Value::U64(value) => NonFungibleId::Number(*value), ast::Value::U128(value) => NonFungibleId::UUID(*value), ast::Value::String(value) => NonFungibleId::String(value.clone()), ast::Value::Bytes(value) => { @@ -928,7 +976,7 @@ impl Value { value: value.clone(), }, Self::Enum { variant, fields } => ScryptoValue::Enum { - discriminator: variant.clone(), + discriminator: variant.resolve_discriminator()?, fields: fields .clone() .unwrap_or_default() @@ -937,21 +985,44 @@ impl Value { .collect::>>()?, }, Self::Some { value } => ScryptoValue::Enum { - discriminator: "Some".into(), + discriminator: *KNOWN_ENUM_DISCRIMINATORS + .get("Option::Some") + .expect("Should never fail!"), fields: vec![value.to_scrypto_value()?], }, Self::None => ScryptoValue::Enum { - discriminator: "None".into(), + discriminator: *KNOWN_ENUM_DISCRIMINATORS + .get("Option::None") + .expect("Should never fail!"), fields: Vec::new(), }, Self::Ok { value } => ScryptoValue::Enum { - discriminator: "Ok".into(), + discriminator: *KNOWN_ENUM_DISCRIMINATORS + .get("Result::Ok") + .expect("Should never fail!"), fields: vec![value.to_scrypto_value()?], }, Self::Err { value } => ScryptoValue::Enum { - discriminator: "Err".into(), + discriminator: *KNOWN_ENUM_DISCRIMINATORS + .get("Result::Err") + .expect("Should never fail!"), fields: vec![value.to_scrypto_value()?], }, + Self::Map { + key_value_kind, + value_value_kind, + entries, + } => ScryptoValue::Map { + key_value_kind: (*key_value_kind).into(), + value_value_kind: (*value_value_kind).into(), + entries: { + let mut scrypto_entries = Vec::new(); + while let Some((key, value)) = entries.iter().next() { + scrypto_entries.push((key.to_scrypto_value()?, value.to_scrypto_value()?)) + } + scrypto_entries + }, + }, Self::Array { element_kind, elements, @@ -1078,7 +1149,7 @@ impl Value { discriminator, fields, } => Self::Enum { - variant: discriminator.clone(), + variant: EnumDiscriminator::U8(*discriminator), fields: if fields.is_empty() { None } else { @@ -1091,6 +1162,24 @@ impl Value { ) }, }, + 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(); + while let Some((key, value)) = entries.iter().next() { + scrypto_entries.push(( + Self::from_scrypto_value(key, network_id), + Self::from_scrypto_value(value, network_id), + )) + } + scrypto_entries + }, + }, ScryptoValue::Array { element_value_kind, elements, @@ -1202,62 +1291,11 @@ impl Value { } } - /// Handles the aliasing of certain [`Value`] kinds such as [`Value::Enum`] and - /// [`Value::NonFungibleAddress`]. This is typically used during request post processing to - /// ensure that all responses include aliased values + /// Handles the aliasing of certain [`Value`] kinds such as [`Value::NonFungibleAddress`]. This + /// is typically used during request post processing to ensure that all responses include + /// aliased values pub fn alias(&mut self) { match self { - // Case: Some - An enum with a discriminator of "Some" which has a single field. - Self::Enum { variant, fields } - if variant == "Some" && fields.as_ref().map_or(0, |fields| fields.len()) == 1 => - { - *self = Self::Some { - value: Box::new( - fields - .as_ref() - .expect("Illegal State!") - .get(0) - .expect("Illegal State!") - .clone(), - ), - } - } - // Case: None - An enum with a discriminator of "None" which has no fields. - Self::Enum { variant, fields } - if variant == "None" && fields.as_ref().map_or(0, |fields| fields.len()) == 0 => - { - *self = Self::None - } - // Case: Ok - An enum with a discriminator of "Ok" which has a single field. - Self::Enum { variant, fields } - if variant == "Ok" && fields.as_ref().map_or(0, |fields| fields.len()) == 1 => - { - *self = Self::Ok { - value: Box::new( - fields - .as_ref() - .expect("Illegal State!") - .get(0) - .expect("Illegal State!") - .clone(), - ), - } - } - // Case: Err - An enum with a discriminator of "Err" which has a single field. - Self::Enum { variant, fields } - if variant == "Err" && fields.as_ref().map_or(0, |fields| fields.len()) == 1 => - { - *self = Self::Err { - value: Box::new( - fields - .as_ref() - .expect("Illegal State!") - .get(0) - .expect("Illegal State!") - .clone(), - ), - } - } Self::Tuple { ref elements } => { // Case: NonFungibleAddress - A tuple of ResourceAddress and NonFungibleId match (elements.get(0), elements.get(1)) { @@ -1363,6 +1401,7 @@ impl From for ast::Type { ValueKind::Ok => ast::Type::Enum, ValueKind::Err => ast::Type::Enum, + ValueKind::Map => ast::Type::Array, ValueKind::Array => ast::Type::Array, ValueKind::Tuple => ast::Type::Tuple, @@ -1466,6 +1505,7 @@ impl From for ValueKind { ScryptoValueKind::String => ValueKind::String, ScryptoValueKind::Enum => ValueKind::Enum, + ScryptoValueKind::Map => ValueKind::Map, ScryptoValueKind::Array => ValueKind::Array, ScryptoValueKind::Tuple => ValueKind::Tuple, @@ -1527,6 +1567,7 @@ impl From for ScryptoValueKind { ValueKind::Ok => ScryptoValueKind::Enum, ValueKind::Err => ScryptoValueKind::Enum, + ValueKind::Map => ScryptoValueKind::Map, ValueKind::Array => ScryptoValueKind::Array, ValueKind::Bytes => ScryptoValueKind::Array, ValueKind::Tuple => ScryptoValueKind::Tuple, From c7ebccda800d0fbd3eea703747fe9a65d6d0d574 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 16 Jan 2023 22:46:29 +0300 Subject: [PATCH 046/110] map collection validation --- radix-engine-toolkit/src/model/value.rs | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/radix-engine-toolkit/src/model/value.rs b/radix-engine-toolkit/src/model/value.rs index 576197a0..d906ab91 100644 --- a/radix-engine-toolkit/src/model/value.rs +++ b/radix-engine-toolkit/src/model/value.rs @@ -1372,6 +1372,41 @@ impl Value { Ok(()) } } + Self::Map { + key_value_kind, + value_value_kind, + entries, + } => { + if let Some(offending_value_kind) = entries + .iter() + .enumerate() + .filter(|(i, _)| i % 2 == 0) + .map(|(_, (key, _))| key) + .map(|value| value.kind()) + .find(|kind| *kind != *key_value_kind) + { + Err(Error::UnexpectedAstContents { + parsing: ValueKind::Array, + expected: vec![*key_value_kind], + found: offending_value_kind, + }) + } else if let Some(offending_value_kind) = entries + .iter() + .enumerate() + .filter(|(i, _)| i % 2 == 0) + .map(|(_, (_, value))| value) + .map(|value| value.kind()) + .find(|kind| *kind != *key_value_kind) + { + Err(Error::UnexpectedAstContents { + parsing: ValueKind::Array, + expected: vec![*value_value_kind], + found: offending_value_kind, + }) + } else { + Ok(()) + } + } _ => Ok(()), } } From bc059d5f1f15cbbce1ad74d37d395ff7d130312a Mon Sep 17 00:00:00 2001 From: Omar Date: Tue, 17 Jan 2023 02:13:41 +0300 Subject: [PATCH 047/110] Value tests --- radix-engine-toolkit/Cargo.toml | 4 + radix-engine-toolkit/src/model/value.rs | 20 +- radix-engine-toolkit/tests/test_vector/mod.rs | 3 + .../tests/test_vector/value.rs | 456 ++++++++++++++++++ radix-engine-toolkit/tests/value.rs | 267 ++++++++++ 5 files changed, 747 insertions(+), 3 deletions(-) create mode 100644 radix-engine-toolkit/tests/test_vector/mod.rs create mode 100644 radix-engine-toolkit/tests/test_vector/value.rs create mode 100644 radix-engine-toolkit/tests/value.rs diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index f2916754..283d4a92 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -28,3 +28,7 @@ hex = { version = "0.4.3", default-features = false } # 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 } + +[dev-dependencies] +lazy_static = { version = "1.4.0" } +serde_json = { version = "1.0.91" } \ No newline at end of file diff --git a/radix-engine-toolkit/src/model/value.rs b/radix-engine-toolkit/src/model/value.rs index d906ab91..d1b522db 100644 --- a/radix-engine-toolkit/src/model/value.rs +++ b/radix-engine-toolkit/src/model/value.rs @@ -698,7 +698,7 @@ impl Value { Err(Error::from(GeneratorError::OddNumberOfElements)) } else { let mut entries_vec = Vec::new(); - while let Some(chunk) = entries.chunks(2).next() { + 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)?; @@ -1017,7 +1017,7 @@ impl Value { value_value_kind: (*value_value_kind).into(), entries: { let mut scrypto_entries = Vec::new(); - while let Some((key, value)) = entries.iter().next() { + for (key, value) in entries { scrypto_entries.push((key.to_scrypto_value()?, value.to_scrypto_value()?)) } scrypto_entries @@ -1171,7 +1171,7 @@ impl Value { value_value_kind: (*value_value_kind).into(), entries: { let mut scrypto_entries = Vec::new(); - while let Some((key, value)) = entries.iter().next() { + for (key, value) in entries { scrypto_entries.push(( Self::from_scrypto_value(key, network_id), Self::from_scrypto_value(value, network_id), @@ -1317,6 +1317,20 @@ impl Value { _ => {} } } + // Case: Bytes - An array of bytes + Self::Array { + element_kind: ValueKind::U8, + elements, + } => { + let mut bytes = Vec::new(); + for element in elements.iter() { + match element { + Value::U8 { value } => bytes.push(*value), + _ => break, + } + } + *self = Value::Bytes { value: bytes } + } _ => {} } } diff --git a/radix-engine-toolkit/tests/test_vector/mod.rs b/radix-engine-toolkit/tests/test_vector/mod.rs new file mode 100644 index 00000000..a78c6e3f --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/mod.rs @@ -0,0 +1,3 @@ +pub mod value; + +pub use value::*; diff --git a/radix-engine-toolkit/tests/test_vector/value.rs b/radix-engine-toolkit/tests/test_vector/value.rs new file mode 100644 index 00000000..b7ba70db --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/value.rs @@ -0,0 +1,456 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#![allow(dead_code)] +#![macro_use] + +use std::collections::BTreeMap; + +use native_transaction::manifest::generator::{generate_value, NameResolver}; +use native_transaction::manifest::lexer::tokenize; +use radix_engine_toolkit::{address::*, BucketId, ProofId, TransientIdentifier}; +use radix_engine_toolkit::{Value, ValueKind}; +use scrypto::prelude::{Hash, ScryptoValue}; +use scrypto::runtime::ManifestBlobRef; +extern crate lazy_static; + +pub struct ValueRepresentationTestVector { + pub value: Value, + pub json_representation: String, + pub manifest_representation: String, +} + +impl ValueRepresentationTestVector { + pub fn new, T: AsRef>( + value: Value, + json_representation: S, + manifest_representation: T, + ) -> Self { + Self { + value, + json_representation: json_representation.as_ref().into(), + manifest_representation: manifest_representation.as_ref().into(), + } + } + + pub fn manifest_representation_as_ast_value(&self) -> native_transaction::manifest::ast::Value { + native_transaction::manifest::parser::Parser::new( + tokenize(&self.manifest_representation).expect("Failed to tokenize trusted value"), + ) + .parse_value() + .expect("Failed to parse trusted value to ast value") + } + + pub fn manifest_representation_as_scrypto_value( + &self, + bech32_coder: &Bech32Coder, + ) -> ScryptoValue { + let mut blobs = BTreeMap::>::new(); + if let Value::Blob { ref hash } = self.value { + blobs.insert(hash.0, Vec::new()); + }; + + let ast_value = self.manifest_representation_as_ast_value(); + generate_value( + &ast_value, + None, + &mut NameResolver::new(), + &bech32_coder.decoder(), + &blobs, + ) + .expect("Failed to generate scrypto value from ast_value") + } +} + +lazy_static::lazy_static! { + pub static ref VALUE_CONVERSION_TEST_VECTORS: Vec = vec![ + // ================ + // Primitive Types + // ================ + + // Unit and Boolean + ValueRepresentationTestVector::new( + Value::Bool { value: true }, + r#"{"type": "Bool", "value": true}"#, + r#"true"#, + ), + ValueRepresentationTestVector::new( + Value::Bool { value: false }, + r#"{"type": "Bool", "value": false}"#, + r#"false"#, + ), + // Unsigned Integers + ValueRepresentationTestVector::new( + Value::U8 { value: 19 }, + r#"{"type": "U8", "value": "19"}"#, + "19u8" + ), + ValueRepresentationTestVector::new( + Value::U16 { value: 19 }, + r#"{"type": "U16", "value": "19"}"#, + "19u16" + ), + ValueRepresentationTestVector::new( + Value::U32 { value: 19 }, + r#"{"type": "U32", "value": "19"}"#, + "19u32" + ), + ValueRepresentationTestVector::new( + Value::U64 { value: 19 }, + r#"{"type": "U64", "value": "19"}"#, + "19u64" + ), + ValueRepresentationTestVector::new( + Value::U128 { value: 19 }, + r#"{"type": "U128", "value": "19"}"#, + "19u128" + ), + // Signed Integers + ValueRepresentationTestVector::new( + Value::I8 { value: 19 }, + r#"{"type": "I8", "value": "19"}"#, + "19i8" + ), + ValueRepresentationTestVector::new( + Value::I16 { value: 19 }, + r#"{"type": "I16", "value": "19"}"#, + "19i16" + ), + ValueRepresentationTestVector::new( + Value::I32 { value: 19 }, + r#"{"type": "I32", "value": "19"}"#, + "19i32" + ), + ValueRepresentationTestVector::new( + Value::I64 { value: 19 }, + r#"{"type": "I64", "value": "19"}"#, + "19i64" + ), + ValueRepresentationTestVector::new( + Value::I128 { value: 19 }, + r#"{"type": "I128", "value": "19"}"#, + "19i128" + ), + // String + ValueRepresentationTestVector::new( + Value::String { + value: "P2P Cash System".into(), + }, + r#"{"type": "String", "value": "P2P Cash System"}"#, + r#""P2P Cash System""#, + ), + // Enums and Enum Aliases (Option & Result) + ValueRepresentationTestVector::new( + Value::Enum { + variant: radix_engine_toolkit::EnumDiscriminator::U8(1), + fields: Some(vec![Value::String { + value: "Component".into(), + }]), + }, + r#"{"type": "Enum", "variant": 1, "fields": [{"type": "String", "value": "Component"}]}"#, + r#"Enum("Option::Some", "Component")"#, + ), + ValueRepresentationTestVector::new( + Value::Some { + value: Box::new(Value::String { + value: "Component".into(), + }), + }, + r#"{"type": "Some", "value": {"type": "String", "value": "Component"}}"#, + r#"Some("Component")"#, + ), + ValueRepresentationTestVector::new( + Value::None, + r#"{"type": "None"}"#, + r#"None"#, + ), + ValueRepresentationTestVector::new( + Value::Ok { + value: Box::new(Value::String { + value: "Component".into(), + }), + }, + r#"{"type": "Ok", "value": {"type": "String", "value": "Component"}}"#, + r#"Ok("Component")"#, + ), + ValueRepresentationTestVector::new( + Value::Err { + value: Box::new(Value::String { + value: "Component".into(), + }), + }, + r#"{"type": "Err", "value": {"type": "String", "value": "Component"}}"#, + r#"Err("Component")"#, + ), + // ================= + // Collection Types + // ================= + ValueRepresentationTestVector::new( + Value::Array { + element_kind: ValueKind::String, + elements: vec![Value::String { + value: "World, Hello!".into(), + }], + }, + r#"{"type": "Array", "element_kind": "String", "elements": [{"type": "String", "value": "World, Hello!"}]}"#, + r#"Array("World, Hello!")"#, + ), + ValueRepresentationTestVector::new( + Value::Map { + key_value_kind: ValueKind::String, + value_value_kind: ValueKind::U16, + entries: vec![ + ( + Value::String { + value: "Hello, World!".into() + }, + Value::U16 { value: 919 } + ), + ( + Value::String { + value: "World, Hello!".into() + }, + Value::U16 { value: 111 } + ) + ] + }, + r#"{"type": "Map", "key_value_kind": "String", "value_value_kind": "U16", "entries": [[{"type":"String","value":"Hello, World!"},{"type":"U16","value":"919"}],[{"type":"String","value":"World, Hello!"},{"type":"U16","value":"111"}]]}"#, + r#"Map("Hello, World!", 919u16, "World, Hello!", 111u16)"#, + ), + ValueRepresentationTestVector::new( + Value::Tuple { + elements: vec![Value::I64 { value: 19 }, Value::I8 { value: 19 }], + }, + r#"{"type": "Tuple", "elements": [{"type": "I64", "value": "19"}, {"type": "I8", "value": "19"}]}"#, + "Tuple(19i64, 19i8)" + ), + // ============================ + // Decimal And Precise Decimal + // ============================ + ValueRepresentationTestVector::new( + Value::Decimal { + value: "1923319912.102221313".parse().unwrap(), + }, + r#"{"type": "Decimal", "value": "1923319912.102221313"}"#, + r#"Decimal("1923319912.102221313")"#, + ), + ValueRepresentationTestVector::new( + Value::PreciseDecimal { + value: "1923319912.102221313".parse().unwrap(), + }, + r#"{"type": "PreciseDecimal", "value": "1923319912.102221313"}"#, + r#"PreciseDecimal("1923319912.102221313")"#, + ), + // ============== + // Address Types + // ============== + ValueRepresentationTestVector::new( + Value::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0xf2, + address: scrypto::prelude::ComponentAddress::Account([0; 26]), + }, + }, + r#"{"type": "ComponentAddress", "address": "account_sim1qvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqg5cu7q"}"#, + r#"ComponentAddress("account_sim1qvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqg5cu7q")"#, + ), + ValueRepresentationTestVector::new( + Value::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: scrypto::prelude::ResourceAddress::Normal([0; 26]), + }, + }, + r#"{"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}"#, + r#"ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety")"#, + ), + ValueRepresentationTestVector::new( + Value::PackageAddress { + address: NetworkAwarePackageAddress { + network_id: 0xf2, + address: scrypto::prelude::PackageAddress::Normal([0; 26]), + }, + }, + r#"{"type": "PackageAddress", "address": "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq"}"#, + r#"PackageAddress("package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq")"#, + ), + ValueRepresentationTestVector::new( + Value::SystemAddress { + address: NetworkAwareSystemAddress { + network_id: 0xf2, + address: scrypto::prelude::SystemAddress::EpochManager([0; 26]), + }, + }, + r#"{"type": "SystemAddress", "address": "system_sim1qsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsglvqq"}"#, + r#"SystemAddress("system_sim1qsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsglvqq")"#, + ), + // ============== + // Cryptographic + // ============== + ValueRepresentationTestVector::new( + Value::Hash { value: "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824".parse().unwrap() }, + r#"{"type": "Hash", "value": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"}"#, + r#"Hash("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824")"#, + ), + ValueRepresentationTestVector::new( + Value::EcdsaSecp256k1PublicKey { public_key: "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798".parse().unwrap() }, + r#"{"type": "EcdsaSecp256k1PublicKey", "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"}"#, + r#"EcdsaSecp256k1PublicKey("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")"#, + ), + ValueRepresentationTestVector::new( + Value::EddsaEd25519PublicKey { public_key: "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29".parse().unwrap() }, + r#"{"type": "EddsaEd25519PublicKey", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29"}"#, + r#"EddsaEd25519PublicKey("4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29")"#, + ), + ValueRepresentationTestVector::new( + Value::EcdsaSecp256k1Signature { signature: "0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e".parse().unwrap() }, + r#"{"type": "EcdsaSecp256k1Signature", "signature": "0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e"}"#, + r#"EcdsaSecp256k1Signature("0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e")"#, + ), + ValueRepresentationTestVector::new( + Value::EddsaEd25519Signature { signature: "ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09".parse().unwrap() }, + r#"{"type": "EddsaEd25519Signature", "signature": "ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09"}"#, + r#"EddsaEd25519Signature("ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09")"#, + ), + + // =================== + // Buckets and Proofs + // =================== + ValueRepresentationTestVector::new( + Value::Bucket { identifier: BucketId(TransientIdentifier::String("xrd_bucket".into())) }, + r#"{"type": "Bucket", "identifier": "xrd_bucket"}"#, + r#"Bucket("xrd_bucket")"# + ), + ValueRepresentationTestVector::new( + Value::Bucket { identifier: BucketId(TransientIdentifier::U32(28)) }, + r#"{"type": "Bucket", "identifier": 28}"#, + r#"Bucket(28u32)"# + ), + ValueRepresentationTestVector::new( + Value::Proof { identifier: ProofId(TransientIdentifier::String("xrd_proof".into())) }, + r#"{"type": "Proof", "identifier": "xrd_proof"}"#, + r#"Proof("xrd_proof")"# + ), + ValueRepresentationTestVector::new( + Value::Proof { identifier: ProofId(TransientIdentifier::U32(28)) }, + r#"{"type": "Proof", "identifier": 28}"#, + r#"Proof(28u32)"# + ), + + // ========================== + // Non Fungible Id & Address + // ========================== + + ValueRepresentationTestVector::new( + Value::NonFungibleId { value: scrypto::prelude::NonFungibleId::Number(114441894733333) }, + r#"{"type": "NonFungibleId", "variant": "Number", "value": "114441894733333"}"#, + r#"NonFungibleId(114441894733333u64)"#, + ), + ValueRepresentationTestVector::new( + Value::NonFungibleId { value: scrypto::prelude::NonFungibleId::UUID(11444189334733333) }, + r#"{"type": "NonFungibleId", "variant": "UUID", "value": "11444189334733333"}"#, + r#"NonFungibleId(11444189334733333u128)"#, + ), + ValueRepresentationTestVector::new( + Value::NonFungibleId { value: scrypto::prelude::NonFungibleId::String("hello_world".into()) }, + r#"{"type": "NonFungibleId", "variant": "String", "value": "hello_world"}"#, + r#"NonFungibleId("hello_world")"#, + ), + ValueRepresentationTestVector::new( + Value::NonFungibleId { value: scrypto::prelude::NonFungibleId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) }, + r#"{"type": "NonFungibleId", "variant": "Bytes", "value": "10a23101"}"#, + r#"NonFungibleId(Bytes("10a23101"))"#, + ), + + ValueRepresentationTestVector::new( + Value::NonFungibleAddress { + address: radix_engine_toolkit::model::NonFungibleAddress { + resource_address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: scrypto::prelude::ResourceAddress::Normal([0; 26]), + }, + non_fungible_id: scrypto::prelude::NonFungibleId::Number(114441894733333) + } + }, + r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "variant": "Number", "value": "114441894733333"}}"#, + r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", 114441894733333u64)"#, + ), + ValueRepresentationTestVector::new( + Value::NonFungibleAddress { + address: radix_engine_toolkit::model::NonFungibleAddress { + resource_address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: scrypto::prelude::ResourceAddress::Normal([0; 26]), + }, + non_fungible_id: scrypto::prelude::NonFungibleId::UUID(11444189334733333) + } + }, + r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "variant": "UUID", "value": "11444189334733333"}}"#, + r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", 11444189334733333u128)"#, + ), + ValueRepresentationTestVector::new( + Value::NonFungibleAddress { + address: radix_engine_toolkit::model::NonFungibleAddress { + resource_address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: scrypto::prelude::ResourceAddress::Normal([0; 26]), + }, + non_fungible_id: scrypto::prelude::NonFungibleId::String("hello_world".into()) + } + }, + r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "variant": "String", "value": "hello_world"}}"#, + r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", "hello_world")"#, + ), + ValueRepresentationTestVector::new( + Value::NonFungibleAddress { + address: radix_engine_toolkit::model::NonFungibleAddress { + resource_address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: scrypto::prelude::ResourceAddress::Normal([0; 26]), + }, + non_fungible_id: scrypto::prelude::NonFungibleId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) + } + }, + r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "variant": "Bytes", "value": "10a23101"}}"#, + r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", Bytes("10a23101"))"#, + ), + + // ================= + // Other Misc Types + // ================= + ValueRepresentationTestVector::new( + Value::Blob { hash: ManifestBlobRef("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824".parse().unwrap()) }, + r#"{"type": "Blob", "hash": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"}"#, + r#"Blob("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824")"# + ), + ValueRepresentationTestVector::new( + Value::Expression { value: scrypto::runtime::ManifestExpression::EntireAuthZone }, + r#"{"type": "Expression", "value": "ENTIRE_AUTH_ZONE"}"#, + r#"Expression("ENTIRE_AUTH_ZONE")"# + ), + ValueRepresentationTestVector::new( + Value::Expression { value: scrypto::runtime::ManifestExpression::EntireWorktop }, + r#"{"type": "Expression", "value": "ENTIRE_WORKTOP"}"#, + r#"Expression("ENTIRE_WORKTOP")"# + ), + ValueRepresentationTestVector::new( + Value::Bytes { value: vec![0x12, 0x19, 0x12, 0x20, 0x8] }, + r#"{"type": "Bytes", "value": "1219122008"}"#, + r#"Bytes("1219122008")"# + ), + ]; +} diff --git a/radix-engine-toolkit/tests/value.rs b/radix-engine-toolkit/tests/value.rs new file mode 100644 index 00000000..1c355b83 --- /dev/null +++ b/radix-engine-toolkit/tests/value.rs @@ -0,0 +1,267 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +mod test_vector; + +use radix_engine_toolkit::{ + model::{Bech32Coder, TransientIdentifier, Value}, + BucketId, ProofId, +}; +use scrypto::prelude::*; +pub use test_vector::*; + +#[test] +fn serialized_values_match_expected() { + // Checking that the serialization of values matches + for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { + // Act + let expected_serialized_value: serde_json::Value = + serde_json::from_str(&test_vector.json_representation) + .expect("Failed to deserialize trusted value"); + let serialized_value = + serde_json::to_value(&test_vector.value).expect("Failed to serialize trusted value"); + + // Assert + assert_eq!(expected_serialized_value, serialized_value,); + } +} + +#[test] +fn deserialized_values_match_expected() { + // Checking that the deserialization of values matches + for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { + // Act + let expected_value = &test_vector.value; + let deserialized_value = serde_json::from_str(&test_vector.json_representation) + .expect("Deserialization failed!"); + + // Assert + assert_eq!(*expected_value, deserialized_value) + } +} + +/// # Background +/// +/// There are methods on the [Value] model to convert a [Value] to a +/// [radix_transaction::manifest::ast::Value]. This conversion requires some domain-specific +/// knowledge as to what the abstract syntax tree looks like. +/// +/// As an example for a `ResourceAddress("some_address")` in the manifest we know that this is an +/// `AstValue::ResourceAddress` with a `AstValue::String` inside of it. Because of the +/// domain-knowledge requirement for this conversion, the transaction compiler could have a change +/// made to it which changes the expected structure of the AST. There would likely be no +/// compile-time errors as the AST uses an unstructured value model. +/// +/// # Purpose +/// +/// The purpose of this test is to check that the conversion of a [Value] to a +/// [radix_transaction::manifest::ast::Value] matches the abstract syntax tree that is generated by +/// the transaction compiler for an equivalent manifest string value. +#[test] +fn value_ast_conversions_match_that_produced_by_transaction_compiler() { + // Arrange + let bech32_coder = Bech32Coder::new(0xf2); + + // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest + for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { + let expected_ast_value = test_vector.manifest_representation_as_ast_value(); + + // Act + let ast_value = test_vector + .value + .to_ast_value(&bech32_coder) + .expect("Value -> AstValue conversion of trusted value failed"); + + // Assert + assert_eq!(expected_ast_value, ast_value) + } +} + +#[test] +fn value_scrypto_value_conversion_match_that_produced_by_transaction_compiler() { + // Arrange + let bech32_coder = Bech32Coder::new(0xf2); + + for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { + match test_vector.value { + Value::Map { .. } => { + println!("") + } + _ => {} + } + println!("{:?}", test_vector.value.kind()); + + // This test will fail (as expected) for buckets and proofs with string TransientIdentifiers. So, + // we skip those tests + if let Value::Bucket { ref identifier } = test_vector.value { + if let TransientIdentifier::String(..) = identifier.0 { + continue; + } + } else if let Value::Proof { ref identifier } = test_vector.value { + if let TransientIdentifier::String(..) = identifier.0 { + continue; + } + } + + let expected_scrypto_value = + test_vector.manifest_representation_as_scrypto_value(&bech32_coder); + + // Act + let scrypto_value = test_vector + .value + .to_scrypto_value() + .expect("Failed to convert a trusted value to a scrypto value"); + + // Assert + assert_eq!(scrypto_value, expected_scrypto_value); + } +} + +#[test] +fn no_information_is_lost_when_converting_value_to_ast_value_and_back() { + // Arrange + let bech32_coder = Bech32Coder::new(0xf2); + + // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest + for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { + let expected_value = &test_vector.value; + + // Act + let ast_value = Value::from_ast_value( + &test_vector + .value + .to_ast_value(&bech32_coder) + .expect("Value -> AstValue conversion of trusted value failed"), + &bech32_coder, + ) + .expect("AstValue -> Value for a trusted value failed"); + + // Assert + assert_eq!(*expected_value, ast_value) + } +} + +#[test] +fn no_information_is_lost_when_converting_value_to_scrypto_value_and_back() { + // Arrange + let bech32_coder = Bech32Coder::new(0xf2); + + // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest + for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { + match test_vector.value { + Value::Bucket { + identifier: BucketId(TransientIdentifier::String(..)), + } + | Value::Proof { + identifier: ProofId(TransientIdentifier::String(..)), + } + | Value::Some { .. } + | Value::None + | Value::Ok { .. } + | Value::Err { .. } => continue, + _ => {} + } + + let expected_value = &test_vector.value; + + // Act + let mut ast_value = Value::from_scrypto_value( + &test_vector + .value + .to_scrypto_value() + .expect("Value -> AstValue conversion of trusted value failed"), + bech32_coder.network_id(), + ); + ast_value.alias(); + + // Assert + assert_eq!(*expected_value, ast_value) + } +} + +#[test] +fn sbor_encoding_value_yields_expected_result() { + // Arrange + let bech32_coder = Bech32Coder::new(0xf2); + + // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest + for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { + // This test will fail (as expected) for buckets and proofs with string TransientIdentifiers. So, + // we skip those tests + match test_vector.value { + Value::Bucket { + identifier: BucketId(TransientIdentifier::String(..)), + } + | Value::Proof { + identifier: ProofId(TransientIdentifier::String(..)), + } + | Value::Some { .. } + | Value::None + | Value::Ok { .. } + | Value::Err { .. } => continue, + _ => {} + } + + let expected_encoding = + scrypto_encode(&test_vector.manifest_representation_as_scrypto_value(&bech32_coder)) + .unwrap(); + + // Act + let encoded_value = test_vector.value.encode().unwrap(); + + // Assert + assert_eq!(*expected_encoding, encoded_value) + } +} + +#[test] +fn sbor_decoding_value_yields_expected_result() { + // Arrange + let bech32_coder = Bech32Coder::new(0xf2); + + // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest + for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { + // This test will fail (as expected) for buckets and proofs with string TransientIdentifiers. So, + // we skip those tests + match test_vector.value { + Value::Bucket { + identifier: BucketId(TransientIdentifier::String(..)), + } + | Value::Proof { + identifier: ProofId(TransientIdentifier::String(..)), + } + | Value::Some { .. } + | Value::None + | Value::Ok { .. } + | Value::Err { .. } => continue, + _ => {} + } + + let expected_value = &test_vector.value; + let encoded_value = + scrypto_encode(&test_vector.manifest_representation_as_scrypto_value(&bech32_coder)) + .unwrap(); + + // Act + let mut value = + Value::decode(&encoded_value, 0xf2).expect("Failed to SBOR decode trusted value"); + value.alias(); + + // Assert + assert_eq!(*expected_value, value) + } +} From 2544a80630a8ae92c46454ad852a5c8be17a6bbf Mon Sep 17 00:00:00 2001 From: Omar Date: Tue, 17 Jan 2023 02:34:09 +0300 Subject: [PATCH 048/110] WASM wrapper test --- native-json-interface/Cargo.toml | 7 + .../tests/toolkit_wasm_wrapper.rs | 569 ++++++++++++++++++ 2 files changed, 576 insertions(+) create mode 100644 native-json-interface/tests/toolkit_wasm_wrapper.rs diff --git a/native-json-interface/Cargo.toml b/native-json-interface/Cargo.toml index e240cf2d..4b8aa53f 100644 --- a/native-json-interface/Cargo.toml +++ b/native-json-interface/Cargo.toml @@ -9,6 +9,13 @@ radix_engine_toolkit = { path = "../radix-engine-toolkit" } 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 diff --git a/native-json-interface/tests/toolkit_wasm_wrapper.rs b/native-json-interface/tests/toolkit_wasm_wrapper.rs new file mode 100644 index 00000000..65c5b082 --- /dev/null +++ b/native-json-interface/tests/toolkit_wasm_wrapper.rs @@ -0,0 +1,569 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT 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"]) + .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(_))) + } +} From 5e7fe17f6628d4be5abe2296a0973593330c3cc0 Mon Sep 17 00:00:00 2001 From: Omar Date: Tue, 17 Jan 2023 03:34:19 +0300 Subject: [PATCH 049/110] Example generation --- .../src/request/information.rs | 2 +- .../tests/test_vector/manifest/worktop.rtm | 28 + radix-engine-toolkit/tests/value.rs | 12 +- schema/Cargo.toml | 6 + schema/out/examples/examples.md | 2568 +++++++++++++++++ ...compile_notarized_transaction_request.json | 168 +- ...ile_signed_transaction_intent_request.json | 168 +- .../compile_transaction_intent_request.json | 168 +- .../out/schema/convert_manifest_request.json | 168 +- .../out/schema/convert_manifest_response.json | 168 +- ...ompile_notarized_transaction_response.json | 168 +- ...le_signed_transaction_intent_response.json | 168 +- ...decompile_transaction_intent_response.json | 168 +- ...e_unknown_transaction_intent_response.json | 168 +- ...rive_virtual_account_address_response.json | 93 +- schema/out/schema/information_request.json | 2 +- .../known_entity_addresses_response.json | 93 +- schema/out/schema/sbor_decode_response.json | 172 +- schema/out/schema/sbor_encode_request.json | 172 +- schema/src/examples.rs | 420 +++ schema/src/examples_builder.rs | 101 + schema/src/main.rs | 46 +- 22 files changed, 4605 insertions(+), 622 deletions(-) create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/worktop.rtm create mode 100644 schema/out/examples/examples.md create mode 100644 schema/src/examples.rs create mode 100644 schema/src/examples_builder.rs diff --git a/radix-engine-toolkit/src/request/information.rs b/radix-engine-toolkit/src/request/information.rs index c489e867..159634c7 100644 --- a/radix-engine-toolkit/src/request/information.rs +++ b/radix-engine-toolkit/src/request/information.rs @@ -28,7 +28,7 @@ use serializable::serializable; /// 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; +pub struct InformationRequest {} /// The response from [`InformationRequest`]s #[serializable] diff --git a/radix-engine-toolkit/tests/test_vector/manifest/worktop.rtm b/radix-engine-toolkit/tests/test_vector/manifest/worktop.rtm new file mode 100644 index 00000000..f97e87a7 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/worktop.rtm @@ -0,0 +1,28 @@ +# Withdraw XRD from account +CALL_METHOD ComponentAddress("account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064") "withdraw_by_amount" Decimal("5.0") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"); + +# Buy GUM with XRD +TAKE_FROM_WORKTOP_BY_AMOUNT Decimal("2.0") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("xrd"); +CALL_METHOD ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") "buy_gumball" Bucket("xrd"); +ASSERT_WORKTOP_CONTAINS_BY_AMOUNT Decimal("3.0") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"); +ASSERT_WORKTOP_CONTAINS ResourceAddress("resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6"); + +# Create a proof from bucket, clone it and drop both +TAKE_FROM_WORKTOP ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("some_xrd"); +CREATE_PROOF_FROM_BUCKET Bucket("some_xrd") Proof("proof1"); +CLONE_PROOF Proof("proof1") Proof("proof2"); +DROP_PROOF Proof("proof1"); +DROP_PROOF Proof("proof2"); + +# Create a proof from account and drop it +CALL_METHOD ComponentAddress("account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064") "create_proof_by_amount" Decimal("5.0") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"); +POP_FROM_AUTH_ZONE Proof("proof3"); +DROP_PROOF Proof("proof3"); + +# Return a bucket to worktop +RETURN_TO_WORKTOP Bucket("some_xrd"); +TAKE_FROM_WORKTOP_BY_IDS Array(NonFungibleId(1u64)) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("nfts"); + +# Drop all proofs, cancel all buckets and move resources to account +DROP_ALL_PROOFS; +CALL_METHOD ComponentAddress("account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064") "deposit_batch" Expression("ENTIRE_WORKTOP"); diff --git a/radix-engine-toolkit/tests/value.rs b/radix-engine-toolkit/tests/value.rs index 1c355b83..d1f7c911 100644 --- a/radix-engine-toolkit/tests/value.rs +++ b/radix-engine-toolkit/tests/value.rs @@ -105,8 +105,8 @@ fn value_scrypto_value_conversion_match_that_produced_by_transaction_compiler() } println!("{:?}", test_vector.value.kind()); - // This test will fail (as expected) for buckets and proofs with string TransientIdentifiers. So, - // we skip those tests + // This test will fail (as expected) for buckets and proofs with string + // TransientIdentifiers. So, we skip those tests if let Value::Bucket { ref identifier } = test_vector.value { if let TransientIdentifier::String(..) = identifier.0 { continue; @@ -200,8 +200,8 @@ fn sbor_encoding_value_yields_expected_result() { // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { - // This test will fail (as expected) for buckets and proofs with string TransientIdentifiers. So, - // we skip those tests + // This test will fail (as expected) for buckets and proofs with string + // TransientIdentifiers. So, we skip those tests match test_vector.value { Value::Bucket { identifier: BucketId(TransientIdentifier::String(..)), @@ -235,8 +235,8 @@ fn sbor_decoding_value_yields_expected_result() { // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { - // This test will fail (as expected) for buckets and proofs with string TransientIdentifiers. So, - // we skip those tests + // This test will fail (as expected) for buckets and proofs with string + // TransientIdentifiers. So, we skip those tests match test_vector.value { Value::Bucket { identifier: BucketId(TransientIdentifier::String(..)), diff --git a/schema/Cargo.toml b/schema/Cargo.toml index 0ca0d21d..2accc7e2 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -14,3 +14,9 @@ serde_json = "1.0.91" 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 = "develop-9055c6" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6" } \ No newline at end of file diff --git a/schema/out/examples/examples.md b/schema/out/examples/examples.md new file mode 100644 index 00000000..7d943c02 --- /dev/null +++ b/schema/out/examples/examples.md @@ -0,0 +1,2568 @@ +# 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. | +| Request Type | `InformationRequest` | +| Response Type | `InformationResponse` | + +
+ Request Example + +```json +{} +``` +
+ +
+ Response Example + +```json +{ + "package_version": "0.7.0" +} +``` +
+ +## 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. | +| 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": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "withdraw_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "2" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket1" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + }, + "method_name": { + "type": "String", + "value": "buy_gumball" + }, + "arguments": [ + { + "type": "Bucket", + "identifier": "bucket1" + } + ] + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "3" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "CREATE_PROOF_FROM_BUCKET", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "CLONE_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "create_proof_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "RETURN_TO_WORKTOP", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "ids": [ + { + "type": "NonFungibleId", + "variant": "Number", + "value": "1" + } + ], + "into_bucket": { + "type": "Bucket", + "identifier": "bucket3" + } + }, + { + "instruction": "DROP_ALL_PROOFS" + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "deposit_batch" + }, + "arguments": [ + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ] + } + ] + }, + "blobs": [] + } +} +``` +
+ +
+ Response Example + +```json +{ + "instructions": { + "type": "Parsed", + "value": [ + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "withdraw_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "2" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket1" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + }, + "method_name": { + "type": "String", + "value": "buy_gumball" + }, + "arguments": [ + { + "type": "Bucket", + "identifier": "bucket1" + } + ] + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "3" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "CREATE_PROOF_FROM_BUCKET", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "CLONE_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "create_proof_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "RETURN_TO_WORKTOP", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "ids": [ + { + "type": "NonFungibleId", + "variant": "Number", + "value": "1" + } + ], + "into_bucket": { + "type": "Bucket", + "identifier": "bucket3" + } + }, + { + "instruction": "DROP_ALL_PROOFS" + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "deposit_batch" + }, + "arguments": [ + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ] + } + ] + }, + "blobs": [] +} +``` +
+ +## 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. | +| 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": { + "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": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "withdraw_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "2" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket1" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + }, + "method_name": { + "type": "String", + "value": "buy_gumball" + }, + "arguments": [ + { + "type": "Bucket", + "identifier": "bucket1" + } + ] + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "3" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "CREATE_PROOF_FROM_BUCKET", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "CLONE_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "create_proof_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "RETURN_TO_WORKTOP", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "ids": [ + { + "type": "NonFungibleId", + "variant": "Number", + "value": "1" + } + ], + "into_bucket": { + "type": "Bucket", + "identifier": "bucket3" + } + }, + { + "instruction": "DROP_ALL_PROOFS" + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "deposit_batch" + }, + "arguments": [ + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ] + } + ] + }, + "blobs": [] + } +} +``` +
+ +
+ Response Example + +```json +{ + "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221123038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042303810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" +} +``` +
+ +## 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. | +| Request Type | `DecompileTransactionIntentRequest` | +| Response Type | `DecompileTransactionIntentResponse` | + +
+ Request Example + +```json +{ + "instructions_output_kind": "Parsed", + "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221123038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042303810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" +} +``` +
+ +
+ 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": { + "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": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "withdraw_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "2" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket1" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + }, + "method_name": { + "type": "String", + "value": "buy_gumball" + }, + "arguments": [ + { + "type": "Bucket", + "identifier": "bucket1" + } + ] + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "3" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "CREATE_PROOF_FROM_BUCKET", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "CLONE_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "create_proof_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "RETURN_TO_WORKTOP", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "ids": [ + { + "type": "NonFungibleId", + "variant": "Number", + "value": "1" + } + ], + "into_bucket": { + "type": "Bucket", + "identifier": "bucket3" + } + }, + { + "instruction": "DROP_ALL_PROOFS" + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "deposit_batch" + }, + "arguments": [ + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ] + } + ] + }, + "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. | +| 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": { + "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": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "withdraw_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "2" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket1" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + }, + "method_name": { + "type": "String", + "value": "buy_gumball" + }, + "arguments": [ + { + "type": "Bucket", + "identifier": "bucket1" + } + ] + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "3" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "CREATE_PROOF_FROM_BUCKET", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "CLONE_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "create_proof_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "RETURN_TO_WORKTOP", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "ids": [ + { + "type": "NonFungibleId", + "variant": "Number", + "value": "1" + } + ], + "into_bucket": { + "type": "Bucket", + "identifier": "bucket3" + } + }, + { + "instruction": "DROP_ALL_PROOFS" + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "deposit_batch" + }, + "arguments": [ + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ] + } + ] + }, + "blobs": [] + } + }, + "intent_signatures": [ + { + "EcdsaSecp256k1": { + "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" + } + }, + { + "EcdsaSecp256k1": { + "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" + } + }, + { + "EcdsaSecp256k1": { + "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" + } + }, + { + "EddsaEd25519": { + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", + "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" + } + }, + { + "EddsaEd25519": { + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" + } + }, + { + "EddsaEd25519": { + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" + } + } + ] +} +``` +
+ +
+ Response Example + +```json +{ + "compiled_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221123038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042303810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf10001b20004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c0001b201607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b97290102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b430fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c492080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e5070102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb49df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" +} +``` +
+ +## 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. | +| Request Type | `DecompileSignedTransactionIntentRequest` | +| Response Type | `DecompileSignedTransactionIntentResponse` | + +
+ Request Example + +```json +{ + "instructions_output_kind": "Parsed", + "compiled_signed_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221123038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042303810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf10001b20004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c0001b201607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b97290102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b430fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c492080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e5070102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb49df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" +} +``` +
+ +
+ 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": { + "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": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "withdraw_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "2" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket1" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + }, + "method_name": { + "type": "String", + "value": "buy_gumball" + }, + "arguments": [ + { + "type": "Bucket", + "identifier": "bucket1" + } + ] + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "3" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "CREATE_PROOF_FROM_BUCKET", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "CLONE_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "create_proof_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "RETURN_TO_WORKTOP", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "ids": [ + { + "type": "NonFungibleId", + "variant": "Number", + "value": "1" + } + ], + "into_bucket": { + "type": "Bucket", + "identifier": "bucket3" + } + }, + { + "instruction": "DROP_ALL_PROOFS" + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "deposit_batch" + }, + "arguments": [ + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ] + } + ] + }, + "blobs": [] + } + }, + "intent_signatures": [ + { + "EcdsaSecp256k1": { + "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" + } + }, + { + "EcdsaSecp256k1": { + "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" + } + }, + { + "EcdsaSecp256k1": { + "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" + } + }, + { + "EddsaEd25519": { + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", + "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" + } + }, + { + "EddsaEd25519": { + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" + } + }, + { + "EddsaEd25519": { + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" + } + } + ] +} +``` +
+ +## 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 | +| 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": { + "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": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "withdraw_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "2" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket1" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + }, + "method_name": { + "type": "String", + "value": "buy_gumball" + }, + "arguments": [ + { + "type": "Bucket", + "identifier": "bucket1" + } + ] + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "3" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "CREATE_PROOF_FROM_BUCKET", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "CLONE_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "create_proof_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "RETURN_TO_WORKTOP", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "ids": [ + { + "type": "NonFungibleId", + "variant": "Number", + "value": "1" + } + ], + "into_bucket": { + "type": "Bucket", + "identifier": "bucket3" + } + }, + { + "instruction": "DROP_ALL_PROOFS" + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "deposit_batch" + }, + "arguments": [ + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ] + } + ] + }, + "blobs": [] + } + }, + "intent_signatures": [ + { + "EcdsaSecp256k1": { + "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" + } + }, + { + "EcdsaSecp256k1": { + "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" + } + }, + { + "EcdsaSecp256k1": { + "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" + } + }, + { + "EddsaEd25519": { + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", + "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" + } + }, + { + "EddsaEd25519": { + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" + } + }, + { + "EddsaEd25519": { + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" + } + } + ] + }, + "notary_signature": { + "curve": "EcdsaSecp256k1", + "signature": { + "signature": "00c2daa118a8541ef384a38f431a3dde3bf023463e49c124dca7631e2083495dbc1a50968d3bd21033c2bdf0b22c64d56c84a3f1c8e61b847e0208c694627835ef" + } + } +} +``` +
+ +
+ Response Example + +```json +{ + "compiled_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221123038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042303810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf10001b20004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c0001b201607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b97290102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b430fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c492080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e5070102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb49df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409220001b200c2daa118a8541ef384a38f431a3dde3bf023463e49c124dca7631e2083495dbc1a50968d3bd21033c2bdf0b22c64d56c84a3f1c8e61b847e0208c694627835ef" +} +``` +
+ +## 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. | +| Request Type | `DecompileNotarizedTransactionRequest` | +| Response Type | `DecompileNotarizedTransactionResponse` | + +
+ Request Example + +```json +{ + "instructions_output_kind": "Parsed", + "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221123038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042303810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf10001b20004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c0001b201607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b97290102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b430fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c492080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e5070102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb49df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409220001b200c2daa118a8541ef384a38f431a3dde3bf023463e49c124dca7631e2083495dbc1a50968d3bd21033c2bdf0b22c64d56c84a3f1c8e61b847e0208c694627835ef" +} +``` +
+ +
+ 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": { + "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": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "withdraw_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "2" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket1" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + }, + "method_name": { + "type": "String", + "value": "buy_gumball" + }, + "arguments": [ + { + "type": "Bucket", + "identifier": "bucket1" + } + ] + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "amount": { + "type": "Decimal", + "value": "3" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "into_bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "CREATE_PROOF_FROM_BUCKET", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "CLONE_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + }, + "into_proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof1" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof2" + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "create_proof_by_amount" + }, + "arguments": [ + { + "type": "Decimal", + "value": "5" + }, + { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + } + ] + }, + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": "proof3" + } + }, + { + "instruction": "RETURN_TO_WORKTOP", + "bucket": { + "type": "Bucket", + "identifier": "bucket2" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + }, + "ids": [ + { + "type": "NonFungibleId", + "variant": "Number", + "value": "1" + } + ], + "into_bucket": { + "type": "Bucket", + "identifier": "bucket3" + } + }, + { + "instruction": "DROP_ALL_PROOFS" + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + }, + "method_name": { + "type": "String", + "value": "deposit_batch" + }, + "arguments": [ + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ] + } + ] + }, + "blobs": [] + } + }, + "intent_signatures": [ + { + "EcdsaSecp256k1": { + "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" + } + }, + { + "EcdsaSecp256k1": { + "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" + } + }, + { + "EcdsaSecp256k1": { + "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" + } + }, + { + "EddsaEd25519": { + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", + "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" + } + }, + { + "EddsaEd25519": { + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" + } + }, + { + "EddsaEd25519": { + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" + } + } + ] + }, + "notary_signature": { + "curve": "EcdsaSecp256k1", + "signature": { + "signature": "00c2daa118a8541ef384a38f431a3dde3bf023463e49c124dca7631e2083495dbc1a50968d3bd21033c2bdf0b22c64d56c84a3f1c8e61b847e0208c694627835ef" + } + } +} +``` +
+ +## 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. | +| Request Type | `EncodeAddressRequest` | +| Response Type | `EncodeAddressResponse` | + +
+ Request Example + +```json +{ + "address_bytes": "000000000000000000000000000000000000000000000000000002", + "network_id": "242" +} +``` +
+ +
+ Response Example + +```json +{ + "type": "ResourceAddress", + "address": { + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqd60rqz" + } +} +``` +
+ +## 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. | +| Request Type | `DecodeAddressRequest` | +| Response Type | `DecodeAddressResponse` | + +
+ Request Example + +```json +{ + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqd60rqz" +} +``` +
+ +
+ Response Example + +```json +{ + "network_id": "242", + "network_name": "simulator", + "entity_type": "Resource", + "data": "000000000000000000000000000000000000000000000000000002", + "hrp": "resource_sim" +} +``` +
+ +## Sbor Encode + +| Function Name | `sbor_encode` | +| ----------------- | :----------------- | +| JNI Function Name | `Java_RadixEngineToolkitFFI_sborEncode` | +| Functionality | This function takes in a Value and encodes it in SBOR. | +| Request Type | `SborEncodeRequest` | +| Response Type | `SborEncodeResponse` | + +
+ Request Example + +```json +{ + "type": "Tuple", + "elements": [ + { + "type": "Decimal", + "value": "10" + }, + { + "type": "PreciseDecimal", + "value": "10" + }, + { + "type": "String", + "value": "Hello World!" + }, + { + "type": "Tuple", + "elements": [ + { + "type": "Decimal", + "value": "10" + }, + { + "type": "PreciseDecimal", + "value": "10" + }, + { + "type": "String", + "value": "Hello World!" + }, + { + "type": "Tuple", + "elements": [ + { + "type": "Decimal", + "value": "10" + }, + { + "type": "PreciseDecimal", + "value": "10" + }, + { + "type": "String", + "value": "Hello World!" + }, + { + "type": "Tuple", + "elements": [ + { + "type": "Decimal", + "value": "10" + }, + { + "type": "PreciseDecimal", + "value": "10" + }, + { + "type": "String", + "value": "Hello World!" + }, + { + "type": "Array", + "element_kind": "Decimal", + "elements": [ + { + "type": "Decimal", + "value": "20" + }, + { + "type": "Decimal", + "value": "100" + }, + { + "type": "Decimal", + "value": "192.31" + } + ] + } + ] + } + ] + } + ] + } + ] +} +``` +
+ +
+ Response Example + +```json +{ + "encoded_value": "5c2104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c642120b5030000d01309468e15010000000000000000000000000000000000000000000000000010632d5ec76b05000000000000000000000000000000000000000000000000005f13195ed66c0a0000000000000000000000000000000000000000000000" +} +``` +
+ +## Sbor Decode + +| Function Name | `sbor_decode` | +| ----------------- | :----------------- | +| JNI Function Name | `Java_RadixEngineToolkitFFI_sborDecode` | +| Functionality | This function takes in a hex string and attemps to decode it into a Value. | +| Request Type | `SborDecodeRequest` | +| Response Type | `SborDecodeResponse` | + +
+ Request Example + +```json +{ + "encoded_value": "5c2104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c642120b5030000d01309468e15010000000000000000000000000000000000000000000000000010632d5ec76b05000000000000000000000000000000000000000000000000005f13195ed66c0a0000000000000000000000000000000000000000000000", + "network_id": "242" +} +``` +
+ +
+ Response Example + +```json +{ + "type": "Tuple", + "elements": [ + { + "type": "Decimal", + "value": "10" + }, + { + "type": "PreciseDecimal", + "value": "10" + }, + { + "type": "String", + "value": "Hello World!" + }, + { + "type": "Tuple", + "elements": [ + { + "type": "Decimal", + "value": "10" + }, + { + "type": "PreciseDecimal", + "value": "10" + }, + { + "type": "String", + "value": "Hello World!" + }, + { + "type": "Tuple", + "elements": [ + { + "type": "Decimal", + "value": "10" + }, + { + "type": "PreciseDecimal", + "value": "10" + }, + { + "type": "String", + "value": "Hello World!" + }, + { + "type": "Tuple", + "elements": [ + { + "type": "Decimal", + "value": "10" + }, + { + "type": "PreciseDecimal", + "value": "10" + }, + { + "type": "String", + "value": "Hello World!" + }, + { + "type": "Array", + "element_kind": "Decimal", + "elements": [ + { + "type": "Decimal", + "value": "20" + }, + { + "type": "Decimal", + "value": "100" + }, + { + "type": "Decimal", + "value": "192.31" + } + ] + } + ] + } + ] + } + ] + } + ] +} +``` +
+ +## 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. | +| Request Type | `DeriveVirtualAccountAddressRequest` | +| Response Type | `DeriveVirtualAccountAddressResponse` | + +
+ Request Example + +```json +{ + "network_id": "242", + "public_key": { + "curve": "EcdsaSecp256k1", + "public_key": { + "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" + } + } +} +``` +
+ +
+ Response Example + +```json +{ + "virtual_account_address": { + "type": "ComponentAddress", + "address": "account_sim1qcpveqrdmh7kw0vefxrzjw5e0fgw3sgdj4zrh66jkphqqc62xd" + } +} +``` +
+ +## Statically Validate Transaction + +| Function Name | `statically_validate_transaction` | +| ----------------- | :----------------- | +| JNI Function Name | `Java_RadixEngineToolkitFFI_staticallyValidateTransaction` | +| Functionality | Performs static validation on the given notarized transaction. | +| Request Type | `StaticallyValidateTransactionRequest` | +| Response Type | `StaticallyValidateTransactionResponse` | + +
+ Request Example + +```json +{ + "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221123038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042303810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf10001b20004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c0001b201607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b97290102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b430fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c492080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e5070102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb49df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409220001b200d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1", + "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). | +| Request Type | `KnownEntityAddressesRequest` | +| Response Type | `KnownEntityAddressesResponse` | + +
+ Request Example + +```json +{ + "network_id": "1" +} +``` +
+ +
+ Response Example + +```json +{ + "faucet_component_address": { + "type": "ComponentAddress", + "address": "component_rdx1qg5fe67sukas49kytvluq72uederg3wfehh0rjfl2qsqe58dfx" + }, + "faucet_package_address": { + "type": "PackageAddress", + "address": "package_rdx1qx9kvuz62mchk6kzwexh4exqerlxreps0h5656mf2a5sevg7d6" + }, + "account_package_address": { + "type": "PackageAddress", + "address": "package_rdx1q8fqfj78l4t4vdlp5rgh6ghke6x7pg8vxmdam6g2y98su3qsvj" + }, + "xrd_resource_address": { + "type": "ResourceAddress", + "address": "resource_rdx1qpflrslzpnprsd27ywcpmm9mqzncshp2sfjg6h59n48say30yn" + }, + "system_token_resource_address": { + "type": "ResourceAddress", + "address": "resource_rdx1qrkx57yl3uxamygyyh370at22450nh2xxgrxmm2dyzqq9pl8qr" + }, + "ecdsa_secp256k1_token_resource_address": { + "type": "ResourceAddress", + "address": "resource_rdx1qzms24rcrka4kdr2pn9zsw8jcghdvw6q2tux0rzq6gfs44jzu2" + }, + "eddsa_ed25519_token_resource_address": { + "type": "ResourceAddress", + "address": "resource_rdx1qraaz8dkuk98cyl0sjhch5ekt3thklgaxpssclgxs0gqdd62m6" + }, + "epoch_manager_system_address": { + "type": "SystemAddress", + "address": "system_rdx1qjjmc80hcmx4sfnyahhg4varselspsrm8gsuqa8dmsxs6y0ppl" + }, + "clock_system_address": { + "type": "SystemAddress", + "address": "system_rdx1q53eheg7mcydm2xms66n397udu8awhhj0xz6c99dtnmsq5rme9" + } +} +``` +
diff --git a/schema/out/schema/compile_notarized_transaction_request.json b/schema/out/schema/compile_notarized_transaction_request.json index 329cf48a..ebedfa07 100644 --- a/schema/out/schema/compile_notarized_transaction_request.json +++ b/schema/out/schema/compile_notarized_transaction_request.json @@ -917,7 +917,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -925,7 +925,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1107,7 +1107,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1282,7 +1282,7 @@ } }, { - "description": "An instruction to mind non-fungibles of a resource", + "description": "An instruction to mint non-fungibles of a resource", "type": "object", "required": [ "entries", @@ -1314,6 +1314,39 @@ } } }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, { "description": "An instruction to create a new fungible resource.", "type": "object", @@ -1340,7 +1373,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1348,7 +1381,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1391,7 +1424,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1442,7 +1475,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1450,7 +1483,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1493,7 +1526,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1825,7 +1858,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -1943,6 +1980,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -2345,26 +2433,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2376,7 +2444,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -2539,6 +2607,19 @@ } ] }, + "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. This type does not itself require a discriminator.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + ] + }, "ValueKind": { "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", @@ -2560,6 +2641,7 @@ "None", "Ok", "Err", + "Map", "Array", "Tuple", "Decimal", @@ -2637,26 +2719,6 @@ "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2668,7 +2730,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { diff --git a/schema/out/schema/compile_signed_transaction_intent_request.json b/schema/out/schema/compile_signed_transaction_intent_request.json index eb62cf60..04462aa4 100644 --- a/schema/out/schema/compile_signed_transaction_intent_request.json +++ b/schema/out/schema/compile_signed_transaction_intent_request.json @@ -891,7 +891,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -899,7 +899,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1081,7 +1081,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1256,7 +1256,7 @@ } }, { - "description": "An instruction to mind non-fungibles of a resource", + "description": "An instruction to mint non-fungibles of a resource", "type": "object", "required": [ "entries", @@ -1288,6 +1288,39 @@ } } }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, { "description": "An instruction to create a new fungible resource.", "type": "object", @@ -1314,7 +1347,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1322,7 +1355,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1365,7 +1398,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1416,7 +1449,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1424,7 +1457,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1467,7 +1500,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1799,7 +1832,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -1917,6 +1954,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -2319,26 +2407,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2350,7 +2418,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -2513,6 +2581,19 @@ } ] }, + "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. This type does not itself require a discriminator.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + ] + }, "ValueKind": { "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", @@ -2534,6 +2615,7 @@ "None", "Ok", "Err", + "Map", "Array", "Tuple", "Decimal", @@ -2611,26 +2693,6 @@ "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2642,7 +2704,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { diff --git a/schema/out/schema/compile_transaction_intent_request.json b/schema/out/schema/compile_transaction_intent_request.json index 39675e18..7be06f0b 100644 --- a/schema/out/schema/compile_transaction_intent_request.json +++ b/schema/out/schema/compile_transaction_intent_request.json @@ -866,7 +866,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -874,7 +874,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1056,7 +1056,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1231,7 +1231,7 @@ } }, { - "description": "An instruction to mind non-fungibles of a resource", + "description": "An instruction to mint non-fungibles of a resource", "type": "object", "required": [ "entries", @@ -1263,6 +1263,39 @@ } } }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, { "description": "An instruction to create a new fungible resource.", "type": "object", @@ -1289,7 +1322,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1297,7 +1330,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1340,7 +1373,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1391,7 +1424,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1399,7 +1432,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1442,7 +1475,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1774,7 +1807,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -1892,6 +1929,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -2294,26 +2382,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2325,7 +2393,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -2488,6 +2556,19 @@ } ] }, + "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. This type does not itself require a discriminator.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + ] + }, "ValueKind": { "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", @@ -2509,6 +2590,7 @@ "None", "Ok", "Err", + "Map", "Array", "Tuple", "Decimal", @@ -2586,26 +2668,6 @@ "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2617,7 +2679,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { diff --git a/schema/out/schema/convert_manifest_request.json b/schema/out/schema/convert_manifest_request.json index 2891aedb..6ce9ea00 100644 --- a/schema/out/schema/convert_manifest_request.json +++ b/schema/out/schema/convert_manifest_request.json @@ -758,7 +758,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -766,7 +766,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -948,7 +948,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1123,7 +1123,7 @@ } }, { - "description": "An instruction to mind non-fungibles of a resource", + "description": "An instruction to mint non-fungibles of a resource", "type": "object", "required": [ "entries", @@ -1155,6 +1155,39 @@ } } }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, { "description": "An instruction to create a new fungible resource.", "type": "object", @@ -1181,7 +1214,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1189,7 +1222,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1232,7 +1265,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1283,7 +1316,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1291,7 +1324,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1334,7 +1367,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1666,7 +1699,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -1784,6 +1821,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -2186,26 +2274,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2217,7 +2285,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -2380,6 +2448,19 @@ } ] }, + "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. This type does not itself require a discriminator.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + ] + }, "ValueKind": { "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", @@ -2401,6 +2482,7 @@ "None", "Ok", "Err", + "Map", "Array", "Tuple", "Decimal", @@ -2478,26 +2560,6 @@ "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2509,7 +2571,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { diff --git a/schema/out/schema/convert_manifest_response.json b/schema/out/schema/convert_manifest_response.json index 4f358ba3..9e7a2b0a 100644 --- a/schema/out/schema/convert_manifest_response.json +++ b/schema/out/schema/convert_manifest_response.json @@ -718,7 +718,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -726,7 +726,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -908,7 +908,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1083,7 +1083,7 @@ } }, { - "description": "An instruction to mind non-fungibles of a resource", + "description": "An instruction to mint non-fungibles of a resource", "type": "object", "required": [ "entries", @@ -1115,6 +1115,39 @@ } } }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, { "description": "An instruction to create a new fungible resource.", "type": "object", @@ -1141,7 +1174,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1149,7 +1182,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1192,7 +1225,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1243,7 +1276,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1251,7 +1284,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1294,7 +1327,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1626,7 +1659,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -1744,6 +1781,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -2146,26 +2234,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2177,7 +2245,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -2340,6 +2408,19 @@ } ] }, + "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. This type does not itself require a discriminator.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + ] + }, "ValueKind": { "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", @@ -2361,6 +2442,7 @@ "None", "Ok", "Err", + "Map", "Array", "Tuple", "Decimal", @@ -2438,26 +2520,6 @@ "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2469,7 +2531,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { diff --git a/schema/out/schema/decompile_notarized_transaction_response.json b/schema/out/schema/decompile_notarized_transaction_response.json index 7c8ae6ee..74ac555b 100644 --- a/schema/out/schema/decompile_notarized_transaction_response.json +++ b/schema/out/schema/decompile_notarized_transaction_response.json @@ -917,7 +917,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -925,7 +925,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1107,7 +1107,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1282,7 +1282,7 @@ } }, { - "description": "An instruction to mind non-fungibles of a resource", + "description": "An instruction to mint non-fungibles of a resource", "type": "object", "required": [ "entries", @@ -1314,6 +1314,39 @@ } } }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, { "description": "An instruction to create a new fungible resource.", "type": "object", @@ -1340,7 +1373,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1348,7 +1381,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1391,7 +1424,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1442,7 +1475,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1450,7 +1483,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1493,7 +1526,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1825,7 +1858,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -1943,6 +1980,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -2345,26 +2433,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2376,7 +2444,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -2539,6 +2607,19 @@ } ] }, + "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. This type does not itself require a discriminator.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + ] + }, "ValueKind": { "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", @@ -2560,6 +2641,7 @@ "None", "Ok", "Err", + "Map", "Array", "Tuple", "Decimal", @@ -2637,26 +2719,6 @@ "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2668,7 +2730,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { diff --git a/schema/out/schema/decompile_signed_transaction_intent_response.json b/schema/out/schema/decompile_signed_transaction_intent_response.json index c4b122d9..6bda8eb1 100644 --- a/schema/out/schema/decompile_signed_transaction_intent_response.json +++ b/schema/out/schema/decompile_signed_transaction_intent_response.json @@ -891,7 +891,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -899,7 +899,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1081,7 +1081,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1256,7 +1256,7 @@ } }, { - "description": "An instruction to mind non-fungibles of a resource", + "description": "An instruction to mint non-fungibles of a resource", "type": "object", "required": [ "entries", @@ -1288,6 +1288,39 @@ } } }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, { "description": "An instruction to create a new fungible resource.", "type": "object", @@ -1314,7 +1347,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1322,7 +1355,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1365,7 +1398,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1416,7 +1449,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1424,7 +1457,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1467,7 +1500,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1799,7 +1832,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -1917,6 +1954,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -2319,26 +2407,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2350,7 +2418,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -2513,6 +2581,19 @@ } ] }, + "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. This type does not itself require a discriminator.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + ] + }, "ValueKind": { "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", @@ -2534,6 +2615,7 @@ "None", "Ok", "Err", + "Map", "Array", "Tuple", "Decimal", @@ -2611,26 +2693,6 @@ "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2642,7 +2704,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { diff --git a/schema/out/schema/decompile_transaction_intent_response.json b/schema/out/schema/decompile_transaction_intent_response.json index 763f57b3..d51f4e92 100644 --- a/schema/out/schema/decompile_transaction_intent_response.json +++ b/schema/out/schema/decompile_transaction_intent_response.json @@ -866,7 +866,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -874,7 +874,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1056,7 +1056,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1231,7 +1231,7 @@ } }, { - "description": "An instruction to mind non-fungibles of a resource", + "description": "An instruction to mint non-fungibles of a resource", "type": "object", "required": [ "entries", @@ -1263,6 +1263,39 @@ } } }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, { "description": "An instruction to create a new fungible resource.", "type": "object", @@ -1289,7 +1322,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1297,7 +1330,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1340,7 +1373,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1391,7 +1424,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1399,7 +1432,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1442,7 +1475,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1774,7 +1807,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -1892,6 +1929,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -2294,26 +2382,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2325,7 +2393,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -2488,6 +2556,19 @@ } ] }, + "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. This type does not itself require a discriminator.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + ] + }, "ValueKind": { "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", @@ -2509,6 +2590,7 @@ "None", "Ok", "Err", + "Map", "Array", "Tuple", "Decimal", @@ -2586,26 +2668,6 @@ "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2617,7 +2679,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { diff --git a/schema/out/schema/decompile_unknown_transaction_intent_response.json b/schema/out/schema/decompile_unknown_transaction_intent_response.json index 02ad616d..1f3776df 100644 --- a/schema/out/schema/decompile_unknown_transaction_intent_response.json +++ b/schema/out/schema/decompile_unknown_transaction_intent_response.json @@ -880,7 +880,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -888,7 +888,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1070,7 +1070,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1245,7 +1245,7 @@ } }, { - "description": "An instruction to mind non-fungibles of a resource", + "description": "An instruction to mint non-fungibles of a resource", "type": "object", "required": [ "entries", @@ -1277,6 +1277,39 @@ } } }, + { + "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.", + "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 Value model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, { "description": "An instruction to create a new fungible resource.", "type": "object", @@ -1303,7 +1336,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1311,7 +1344,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1354,7 +1387,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1405,7 +1438,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1413,7 +1446,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1456,7 +1489,7 @@ ] }, "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 `Array` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1788,7 +1821,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -1906,6 +1943,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -2308,26 +2396,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2339,7 +2407,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -2502,6 +2570,19 @@ } ] }, + "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. This type does not itself require a discriminator.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + ] + }, "ValueKind": { "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", @@ -2523,6 +2604,7 @@ "None", "Ok", "Err", + "Map", "Array", "Tuple", "Decimal", @@ -2600,26 +2682,6 @@ "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -2631,7 +2693,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { diff --git a/schema/out/schema/derive_virtual_account_address_response.json b/schema/out/schema/derive_virtual_account_address_response.json index 875e8146..878fe7e9 100644 --- a/schema/out/schema/derive_virtual_account_address_response.json +++ b/schema/out/schema/derive_virtual_account_address_response.json @@ -274,7 +274,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -392,6 +396,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -794,26 +849,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -825,7 +860,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -988,6 +1023,19 @@ } ] }, + "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. This type does not itself require a discriminator.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + ] + }, "ValueKind": { "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", @@ -1009,6 +1057,7 @@ "None", "Ok", "Err", + "Map", "Array", "Tuple", "Decimal", diff --git a/schema/out/schema/information_request.json b/schema/out/schema/information_request.json index 3699af53..50e96273 100644 --- a/schema/out/schema/information_request.json +++ b/schema/out/schema/information_request.json @@ -2,5 +2,5 @@ "$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": "null" + "type": "object" } \ 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 index 47df2a85..9bc78c6f 100644 --- a/schema/out/schema/known_entity_addresses_response.json +++ b/schema/out/schema/known_entity_addresses_response.json @@ -346,7 +346,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -464,6 +468,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -866,26 +921,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -897,7 +932,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -1060,6 +1095,19 @@ } ] }, + "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. This type does not itself require a discriminator.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + ] + }, "ValueKind": { "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", @@ -1081,6 +1129,7 @@ "None", "Ok", "Err", + "Map", "Array", "Tuple", "Decimal", diff --git a/schema/out/schema/sbor_decode_response.json b/schema/out/schema/sbor_decode_response.json index f271b29f..1cbe504d 100644 --- a/schema/out/schema/sbor_decode_response.json +++ b/schema/out/schema/sbor_decode_response.json @@ -258,7 +258,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -376,6 +380,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -778,26 +833,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -809,7 +844,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -972,6 +1007,19 @@ } ], "definitions": { + "EnumDiscriminator": { + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number. This type does not itself require a discriminator.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + ] + }, "Value": { "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", "oneOf": [ @@ -1229,7 +1277,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -1347,6 +1399,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -1749,26 +1852,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -1780,7 +1863,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -1964,6 +2047,7 @@ "None", "Ok", "Err", + "Map", "Array", "Tuple", "Decimal", diff --git a/schema/out/schema/sbor_encode_request.json b/schema/out/schema/sbor_encode_request.json index c82dbf8a..369e70e6 100644 --- a/schema/out/schema/sbor_encode_request.json +++ b/schema/out/schema/sbor_encode_request.json @@ -258,7 +258,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -376,6 +380,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -778,26 +833,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -809,7 +844,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -972,6 +1007,19 @@ } ], "definitions": { + "EnumDiscriminator": { + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number. This type does not itself require a discriminator.", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + ] + }, "Value": { "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", "oneOf": [ @@ -1229,7 +1277,11 @@ }, "variant": { "description": "The name of the variant of the enum", - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] }, "fields": { "description": "Optional fields that the enum may have", @@ -1347,6 +1399,57 @@ } } }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, { "description": "An array of elements where elements could be of different kinds.", "type": "object", @@ -1749,26 +1852,6 @@ "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "oneOf": [ - { - "description": "A 32 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", @@ -1780,7 +1863,7 @@ "variant": { "type": "string", "enum": [ - "U64" + "Number" ] }, "value": { @@ -1964,6 +2047,7 @@ "None", "Ok", "Err", + "Map", "Array", "Tuple", "Decimal", diff --git a/schema/src/examples.rs b/schema/src/examples.rs new file mode 100644 index 00000000..fdba4022 --- /dev/null +++ b/schema/src/examples.rs @@ -0,0 +1,420 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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::manifest::compile; +use native_transaction::model::{NotarizedTransaction, TransactionHeader}; +use native_transaction::signing::{EcdsaSecp256k1PrivateKey, EddsaEd25519PrivateKey}; +use radix_engine_toolkit::*; + +use scrypto::{prelude::*, radix_engine_interface::node::NetworkDefinition}; +use serde::Serialize; + +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/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().clone().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() -> Value { + Value::Tuple { + elements: vec![ + Value::Decimal { value: dec!("10") }, + Value::PreciseDecimal { value: pdec!("10") }, + Value::String { + value: "Hello World!".into(), + }, + Value::Tuple { + elements: vec![ + Value::Decimal { value: dec!("10") }, + Value::PreciseDecimal { value: pdec!("10") }, + Value::String { + value: "Hello World!".into(), + }, + Value::Tuple { + elements: vec![ + Value::Decimal { value: dec!("10") }, + Value::PreciseDecimal { value: pdec!("10") }, + Value::String { + value: "Hello World!".into(), + }, + Value::Tuple { + elements: vec![ + Value::Decimal { value: dec!("10") }, + Value::PreciseDecimal { value: pdec!("10") }, + Value::String { + value: "Hello World!".into(), + }, + Value::Array { + element_kind: ValueKind::Decimal, + elements: vec![ + Value::Decimal { value: dec!("20") }, + Value::Decimal { value: dec!("100") }, + Value::Decimal { + value: dec!("192.31"), + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], + } +} + +pub struct Example { + pub request_type_name: String, + pub response_type_name: String, + pub request_description: String, + pub request: String, + pub response: String, +} + +pub trait ExampleData +where + Self: Handler, + I: Serialize + Clone, + O: Serialize + Clone, +{ + fn description() -> String; + + fn example_request() -> I; + + 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 to_example() -> Example { + let request = Self::example_request(); + let response = Self::fulfill(request.clone()).unwrap(); + Example { + request_type_name: Self::request_type_name(), + response_type_name: Self::response_type_name(), + request_description: Self::description(), + 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 {} + } +} + +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::TransactionManifest::from_native_manifest( + ¬arized_intent().signed_intent.intent.manifest.clone(), + InstructionKind::Parsed, + &bec32_coder, + ) + .unwrap(), + instructions_output_kind: radix_engine_toolkit::model::InstructionKind::Parsed, + 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::TransactionIntent::from_native_transaction_intent( + ¬arized_intent().signed_intent.intent.clone(), + 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 = + scrypto_encode(¬arized_intent().signed_intent.intent).unwrap(); + DecompileTransactionIntentRequest { + compiled_intent: compiled_transaction_intent, + instructions_output_kind: radix_engine_toolkit::model::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::SignedTransactionIntent::from_native_signed_transaction_intent(¬arized_intent() + .signed_intent + .clone(), 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 = + scrypto_encode(¬arized_intent().signed_intent).unwrap(); + DecompileSignedTransactionIntentRequest { + compiled_signed_intent: compiled_transaction_intent, + instructions_output_kind: radix_engine_toolkit::model::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::NotarizedTransaction::from_native_notarized_transaction_intent(¬arized_intent() + .clone(), 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 = scrypto_encode(¬arized_intent()).unwrap(); + DecompileNotarizedTransactionRequest { + compiled_notarized_intent: compiled_transaction_intent, + instructions_output_kind: radix_engine_toolkit::model::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 = scrypto_encode(¬arized_intent()).unwrap(); + DecompileUnknownTransactionIntentRequest { + compiled_unknown_intent: compiled_transaction_intent, + instructions_output_kind: radix_engine_toolkit::model::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_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqd60rqz".into(), + } + } +} + +impl ExampleData for SborEncodeHandler { + fn description() -> String { + r#"This function takes in a Value and encodes it in SBOR."#.to_owned() + } + + fn example_request() -> SborEncodeRequest { + SborEncodeRequest { + value: value().clone(), + } + } +} + +impl ExampleData for SborDecodeHandler { + fn description() -> String { + r#"This function takes in a hex string and attemps to decode it into a Value."#.to_owned() + } + + fn example_request() -> SborDecodeRequest { + SborDecodeRequest { + encoded_value: (value()).encode().unwrap(), + 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 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().clone(); + transaction.notary_signature = + transaction.signed_intent.intent_signatures[0].signature(); + transaction + }; + + let compiled_transaction_intent = scrypto_encode(¬arized_transaction).unwrap(); + let validation_config = native_transaction::validation::ValidationConfig::default(0xf2); + StaticallyValidateTransactionRequest { + compiled_notarized_intent: compiled_transaction_intent, + validation_config, + } + } +} diff --git a/schema/src/examples_builder.rs b/schema/src/examples_builder.rs new file mode 100644 index 00000000..fe3f70c3 --- /dev/null +++ b/schema/src/examples_builder.rs @@ -0,0 +1,101 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +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, + O: Serialize + Clone, + { + 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 | {} | +| Request Type | `{}` | +| Response Type | `{}` | + +
+ Request Example + +```json +{} +``` +
+ +
+ Response Example + +```json +{} +``` +
+"#, + title, + function_name, + jni_function_name, + example.request_description.replace('\n', "
"), + 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 index 214f7a4e..9cb7bbb3 100644 --- a/schema/src/main.rs +++ b/schema/src/main.rs @@ -15,10 +15,15 @@ // 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 { @@ -44,10 +49,11 @@ macro_rules! generate_schema_hashmap { } fn main() { - generate_json_schema().expect("Failed to generate schema") + generate_json_schema().expect("Failed to generate schema"); + generate_request_examples().expect("Failed to generate request examples"); } -pub fn generate_json_schema() -> Result<(), JsonSchemaGenerationError> { +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!( @@ -107,9 +113,9 @@ pub fn generate_json_schema() -> Result<(), JsonSchemaGenerationError> { }; serde_json::to_string_pretty(schema) - .map_err(JsonSchemaGenerationError::SerializationError) + .map_err(GenerationError::SerializationError) .and_then(|schema_string| { - std::fs::write(path, schema_string).map_err(JsonSchemaGenerationError::IOError) + std::fs::write(path, schema_string).map_err(GenerationError::IOError) }) }) .collect::, _>>()?; @@ -117,8 +123,38 @@ pub fn generate_json_schema() -> Result<(), JsonSchemaGenerationError> { 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::() + .build(); + + let path = { + let mut path = PathBuf::from("."); + path.push("out"); + path.push("examples"); + path.push("examples.md"); + path + }; + + std::fs::write(path, examples).map_err(GenerationError::IOError) +} + #[derive(Debug)] -pub enum JsonSchemaGenerationError { +pub enum GenerationError { IOError(std::io::Error), SerializationError(serde_json::Error), } From e391bf7db95ddc65613323907754804cf1225b06 Mon Sep 17 00:00:00 2001 From: Omar Date: Tue, 17 Jan 2023 13:11:40 +0300 Subject: [PATCH 050/110] github CI --- .github/workflows/build.yml | 176 ++++++++++++++++++ .github/workflows/publish-native-packages.yml | 59 ++++++ .github/workflows/release.yml | 24 +++ .github/workflows/test.yml | 41 ++++ README.md | 107 +++++++++++ build-specific.sh | 2 +- build.sh | 4 +- images/library-overview.png | Bin 0 -> 58356 bytes images/v0.5.0-transaction-model.png | Bin 0 -> 342403 bytes .../RadixDlt.RadixEngineToolkit.Native.nuspec | 26 +++ ...RadixDlt.RadixEngineToolkit.Native.targets | 60 ++++++ 11 files changed, 496 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/publish-native-packages.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml create mode 100644 README.md create mode 100644 images/library-overview.png create mode 100644 images/v0.5.0-transaction-model.png create mode 100644 interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec create mode 100644 interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..f4ed1ec0 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,176 @@ +name: Build + +on: + pull_request: + branches: + - develop + - main + +jobs: + build: + runs-on: macos-latest + continue-on-error: true + strategy: + matrix: + build-target: + # native-json-interface Crate + - crate: native-json-interface + 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" + - crate: native-json-interface + target-triple: x86_64-apple-darwin + custom-linker: "" + custom-compiler: /usr/local/opt/llvm/bin/clang + custom-archiver: /usr/local/opt/llvm/bin/llvm-ar + features: "jni" + - crate: native-json-interface + target-triple: aarch64-apple-ios + custom-linker: "" + custom-compiler: /usr/local/opt/llvm/bin/clang + custom-archiver: /usr/local/opt/llvm/bin/llvm-ar + features: "jni" + - crate: native-json-interface + target-triple: aarch64-apple-ios-sim + custom-linker: "" + custom-compiler: /usr/local/opt/llvm/bin/clang + custom-archiver: /usr/local/opt/llvm/bin/llvm-ar + features: "jni" + - crate: native-json-interface + target-triple: x86_64-pc-windows-gnu + custom-linker: "" + custom-compiler: x86_64-w64-mingw32-gcc + custom-archiver: x86_64-w64-mingw32-ar + features: "jni" + - crate: native-json-interface + target-triple: x86_64-unknown-linux-gnu + custom-linker: x86_64-unknown-linux-gnu-gcc + custom-compiler: /usr/local/opt/llvm/bin/clang + custom-archiver: /usr/local/opt/llvm/bin/llvm-ar + features: "jni" + - crate: native-json-interface + target-triple: aarch64-unknown-linux-gnu + custom-linker: aarch64-unknown-linux-gnu-gcc + custom-compiler: aarch64-unknown-linux-gnu-gcc + custom-archiver: aarch64-unknown-linux-gnu-gcc-ar + features: "jni" + - crate: native-json-interface + target-triple: i686-unknown-linux-gnu + custom-linker: i686-unknown-linux-gnu-gcc + custom-compiler: i686-unknown-linux-gnu-gcc + custom-archiver: i686-unknown-linux-gnu-gcc-ar + features: "jni" + - crate: native-json-interface + target-triple: wasm32-unknown-unknown + custom-linker: "" + custom-compiler: /usr/local/opt/llvm/bin/clang + custom-archiver: /usr/local/opt/llvm/bin/llvm-ar + features: "jni" + - crate: native-json-interface + target-triple: aarch64-linux-android + custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang + custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang + custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ar + features: "jni" + - crate: native-json-interface + target-triple: armv7-linux-androideabi + custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang + custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang + custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar + features: "jni" + - crate: native-json-interface + target-triple: i686-linux-android + custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang + custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang + custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android-ar + features: "jni" + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Build Dependencies + run: | + brew tap SergioBenitez/osxct + brew install llvm + brew install x86_64-unknown-linux-gnu + brew install mingw-w64 + + brew tap messense/macos-cross-toolchains + brew install aarch64-unknown-linux-gnu + brew install i686-unknown-linux-gnu + + wget https://dl.google.com/android/repository/android-ndk-r22b-darwin-x86_64.zip + unzip -q android-ndk-r22b-darwin-x86_64.zip -d $HOME/android-ndk + + - name: Install Rust Toolchain + run: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup.sh + chmod +x rustup.sh + ./rustup.sh -y + rustup update + rustup toolchain install nightly + + - name: Install Rust Targets + run: | + rustup target install ${{ matrix.build-target.target-triple }} + rustup +nightly target install ${{ matrix.build-target.target-triple }} + rustup component add rust-src --toolchain nightly-x86_64-apple-darwin + + - name: Building Toolkit + run: | + ( + export CURRENT_DIRECTORY=$(pwd) + export CRATE_PATH="$CURRENT_DIRECTORY/${{matrix.build-target.crate}}" + cd $CRATE_PATH + + export LINKER_ENVIRONMENT_VARIABLE="CARGO_TARGET_"$(echo ${{ matrix.build-target.target-triple }} | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g')"_LINKER" + if [ ! -z "${{ matrix.build-target.custom-linker }}" ] + 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 }} + export features=$${{ matrix.build-target.features }} + export features=${features:="default"} + + cargo build \ + --target ${{ matrix.build-target.target-triple }} \ + --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 + + 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" + + ( + 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 + ) + ) + + - name: Upload Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: "${{ matrix.build-target.crate }}-${{ matrix.build-target.target-triple }}.tar.gz" + path: "./${{matrix.build-target.crate}}/target/${{ matrix.build-target.target-triple }}/release/${{ matrix.build-target.target-triple }}.tar.gz" diff --git a/.github/workflows/publish-native-packages.yml b/.github/workflows/publish-native-packages.yml new file mode 100644 index 00000000..63685357 --- /dev/null +++ b/.github/workflows/publish-native-packages.yml @@ -0,0 +1,59 @@ +name: Publish Native Packages + +on: + push: + branches: + - main + - develop + +jobs: + publish-csharp-nuget: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Download Artifacts + uses: dawidd6/action-download-artifact@v2 + with: + github_token: ${{secrets.GITHUB_TOKEN}} + workflow: build.yml + path: artifacts + - name: Extract Artifacts + working-directory: artifacts + run: | + mkdir native + + for d in native-json-interface-*.tar.gz; do + mv ./$d/* ./native/ + done + + cd native + + for f in *.tar.gz; do + fn=`echo "$f" | cut -d'.' -f 1` + mkdir "$fn" + tar -xvzf "$f" --directory="$fn"; + done + - name: Setup .NET SDK + uses: actions/setup-dotnet@5a3fa01c67e60dba8f95e2878436c7151c4b5f01 + with: + dotnet-version: 7.0.x + - name: Configure Version # TODO missing support for stable packages on releases (where VERSION_SUFFIX should not be appended) + run: | + GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's/\//-/g') + GIT_COMMIT=$(git log -1 --format=%h ) + CORE_VERSION=$(cat radix-engine-toolkit-core/Cargo.toml| grep -e '^version' | cut -d'"' -f 2) + VERSION_SUFFIX=${GIT_BRANCH}-${GIT_COMMIT} + VERSION=${CORE_VERSION}-${VERSION_SUFFIX} + + sed -i "s/\(\)[^<>]*\(<\/version>\)/\1$VERSION\2/g" interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec + + 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 }} + + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..5d56f571 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,24 @@ +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 new file mode 100644 index 00000000..b16bfe09 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,41 @@ +name: Test + +on: + pull_request: + branches: + - betanet + - develop + - main + push: + branches: + - betanet + - develop + - main + +env: + CARGO_TERM_COLOR: always + +jobs: + rust-test: + runs-on: ubuntu-latest + strategy: + matrix: + crate: [ native-json-interface, radix-engine-toolkit ] + + 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 + + generated-request-examples-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Checking Generated Requests + run: | + cd docs-examples-generator + mv request-examples.md old-request-examples.md + cargo run + cmp --quiet request-examples.md old-request-examples.md && exit 0 || exit 1 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..609cc5ee --- /dev/null +++ b/README.md @@ -0,0 +1,107 @@ +# Radix Engine Toolkit + +The Radix Engine Toolkit is a multiplatform library written in Rust 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. + +## Background + +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) + +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. + +Similarly, when the notary wishes to notarize a signed transaction intent, they compile the signed transaction intent (as explained above, they encode the signed transaction intent in SBOR), sign that, and with that they have the notary signature required to form a complete transaction. + +## Motivation + +As can be seen in the [background section](#background), the process of creating a transaction requires that a client is able to encode different parts of a transaction in SBOR to later allow for these parts to be signed or notarized. This means that a client would need to, at a minimum, have an SBOR encoder for compiling transactions, and perhaps a decoder if the decompilation of transactions is desirable. + +The main implementation of SBOR is written in Rust. That being said, clients wishing to integrate their services with Radix (or just build and send programmatic transactions) could have clients written in a any programming languages. It is unrealistic to expect that clients would write, test, and maintain their own SBOR implementation in their client language as this is a high implementation burden on the client and is a non-trivial and potentially security critical task. + +In addition to the building of transactions requiring SBOR for compilation, certain clients might wish to decompile transactions to figure out what the transaction does, who has signed it, contents of the header, or for other application-specific reasons. Much like compilation, without an SBOR implementation available to the client, the decompilation of transactions would be impossible. + +Therefore, there is a strong need to **not** rewrite SBOR in different languages, instead, to reuse and re-utilize the original SBOR implementation for clients written in any language. This library achieves that by being fully written in rust; thus leveraging the ability to use the original SBOR implementation, and being compilable to different targets to allow it to run on different operating systems with different processor architectures. In addition to that, this library may be compiled to WASM which means that languages with easy access to a WASM runtime can utilize this library. As an example, the Radix Engine Toolkit may run in the web by utilizing web assembly. + +The choice of making the radix engine toolkit a library and not an REST API comes with a number of advantages, the first of which is that certain clients may wish to build their transactions, SBOR encode and decode their data, or Bech32 encode or decode their addresses in a trustless fashion without having to rely on a REST API where a non-negligible chance of tampering exists. Having this library as a library allows such clients to do all they need in a trustless manner without worrying about trusting an external server. + +In addition to that, using WASM instead of a docker-based solution to this problem means that the solution is very lightweight and also compatible with platforms where Docker is no an option (mostly smart phones.), thus making this library available to the largest amount of clients without any compromises. + +With the above in mind, this library allows for the following functionality to be performed in a turstless fashion: + +1. The compilation and decompilation of unsigned, signed, and notarized transaction intents. +2. The ability to convert manifests between their string and JSON representations. +3. The ability to Bech32 encode and decode addresses as needed. +4. The ability to encode and decode SBOR values as needed. +5. The ability to statically validate transactions to check for common errors and problems (currently a work in progress, although this functionality is implemented as part of certain requests in the library) + +## High Level Architecture Overview + +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) + +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 +``` diff --git a/build-specific.sh b/build-specific.sh index 279efa1a..0ba3b80b 100755 --- a/build-specific.sh +++ b/build-specific.sh @@ -22,7 +22,7 @@ # 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.: radix-engine-toolkit-native) +# 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) diff --git a/build.sh b/build.sh index 9ea16c73..e0139715 100755 --- a/build.sh +++ b/build.sh @@ -151,7 +151,7 @@ LIBRARY_NAME="lib$CLEANED_PACKAGE_NAME" # Creating an XCFramework from the Apple builds ( # The name of the crate that we are building - CRATE_NAME="radix-engine-toolkit-native" + CRATE_NAME="native-json-interface" # The path of the crate CRATE_PATH="$SCRIPT_DIR/$CRATE_NAME" @@ -199,7 +199,7 @@ BUILDS_DIRECTORY="$SCRIPT_DIR/build" [[ -d $BUILDS_DIRECTORY ]] && rm -r $BUILDS_DIRECTORY mkdir $BUILDS_DIRECTORY -for crate_name in "radix-engine-toolkit-jni" "radix-engine-toolkit-native" "radix-engine-toolkit-wasm"; +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" diff --git a/images/library-overview.png b/images/library-overview.png new file mode 100644 index 0000000000000000000000000000000000000000..3f0b21b43126f2b73b83809c87f82949238a0b0f GIT binary patch literal 58356 zcmeFYWl&sQ)&@#&2_7H`PJ(+#a19WGyF-8g!JTg0JrE$lg9dkPtg!&WgS#{YZL}ds z<8V*jnRjOHt@^6w=lwBNT}2gj`t;swuV=}#o*kv8B8QLr6c+^r1z-NHj0Oq{mNg2> z18Zzd;6Go~%94RU58O25UZYfwQ0<_g(4ol7NNIV#+t0+BdL%m&&i#a#5gQltXUhj( zb}r1|;3r8eEb`Cajy#caeG{BR_f~_L$4cwx1G3rH-O{qhL^uj+#22HBH)2S4U1i-- z_w%2=D~52-DJLkqXr|+|&)zaadLv@)8OL);)c^AHnUv*q5Wj1$eIWYV|L((q`pDYr zSv(5PfAx`6LT4H4MgKbdUp@Wjr5FawX#eHnpA(Tjz=iMzec=0VzaSZueEwgq90lix zOdzU*QqKIt|8A=&IBGeYV*j<}d5Lo*DM_vQrT^Qb0?bbM-&*m1X8*rD;(uoUKm7lH z-u{08@qa<)|A>G83o`!;GN{khOwku$628w{#NRRc@cTdW@xN3+?$33VDgFnZ;)5kW zzaY!E-png_8`hoQPi&=F^K3LWiQ=G9&!vu+gzmvVKE&T{yBGhX4mpmNY&d8vwkE?4 z0?#gx)t-bsQRjW%_HVnZv0y(Escc9rmY_?nnedOs;G?Af=etOb=q0Zs8nOTFy&Duk zf(MN(0~>9U*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Z9d_!X^KWsq=uU1QRaMxw zuzKoVIT1s@zmPDSWz;3PZ=f|xWL@Coj_&46h7r-#NUp*Cu5Qq3!!xktnAKnN@cV%G z_leKHAJ80|uPxj$C1}jlx?2YAaIk~rJSY4e0$5=8LIP&=f}EEVrzZweUH=k+=6_COUDnBhpy6QI zRp6|r8n{fn;=eM>6&k+xZ^r!3EqWTzm6`Q^=Ndv*HL()TMjAuh6|O(TOiP;>8+X=p zs`_W1{l10%yz}Pq@gL+&k+GN|YyaqE6280k7vV0OtP>&c|S6U>i;$NqfwZ!W@* zG4WG^{FMB5I$a#BI}4!Y7hNWGNR0+hO=1;8mTY<#ngV+-d%EI2xDzt}`x)7{pYvi@ zV~zA2q*g_xhsaSY3y*;?zBgCx|FIR$b-Rl@l!?2a=+(*Jg^+ycJ#iFI&vVfDcXGV%@sV3y+(&cufA7gpcjE4c-II-a-VPiFf4=^=3$>$wo<3_=ap2#! z=LNJk5f{(%Z`I8CYid_5uRoFf%X;~nhSd%O?VU7~68xwfi%_{W31;uv!)T#> s{i^Z*3E2M$*#Bv*)Bj(!){l$(uZTSKc>COQ5Adgb!{9pRn(e*+2c)!c8UO$Q literal 0 HcmV?d00001 diff --git a/images/v0.5.0-transaction-model.png b/images/v0.5.0-transaction-model.png new file mode 100644 index 0000000000000000000000000000000000000000..d26fef35232ea0ddce09a04a825b206b8104e4a0 GIT binary patch literal 342403 zcmeFZc{tQ<`v)8)ZPH2+ijZt6OZG~IgzW23gsc-|Hw>xBT4c#Kii};d8)j6PWErxr zBiq==KEp8ce&>Gfp7-~t-+kPkKYqvY9`AiS?wV?5zSnhL=XIXv=W~9p>%~0{Wu^mc z2X^h+#iXioQ+wC01EgKM7(eXW3;Yek_d4L$U33s_douAo@TRy z`>PBf6vYK%46jwz)7KVkx( z%i)NqsCFKU&e!HtWC8mEs#KwFi?c+bu37;F{D$IOU7Z{#aI9huA^Q$57eDAia9fzF z-clueL@CQBEY0}A2-M@cS}^M9x^4XG;^yYcB_RhmB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gG=03St02LJ#7 literal 0 HcmV?d00001 diff --git a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec new file mode 100644 index 00000000..b070b384 --- /dev/null +++ b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec @@ -0,0 +1,26 @@ + + + + RadixDlt.RadixEngineToolkit.Native + 0.0.0 + Radix Publishing + 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 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets new file mode 100644 index 00000000..ed525294 --- /dev/null +++ b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.targets @@ -0,0 +1,60 @@ + + + + + true + PreserveNewest + native\win-x64\radix_engine_toolkit.dll + true + false + + + + true + PreserveNewest + native\linux-x64\libradix_engine_toolkit.so + true + false + + + true + PreserveNewest + native\linux-x32\libradix_engine_toolkit.so + true + false + + + true + PreserveNewest + native\linux-arm64\libradix_engine_toolkit.so + true + false + + + + true + PreserveNewest + native\osx-x64\libradix_engine_toolkit.dylib + true + false + + + true + PreserveNewest + native\osx-arm64\libradix_engine_toolkit.dylib + true + false + + + + + + \ No newline at end of file From d8faf641c451e3684cdd809e39d99dba1e684c56 Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 18 Jan 2023 14:05:12 +0300 Subject: [PATCH 051/110] CI tests for request examples --- .github/workflows/test.yml | 12 +++++++----- .../examples/{examples.md => request-examples.md} | 0 schema/src/main.rs | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) rename schema/out/examples/{examples.md => request-examples.md} (100%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b16bfe09..db556483 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,13 +29,15 @@ jobs: - name: Run tests run: cargo test --manifest-path ./${{ matrix.crate }}/Cargo.toml --verbose - generated-request-examples-test: + schema-and-example-tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Checking Generated Requests + - name: Generating new schema and examples run: | - cd docs-examples-generator - mv request-examples.md old-request-examples.md + cd schema + mv out old-out cargo run - cmp --quiet request-examples.md old-request-examples.md && exit 0 || exit 1 \ No newline at end of file + - name: Comparing old examples to newly generated + run: | + cmp --quiet out/examples/request-examples.md out-old/examples/request-examples.md && exit 0 || exit 1 \ No newline at end of file diff --git a/schema/out/examples/examples.md b/schema/out/examples/request-examples.md similarity index 100% rename from schema/out/examples/examples.md rename to schema/out/examples/request-examples.md diff --git a/schema/src/main.rs b/schema/src/main.rs index 9cb7bbb3..bdd9a7ba 100644 --- a/schema/src/main.rs +++ b/schema/src/main.rs @@ -146,7 +146,7 @@ fn generate_request_examples() -> Result<(), GenerationError> { let mut path = PathBuf::from("."); path.push("out"); path.push("examples"); - path.push("examples.md"); + path.push("request-examples.md"); path }; From 6640665dc133e48c3e1f866e9a6eda3ad84638b2 Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 18 Jan 2023 14:09:02 +0300 Subject: [PATCH 052/110] fix CI --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index db556483..4946d866 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,6 +37,8 @@ jobs: 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: | From 3fc8962c1438625484983939fdbdaf27eef66472 Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 18 Jan 2023 14:17:42 +0300 Subject: [PATCH 053/110] Schema CI tests --- .github/workflows/test.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4946d866..39e7548f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,4 +42,10 @@ jobs: cargo run - name: Comparing old examples to newly generated run: | - cmp --quiet out/examples/request-examples.md out-old/examples/request-examples.md && exit 0 || exit 1 \ No newline at end of file + 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: | + for filename in $(find ./out/schema -type f -name "*.json" -exec basename {} \;); + do + cmp --quiet out/schema/$filename ./old-out/examples/$filename && exit 0 || exit 1 + done \ No newline at end of file From 3089f8b8465d23f4e65c203dd26273e13787f90e Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 18 Jan 2023 14:22:59 +0300 Subject: [PATCH 054/110] CI Fix --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 39e7548f..f2cbdf8d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,9 +42,11 @@ jobs: 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/examples/$filename && exit 0 || exit 1 From d015abafbdd4af2e1f393769251108c3b5b0f010 Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 18 Jan 2023 14:28:21 +0300 Subject: [PATCH 055/110] Fix CI path --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f2cbdf8d..c4cc139d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,5 +49,5 @@ jobs: cd schema for filename in $(find ./out/schema -type f -name "*.json" -exec basename {} \;); do - cmp --quiet out/schema/$filename ./old-out/examples/$filename && exit 0 || exit 1 + cmp --quiet out/schema/$filename ./old-out/schema/$filename && exit 0 || exit 1 done \ No newline at end of file From ae4bbd015665953cc9637f8a9452fe41da8d4dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=81abu=C5=9B?= Date: Wed, 18 Jan 2023 15:59:29 +0100 Subject: [PATCH 056/110] fix: Fixed publish-native-packages.yml core version lookup --- .github/workflows/publish-native-packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-native-packages.yml b/.github/workflows/publish-native-packages.yml index 63685357..11a670a3 100644 --- a/.github/workflows/publish-native-packages.yml +++ b/.github/workflows/publish-native-packages.yml @@ -42,7 +42,7 @@ jobs: run: | GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's/\//-/g') GIT_COMMIT=$(git log -1 --format=%h ) - CORE_VERSION=$(cat radix-engine-toolkit-core/Cargo.toml| grep -e '^version' | cut -d'"' -f 2) + CORE_VERSION=$(cat radix-engine-toolkit/Cargo.toml | grep -e '^version' | cut -d'"' -f 2) VERSION_SUFFIX=${GIT_BRANCH}-${GIT_COMMIT} VERSION=${CORE_VERSION}-${VERSION_SUFFIX} From 0cb1a07f96c5b8f765fda9bd0a42b39b2829c64b Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 18 Jan 2023 22:05:33 +0300 Subject: [PATCH 057/110] Fix signature and public key serialization --- .../src/model/crypto/public_key.rs | 2 +- .../src/model/crypto/signature.rs | 2 +- schema/out/examples/request-examples.md | 36 +++-------- ...compile_notarized_transaction_request.json | 64 +++++-------------- ...ile_signed_transaction_intent_request.json | 32 +++------- .../compile_transaction_intent_request.json | 32 +++------- ...ompile_notarized_transaction_response.json | 64 +++++-------------- ...le_signed_transaction_intent_response.json | 32 +++------- ...decompile_transaction_intent_response.json | 32 +++------- ...e_unknown_transaction_intent_response.json | 64 +++++-------------- ...erive_virtual_account_address_request.json | 32 +++------- 11 files changed, 99 insertions(+), 293 deletions(-) diff --git a/radix-engine-toolkit/src/model/crypto/public_key.rs b/radix-engine-toolkit/src/model/crypto/public_key.rs index 5d05e588..d81328f3 100644 --- a/radix-engine-toolkit/src/model/crypto/public_key.rs +++ b/radix-engine-toolkit/src/model/crypto/public_key.rs @@ -24,7 +24,7 @@ use serializable::serializable; /// A discriminated union of the possible public keys used by Scrypto and the Radix Engine. #[serializable] -#[serde(tag = "curve", content = "public_key")] +#[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. diff --git a/radix-engine-toolkit/src/model/crypto/signature.rs b/radix-engine-toolkit/src/model/crypto/signature.rs index d7237423..952b0a04 100644 --- a/radix-engine-toolkit/src/model/crypto/signature.rs +++ b/radix-engine-toolkit/src/model/crypto/signature.rs @@ -25,7 +25,7 @@ use serializable::serializable; /// A discriminated union of the possible cryptographic signatures used by Scrypto and the Radix /// Engine. #[serializable] -#[serde(tag = "curve", content = "signature")] +#[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 diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index 7d943c02..2126d7aa 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -491,9 +491,7 @@ This document contains examples and descriptions of the different requests and r "nonce": "34", "notary_public_key": { "curve": "EcdsaSecp256k1", - "public_key": { - "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" - } + "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" }, "notary_as_signatory": true, "cost_unit_limit": "100000000", @@ -752,9 +750,7 @@ This document contains examples and descriptions of the different requests and r "nonce": "34", "notary_public_key": { "curve": "EcdsaSecp256k1", - "public_key": { - "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" - } + "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" }, "notary_as_signatory": true, "cost_unit_limit": "100000000", @@ -993,9 +989,7 @@ This document contains examples and descriptions of the different requests and r "nonce": "34", "notary_public_key": { "curve": "EcdsaSecp256k1", - "public_key": { - "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" - } + "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" }, "notary_as_signatory": true, "cost_unit_limit": "100000000", @@ -1291,9 +1285,7 @@ This document contains examples and descriptions of the different requests and r "nonce": "34", "notary_public_key": { "curve": "EcdsaSecp256k1", - "public_key": { - "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" - } + "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" }, "notary_as_signatory": true, "cost_unit_limit": "100000000", @@ -1569,9 +1561,7 @@ This document contains examples and descriptions of the different requests and r "nonce": "34", "notary_public_key": { "curve": "EcdsaSecp256k1", - "public_key": { - "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" - } + "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" }, "notary_as_signatory": true, "cost_unit_limit": "100000000", @@ -1822,9 +1812,7 @@ This document contains examples and descriptions of the different requests and r }, "notary_signature": { "curve": "EcdsaSecp256k1", - "signature": { - "signature": "00c2daa118a8541ef384a38f431a3dde3bf023463e49c124dca7631e2083495dbc1a50968d3bd21033c2bdf0b22c64d56c84a3f1c8e61b847e0208c694627835ef" - } + "signature": "00c2daa118a8541ef384a38f431a3dde3bf023463e49c124dca7631e2083495dbc1a50968d3bd21033c2bdf0b22c64d56c84a3f1c8e61b847e0208c694627835ef" } } ``` @@ -1875,9 +1863,7 @@ This document contains examples and descriptions of the different requests and r "nonce": "34", "notary_public_key": { "curve": "EcdsaSecp256k1", - "public_key": { - "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" - } + "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" }, "notary_as_signatory": true, "cost_unit_limit": "100000000", @@ -2128,9 +2114,7 @@ This document contains examples and descriptions of the different requests and r }, "notary_signature": { "curve": "EcdsaSecp256k1", - "signature": { - "signature": "00c2daa118a8541ef384a38f431a3dde3bf023463e49c124dca7631e2083495dbc1a50968d3bd21033c2bdf0b22c64d56c84a3f1c8e61b847e0208c694627835ef" - } + "signature": "00c2daa118a8541ef384a38f431a3dde3bf023463e49c124dca7631e2083495dbc1a50968d3bd21033c2bdf0b22c64d56c84a3f1c8e61b847e0208c694627835ef" } } ``` @@ -2444,9 +2428,7 @@ This document contains examples and descriptions of the different requests and r "network_id": "242", "public_key": { "curve": "EcdsaSecp256k1", - "public_key": { - "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" - } + "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" } } ``` diff --git a/schema/out/schema/compile_notarized_transaction_request.json b/schema/out/schema/compile_notarized_transaction_request.json index ebedfa07..f6e524b9 100644 --- a/schema/out/schema/compile_notarized_transaction_request.json +++ b/schema/out/schema/compile_notarized_transaction_request.json @@ -152,18 +152,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } }, @@ -182,18 +174,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } } @@ -2881,18 +2865,10 @@ ] }, "signature": { - "type": "object", - "required": [ - "signature" - ], - "properties": { - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" } } }, @@ -2911,18 +2887,10 @@ ] }, "signature": { - "type": "object", - "required": [ - "signature" - ], - "properties": { - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" } } } diff --git a/schema/out/schema/compile_signed_transaction_intent_request.json b/schema/out/schema/compile_signed_transaction_intent_request.json index 04462aa4..dd2ff23e 100644 --- a/schema/out/schema/compile_signed_transaction_intent_request.json +++ b/schema/out/schema/compile_signed_transaction_intent_request.json @@ -126,18 +126,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } }, @@ -156,18 +148,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } } diff --git a/schema/out/schema/compile_transaction_intent_request.json b/schema/out/schema/compile_transaction_intent_request.json index 7be06f0b..ab0eb124 100644 --- a/schema/out/schema/compile_transaction_intent_request.json +++ b/schema/out/schema/compile_transaction_intent_request.json @@ -101,18 +101,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } }, @@ -131,18 +123,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } } diff --git a/schema/out/schema/decompile_notarized_transaction_response.json b/schema/out/schema/decompile_notarized_transaction_response.json index 74ac555b..8df863f1 100644 --- a/schema/out/schema/decompile_notarized_transaction_response.json +++ b/schema/out/schema/decompile_notarized_transaction_response.json @@ -152,18 +152,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } }, @@ -182,18 +174,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } } @@ -2881,18 +2865,10 @@ ] }, "signature": { - "type": "object", - "required": [ - "signature" - ], - "properties": { - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" } } }, @@ -2911,18 +2887,10 @@ ] }, "signature": { - "type": "object", - "required": [ - "signature" - ], - "properties": { - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" } } } diff --git a/schema/out/schema/decompile_signed_transaction_intent_response.json b/schema/out/schema/decompile_signed_transaction_intent_response.json index 6bda8eb1..94209330 100644 --- a/schema/out/schema/decompile_signed_transaction_intent_response.json +++ b/schema/out/schema/decompile_signed_transaction_intent_response.json @@ -126,18 +126,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } }, @@ -156,18 +148,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } } diff --git a/schema/out/schema/decompile_transaction_intent_response.json b/schema/out/schema/decompile_transaction_intent_response.json index d51f4e92..d269716c 100644 --- a/schema/out/schema/decompile_transaction_intent_response.json +++ b/schema/out/schema/decompile_transaction_intent_response.json @@ -101,18 +101,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } }, @@ -131,18 +123,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } } diff --git a/schema/out/schema/decompile_unknown_transaction_intent_response.json b/schema/out/schema/decompile_unknown_transaction_intent_response.json index 1f3776df..2786bde7 100644 --- a/schema/out/schema/decompile_unknown_transaction_intent_response.json +++ b/schema/out/schema/decompile_unknown_transaction_intent_response.json @@ -115,18 +115,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } }, @@ -145,18 +137,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } } @@ -2946,18 +2930,10 @@ ] }, "signature": { - "type": "object", - "required": [ - "signature" - ], - "properties": { - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" } } }, @@ -2976,18 +2952,10 @@ ] }, "signature": { - "type": "object", - "required": [ - "signature" - ], - "properties": { - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" } } } diff --git a/schema/out/schema/derive_virtual_account_address_request.json b/schema/out/schema/derive_virtual_account_address_request.json index cf88f218..96256eb2 100644 --- a/schema/out/schema/derive_virtual_account_address_request.json +++ b/schema/out/schema/derive_virtual_account_address_request.json @@ -41,18 +41,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } }, @@ -71,18 +63,10 @@ ] }, "public_key": { - "type": "object", - "required": [ - "public_key" - ], - "properties": { - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" } } } From fbbfea7fcbb9c9d94ef9a1e27be1afddc0a061ad Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 18 Jan 2023 22:33:13 +0300 Subject: [PATCH 058/110] minor change --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 609cc5ee..59dcd13d 100644 --- a/README.md +++ b/README.md @@ -97,8 +97,8 @@ The Radix Engine Toolkit comes with a [bash script](./build-specific.sh) to make 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`) +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: From 82e096d950fbe75444f85752088deb2834adf536 Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 19 Jan 2023 02:01:21 +0300 Subject: [PATCH 059/110] expirement with fns --- native-json-interface/src/lib.rs | 7 ++++++- .../src/model/crypto/signature_with_public_key.rs | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/native-json-interface/src/lib.rs b/native-json-interface/src/lib.rs index 0e11a379..f5d14406 100644 --- a/native-json-interface/src/lib.rs +++ b/native-json-interface/src/lib.rs @@ -98,7 +98,7 @@ pub mod jni { use radix_engine_toolkit::request::*; use serde::Serialize; - pub fn serialize_to_jstring( + pub unsafe extern "system" serialize_to_jstring( env: jni::JNIEnv, object: &T, ) -> Result { @@ -221,3 +221,8 @@ pub mod jni { as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_staticallyValidateTransaction ); } + +#[no_mangle] +pub unsafe extern "C" this_function_should_be_in_name_dump() { + +} \ No newline at end of file diff --git a/radix-engine-toolkit/src/model/crypto/signature_with_public_key.rs b/radix-engine-toolkit/src/model/crypto/signature_with_public_key.rs index 58c51efd..47109bd8 100644 --- a/radix-engine-toolkit/src/model/crypto/signature_with_public_key.rs +++ b/radix-engine-toolkit/src/model/crypto/signature_with_public_key.rs @@ -25,6 +25,7 @@ use serializable::serializable; /// 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 EcdsaSecp256k1 { From 078b567231ec2f464814b4d2aaf85a6daea08360 Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 19 Jan 2023 02:03:38 +0300 Subject: [PATCH 060/110] Update schema and examples --- schema/out/examples/request-examples.md | 144 ++++++++---------- ...compile_notarized_transaction_request.json | 80 +++++----- ...ile_signed_transaction_intent_request.json | 80 +++++----- ...ompile_notarized_transaction_response.json | 80 +++++----- ...le_signed_transaction_intent_response.json | 80 +++++----- ...e_unknown_transaction_intent_response.json | 80 +++++----- 6 files changed, 250 insertions(+), 294 deletions(-) diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index 2126d7aa..ce7c627d 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -1204,37 +1204,31 @@ This document contains examples and descriptions of the different requests and r }, "intent_signatures": [ { - "EcdsaSecp256k1": { - "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" - } + "curve": "EcdsaSecp256k1", + "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" }, { - "EcdsaSecp256k1": { - "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" - } + "curve": "EcdsaSecp256k1", + "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" }, { - "EcdsaSecp256k1": { - "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" - } + "curve": "EcdsaSecp256k1", + "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" }, { - "EddsaEd25519": { - "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" - } + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", + "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" }, { - "EddsaEd25519": { - "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" - } + "curve": "EddsaEd25519", + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" }, { - "EddsaEd25519": { - "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" - } + "curve": "EddsaEd25519", + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" } ] } @@ -1500,37 +1494,31 @@ This document contains examples and descriptions of the different requests and r }, "intent_signatures": [ { - "EcdsaSecp256k1": { - "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" - } + "curve": "EcdsaSecp256k1", + "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" }, { - "EcdsaSecp256k1": { - "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" - } + "curve": "EcdsaSecp256k1", + "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" }, { - "EcdsaSecp256k1": { - "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" - } + "curve": "EcdsaSecp256k1", + "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" }, { - "EddsaEd25519": { - "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" - } + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", + "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" }, { - "EddsaEd25519": { - "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" - } + "curve": "EddsaEd25519", + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" }, { - "EddsaEd25519": { - "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" - } + "curve": "EddsaEd25519", + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" } ] } @@ -1776,37 +1764,31 @@ This document contains examples and descriptions of the different requests and r }, "intent_signatures": [ { - "EcdsaSecp256k1": { - "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" - } + "curve": "EcdsaSecp256k1", + "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" }, { - "EcdsaSecp256k1": { - "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" - } + "curve": "EcdsaSecp256k1", + "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" }, { - "EcdsaSecp256k1": { - "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" - } + "curve": "EcdsaSecp256k1", + "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" }, { - "EddsaEd25519": { - "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" - } + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", + "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" }, { - "EddsaEd25519": { - "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" - } + "curve": "EddsaEd25519", + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" }, { - "EddsaEd25519": { - "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" - } + "curve": "EddsaEd25519", + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" } ] }, @@ -2078,37 +2060,31 @@ This document contains examples and descriptions of the different requests and r }, "intent_signatures": [ { - "EcdsaSecp256k1": { - "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" - } + "curve": "EcdsaSecp256k1", + "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" }, { - "EcdsaSecp256k1": { - "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" - } + "curve": "EcdsaSecp256k1", + "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" }, { - "EcdsaSecp256k1": { - "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" - } + "curve": "EcdsaSecp256k1", + "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" }, { - "EddsaEd25519": { - "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" - } + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", + "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" }, { - "EddsaEd25519": { - "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" - } + "curve": "EddsaEd25519", + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" }, { - "EddsaEd25519": { - "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" - } + "curve": "EddsaEd25519", + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" } ] }, diff --git a/schema/out/schema/compile_notarized_transaction_request.json b/schema/out/schema/compile_notarized_transaction_request.json index f6e524b9..71547fbe 100644 --- a/schema/out/schema/compile_notarized_transaction_request.json +++ b/schema/out/schema/compile_notarized_transaction_request.json @@ -2791,59 +2791,55 @@ "description": "Cryptographic signature and public key for Ecdsa Secp256k1", "type": "object", "required": [ - "EcdsaSecp256k1" + "curve", + "signature" ], "properties": { - "EcdsaSecp256k1": { - "type": "object", - "required": [ - "signature" - ], - "properties": { - "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]+" - } - } + "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]+" } - }, - "additionalProperties": false + } }, { "description": "Cryptographic signature and public key for EdDSA Ed25519", "type": "object", "required": [ - "EddsaEd25519" + "curve", + "public_key", + "signature" ], "properties": { - "EddsaEd25519": { - "type": "object", - "required": [ - "public_key", - "signature" - ], - "properties": { - "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]+" - } - } + "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]+" } - }, - "additionalProperties": false + } } ] }, diff --git a/schema/out/schema/compile_signed_transaction_intent_request.json b/schema/out/schema/compile_signed_transaction_intent_request.json index dd2ff23e..9b878df7 100644 --- a/schema/out/schema/compile_signed_transaction_intent_request.json +++ b/schema/out/schema/compile_signed_transaction_intent_request.json @@ -2765,59 +2765,55 @@ "description": "Cryptographic signature and public key for Ecdsa Secp256k1", "type": "object", "required": [ - "EcdsaSecp256k1" + "curve", + "signature" ], "properties": { - "EcdsaSecp256k1": { - "type": "object", - "required": [ - "signature" - ], - "properties": { - "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]+" - } - } + "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]+" } - }, - "additionalProperties": false + } }, { "description": "Cryptographic signature and public key for EdDSA Ed25519", "type": "object", "required": [ - "EddsaEd25519" + "curve", + "public_key", + "signature" ], "properties": { - "EddsaEd25519": { - "type": "object", - "required": [ - "public_key", - "signature" - ], - "properties": { - "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]+" - } - } + "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]+" } - }, - "additionalProperties": false + } } ] } diff --git a/schema/out/schema/decompile_notarized_transaction_response.json b/schema/out/schema/decompile_notarized_transaction_response.json index 8df863f1..77b4e485 100644 --- a/schema/out/schema/decompile_notarized_transaction_response.json +++ b/schema/out/schema/decompile_notarized_transaction_response.json @@ -2791,59 +2791,55 @@ "description": "Cryptographic signature and public key for Ecdsa Secp256k1", "type": "object", "required": [ - "EcdsaSecp256k1" + "curve", + "signature" ], "properties": { - "EcdsaSecp256k1": { - "type": "object", - "required": [ - "signature" - ], - "properties": { - "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]+" - } - } + "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]+" } - }, - "additionalProperties": false + } }, { "description": "Cryptographic signature and public key for EdDSA Ed25519", "type": "object", "required": [ - "EddsaEd25519" + "curve", + "public_key", + "signature" ], "properties": { - "EddsaEd25519": { - "type": "object", - "required": [ - "public_key", - "signature" - ], - "properties": { - "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]+" - } - } + "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]+" } - }, - "additionalProperties": false + } } ] }, diff --git a/schema/out/schema/decompile_signed_transaction_intent_response.json b/schema/out/schema/decompile_signed_transaction_intent_response.json index 94209330..aa3a7587 100644 --- a/schema/out/schema/decompile_signed_transaction_intent_response.json +++ b/schema/out/schema/decompile_signed_transaction_intent_response.json @@ -2765,59 +2765,55 @@ "description": "Cryptographic signature and public key for Ecdsa Secp256k1", "type": "object", "required": [ - "EcdsaSecp256k1" + "curve", + "signature" ], "properties": { - "EcdsaSecp256k1": { - "type": "object", - "required": [ - "signature" - ], - "properties": { - "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]+" - } - } + "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]+" } - }, - "additionalProperties": false + } }, { "description": "Cryptographic signature and public key for EdDSA Ed25519", "type": "object", "required": [ - "EddsaEd25519" + "curve", + "public_key", + "signature" ], "properties": { - "EddsaEd25519": { - "type": "object", - "required": [ - "public_key", - "signature" - ], - "properties": { - "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]+" - } - } + "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]+" } - }, - "additionalProperties": false + } } ] } diff --git a/schema/out/schema/decompile_unknown_transaction_intent_response.json b/schema/out/schema/decompile_unknown_transaction_intent_response.json index 2786bde7..9194ff7f 100644 --- a/schema/out/schema/decompile_unknown_transaction_intent_response.json +++ b/schema/out/schema/decompile_unknown_transaction_intent_response.json @@ -2805,59 +2805,55 @@ "description": "Cryptographic signature and public key for Ecdsa Secp256k1", "type": "object", "required": [ - "EcdsaSecp256k1" + "curve", + "signature" ], "properties": { - "EcdsaSecp256k1": { - "type": "object", - "required": [ - "signature" - ], - "properties": { - "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]+" - } - } + "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]+" } - }, - "additionalProperties": false + } }, { "description": "Cryptographic signature and public key for EdDSA Ed25519", "type": "object", "required": [ - "EddsaEd25519" + "curve", + "public_key", + "signature" ], "properties": { - "EddsaEd25519": { - "type": "object", - "required": [ - "public_key", - "signature" - ], - "properties": { - "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]+" - } - } + "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]+" } - }, - "additionalProperties": false + } } ] }, From edca10e43cdeef1baaf4f7c2ee46934605f1fa5f Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 19 Jan 2023 02:13:47 +0300 Subject: [PATCH 061/110] Fix: minor fix --- native-json-interface/src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/native-json-interface/src/lib.rs b/native-json-interface/src/lib.rs index f5d14406..e8cc6024 100644 --- a/native-json-interface/src/lib.rs +++ b/native-json-interface/src/lib.rs @@ -98,7 +98,7 @@ pub mod jni { use radix_engine_toolkit::request::*; use serde::Serialize; - pub unsafe extern "system" serialize_to_jstring( + fn serialize_to_jstring( env: jni::JNIEnv, object: &T, ) -> Result { @@ -121,7 +121,7 @@ pub mod jni { macro_rules! export_handler { ($handler: ident as $handler_ident: ident) => { #[no_mangle] - pub extern "system" fn $handler_ident( + pub unsafe extern "system" fn $handler_ident( env: jni::JNIEnv, _: jni::objects::JClass, input: jni::objects::JString, @@ -223,6 +223,4 @@ pub mod jni { } #[no_mangle] -pub unsafe extern "C" this_function_should_be_in_name_dump() { - -} \ No newline at end of file +pub unsafe extern "C" fn this_function_should_be_in_name_dump() {} From 89fb25751364ddf8d2a0205ddefef41755fdbce4 Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 19 Jan 2023 18:15:54 +0300 Subject: [PATCH 062/110] Add build git hash to information request --- radix-engine-toolkit/Cargo.toml | 1 + radix-engine-toolkit/build.rs | 11 +++++++++++ radix-engine-toolkit/src/request/information.rs | 6 ++++++ schema/out/examples/request-examples.md | 3 ++- schema/out/schema/information_response.json | 5 +++++ schema/src/examples.rs | 12 +++++++++++- 6 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 radix-engine-toolkit/build.rs diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index 283d4a92..9e4ed215 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -2,6 +2,7 @@ name = "radix_engine_toolkit" version = "0.7.0" edition = "2021" +build = "build.rs" [dependencies] # Crates for Serde serialization. diff --git a/radix-engine-toolkit/build.rs b/radix-engine-toolkit/build.rs new file mode 100644 index 00000000..840d134b --- /dev/null +++ b/radix-engine-toolkit/build.rs @@ -0,0 +1,11 @@ +use std::process::Command; + +fn main() { + // note: add error checking yourself. + let output = Command::new("git") + .args(&["rev-parse", "HEAD"]) + .output() + .unwrap(); + let git_hash = String::from_utf8(output.stdout).unwrap(); + println!("cargo:rustc-env=GIT_HASH={}", git_hash); +} diff --git a/radix-engine-toolkit/src/request/information.rs b/radix-engine-toolkit/src/request/information.rs index 159634c7..f5052d71 100644 --- a/radix-engine-toolkit/src/request/information.rs +++ b/radix-engine-toolkit/src/request/information.rs @@ -36,6 +36,11 @@ 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 git_hash: String, } // =============== @@ -52,6 +57,7 @@ impl Handler for InformationHandler { fn handle(_: &InformationRequest) -> Result { let response = InformationResponse { package_version: env!("CARGO_PKG_VERSION").into(), + git_hash: env!("GIT_HASH").into(), }; Ok(response) } diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index ce7c627d..d4f1163c 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -25,7 +25,8 @@ This document contains examples and descriptions of the different requests and r ```json { - "package_version": "0.7.0" + "package_version": "0.7.0", + "git_hash": "This is just an example. We don't have a commit hash here :)" } ``` diff --git a/schema/out/schema/information_response.json b/schema/out/schema/information_response.json index bca9cde0..33011eb5 100644 --- a/schema/out/schema/information_response.json +++ b/schema/out/schema/information_response.json @@ -4,12 +4,17 @@ "description": "The response from [`InformationRequest`]s", "type": "object", "required": [ + "git_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" + }, + "git_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/src/examples.rs b/schema/src/examples.rs index fdba4022..c01d2112 100644 --- a/schema/src/examples.rs +++ b/schema/src/examples.rs @@ -130,6 +130,10 @@ where fn example_request() -> I; + fn example_response() -> O { + Self::fulfill(Self::example_request()).unwrap() + } + fn request_type_name() -> String { std::any::type_name::() .split("::") @@ -147,7 +151,7 @@ where fn to_example() -> Example { let request = Self::example_request(); - let response = Self::fulfill(request.clone()).unwrap(); + let response = Self::example_response(); Example { request_type_name: Self::request_type_name(), response_type_name: Self::response_type_name(), @@ -166,6 +170,12 @@ impl ExampleData for InformationHandler fn example_request() -> InformationRequest { InformationRequest {} } + + fn example_response() -> InformationResponse { + let mut response = Self::fulfill(Self::example_request()).unwrap(); + response.git_hash = "This is just an example. We don't have a commit hash here :)".into(); + response + } } impl ExampleData for ConvertManifestHandler { From 6540f3ba3e6c864eb2f059d6e494fc57e39eca41 Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 19 Jan 2023 18:24:20 +0300 Subject: [PATCH 063/110] sync build and publish CIs --- .github/workflows/build.yml | 4 ++++ .github/workflows/publish-native-packages.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4ed1ec0..7e097deb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,10 @@ name: Build on: + push: + branches: + - main + - develop pull_request: branches: - develop diff --git a/.github/workflows/publish-native-packages.yml b/.github/workflows/publish-native-packages.yml index 11a670a3..448dccff 100644 --- a/.github/workflows/publish-native-packages.yml +++ b/.github/workflows/publish-native-packages.yml @@ -5,6 +5,10 @@ on: branches: - main - develop + pull_request: + branches: + - develop + - main jobs: publish-csharp-nuget: From 6ce0136ec29e317987ca6563e0b8e3018a8bbc1c Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 19 Jan 2023 18:29:34 +0300 Subject: [PATCH 064/110] Run publish after build --- .github/workflows/publish-native-packages.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-native-packages.yml b/.github/workflows/publish-native-packages.yml index 448dccff..49e897b5 100644 --- a/.github/workflows/publish-native-packages.yml +++ b/.github/workflows/publish-native-packages.yml @@ -1,14 +1,10 @@ name: Publish Native Packages on: - push: - branches: - - main - - develop - pull_request: - branches: - - develop - - main + workflow_run: + workflows: ["Build"] + types: + - completed jobs: publish-csharp-nuget: From 53878bee9853dba63bcd407e2ba1e0d6b809ec19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=81abu=C5=9B?= Date: Thu, 19 Jan 2023 17:43:08 +0100 Subject: [PATCH 065/110] fix: Run publish-native-packages.yml only on main/develop pushes --- .github/workflows/publish-native-packages.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/publish-native-packages.yml b/.github/workflows/publish-native-packages.yml index 49e897b5..432115b4 100644 --- a/.github/workflows/publish-native-packages.yml +++ b/.github/workflows/publish-native-packages.yml @@ -5,6 +5,9 @@ on: workflows: ["Build"] types: - completed + branches: + - main + - develop jobs: publish-csharp-nuget: From 42724011e3515451223b5f96619584b2c7e5fa88 Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 19 Jan 2023 10:23:50 +0300 Subject: [PATCH 066/110] CI: print artifacts hash --- .github/workflows/publish-native-packages.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/publish-native-packages.yml b/.github/workflows/publish-native-packages.yml index 432115b4..88db9a19 100644 --- a/.github/workflows/publish-native-packages.yml +++ b/.github/workflows/publish-native-packages.yml @@ -8,6 +8,10 @@ on: branches: - main - develop + pull_request: + branches: + - main + - develop jobs: publish-csharp-nuget: @@ -35,6 +39,7 @@ jobs: for f in *.tar.gz; do fn=`echo "$f" | cut -d'.' -f 1` mkdir "$fn" + md5 "$fn" tar -xvzf "$f" --directory="$fn"; done - name: Setup .NET SDK From 7bb2fceee7bc4aaa62cb09a04c5528e868957c48 Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 19 Jan 2023 10:27:25 +0300 Subject: [PATCH 067/110] dont hash artifacts --- .github/workflows/publish-native-packages.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/publish-native-packages.yml b/.github/workflows/publish-native-packages.yml index 88db9a19..88ae0aaa 100644 --- a/.github/workflows/publish-native-packages.yml +++ b/.github/workflows/publish-native-packages.yml @@ -39,7 +39,6 @@ jobs: for f in *.tar.gz; do fn=`echo "$f" | cut -d'.' -f 1` mkdir "$fn" - md5 "$fn" tar -xvzf "$f" --directory="$fn"; done - name: Setup .NET SDK From 0c95f5772f2ca6b4a3c00b13a1f8bf0de73293fe Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 19 Jan 2023 10:52:30 +0300 Subject: [PATCH 068/110] Combine build and publish CIs --- .github/workflows/build.yml | 50 ++++++++++++++++++++++++++++++++ native-json-interface/src/lib.rs | 5 ++++ 2 files changed, 55 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7e097deb..779fe1f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -178,3 +178,53 @@ jobs: with: name: "${{ matrix.build-target.crate }}-${{ matrix.build-target.target-triple }}.tar.gz" path: "./${{matrix.build-target.crate}}/target/${{ matrix.build-target.target-triple }}/release/${{ matrix.build-target.target-triple }}.tar.gz" + + publish-csharp-nuget: + needs: [build] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Download Artifacts + uses: dawidd6/action-download-artifact@v2 + with: + github_token: ${{secrets.GITHUB_TOKEN}} + workflow: build.yml + path: artifacts + - name: Extract Artifacts + working-directory: artifacts + run: | + mkdir native + + for d in native-json-interface-*.tar.gz; do + mv ./$d/* ./native/ + done + + cd native + + for f in *.tar.gz; do + fn=`echo "$f" | cut -d'.' -f 1` + mkdir "$fn" + tar -xvzf "$f" --directory="$fn"; + done + - name: Setup .NET SDK + uses: actions/setup-dotnet@5a3fa01c67e60dba8f95e2878436c7151c4b5f01 + with: + dotnet-version: 7.0.x + - name: Configure Version # TODO missing support for stable packages on releases (where VERSION_SUFFIX should not be appended) + run: | + GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's/\//-/g') + GIT_COMMIT=$(git log -1 --format=%h ) + CORE_VERSION=$(cat radix-engine-toolkit/Cargo.toml | grep -e '^version' | cut -d'"' -f 2) + VERSION_SUFFIX=${GIT_BRANCH}-${GIT_COMMIT} + VERSION=${CORE_VERSION}-${VERSION_SUFFIX} + + sed -i "s/\(\)[^<>]*\(<\/version>\)/\1$VERSION\2/g" interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec + + 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 diff --git a/native-json-interface/src/lib.rs b/native-json-interface/src/lib.rs index e8cc6024..9a9c507c 100644 --- a/native-json-interface/src/lib.rs +++ b/native-json-interface/src/lib.rs @@ -224,3 +224,8 @@ pub mod jni { #[no_mangle] pub unsafe extern "C" fn this_function_should_be_in_name_dump() {} + +#[no_mangle] +pub unsafe extern "C" fn this_other_function_should_be_in_name_dump(m: i32, n: i32) -> i32 { + m + n +} From ab95e9c51d57c5fc2834335b564df3055a349e77 Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 19 Jan 2023 11:14:35 +0300 Subject: [PATCH 069/110] Specify artifacts run id --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 779fe1f0..133908af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -191,6 +191,7 @@ jobs: github_token: ${{secrets.GITHUB_TOKEN}} workflow: build.yml path: artifacts + run_id: ${{github.run_id}} - name: Extract Artifacts working-directory: artifacts run: | From 01c1ab8ad7dbb997e8449df9a0c642bd4778c284 Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 19 Jan 2023 11:48:47 +0300 Subject: [PATCH 070/110] Use run number instead of run id --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 133908af..f2f9e60b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -191,7 +191,7 @@ jobs: github_token: ${{secrets.GITHUB_TOKEN}} workflow: build.yml path: artifacts - run_id: ${{github.run_id}} + run_number: ${{github.run_number}} - name: Extract Artifacts working-directory: artifacts run: | From 6c932bef109ecdd54d3d5998bd13635005fecb96 Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 19 Jan 2023 13:15:57 +0300 Subject: [PATCH 071/110] try with commit hash --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f2f9e60b..953e5248 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -183,6 +183,9 @@ jobs: needs: [build] runs-on: ubuntu-latest steps: + - name: Sanity Check + run: | + echo ${{ github.sha }} - name: Checkout uses: actions/checkout@v3 - name: Download Artifacts @@ -191,7 +194,7 @@ jobs: github_token: ${{secrets.GITHUB_TOKEN}} workflow: build.yml path: artifacts - run_number: ${{github.run_number}} + commit: ${{github.sha}} - name: Extract Artifacts working-directory: artifacts run: | From 353bdca6572b59a61c2f38609f2262cf0dc1a42a Mon Sep 17 00:00:00 2001 From: Marek Karwacki Date: Fri, 20 Jan 2023 10:16:32 +0100 Subject: [PATCH 072/110] Test CI --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 953e5248..5463ede4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,12 +60,12 @@ jobs: custom-compiler: aarch64-unknown-linux-gnu-gcc custom-archiver: aarch64-unknown-linux-gnu-gcc-ar features: "jni" - - crate: native-json-interface - target-triple: i686-unknown-linux-gnu - custom-linker: i686-unknown-linux-gnu-gcc - custom-compiler: i686-unknown-linux-gnu-gcc - custom-archiver: i686-unknown-linux-gnu-gcc-ar - features: "jni" +# - crate: native-json-interface +# target-triple: i686-unknown-linux-gnu +# custom-linker: i686-unknown-linux-gnu-gcc +# custom-compiler: i686-unknown-linux-gnu-gcc +# custom-archiver: i686-unknown-linux-gnu-gcc-ar +# features: "jni" - crate: native-json-interface target-triple: wasm32-unknown-unknown custom-linker: "" From abc3e5c23d50cef55a9ad727226b5b221b3b3c39 Mon Sep 17 00:00:00 2001 From: Marek Karwacki Date: Fri, 20 Jan 2023 10:21:24 +0100 Subject: [PATCH 073/110] Test CI --- .github/workflows/build.yml | 36 +++++----- .github/workflows/publish-native-packages.yml | 66 ------------------- 2 files changed, 20 insertions(+), 82 deletions(-) delete mode 100644 .github/workflows/publish-native-packages.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5463ede4..adc21432 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,7 @@ name: Build on: push: - branches: - - main - - develop + pull_request: branches: - develop @@ -60,12 +58,12 @@ jobs: custom-compiler: aarch64-unknown-linux-gnu-gcc custom-archiver: aarch64-unknown-linux-gnu-gcc-ar features: "jni" -# - crate: native-json-interface -# target-triple: i686-unknown-linux-gnu -# custom-linker: i686-unknown-linux-gnu-gcc -# custom-compiler: i686-unknown-linux-gnu-gcc -# custom-archiver: i686-unknown-linux-gnu-gcc-ar -# features: "jni" + - crate: native-json-interface + target-triple: i686-unknown-linux-gnu + custom-linker: i686-unknown-linux-gnu-gcc + custom-compiler: i686-unknown-linux-gnu-gcc + custom-archiver: i686-unknown-linux-gnu-gcc-ar + features: "jni" - crate: native-json-interface target-triple: wasm32-unknown-unknown custom-linker: "" @@ -135,7 +133,7 @@ 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 }} export features=$${{ matrix.build-target.features }} @@ -183,18 +181,17 @@ jobs: needs: [build] runs-on: ubuntu-latest steps: - - name: Sanity Check + - name: Sanity Check no. 1 run: | echo ${{ github.sha }} - name: Checkout uses: actions/checkout@v3 - - name: Download Artifacts - uses: dawidd6/action-download-artifact@v2 + - uses: actions/download-artifact@v3 with: - github_token: ${{secrets.GITHUB_TOKEN}} - workflow: build.yml path: artifacts - commit: ${{github.sha}} + - name: Sanity Check no. 2 + run: | + ls -laR ./artifacts/ - name: Extract Artifacts working-directory: artifacts run: | @@ -211,6 +208,9 @@ jobs: mkdir "$fn" tar -xvzf "$f" --directory="$fn"; done + - name: Sanity Check no. 3 + run: | + ls -laR ./artifacts/ - name: Setup .NET SDK uses: actions/setup-dotnet@5a3fa01c67e60dba8f95e2878436c7151c4b5f01 with: @@ -229,6 +229,10 @@ jobs: - name: NuGet Pack working-directory: interop/csharp run: nuget pack + - name: Sanity Check no. 4 + run: | + md5sum ./artifacts/native/aarch64-apple-darwin/libradix_engine_toolkit.dylib + md5sum ./interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec - 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 diff --git a/.github/workflows/publish-native-packages.yml b/.github/workflows/publish-native-packages.yml deleted file mode 100644 index 88ae0aaa..00000000 --- a/.github/workflows/publish-native-packages.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Publish Native Packages - -on: - workflow_run: - workflows: ["Build"] - types: - - completed - branches: - - main - - develop - pull_request: - branches: - - main - - develop - -jobs: - publish-csharp-nuget: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Download Artifacts - uses: dawidd6/action-download-artifact@v2 - with: - github_token: ${{secrets.GITHUB_TOKEN}} - workflow: build.yml - path: artifacts - - name: Extract Artifacts - working-directory: artifacts - run: | - mkdir native - - for d in native-json-interface-*.tar.gz; do - mv ./$d/* ./native/ - done - - cd native - - for f in *.tar.gz; do - fn=`echo "$f" | cut -d'.' -f 1` - mkdir "$fn" - tar -xvzf "$f" --directory="$fn"; - done - - name: Setup .NET SDK - uses: actions/setup-dotnet@5a3fa01c67e60dba8f95e2878436c7151c4b5f01 - with: - dotnet-version: 7.0.x - - name: Configure Version # TODO missing support for stable packages on releases (where VERSION_SUFFIX should not be appended) - run: | - GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's/\//-/g') - GIT_COMMIT=$(git log -1 --format=%h ) - CORE_VERSION=$(cat radix-engine-toolkit/Cargo.toml | grep -e '^version' | cut -d'"' -f 2) - VERSION_SUFFIX=${GIT_BRANCH}-${GIT_COMMIT} - VERSION=${CORE_VERSION}-${VERSION_SUFFIX} - - sed -i "s/\(\)[^<>]*\(<\/version>\)/\1$VERSION\2/g" interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec - - 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 }} - - From c802e24f2b18d0e896d6b09b65b8bb151943a840 Mon Sep 17 00:00:00 2001 From: Marek Karwacki Date: Fri, 20 Jan 2023 10:28:04 +0100 Subject: [PATCH 074/110] Test CI --- .github/workflows/build.yml | 140 +++++++++++++++++------------------- 1 file changed, 67 insertions(+), 73 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index adc21432..6f54eff2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,66 +28,66 @@ jobs: custom-compiler: /usr/local/opt/llvm/bin/clang custom-archiver: /usr/local/opt/llvm/bin/llvm-ar features: "jni" - - crate: native-json-interface - target-triple: aarch64-apple-ios - custom-linker: "" - custom-compiler: /usr/local/opt/llvm/bin/clang - custom-archiver: /usr/local/opt/llvm/bin/llvm-ar - features: "jni" - - crate: native-json-interface - target-triple: aarch64-apple-ios-sim - custom-linker: "" - custom-compiler: /usr/local/opt/llvm/bin/clang - custom-archiver: /usr/local/opt/llvm/bin/llvm-ar - features: "jni" - - crate: native-json-interface - target-triple: x86_64-pc-windows-gnu - custom-linker: "" - custom-compiler: x86_64-w64-mingw32-gcc - custom-archiver: x86_64-w64-mingw32-ar - features: "jni" - - crate: native-json-interface - target-triple: x86_64-unknown-linux-gnu - custom-linker: x86_64-unknown-linux-gnu-gcc - custom-compiler: /usr/local/opt/llvm/bin/clang - custom-archiver: /usr/local/opt/llvm/bin/llvm-ar - features: "jni" - - crate: native-json-interface - target-triple: aarch64-unknown-linux-gnu - custom-linker: aarch64-unknown-linux-gnu-gcc - custom-compiler: aarch64-unknown-linux-gnu-gcc - custom-archiver: aarch64-unknown-linux-gnu-gcc-ar - features: "jni" - - crate: native-json-interface - target-triple: i686-unknown-linux-gnu - custom-linker: i686-unknown-linux-gnu-gcc - custom-compiler: i686-unknown-linux-gnu-gcc - custom-archiver: i686-unknown-linux-gnu-gcc-ar - features: "jni" - - crate: native-json-interface - target-triple: wasm32-unknown-unknown - custom-linker: "" - custom-compiler: /usr/local/opt/llvm/bin/clang - custom-archiver: /usr/local/opt/llvm/bin/llvm-ar - features: "jni" - - crate: native-json-interface - target-triple: aarch64-linux-android - custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang - custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang - custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ar - features: "jni" - - crate: native-json-interface - target-triple: armv7-linux-androideabi - custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang - custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang - custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar - features: "jni" - - crate: native-json-interface - target-triple: i686-linux-android - custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang - custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang - custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android-ar - features: "jni" +# - crate: native-json-interface +# target-triple: aarch64-apple-ios +# custom-linker: "" +# custom-compiler: /usr/local/opt/llvm/bin/clang +# custom-archiver: /usr/local/opt/llvm/bin/llvm-ar +# features: "jni" +# - crate: native-json-interface +# target-triple: aarch64-apple-ios-sim +# custom-linker: "" +# custom-compiler: /usr/local/opt/llvm/bin/clang +# custom-archiver: /usr/local/opt/llvm/bin/llvm-ar +# features: "jni" +# - crate: native-json-interface +# target-triple: x86_64-pc-windows-gnu +# custom-linker: "" +# custom-compiler: x86_64-w64-mingw32-gcc +# custom-archiver: x86_64-w64-mingw32-ar +# features: "jni" +# - crate: native-json-interface +# target-triple: x86_64-unknown-linux-gnu +# custom-linker: x86_64-unknown-linux-gnu-gcc +# custom-compiler: /usr/local/opt/llvm/bin/clang +# custom-archiver: /usr/local/opt/llvm/bin/llvm-ar +# features: "jni" +# - crate: native-json-interface +# target-triple: aarch64-unknown-linux-gnu +# custom-linker: aarch64-unknown-linux-gnu-gcc +# custom-compiler: aarch64-unknown-linux-gnu-gcc +# custom-archiver: aarch64-unknown-linux-gnu-gcc-ar +# features: "jni" +# - crate: native-json-interface +# target-triple: i686-unknown-linux-gnu +# custom-linker: i686-unknown-linux-gnu-gcc +# custom-compiler: i686-unknown-linux-gnu-gcc +# custom-archiver: i686-unknown-linux-gnu-gcc-ar +# features: "jni" +# - crate: native-json-interface +# target-triple: wasm32-unknown-unknown +# custom-linker: "" +# custom-compiler: /usr/local/opt/llvm/bin/clang +# custom-archiver: /usr/local/opt/llvm/bin/llvm-ar +# features: "jni" +# - crate: native-json-interface +# target-triple: aarch64-linux-android +# custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang +# custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang +# custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ar +# features: "jni" +# - crate: native-json-interface +# target-triple: armv7-linux-androideabi +# custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang +# custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang +# custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar +# features: "jni" +# - crate: native-json-interface +# target-triple: i686-linux-android +# custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang +# custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang +# custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android-ar +# features: "jni" steps: - name: Checkout @@ -133,7 +133,7 @@ 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 }} export features=$${{ matrix.build-target.features }} @@ -181,17 +181,18 @@ jobs: needs: [build] runs-on: ubuntu-latest steps: - - name: Sanity Check no. 1 + - name: Sanity Check run: | echo ${{ github.sha }} - name: Checkout uses: actions/checkout@v3 - - uses: actions/download-artifact@v3 + - name: Download Artifacts + uses: dawidd6/action-download-artifact@v2 with: + github_token: ${{secrets.GITHUB_TOKEN}} + workflow: build.yml path: artifacts - - name: Sanity Check no. 2 - run: | - ls -laR ./artifacts/ + commit: ${{github.sha}} - name: Extract Artifacts working-directory: artifacts run: | @@ -208,9 +209,6 @@ jobs: mkdir "$fn" tar -xvzf "$f" --directory="$fn"; done - - name: Sanity Check no. 3 - run: | - ls -laR ./artifacts/ - name: Setup .NET SDK uses: actions/setup-dotnet@5a3fa01c67e60dba8f95e2878436c7151c4b5f01 with: @@ -229,10 +227,6 @@ jobs: - name: NuGet Pack working-directory: interop/csharp run: nuget pack - - name: Sanity Check no. 4 - run: | - md5sum ./artifacts/native/aarch64-apple-darwin/libradix_engine_toolkit.dylib - md5sum ./interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec - 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 From d7b0bceaa89d417a5c6c09cc410aa506ec8084d8 Mon Sep 17 00:00:00 2001 From: Marek Karwacki Date: Fri, 20 Jan 2023 11:02:04 +0100 Subject: [PATCH 075/110] Use download-artifact action --- .github/workflows/build.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f54eff2..7fd55fad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -186,13 +186,7 @@ jobs: echo ${{ github.sha }} - name: Checkout uses: actions/checkout@v3 - - name: Download Artifacts - uses: dawidd6/action-download-artifact@v2 - with: - github_token: ${{secrets.GITHUB_TOKEN}} - workflow: build.yml - path: artifacts - commit: ${{github.sha}} + - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 - name: Extract Artifacts working-directory: artifacts run: | From d1ac751e66d75544517c794a2f155c936a66365b Mon Sep 17 00:00:00 2001 From: Marek Karwacki Date: Fri, 20 Jan 2023 11:37:58 +0100 Subject: [PATCH 076/110] Use download-artifact action --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7fd55fad..f6a306a7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -187,6 +187,8 @@ jobs: - name: Checkout uses: actions/checkout@v3 - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + with: + path: artifacts - name: Extract Artifacts working-directory: artifacts run: | From 2755878ac3ce5739aa7573c141145b072df38400 Mon Sep 17 00:00:00 2001 From: Marek Karwacki Date: Fri, 20 Jan 2023 12:30:21 +0100 Subject: [PATCH 077/110] Enable all builds --- .github/workflows/build.yml | 120 ++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f6a306a7..715930d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,66 +28,66 @@ jobs: custom-compiler: /usr/local/opt/llvm/bin/clang custom-archiver: /usr/local/opt/llvm/bin/llvm-ar features: "jni" -# - crate: native-json-interface -# target-triple: aarch64-apple-ios -# custom-linker: "" -# custom-compiler: /usr/local/opt/llvm/bin/clang -# custom-archiver: /usr/local/opt/llvm/bin/llvm-ar -# features: "jni" -# - crate: native-json-interface -# target-triple: aarch64-apple-ios-sim -# custom-linker: "" -# custom-compiler: /usr/local/opt/llvm/bin/clang -# custom-archiver: /usr/local/opt/llvm/bin/llvm-ar -# features: "jni" -# - crate: native-json-interface -# target-triple: x86_64-pc-windows-gnu -# custom-linker: "" -# custom-compiler: x86_64-w64-mingw32-gcc -# custom-archiver: x86_64-w64-mingw32-ar -# features: "jni" -# - crate: native-json-interface -# target-triple: x86_64-unknown-linux-gnu -# custom-linker: x86_64-unknown-linux-gnu-gcc -# custom-compiler: /usr/local/opt/llvm/bin/clang -# custom-archiver: /usr/local/opt/llvm/bin/llvm-ar -# features: "jni" -# - crate: native-json-interface -# target-triple: aarch64-unknown-linux-gnu -# custom-linker: aarch64-unknown-linux-gnu-gcc -# custom-compiler: aarch64-unknown-linux-gnu-gcc -# custom-archiver: aarch64-unknown-linux-gnu-gcc-ar -# features: "jni" -# - crate: native-json-interface -# target-triple: i686-unknown-linux-gnu -# custom-linker: i686-unknown-linux-gnu-gcc -# custom-compiler: i686-unknown-linux-gnu-gcc -# custom-archiver: i686-unknown-linux-gnu-gcc-ar -# features: "jni" -# - crate: native-json-interface -# target-triple: wasm32-unknown-unknown -# custom-linker: "" -# custom-compiler: /usr/local/opt/llvm/bin/clang -# custom-archiver: /usr/local/opt/llvm/bin/llvm-ar -# features: "jni" -# - crate: native-json-interface -# target-triple: aarch64-linux-android -# custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang -# custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang -# custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ar -# features: "jni" -# - crate: native-json-interface -# target-triple: armv7-linux-androideabi -# custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang -# custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang -# custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar -# features: "jni" -# - crate: native-json-interface -# target-triple: i686-linux-android -# custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang -# custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang -# custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android-ar -# features: "jni" + - crate: native-json-interface + target-triple: aarch64-apple-ios + custom-linker: "" + custom-compiler: /usr/local/opt/llvm/bin/clang + custom-archiver: /usr/local/opt/llvm/bin/llvm-ar + features: "jni" + - crate: native-json-interface + target-triple: aarch64-apple-ios-sim + custom-linker: "" + custom-compiler: /usr/local/opt/llvm/bin/clang + custom-archiver: /usr/local/opt/llvm/bin/llvm-ar + features: "jni" + - crate: native-json-interface + target-triple: x86_64-pc-windows-gnu + custom-linker: "" + custom-compiler: x86_64-w64-mingw32-gcc + custom-archiver: x86_64-w64-mingw32-ar + features: "jni" + - crate: native-json-interface + target-triple: x86_64-unknown-linux-gnu + custom-linker: x86_64-unknown-linux-gnu-gcc + custom-compiler: /usr/local/opt/llvm/bin/clang + custom-archiver: /usr/local/opt/llvm/bin/llvm-ar + features: "jni" + - crate: native-json-interface + target-triple: aarch64-unknown-linux-gnu + custom-linker: aarch64-unknown-linux-gnu-gcc + custom-compiler: aarch64-unknown-linux-gnu-gcc + custom-archiver: aarch64-unknown-linux-gnu-gcc-ar + features: "jni" + - crate: native-json-interface + target-triple: i686-unknown-linux-gnu + custom-linker: i686-unknown-linux-gnu-gcc + custom-compiler: i686-unknown-linux-gnu-gcc + custom-archiver: i686-unknown-linux-gnu-gcc-ar + features: "jni" + - crate: native-json-interface + target-triple: wasm32-unknown-unknown + custom-linker: "" + custom-compiler: /usr/local/opt/llvm/bin/clang + custom-archiver: /usr/local/opt/llvm/bin/llvm-ar + features: "jni" + - crate: native-json-interface + target-triple: aarch64-linux-android + custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang + custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang + custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ar + features: "jni" + - crate: native-json-interface + target-triple: armv7-linux-androideabi + custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang + custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang + custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar + features: "jni" + - crate: native-json-interface + target-triple: i686-linux-android + custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang + custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang + custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android-ar + features: "jni" steps: - name: Checkout From ce904a51883b3af52f3a8503dadf103987cbc894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=81abu=C5=9B?= Date: Tue, 24 Jan 2023 09:17:55 +0100 Subject: [PATCH 078/110] Attempt to fix publish-native-packages --- .github/workflows/build.yml | 11 +++++++++-- .../csharp/RadixDlt.RadixEngineToolkit.Native.nuspec | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 715930d8..9cdb5e9c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -181,12 +181,12 @@ jobs: needs: [build] runs-on: ubuntu-latest steps: - - name: Sanity Check + - name: Sanity Check no. 1 run: | echo ${{ github.sha }} - name: Checkout uses: actions/checkout@v3 - - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + - uses: actions/download-artifact@v3 with: path: artifacts - name: Extract Artifacts @@ -205,6 +205,9 @@ jobs: mkdir "$fn" tar -xvzf "$f" --directory="$fn"; done + - name: Sanity Check no. 2 + run: | + ls -laR ./artifacts/ - name: Setup .NET SDK uses: actions/setup-dotnet@5a3fa01c67e60dba8f95e2878436c7151c4b5f01 with: @@ -223,6 +226,10 @@ jobs: - name: NuGet Pack working-directory: interop/csharp run: nuget pack + - name: Sanity Check no. 2 + run: | + md5 ./artifacts/native/aarch64-apple-darwin/libradix_engine_toolkit.dylib + md5 ./interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec - 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 diff --git a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec index b070b384..e27a61d0 100644 --- a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec +++ b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec @@ -2,7 +2,7 @@ RadixDlt.RadixEngineToolkit.Native - 0.0.0 + 0.0.0 Radix Publishing Radix Publishing Apache-2.0 From 889f64beb7a4bc641ee16de190aa312c29b82976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=81abu=C5=9B?= Date: Tue, 24 Jan 2023 10:30:44 +0100 Subject: [PATCH 079/110] Attempt to fix publish-native-packages --- .github/workflows/build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9cdb5e9c..05103793 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -189,6 +189,9 @@ jobs: - uses: actions/download-artifact@v3 with: path: artifacts + - name: Sanity Check no. 2 + run: | + ls -laR ./artifacts/ - name: Extract Artifacts working-directory: artifacts run: | @@ -205,7 +208,7 @@ jobs: mkdir "$fn" tar -xvzf "$f" --directory="$fn"; done - - name: Sanity Check no. 2 + - name: Sanity Check no. 3 run: | ls -laR ./artifacts/ - name: Setup .NET SDK @@ -226,7 +229,7 @@ jobs: - name: NuGet Pack working-directory: interop/csharp run: nuget pack - - name: Sanity Check no. 2 + - name: Sanity Check no. 4 run: | md5 ./artifacts/native/aarch64-apple-darwin/libradix_engine_toolkit.dylib md5 ./interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec From 7f61c5ecb4d1f5106b3a15ca9a37d8cb8b19fe28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20=C5=81abu=C5=9B?= Date: Tue, 24 Jan 2023 10:45:18 +0100 Subject: [PATCH 080/110] Attempt to fix publish-native-packages --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 05103793..e0eb7a62 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -231,8 +231,8 @@ jobs: run: nuget pack - name: Sanity Check no. 4 run: | - md5 ./artifacts/native/aarch64-apple-darwin/libradix_engine_toolkit.dylib - md5 ./interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec + md5sum ./artifacts/native/aarch64-apple-darwin/libradix_engine_toolkit.dylib + md5sum ./interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec - 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 From ff782fd14d502a6e38a99b2134399dfe86229442 Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 25 Jan 2023 14:56:08 +0300 Subject: [PATCH 081/110] Feature: `EnumDiscriminator` and `TransientIdentifier` are now tagged unions --- native-json-interface/src/lib.rs | 8 --- .../src/enum_discriminator.rs | 21 ++++-- .../engine_identifier/transient_identifier.rs | 45 +++++++----- radix-engine-toolkit/src/model/value.rs | 68 ++++++++++++++----- .../tests/test_vector/value.rs | 20 +++--- radix-engine-toolkit/tests/value.rs | 26 +++---- 6 files changed, 112 insertions(+), 76 deletions(-) diff --git a/native-json-interface/src/lib.rs b/native-json-interface/src/lib.rs index 9a9c507c..523d87de 100644 --- a/native-json-interface/src/lib.rs +++ b/native-json-interface/src/lib.rs @@ -221,11 +221,3 @@ pub mod jni { as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_staticallyValidateTransaction ); } - -#[no_mangle] -pub unsafe extern "C" fn this_function_should_be_in_name_dump() {} - -#[no_mangle] -pub unsafe extern "C" fn this_other_function_should_be_in_name_dump(m: i32, n: i32) -> i32 { - m + n -} diff --git a/radix-engine-toolkit/src/enum_discriminator.rs b/radix-engine-toolkit/src/enum_discriminator.rs index 8383af85..32837f19 100644 --- a/radix-engine-toolkit/src/enum_discriminator.rs +++ b/radix-engine-toolkit/src/enum_discriminator.rs @@ -24,13 +24,22 @@ use serializable::serializable; // ================= /// A union of the types of discriminators that enums may have. This may either be a string or an -/// 8-bit unsigned number. This type does not itself require a discriminator. +/// 8-bit unsigned number. #[serializable] -#[serde(untagged)] +#[serde(tag = "type")] #[derive(PartialEq, Eq, Hash)] pub enum EnumDiscriminator { - String(String), - U8(u8), + 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, + }, } // ============ @@ -41,8 +50,8 @@ 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 + Self::U8 { discriminator } => Ok(*discriminator), + Self::String { discriminator } => KNOWN_ENUM_DISCRIMINATORS .get(discriminator.as_str()) .copied() .ok_or(Error::InvalidEnumDiscriminator { diff --git a/radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs b/radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs index e4dfad68..b8bcab7b 100644 --- a/radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs +++ b/radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs @@ -26,14 +26,23 @@ use std::str::FromStr; // ================= #[serializable] -#[serde(untagged)] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] -/// Represents an untagged transient identifier typically used as an identifiers for Scrypto buckets +#[serde(tag = "variant")] +/// 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 { - String(String), - U32(u32), + String { + /// A string identifier + identifier: String, + }, + 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")] + identifier: u32, + }, } #[serializable] @@ -54,19 +63,21 @@ impl FromStr for TransientIdentifier { type Err = Error; fn from_str(s: &str) -> Result { - Ok(Self::String(s.to_owned())) + Ok(Self::String { + identifier: s.to_owned(), + }) } } impl From for TransientIdentifier { - fn from(value: String) -> Self { - Self::String(value) + fn from(identifier: String) -> Self { + Self::String { identifier } } } impl From for TransientIdentifier { - fn from(value: u32) -> Self { - Self::U32(value) + fn from(identifier: u32) -> Self { + Self::U32 { identifier } } } @@ -99,10 +110,10 @@ impl TryFrom for ScryptoCustomValue { fn try_from(value: BucketId) -> std::result::Result { match value.0 { - TransientIdentifier::U32(identifier) => { + TransientIdentifier::U32 { identifier } => { Ok(ScryptoCustomValue::Bucket(ManifestBucket(identifier))) } - TransientIdentifier::String(..) => Err(Error::BucketOrProofSBORError { + TransientIdentifier::String { .. } => Err(Error::BucketOrProofSBORError { value_kind: crate::ValueKind::Bucket, }), } @@ -114,10 +125,10 @@ impl TryFrom<&BucketId> for ScryptoCustomValue { fn try_from(value: &BucketId) -> std::result::Result { match &value.0 { - TransientIdentifier::U32(identifier) => { + TransientIdentifier::U32 { identifier } => { Ok(ScryptoCustomValue::Bucket(ManifestBucket(*identifier))) } - TransientIdentifier::String(..) => Err(Error::BucketOrProofSBORError { + TransientIdentifier::String { .. } => Err(Error::BucketOrProofSBORError { value_kind: crate::ValueKind::Bucket, }), } @@ -129,10 +140,10 @@ impl TryFrom for ScryptoCustomValue { fn try_from(value: ProofId) -> std::result::Result { match value.0 { - TransientIdentifier::U32(identifier) => { + TransientIdentifier::U32 { identifier } => { Ok(ScryptoCustomValue::Proof(ManifestProof(identifier))) } - TransientIdentifier::String(..) => Err(Error::BucketOrProofSBORError { + TransientIdentifier::String { .. } => Err(Error::BucketOrProofSBORError { value_kind: crate::ValueKind::Proof, }), } @@ -144,10 +155,10 @@ impl TryFrom<&ProofId> for ScryptoCustomValue { fn try_from(value: &ProofId) -> std::result::Result { match &value.0 { - TransientIdentifier::U32(identifier) => { + TransientIdentifier::U32 { identifier } => { Ok(ScryptoCustomValue::Proof(ManifestProof(*identifier))) } - TransientIdentifier::String(..) => Err(Error::BucketOrProofSBORError { + TransientIdentifier::String { .. } => Err(Error::BucketOrProofSBORError { value_kind: crate::ValueKind::Proof, }), } diff --git a/radix-engine-toolkit/src/model/value.rs b/radix-engine-toolkit/src/model/value.rs index d1b522db..4532ceec 100644 --- a/radix-engine-toolkit/src/model/value.rs +++ b/radix-engine-toolkit/src/model/value.rs @@ -299,11 +299,17 @@ pub enum Value { /// 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 number. - Bucket { identifier: BucketId }, + Bucket { + #[serde(flatten)] + 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 number. - Proof { identifier: ProofId }, + Proof { + #[serde(flatten)] + identifier: ProofId, + }, /// Represents non-fungible ids which is a discriminated union of the different types that /// non-fungible ids may be. @@ -568,12 +574,16 @@ impl Value { ast::Value::Hash(Box::new(ast::Value::String(value.to_string()))) } Value::Bucket { identifier } => ast::Value::Bucket(Box::new(match identifier.0 { - TransientIdentifier::String(ref string) => ast::Value::String(string.clone()), - TransientIdentifier::U32(number) => ast::Value::U32(number), + TransientIdentifier::String { ref identifier } => { + ast::Value::String(identifier.clone()) + } + TransientIdentifier::U32 { identifier } => ast::Value::U32(identifier), })), Value::Proof { identifier } => ast::Value::Proof(Box::new(match identifier.0 { - TransientIdentifier::String(ref string) => ast::Value::String(string.clone()), - TransientIdentifier::U32(number) => ast::Value::U32(number), + TransientIdentifier::String { ref identifier } => { + ast::Value::String(identifier.clone()) + } + TransientIdentifier::U32 { identifier } => ast::Value::U32(identifier), })), Value::NonFungibleId { value } => ast::Value::NonFungibleId(Box::new(match value { @@ -663,7 +673,9 @@ impl Value { }, ast::Value::Enum(variant, fields) => Self::Enum { - variant: EnumDiscriminator::U8(*variant), + variant: EnumDiscriminator::U8 { + discriminator: *variant, + }, fields: { if fields.is_empty() { None @@ -769,13 +781,19 @@ impl Value { })?, ast::Value::Bucket(value) => { - if let ast::Value::U32(value) = &**value { + if let ast::Value::U32(identifier) = &**value { Self::Bucket { - identifier: TransientIdentifier::U32(*value).into(), + identifier: TransientIdentifier::U32 { + identifier: *identifier, + } + .into(), } - } else if let ast::Value::String(value) = &**value { + } else if let ast::Value::String(identifier) = &**value { Self::Bucket { - identifier: TransientIdentifier::String(value.clone()).into(), + identifier: TransientIdentifier::String { + identifier: identifier.to_owned(), + } + .into(), } } else { Err(Error::UnexpectedAstContents { @@ -786,13 +804,19 @@ impl Value { } } ast::Value::Proof(value) => { - if let ast::Value::U32(value) = &**value { + if let ast::Value::U32(identifier) = &**value { Self::Proof { - identifier: TransientIdentifier::U32(*value).into(), + identifier: TransientIdentifier::U32 { + identifier: *identifier, + } + .into(), } - } else if let ast::Value::String(value) = &**value { + } else if let ast::Value::String(identifier) = &**value { Self::Proof { - identifier: TransientIdentifier::String(value.clone()).into(), + identifier: TransientIdentifier::String { + identifier: identifier.clone(), + } + .into(), } } else { Err(Error::UnexpectedAstContents { @@ -1149,7 +1173,9 @@ impl Value { discriminator, fields, } => Self::Enum { - variant: EnumDiscriminator::U8(*discriminator), + variant: EnumDiscriminator::U8 { + discriminator: *discriminator, + }, fields: if fields.is_empty() { None } else { @@ -1235,12 +1261,18 @@ impl Value { ScryptoValue::Custom { value: ScryptoCustomValue::Bucket(identifier), } => Self::Bucket { - identifier: TransientIdentifier::U32(identifier.0).into(), + identifier: TransientIdentifier::U32 { + identifier: identifier.0, + } + .into(), }, ScryptoValue::Custom { value: ScryptoCustomValue::Proof(identifier), } => Self::Proof { - identifier: TransientIdentifier::U32(identifier.0).into(), + identifier: TransientIdentifier::U32 { + identifier: identifier.0, + } + .into(), }, ScryptoValue::Custom { diff --git a/radix-engine-toolkit/tests/test_vector/value.rs b/radix-engine-toolkit/tests/test_vector/value.rs index b7ba70db..e99ae59e 100644 --- a/radix-engine-toolkit/tests/test_vector/value.rs +++ b/radix-engine-toolkit/tests/test_vector/value.rs @@ -156,12 +156,12 @@ lazy_static::lazy_static! { // Enums and Enum Aliases (Option & Result) ValueRepresentationTestVector::new( Value::Enum { - variant: radix_engine_toolkit::EnumDiscriminator::U8(1), + variant: radix_engine_toolkit::EnumDiscriminator::U8{discriminator: 1}, fields: Some(vec![Value::String { value: "Component".into(), }]), }, - r#"{"type": "Enum", "variant": 1, "fields": [{"type": "String", "value": "Component"}]}"#, + r#"{"type": "Enum", "variant": {"type": "U8", "discriminator": "1"}, "fields": [{"type": "String", "value": "Component"}]}"#, r#"Enum("Option::Some", "Component")"#, ), ValueRepresentationTestVector::new( @@ -331,23 +331,23 @@ lazy_static::lazy_static! { // Buckets and Proofs // =================== ValueRepresentationTestVector::new( - Value::Bucket { identifier: BucketId(TransientIdentifier::String("xrd_bucket".into())) }, - r#"{"type": "Bucket", "identifier": "xrd_bucket"}"#, + Value::Bucket { identifier: BucketId(TransientIdentifier::String{ identifier: "xrd_bucket".into()}) }, + r#"{"type": "Bucket", "variant": "String", "identifier": "xrd_bucket"}"#, r#"Bucket("xrd_bucket")"# ), ValueRepresentationTestVector::new( - Value::Bucket { identifier: BucketId(TransientIdentifier::U32(28)) }, - r#"{"type": "Bucket", "identifier": 28}"#, + Value::Bucket { identifier: BucketId(TransientIdentifier::U32{ identifier: 28}) }, + r#"{"type": "Bucket", "variant": "U32", "identifier": "28"}"#, r#"Bucket(28u32)"# ), ValueRepresentationTestVector::new( - Value::Proof { identifier: ProofId(TransientIdentifier::String("xrd_proof".into())) }, - r#"{"type": "Proof", "identifier": "xrd_proof"}"#, + Value::Proof { identifier: ProofId(TransientIdentifier::String{ identifier: "xrd_proof".into()}) }, + r#"{"type": "Proof", "variant": "String", "identifier": "xrd_proof"}"#, r#"Proof("xrd_proof")"# ), ValueRepresentationTestVector::new( - Value::Proof { identifier: ProofId(TransientIdentifier::U32(28)) }, - r#"{"type": "Proof", "identifier": 28}"#, + Value::Proof { identifier: ProofId(TransientIdentifier::U32{ identifier: 28}) }, + r#"{"type": "Proof", "variant": "U32", "identifier": "28"}"#, r#"Proof(28u32)"# ), diff --git a/radix-engine-toolkit/tests/value.rs b/radix-engine-toolkit/tests/value.rs index d1f7c911..7ffa92a1 100644 --- a/radix-engine-toolkit/tests/value.rs +++ b/radix-engine-toolkit/tests/value.rs @@ -97,22 +97,14 @@ fn value_scrypto_value_conversion_match_that_produced_by_transaction_compiler() let bech32_coder = Bech32Coder::new(0xf2); for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { - match test_vector.value { - Value::Map { .. } => { - println!("") - } - _ => {} - } - println!("{:?}", test_vector.value.kind()); - // This test will fail (as expected) for buckets and proofs with string // TransientIdentifiers. So, we skip those tests if let Value::Bucket { ref identifier } = test_vector.value { - if let TransientIdentifier::String(..) = identifier.0 { + if let TransientIdentifier::String { .. } = identifier.0 { continue; } } else if let Value::Proof { ref identifier } = test_vector.value { - if let TransientIdentifier::String(..) = identifier.0 { + if let TransientIdentifier::String { .. } = identifier.0 { continue; } } @@ -164,10 +156,10 @@ fn no_information_is_lost_when_converting_value_to_scrypto_value_and_back() { for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { match test_vector.value { Value::Bucket { - identifier: BucketId(TransientIdentifier::String(..)), + identifier: BucketId(TransientIdentifier::String { .. }), } | Value::Proof { - identifier: ProofId(TransientIdentifier::String(..)), + identifier: ProofId(TransientIdentifier::String { .. }), } | Value::Some { .. } | Value::None @@ -204,10 +196,10 @@ fn sbor_encoding_value_yields_expected_result() { // TransientIdentifiers. So, we skip those tests match test_vector.value { Value::Bucket { - identifier: BucketId(TransientIdentifier::String(..)), + identifier: BucketId(TransientIdentifier::String { .. }), } | Value::Proof { - identifier: ProofId(TransientIdentifier::String(..)), + identifier: ProofId(TransientIdentifier::String { .. }), } | Value::Some { .. } | Value::None @@ -239,10 +231,10 @@ fn sbor_decoding_value_yields_expected_result() { // TransientIdentifiers. So, we skip those tests match test_vector.value { Value::Bucket { - identifier: BucketId(TransientIdentifier::String(..)), + identifier: BucketId(TransientIdentifier::String { .. }), } | Value::Proof { - identifier: ProofId(TransientIdentifier::String(..)), + identifier: ProofId(TransientIdentifier::String { .. }), } | Value::Some { .. } | Value::None @@ -258,7 +250,7 @@ fn sbor_decoding_value_yields_expected_result() { // Act let mut value = - Value::decode(&encoded_value, 0xf2).expect("Failed to SBOR decode trusted value"); + Value::decode(encoded_value, 0xf2).expect("Failed to SBOR decode trusted value"); value.alias(); // Assert From 0bdd7e0977aa16f08090a4b93d523801675c78de Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 25 Jan 2023 15:00:10 +0300 Subject: [PATCH 082/110] Update Schema and examples --- schema/out/examples/request-examples.md | 104 +++++++++++++ ...compile_notarized_transaction_request.json | 120 ++++++++++----- ...ile_signed_transaction_intent_request.json | 120 ++++++++++----- .../compile_transaction_intent_request.json | 120 ++++++++++----- .../out/schema/convert_manifest_request.json | 120 ++++++++++----- .../out/schema/convert_manifest_response.json | 120 ++++++++++----- ...ompile_notarized_transaction_response.json | 120 ++++++++++----- ...le_signed_transaction_intent_response.json | 120 ++++++++++----- ...decompile_transaction_intent_response.json | 120 ++++++++++----- ...e_unknown_transaction_intent_response.json | 120 ++++++++++----- ...rive_virtual_account_address_response.json | 120 ++++++++++----- .../known_entity_addresses_response.json | 120 ++++++++++----- schema/out/schema/sbor_decode_response.json | 138 ++++++++++++------ schema/out/schema/sbor_encode_request.json | 138 ++++++++++++------ 14 files changed, 1216 insertions(+), 484 deletions(-) diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index d4f1163c..1ae84eda 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -84,6 +84,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } }, @@ -100,6 +101,7 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } ] @@ -130,6 +132,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -137,10 +140,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -148,10 +153,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CLONE_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -159,6 +166,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -166,6 +174,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -194,6 +203,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -201,6 +211,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -208,6 +219,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -226,6 +238,7 @@ This document contains examples and descriptions of the different requests and r ], "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket3" } }, @@ -298,6 +311,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } }, @@ -314,6 +328,7 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } ] @@ -344,6 +359,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -351,10 +367,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -362,10 +380,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CLONE_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -373,6 +393,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -380,6 +401,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -408,6 +430,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -415,6 +438,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -422,6 +446,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -440,6 +465,7 @@ This document contains examples and descriptions of the different requests and r ], "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket3" } }, @@ -535,6 +561,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } }, @@ -551,6 +578,7 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } ] @@ -581,6 +609,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -588,10 +617,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -599,10 +630,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CLONE_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -610,6 +643,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -617,6 +651,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -645,6 +680,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -652,6 +688,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -659,6 +696,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -677,6 +715,7 @@ This document contains examples and descriptions of the different requests and r ], "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket3" } }, @@ -794,6 +833,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } }, @@ -810,6 +850,7 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } ] @@ -840,6 +881,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -847,10 +889,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -858,10 +902,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CLONE_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -869,6 +915,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -876,6 +923,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -904,6 +952,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -911,6 +960,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -918,6 +968,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -936,6 +987,7 @@ This document contains examples and descriptions of the different requests and r ], "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket3" } }, @@ -1033,6 +1085,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } }, @@ -1049,6 +1102,7 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } ] @@ -1079,6 +1133,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -1086,10 +1141,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -1097,10 +1154,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CLONE_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -1108,6 +1167,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -1115,6 +1175,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -1143,6 +1204,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -1150,6 +1212,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -1157,6 +1220,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -1175,6 +1239,7 @@ This document contains examples and descriptions of the different requests and r ], "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket3" } }, @@ -1323,6 +1388,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } }, @@ -1339,6 +1405,7 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } ] @@ -1369,6 +1436,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -1376,10 +1444,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -1387,10 +1457,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CLONE_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -1398,6 +1470,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -1405,6 +1478,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -1433,6 +1507,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -1440,6 +1515,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -1447,6 +1523,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -1465,6 +1542,7 @@ This document contains examples and descriptions of the different requests and r ], "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket3" } }, @@ -1593,6 +1671,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } }, @@ -1609,6 +1688,7 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } ] @@ -1639,6 +1719,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -1646,10 +1727,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -1657,10 +1740,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CLONE_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -1668,6 +1753,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -1675,6 +1761,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -1703,6 +1790,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -1710,6 +1798,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -1717,6 +1806,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -1735,6 +1825,7 @@ This document contains examples and descriptions of the different requests and r ], "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket3" } }, @@ -1889,6 +1980,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } }, @@ -1905,6 +1997,7 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", + "variant": "String", "identifier": "bucket1" } ] @@ -1935,6 +2028,7 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -1942,10 +2036,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -1953,10 +2049,12 @@ This document contains examples and descriptions of the different requests and r "instruction": "CLONE_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" }, "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -1964,6 +2062,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof1" } }, @@ -1971,6 +2070,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof2" } }, @@ -1999,6 +2099,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -2006,6 +2107,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "DROP_PROOF", "proof": { "type": "Proof", + "variant": "String", "identifier": "proof3" } }, @@ -2013,6 +2115,7 @@ This document contains examples and descriptions of the different requests and r "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket2" } }, @@ -2031,6 +2134,7 @@ This document contains examples and descriptions of the different requests and r ], "into_bucket": { "type": "Bucket", + "variant": "String", "identifier": "bucket3" } }, diff --git a/schema/out/schema/compile_notarized_transaction_request.json b/schema/out/schema/compile_notarized_transaction_request.json index 71547fbe..a5646f84 100644 --- a/schema/out/schema/compile_notarized_transaction_request.json +++ b/schema/out/schema/compile_notarized_transaction_request.json @@ -2378,8 +2378,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2388,17 +2392,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2407,9 +2412,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -2592,15 +2594,46 @@ ] }, "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. This type does not itself require a discriminator.", - "anyOf": [ + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ { - "type": "string" + "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": "integer", - "format": "uint8", - "minimum": 0.0 + "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]+" + } + } } ] }, @@ -2656,32 +2689,47 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ { - "type": "string" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "identifier": { + "description": "A string identifier", + "type": "string" + } + } }, { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "identifier": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } } ] }, diff --git a/schema/out/schema/compile_signed_transaction_intent_request.json b/schema/out/schema/compile_signed_transaction_intent_request.json index 9b878df7..2bced722 100644 --- a/schema/out/schema/compile_signed_transaction_intent_request.json +++ b/schema/out/schema/compile_signed_transaction_intent_request.json @@ -2352,8 +2352,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2362,17 +2366,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2381,9 +2386,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -2566,15 +2568,46 @@ ] }, "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. This type does not itself require a discriminator.", - "anyOf": [ + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ { - "type": "string" + "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": "integer", - "format": "uint8", - "minimum": 0.0 + "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]+" + } + } } ] }, @@ -2630,32 +2663,47 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ { - "type": "string" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "identifier": { + "description": "A string identifier", + "type": "string" + } + } }, { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "identifier": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } } ] }, diff --git a/schema/out/schema/compile_transaction_intent_request.json b/schema/out/schema/compile_transaction_intent_request.json index ab0eb124..156e0d1d 100644 --- a/schema/out/schema/compile_transaction_intent_request.json +++ b/schema/out/schema/compile_transaction_intent_request.json @@ -2327,8 +2327,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2337,17 +2341,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2356,9 +2361,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -2541,15 +2543,46 @@ ] }, "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. This type does not itself require a discriminator.", - "anyOf": [ + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ { - "type": "string" + "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": "integer", - "format": "uint8", - "minimum": 0.0 + "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]+" + } + } } ] }, @@ -2605,32 +2638,47 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ { - "type": "string" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "identifier": { + "description": "A string identifier", + "type": "string" + } + } }, { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "identifier": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } } ] }, diff --git a/schema/out/schema/convert_manifest_request.json b/schema/out/schema/convert_manifest_request.json index 6ce9ea00..541f940d 100644 --- a/schema/out/schema/convert_manifest_request.json +++ b/schema/out/schema/convert_manifest_request.json @@ -2235,8 +2235,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2245,17 +2249,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2264,9 +2269,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -2449,15 +2451,46 @@ ] }, "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. This type does not itself require a discriminator.", - "anyOf": [ + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ { - "type": "string" + "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": "integer", - "format": "uint8", - "minimum": 0.0 + "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]+" + } + } } ] }, @@ -2513,32 +2546,47 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ { - "type": "string" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "identifier": { + "description": "A string identifier", + "type": "string" + } + } }, { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "identifier": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } } ] }, diff --git a/schema/out/schema/convert_manifest_response.json b/schema/out/schema/convert_manifest_response.json index 9e7a2b0a..cf42c119 100644 --- a/schema/out/schema/convert_manifest_response.json +++ b/schema/out/schema/convert_manifest_response.json @@ -2195,8 +2195,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2205,17 +2209,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2224,9 +2229,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -2409,15 +2411,46 @@ ] }, "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. This type does not itself require a discriminator.", - "anyOf": [ + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ { - "type": "string" + "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": "integer", - "format": "uint8", - "minimum": 0.0 + "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]+" + } + } } ] }, @@ -2473,32 +2506,47 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ { - "type": "string" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "identifier": { + "description": "A string identifier", + "type": "string" + } + } }, { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "identifier": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } } ] }, diff --git a/schema/out/schema/decompile_notarized_transaction_response.json b/schema/out/schema/decompile_notarized_transaction_response.json index 77b4e485..1babb8ed 100644 --- a/schema/out/schema/decompile_notarized_transaction_response.json +++ b/schema/out/schema/decompile_notarized_transaction_response.json @@ -2378,8 +2378,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2388,17 +2392,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2407,9 +2412,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -2592,15 +2594,46 @@ ] }, "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. This type does not itself require a discriminator.", - "anyOf": [ + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ { - "type": "string" + "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": "integer", - "format": "uint8", - "minimum": 0.0 + "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]+" + } + } } ] }, @@ -2656,32 +2689,47 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ { - "type": "string" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "identifier": { + "description": "A string identifier", + "type": "string" + } + } }, { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "identifier": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } } ] }, diff --git a/schema/out/schema/decompile_signed_transaction_intent_response.json b/schema/out/schema/decompile_signed_transaction_intent_response.json index aa3a7587..f6b27b24 100644 --- a/schema/out/schema/decompile_signed_transaction_intent_response.json +++ b/schema/out/schema/decompile_signed_transaction_intent_response.json @@ -2352,8 +2352,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2362,17 +2366,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2381,9 +2386,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -2566,15 +2568,46 @@ ] }, "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. This type does not itself require a discriminator.", - "anyOf": [ + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ { - "type": "string" + "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": "integer", - "format": "uint8", - "minimum": 0.0 + "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]+" + } + } } ] }, @@ -2630,32 +2663,47 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ { - "type": "string" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "identifier": { + "description": "A string identifier", + "type": "string" + } + } }, { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "identifier": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } } ] }, diff --git a/schema/out/schema/decompile_transaction_intent_response.json b/schema/out/schema/decompile_transaction_intent_response.json index d269716c..20adc6c1 100644 --- a/schema/out/schema/decompile_transaction_intent_response.json +++ b/schema/out/schema/decompile_transaction_intent_response.json @@ -2327,8 +2327,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2337,17 +2341,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2356,9 +2361,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -2541,15 +2543,46 @@ ] }, "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. This type does not itself require a discriminator.", - "anyOf": [ + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ { - "type": "string" + "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": "integer", - "format": "uint8", - "minimum": 0.0 + "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]+" + } + } } ] }, @@ -2605,32 +2638,47 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ { - "type": "string" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "identifier": { + "description": "A string identifier", + "type": "string" + } + } }, { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "identifier": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } } ] }, diff --git a/schema/out/schema/decompile_unknown_transaction_intent_response.json b/schema/out/schema/decompile_unknown_transaction_intent_response.json index 9194ff7f..754a9856 100644 --- a/schema/out/schema/decompile_unknown_transaction_intent_response.json +++ b/schema/out/schema/decompile_unknown_transaction_intent_response.json @@ -2341,8 +2341,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2351,17 +2355,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -2370,9 +2375,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -2555,15 +2557,46 @@ ] }, "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. This type does not itself require a discriminator.", - "anyOf": [ + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ { - "type": "string" + "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": "integer", - "format": "uint8", - "minimum": 0.0 + "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]+" + } + } } ] }, @@ -2619,32 +2652,47 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ { - "type": "string" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "identifier": { + "description": "A string identifier", + "type": "string" + } + } }, { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "identifier": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } } ] }, diff --git a/schema/out/schema/derive_virtual_account_address_response.json b/schema/out/schema/derive_virtual_account_address_response.json index 878fe7e9..64747b02 100644 --- a/schema/out/schema/derive_virtual_account_address_response.json +++ b/schema/out/schema/derive_virtual_account_address_response.json @@ -810,8 +810,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -820,17 +824,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -839,9 +844,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -1024,15 +1026,46 @@ ] }, "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. This type does not itself require a discriminator.", - "anyOf": [ + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ { - "type": "string" + "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": "integer", - "format": "uint8", - "minimum": 0.0 + "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]+" + } + } } ] }, @@ -1088,32 +1121,47 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ { - "type": "string" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "identifier": { + "description": "A string identifier", + "type": "string" + } + } }, { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "identifier": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } } ] }, diff --git a/schema/out/schema/known_entity_addresses_response.json b/schema/out/schema/known_entity_addresses_response.json index 9bc78c6f..21a7f0e8 100644 --- a/schema/out/schema/known_entity_addresses_response.json +++ b/schema/out/schema/known_entity_addresses_response.json @@ -882,8 +882,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -892,17 +896,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -911,9 +916,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -1096,15 +1098,46 @@ ] }, "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. This type does not itself require a discriminator.", - "anyOf": [ + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ { - "type": "string" + "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": "integer", - "format": "uint8", - "minimum": 0.0 + "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]+" + } + } } ] }, @@ -1160,32 +1193,47 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ { - "type": "string" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "identifier": { + "description": "A string identifier", + "type": "string" + } + } }, { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "identifier": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } } ] }, diff --git a/schema/out/schema/sbor_decode_response.json b/schema/out/schema/sbor_decode_response.json index 1cbe504d..1234f3c9 100644 --- a/schema/out/schema/sbor_decode_response.json +++ b/schema/out/schema/sbor_decode_response.json @@ -794,8 +794,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -804,17 +808,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -823,9 +828,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -1008,15 +1010,46 @@ ], "definitions": { "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number. This type does not itself require a discriminator.", - "anyOf": [ + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ { - "type": "string" + "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": "integer", - "format": "uint8", - "minimum": 0.0 + "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]+" + } + } } ] }, @@ -1813,8 +1846,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -1823,17 +1860,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -1842,9 +1880,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -2078,32 +2113,47 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ { - "type": "string" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "identifier": { + "description": "A string identifier", + "type": "string" + } + } }, { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "identifier": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } } ] }, diff --git a/schema/out/schema/sbor_encode_request.json b/schema/out/schema/sbor_encode_request.json index 369e70e6..f56ec081 100644 --- a/schema/out/schema/sbor_encode_request.json +++ b/schema/out/schema/sbor_encode_request.json @@ -794,8 +794,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -804,17 +808,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -823,9 +828,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -1008,15 +1010,46 @@ ], "definitions": { "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number. This type does not itself require a discriminator.", - "anyOf": [ + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ { - "type": "string" + "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": "integer", - "format": "uint8", - "minimum": 0.0 + "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]+" + } + } } ] }, @@ -1813,8 +1846,12 @@ { "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -1823,17 +1860,18 @@ "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 number.", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ], "required": [ - "identifier", "type" ], "properties": { @@ -1842,9 +1880,6 @@ "enum": [ "Proof" ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" } } }, @@ -2078,32 +2113,47 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, "TransientIdentifier": { - "description": "Represents an untagged 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)", - "anyOf": [ + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ { - "type": "string" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "String" + ] + }, + "identifier": { + "description": "A string identifier", + "type": "string" + } + } }, { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" + "type": "object", + "required": [ + "identifier", + "variant" + ], + "properties": { + "variant": { + "type": "string", + "enum": [ + "U32" + ] + }, + "identifier": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } } ] }, From af476e46a4e2d290e3a55729f18b8d17d16c1de0 Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 25 Jan 2023 15:46:10 +0300 Subject: [PATCH 083/110] Update `TransientIdentifier` and `NonFungibleId` serialization --- .../src/model/address/non_fungible_id.rs | 2 +- .../src/model/engine_identifier/own.rs | 2 +- .../engine_identifier/transient_identifier.rs | 20 +- radix-engine-toolkit/src/model/value.rs | 46 +- .../tests/test_vector/value.rs | 34 +- schema/out/examples/request-examples.md | 672 ++++++++++++------ ...compile_notarized_transaction_request.json | 390 +++++----- ...ile_signed_transaction_intent_request.json | 390 +++++----- .../compile_transaction_intent_request.json | 390 +++++----- .../out/schema/convert_manifest_request.json | 390 +++++----- .../out/schema/convert_manifest_response.json | 390 +++++----- ...ompile_notarized_transaction_response.json | 390 +++++----- ...le_signed_transaction_intent_response.json | 390 +++++----- ...decompile_transaction_intent_response.json | 390 +++++----- ...e_unknown_transaction_intent_response.json | 390 +++++----- ...rive_virtual_account_address_response.json | 424 +++++------ .../known_entity_addresses_response.json | 424 +++++------ schema/out/schema/sbor_decode_response.json | 632 +++++++--------- schema/out/schema/sbor_encode_request.json | 632 +++++++--------- 19 files changed, 2936 insertions(+), 3462 deletions(-) diff --git a/radix-engine-toolkit/src/model/address/non_fungible_id.rs b/radix-engine-toolkit/src/model/address/non_fungible_id.rs index 5b131af4..5f958e88 100644 --- a/radix-engine-toolkit/src/model/address/non_fungible_id.rs +++ b/radix-engine-toolkit/src/model/address/non_fungible_id.rs @@ -19,7 +19,7 @@ use scrypto::prelude::NonFungibleId as ScryptoNonFungibleId; use serializable::serializable; #[serializable] -#[serde(tag = "variant", content = "value")] +#[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 NonFungibleId { diff --git a/radix-engine-toolkit/src/model/engine_identifier/own.rs b/radix-engine-toolkit/src/model/engine_identifier/own.rs index 7ad1b8c6..c8f7173d 100644 --- a/radix-engine-toolkit/src/model/engine_identifier/own.rs +++ b/radix-engine-toolkit/src/model/engine_identifier/own.rs @@ -24,7 +24,7 @@ use serializable::serializable; // ================= #[serializable] -#[serde(tag = "variant", content = "value")] +#[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 { diff --git a/radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs b/radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs index b8bcab7b..09dd3f3a 100644 --- a/radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs +++ b/radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs @@ -27,21 +27,21 @@ use std::str::FromStr; #[serializable] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] -#[serde(tag = "variant")] +#[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 { String { /// A string identifier - identifier: String, + value: String, }, 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")] - identifier: u32, + value: u32, }, } @@ -64,20 +64,20 @@ impl FromStr for TransientIdentifier { fn from_str(s: &str) -> Result { Ok(Self::String { - identifier: s.to_owned(), + value: s.to_owned(), }) } } impl From for TransientIdentifier { fn from(identifier: String) -> Self { - Self::String { identifier } + Self::String { value: identifier } } } impl From for TransientIdentifier { fn from(identifier: u32) -> Self { - Self::U32 { identifier } + Self::U32 { value: identifier } } } @@ -110,7 +110,7 @@ impl TryFrom for ScryptoCustomValue { fn try_from(value: BucketId) -> std::result::Result { match value.0 { - TransientIdentifier::U32 { identifier } => { + TransientIdentifier::U32 { value: identifier } => { Ok(ScryptoCustomValue::Bucket(ManifestBucket(identifier))) } TransientIdentifier::String { .. } => Err(Error::BucketOrProofSBORError { @@ -125,7 +125,7 @@ impl TryFrom<&BucketId> for ScryptoCustomValue { fn try_from(value: &BucketId) -> std::result::Result { match &value.0 { - TransientIdentifier::U32 { identifier } => { + TransientIdentifier::U32 { value: identifier } => { Ok(ScryptoCustomValue::Bucket(ManifestBucket(*identifier))) } TransientIdentifier::String { .. } => Err(Error::BucketOrProofSBORError { @@ -140,7 +140,7 @@ impl TryFrom for ScryptoCustomValue { fn try_from(value: ProofId) -> std::result::Result { match value.0 { - TransientIdentifier::U32 { identifier } => { + TransientIdentifier::U32 { value: identifier } => { Ok(ScryptoCustomValue::Proof(ManifestProof(identifier))) } TransientIdentifier::String { .. } => Err(Error::BucketOrProofSBORError { @@ -155,7 +155,7 @@ impl TryFrom<&ProofId> for ScryptoCustomValue { fn try_from(value: &ProofId) -> std::result::Result { match &value.0 { - TransientIdentifier::U32 { identifier } => { + TransientIdentifier::U32 { value: identifier } => { Ok(ScryptoCustomValue::Proof(ManifestProof(*identifier))) } TransientIdentifier::String { .. } => Err(Error::BucketOrProofSBORError { diff --git a/radix-engine-toolkit/src/model/value.rs b/radix-engine-toolkit/src/model/value.rs index 4532ceec..cdae8526 100644 --- a/radix-engine-toolkit/src/model/value.rs +++ b/radix-engine-toolkit/src/model/value.rs @@ -204,7 +204,6 @@ pub enum Value { /// Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of /// the transaction manifest. Own { - #[serde(flatten)] #[schemars(with = "crate::Own")] #[serde_as(as = "serde_with::FromInto")] value: Own, @@ -299,22 +298,15 @@ pub enum Value { /// 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 number. - Bucket { - #[serde(flatten)] - identifier: BucketId, - }, + 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 number. - Proof { - #[serde(flatten)] - identifier: ProofId, - }, + Proof { identifier: ProofId }, /// Represents non-fungible ids which is a discriminated union of the different types that /// non-fungible ids may be. NonFungibleId { - #[serde(flatten)] #[schemars(with = "crate::NonFungibleId")] #[serde_as(as = "serde_with::FromInto")] value: NonFungibleId, @@ -574,16 +566,16 @@ impl Value { ast::Value::Hash(Box::new(ast::Value::String(value.to_string()))) } Value::Bucket { identifier } => ast::Value::Bucket(Box::new(match identifier.0 { - TransientIdentifier::String { ref identifier } => { - ast::Value::String(identifier.clone()) - } - TransientIdentifier::U32 { identifier } => ast::Value::U32(identifier), + TransientIdentifier::String { + value: ref identifier, + } => ast::Value::String(identifier.clone()), + TransientIdentifier::U32 { value: identifier } => ast::Value::U32(identifier), })), Value::Proof { identifier } => ast::Value::Proof(Box::new(match identifier.0 { - TransientIdentifier::String { ref identifier } => { - ast::Value::String(identifier.clone()) - } - TransientIdentifier::U32 { identifier } => ast::Value::U32(identifier), + TransientIdentifier::String { + value: ref identifier, + } => ast::Value::String(identifier.clone()), + TransientIdentifier::U32 { value: identifier } => ast::Value::U32(identifier), })), Value::NonFungibleId { value } => ast::Value::NonFungibleId(Box::new(match value { @@ -783,15 +775,12 @@ impl Value { ast::Value::Bucket(value) => { if let ast::Value::U32(identifier) = &**value { Self::Bucket { - identifier: TransientIdentifier::U32 { - identifier: *identifier, - } - .into(), + identifier: TransientIdentifier::U32 { value: *identifier }.into(), } } else if let ast::Value::String(identifier) = &**value { Self::Bucket { identifier: TransientIdentifier::String { - identifier: identifier.to_owned(), + value: identifier.to_owned(), } .into(), } @@ -806,15 +795,12 @@ impl Value { ast::Value::Proof(value) => { if let ast::Value::U32(identifier) = &**value { Self::Proof { - identifier: TransientIdentifier::U32 { - identifier: *identifier, - } - .into(), + identifier: TransientIdentifier::U32 { value: *identifier }.into(), } } else if let ast::Value::String(identifier) = &**value { Self::Proof { identifier: TransientIdentifier::String { - identifier: identifier.clone(), + value: identifier.clone(), } .into(), } @@ -1262,7 +1248,7 @@ impl Value { value: ScryptoCustomValue::Bucket(identifier), } => Self::Bucket { identifier: TransientIdentifier::U32 { - identifier: identifier.0, + value: identifier.0, } .into(), }, @@ -1270,7 +1256,7 @@ impl Value { value: ScryptoCustomValue::Proof(identifier), } => Self::Proof { identifier: TransientIdentifier::U32 { - identifier: identifier.0, + value: identifier.0, } .into(), }, diff --git a/radix-engine-toolkit/tests/test_vector/value.rs b/radix-engine-toolkit/tests/test_vector/value.rs index e99ae59e..b292ab70 100644 --- a/radix-engine-toolkit/tests/test_vector/value.rs +++ b/radix-engine-toolkit/tests/test_vector/value.rs @@ -69,7 +69,7 @@ impl ValueRepresentationTestVector { &ast_value, None, &mut NameResolver::new(), - &bech32_coder.decoder(), + bech32_coder.decoder(), &blobs, ) .expect("Failed to generate scrypto value from ast_value") @@ -331,23 +331,23 @@ lazy_static::lazy_static! { // Buckets and Proofs // =================== ValueRepresentationTestVector::new( - Value::Bucket { identifier: BucketId(TransientIdentifier::String{ identifier: "xrd_bucket".into()}) }, - r#"{"type": "Bucket", "variant": "String", "identifier": "xrd_bucket"}"#, + Value::Bucket { identifier: BucketId(TransientIdentifier::String{ value: "xrd_bucket".into()}) }, + r#"{"type": "Bucket", "identifier": {"type": "String", "value": "xrd_bucket"}}"#, r#"Bucket("xrd_bucket")"# ), ValueRepresentationTestVector::new( - Value::Bucket { identifier: BucketId(TransientIdentifier::U32{ identifier: 28}) }, - r#"{"type": "Bucket", "variant": "U32", "identifier": "28"}"#, + Value::Bucket { identifier: BucketId(TransientIdentifier::U32{ value: 28}) }, + r#"{"type": "Bucket", "identifier": {"type": "U32", "value": "28"}}"#, r#"Bucket(28u32)"# ), ValueRepresentationTestVector::new( - Value::Proof { identifier: ProofId(TransientIdentifier::String{ identifier: "xrd_proof".into()}) }, - r#"{"type": "Proof", "variant": "String", "identifier": "xrd_proof"}"#, + Value::Proof { identifier: ProofId(TransientIdentifier::String{ value: "xrd_proof".into()}) }, + r#"{"type": "Proof", "identifier": {"type": "String", "value": "xrd_proof"}}"#, r#"Proof("xrd_proof")"# ), ValueRepresentationTestVector::new( - Value::Proof { identifier: ProofId(TransientIdentifier::U32{ identifier: 28}) }, - r#"{"type": "Proof", "variant": "U32", "identifier": "28"}"#, + Value::Proof { identifier: ProofId(TransientIdentifier::U32{ value: 28}) }, + r#"{"type": "Proof", "identifier": {"type": "U32", "value": "28"}}"#, r#"Proof(28u32)"# ), @@ -357,22 +357,22 @@ lazy_static::lazy_static! { ValueRepresentationTestVector::new( Value::NonFungibleId { value: scrypto::prelude::NonFungibleId::Number(114441894733333) }, - r#"{"type": "NonFungibleId", "variant": "Number", "value": "114441894733333"}"#, + r#"{"type": "NonFungibleId", "value": {"type": "Number", "value": "114441894733333"}}"#, r#"NonFungibleId(114441894733333u64)"#, ), ValueRepresentationTestVector::new( Value::NonFungibleId { value: scrypto::prelude::NonFungibleId::UUID(11444189334733333) }, - r#"{"type": "NonFungibleId", "variant": "UUID", "value": "11444189334733333"}"#, + r#"{"type": "NonFungibleId", "value": {"type": "UUID", "value": "11444189334733333"}}"#, r#"NonFungibleId(11444189334733333u128)"#, ), ValueRepresentationTestVector::new( Value::NonFungibleId { value: scrypto::prelude::NonFungibleId::String("hello_world".into()) }, - r#"{"type": "NonFungibleId", "variant": "String", "value": "hello_world"}"#, + r#"{"type": "NonFungibleId", "value": {"type": "String", "value": "hello_world"}}"#, r#"NonFungibleId("hello_world")"#, ), ValueRepresentationTestVector::new( Value::NonFungibleId { value: scrypto::prelude::NonFungibleId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) }, - r#"{"type": "NonFungibleId", "variant": "Bytes", "value": "10a23101"}"#, + r#"{"type": "NonFungibleId", "value": {"type": "Bytes", "value": "10a23101"}}"#, r#"NonFungibleId(Bytes("10a23101"))"#, ), @@ -386,7 +386,7 @@ lazy_static::lazy_static! { non_fungible_id: scrypto::prelude::NonFungibleId::Number(114441894733333) } }, - r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "variant": "Number", "value": "114441894733333"}}"#, + r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "value": {"type": "Number", "value": "114441894733333"}}}"#, r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", 114441894733333u64)"#, ), ValueRepresentationTestVector::new( @@ -399,7 +399,7 @@ lazy_static::lazy_static! { non_fungible_id: scrypto::prelude::NonFungibleId::UUID(11444189334733333) } }, - r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "variant": "UUID", "value": "11444189334733333"}}"#, + r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "value": {"type": "UUID", "value": "11444189334733333"}}}"#, r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", 11444189334733333u128)"#, ), ValueRepresentationTestVector::new( @@ -412,7 +412,7 @@ lazy_static::lazy_static! { non_fungible_id: scrypto::prelude::NonFungibleId::String("hello_world".into()) } }, - r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "variant": "String", "value": "hello_world"}}"#, + r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "value": {"type": "String", "value": "hello_world"}}}"#, r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", "hello_world")"#, ), ValueRepresentationTestVector::new( @@ -425,7 +425,7 @@ lazy_static::lazy_static! { non_fungible_id: scrypto::prelude::NonFungibleId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) } }, - r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "variant": "Bytes", "value": "10a23101"}}"#, + r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "value": {"type": "Bytes", "value": "10a23101"}}}"#, r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", Bytes("10a23101"))"#, ), diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index 1ae84eda..67125b4a 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -84,8 +84,10 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } }, { @@ -101,8 +103,10 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } ] }, @@ -132,50 +136,64 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "CLONE_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { @@ -203,24 +221,30 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { @@ -232,14 +256,18 @@ This document contains examples and descriptions of the different requests and r "ids": [ { "type": "NonFungibleId", - "variant": "Number", - "value": "1" + "value": { + "type": "Number", + "value": "1" + } } ], "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket3" + "identifier": { + "type": "String", + "value": "bucket3" + } } }, { @@ -311,8 +339,10 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } }, { @@ -328,8 +358,10 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } ] }, @@ -359,50 +391,64 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "CLONE_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { @@ -430,24 +476,30 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { @@ -459,14 +511,18 @@ This document contains examples and descriptions of the different requests and r "ids": [ { "type": "NonFungibleId", - "variant": "Number", - "value": "1" + "value": { + "type": "Number", + "value": "1" + } } ], "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket3" + "identifier": { + "type": "String", + "value": "bucket3" + } } }, { @@ -561,8 +617,10 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } }, { @@ -578,8 +636,10 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } ] }, @@ -609,50 +669,64 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "CLONE_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { @@ -680,24 +754,30 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { @@ -709,14 +789,18 @@ This document contains examples and descriptions of the different requests and r "ids": [ { "type": "NonFungibleId", - "variant": "Number", - "value": "1" + "value": { + "type": "Number", + "value": "1" + } } ], "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket3" + "identifier": { + "type": "String", + "value": "bucket3" + } } }, { @@ -833,8 +917,10 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } }, { @@ -850,8 +936,10 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } ] }, @@ -881,50 +969,64 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "CLONE_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { @@ -952,24 +1054,30 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { @@ -981,14 +1089,18 @@ This document contains examples and descriptions of the different requests and r "ids": [ { "type": "NonFungibleId", - "variant": "Number", - "value": "1" + "value": { + "type": "Number", + "value": "1" + } } ], "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket3" + "identifier": { + "type": "String", + "value": "bucket3" + } } }, { @@ -1085,8 +1197,10 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } }, { @@ -1102,8 +1216,10 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } ] }, @@ -1133,50 +1249,64 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "CLONE_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { @@ -1204,24 +1334,30 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { @@ -1233,14 +1369,18 @@ This document contains examples and descriptions of the different requests and r "ids": [ { "type": "NonFungibleId", - "variant": "Number", - "value": "1" + "value": { + "type": "Number", + "value": "1" + } } ], "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket3" + "identifier": { + "type": "String", + "value": "bucket3" + } } }, { @@ -1388,8 +1528,10 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } }, { @@ -1405,8 +1547,10 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } ] }, @@ -1436,50 +1580,64 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "CLONE_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { @@ -1507,24 +1665,30 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { @@ -1536,14 +1700,18 @@ This document contains examples and descriptions of the different requests and r "ids": [ { "type": "NonFungibleId", - "variant": "Number", - "value": "1" + "value": { + "type": "Number", + "value": "1" + } } ], "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket3" + "identifier": { + "type": "String", + "value": "bucket3" + } } }, { @@ -1671,8 +1839,10 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } }, { @@ -1688,8 +1858,10 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } ] }, @@ -1719,50 +1891,64 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "CLONE_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { @@ -1790,24 +1976,30 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { @@ -1819,14 +2011,18 @@ This document contains examples and descriptions of the different requests and r "ids": [ { "type": "NonFungibleId", - "variant": "Number", - "value": "1" + "value": { + "type": "Number", + "value": "1" + } } ], "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket3" + "identifier": { + "type": "String", + "value": "bucket3" + } } }, { @@ -1980,8 +2176,10 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } }, { @@ -1997,8 +2195,10 @@ This document contains examples and descriptions of the different requests and r "arguments": [ { "type": "Bucket", - "variant": "String", - "identifier": "bucket1" + "identifier": { + "type": "String", + "value": "bucket1" + } } ] }, @@ -2028,50 +2228,64 @@ This document contains examples and descriptions of the different requests and r }, "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { "instruction": "CREATE_PROOF_FROM_BUCKET", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "CLONE_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } }, "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof1" + "identifier": { + "type": "String", + "value": "proof1" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof2" + "identifier": { + "type": "String", + "value": "proof2" + } } }, { @@ -2099,24 +2313,30 @@ This document contains examples and descriptions of the different requests and r "instruction": "POP_FROM_AUTH_ZONE", "into_proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "DROP_PROOF", "proof": { "type": "Proof", - "variant": "String", - "identifier": "proof3" + "identifier": { + "type": "String", + "value": "proof3" + } } }, { "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket2" + "identifier": { + "type": "String", + "value": "bucket2" + } } }, { @@ -2128,14 +2348,18 @@ This document contains examples and descriptions of the different requests and r "ids": [ { "type": "NonFungibleId", - "variant": "Number", - "value": "1" + "value": { + "type": "Number", + "value": "1" + } } ], "into_bucket": { "type": "Bucket", - "variant": "String", - "identifier": "bucket3" + "identifier": { + "type": "String", + "value": "bucket3" + } } }, { diff --git a/schema/out/schema/compile_notarized_transaction_request.json b/schema/out/schema/compile_notarized_transaction_request.json index a5646f84..dbaefc06 100644 --- a/schema/out/schema/compile_notarized_transaction_request.json +++ b/schema/out/schema/compile_notarized_transaction_request.json @@ -2080,105 +2080,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2186,6 +2090,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -2378,12 +2285,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2392,18 +2295,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2412,95 +2314,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2508,6 +2333,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -2682,6 +2510,106 @@ "Bytes" ] }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "NodeIdentifier": { "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", "type": "string", @@ -2689,23 +2617,31 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, "TransientIdentifier": { "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" ] }, - "identifier": { + "value": { "description": "A string identifier", "type": "string" } @@ -2714,17 +2650,17 @@ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "U32" ] }, - "identifier": { + "value": { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "string", "pattern": "[0-9]+" @@ -2733,21 +2669,14 @@ } ] }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } ] }, - "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]+" - }, "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ @@ -2755,11 +2684,11 @@ "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Number" @@ -2775,11 +2704,11 @@ "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "UUID" @@ -2795,11 +2724,11 @@ "description": "An byte array non-fungible id type which is serialized as a hex string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Bytes" @@ -2815,11 +2744,11 @@ "description": "A string non-fungible id", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" @@ -2832,6 +2761,21 @@ } ] }, + "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": [ diff --git a/schema/out/schema/compile_signed_transaction_intent_request.json b/schema/out/schema/compile_signed_transaction_intent_request.json index 2bced722..c18eb007 100644 --- a/schema/out/schema/compile_signed_transaction_intent_request.json +++ b/schema/out/schema/compile_signed_transaction_intent_request.json @@ -2054,105 +2054,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2160,6 +2064,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -2352,12 +2259,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2366,18 +2269,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2386,95 +2288,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2482,6 +2307,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -2656,6 +2484,106 @@ "Bytes" ] }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "NodeIdentifier": { "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", "type": "string", @@ -2663,23 +2591,31 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, "TransientIdentifier": { "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" ] }, - "identifier": { + "value": { "description": "A string identifier", "type": "string" } @@ -2688,17 +2624,17 @@ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "U32" ] }, - "identifier": { + "value": { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "string", "pattern": "[0-9]+" @@ -2707,21 +2643,14 @@ } ] }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } ] }, - "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]+" - }, "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ @@ -2729,11 +2658,11 @@ "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Number" @@ -2749,11 +2678,11 @@ "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "UUID" @@ -2769,11 +2698,11 @@ "description": "An byte array non-fungible id type which is serialized as a hex string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Bytes" @@ -2789,11 +2718,11 @@ "description": "A string non-fungible id", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" @@ -2806,6 +2735,21 @@ } ] }, + "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": [ diff --git a/schema/out/schema/compile_transaction_intent_request.json b/schema/out/schema/compile_transaction_intent_request.json index 156e0d1d..bf91d5c5 100644 --- a/schema/out/schema/compile_transaction_intent_request.json +++ b/schema/out/schema/compile_transaction_intent_request.json @@ -2029,105 +2029,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2135,6 +2039,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -2327,12 +2234,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2341,18 +2244,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2361,95 +2263,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2457,6 +2282,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -2631,6 +2459,106 @@ "Bytes" ] }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "NodeIdentifier": { "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", "type": "string", @@ -2638,23 +2566,31 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, "TransientIdentifier": { "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" ] }, - "identifier": { + "value": { "description": "A string identifier", "type": "string" } @@ -2663,17 +2599,17 @@ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "U32" ] }, - "identifier": { + "value": { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "string", "pattern": "[0-9]+" @@ -2682,21 +2618,14 @@ } ] }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } ] }, - "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]+" - }, "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ @@ -2704,11 +2633,11 @@ "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Number" @@ -2724,11 +2653,11 @@ "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "UUID" @@ -2744,11 +2673,11 @@ "description": "An byte array non-fungible id type which is serialized as a hex string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Bytes" @@ -2764,11 +2693,11 @@ "description": "A string non-fungible id", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" @@ -2780,6 +2709,21 @@ } } ] + }, + "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_request.json b/schema/out/schema/convert_manifest_request.json index 541f940d..9aa1abd2 100644 --- a/schema/out/schema/convert_manifest_request.json +++ b/schema/out/schema/convert_manifest_request.json @@ -1937,105 +1937,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2043,6 +1947,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -2235,12 +2142,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2249,18 +2152,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2269,95 +2171,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2365,6 +2190,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -2539,6 +2367,106 @@ "Bytes" ] }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "NodeIdentifier": { "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", "type": "string", @@ -2546,23 +2474,31 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, "TransientIdentifier": { "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" ] }, - "identifier": { + "value": { "description": "A string identifier", "type": "string" } @@ -2571,17 +2507,17 @@ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "U32" ] }, - "identifier": { + "value": { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "string", "pattern": "[0-9]+" @@ -2590,21 +2526,14 @@ } ] }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } ] }, - "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]+" - }, "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ @@ -2612,11 +2541,11 @@ "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Number" @@ -2632,11 +2561,11 @@ "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "UUID" @@ -2652,11 +2581,11 @@ "description": "An byte array non-fungible id type which is serialized as a hex string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Bytes" @@ -2672,11 +2601,11 @@ "description": "A string non-fungible id", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" @@ -2688,6 +2617,21 @@ } } ] + }, + "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 index cf42c119..bdf191ca 100644 --- a/schema/out/schema/convert_manifest_response.json +++ b/schema/out/schema/convert_manifest_response.json @@ -1897,105 +1897,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2003,6 +1907,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -2195,12 +2102,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2209,18 +2112,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2229,95 +2131,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2325,6 +2150,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -2499,6 +2327,106 @@ "Bytes" ] }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "NodeIdentifier": { "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", "type": "string", @@ -2506,23 +2434,31 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, "TransientIdentifier": { "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" ] }, - "identifier": { + "value": { "description": "A string identifier", "type": "string" } @@ -2531,17 +2467,17 @@ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "U32" ] }, - "identifier": { + "value": { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "string", "pattern": "[0-9]+" @@ -2550,21 +2486,14 @@ } ] }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } ] }, - "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]+" - }, "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ @@ -2572,11 +2501,11 @@ "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Number" @@ -2592,11 +2521,11 @@ "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "UUID" @@ -2612,11 +2541,11 @@ "description": "An byte array non-fungible id type which is serialized as a hex string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Bytes" @@ -2632,11 +2561,11 @@ "description": "A string non-fungible id", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" @@ -2648,6 +2577,21 @@ } } ] + }, + "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_notarized_transaction_response.json b/schema/out/schema/decompile_notarized_transaction_response.json index 1babb8ed..211607b5 100644 --- a/schema/out/schema/decompile_notarized_transaction_response.json +++ b/schema/out/schema/decompile_notarized_transaction_response.json @@ -2080,105 +2080,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2186,6 +2090,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -2378,12 +2285,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2392,18 +2295,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2412,95 +2314,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2508,6 +2333,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -2682,6 +2510,106 @@ "Bytes" ] }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "NodeIdentifier": { "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", "type": "string", @@ -2689,23 +2617,31 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, "TransientIdentifier": { "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" ] }, - "identifier": { + "value": { "description": "A string identifier", "type": "string" } @@ -2714,17 +2650,17 @@ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "U32" ] }, - "identifier": { + "value": { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "string", "pattern": "[0-9]+" @@ -2733,21 +2669,14 @@ } ] }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } ] }, - "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]+" - }, "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ @@ -2755,11 +2684,11 @@ "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Number" @@ -2775,11 +2704,11 @@ "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "UUID" @@ -2795,11 +2724,11 @@ "description": "An byte array non-fungible id type which is serialized as a hex string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Bytes" @@ -2815,11 +2744,11 @@ "description": "A string non-fungible id", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" @@ -2832,6 +2761,21 @@ } ] }, + "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": [ diff --git a/schema/out/schema/decompile_signed_transaction_intent_response.json b/schema/out/schema/decompile_signed_transaction_intent_response.json index f6b27b24..f331cee9 100644 --- a/schema/out/schema/decompile_signed_transaction_intent_response.json +++ b/schema/out/schema/decompile_signed_transaction_intent_response.json @@ -2054,105 +2054,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2160,6 +2064,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -2352,12 +2259,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2366,18 +2269,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2386,95 +2288,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2482,6 +2307,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -2656,6 +2484,106 @@ "Bytes" ] }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "NodeIdentifier": { "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", "type": "string", @@ -2663,23 +2591,31 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, "TransientIdentifier": { "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" ] }, - "identifier": { + "value": { "description": "A string identifier", "type": "string" } @@ -2688,17 +2624,17 @@ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "U32" ] }, - "identifier": { + "value": { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "string", "pattern": "[0-9]+" @@ -2707,21 +2643,14 @@ } ] }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } ] }, - "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]+" - }, "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ @@ -2729,11 +2658,11 @@ "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Number" @@ -2749,11 +2678,11 @@ "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "UUID" @@ -2769,11 +2698,11 @@ "description": "An byte array non-fungible id type which is serialized as a hex string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Bytes" @@ -2789,11 +2718,11 @@ "description": "A string non-fungible id", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" @@ -2806,6 +2735,21 @@ } ] }, + "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": [ diff --git a/schema/out/schema/decompile_transaction_intent_response.json b/schema/out/schema/decompile_transaction_intent_response.json index 20adc6c1..3418898f 100644 --- a/schema/out/schema/decompile_transaction_intent_response.json +++ b/schema/out/schema/decompile_transaction_intent_response.json @@ -2029,105 +2029,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2135,6 +2039,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -2327,12 +2234,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2341,18 +2244,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2361,95 +2263,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2457,6 +2282,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -2631,6 +2459,106 @@ "Bytes" ] }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "NodeIdentifier": { "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", "type": "string", @@ -2638,23 +2566,31 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, "TransientIdentifier": { "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" ] }, - "identifier": { + "value": { "description": "A string identifier", "type": "string" } @@ -2663,17 +2599,17 @@ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "U32" ] }, - "identifier": { + "value": { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "string", "pattern": "[0-9]+" @@ -2682,21 +2618,14 @@ } ] }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } ] }, - "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]+" - }, "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ @@ -2704,11 +2633,11 @@ "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Number" @@ -2724,11 +2653,11 @@ "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "UUID" @@ -2744,11 +2673,11 @@ "description": "An byte array non-fungible id type which is serialized as a hex string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Bytes" @@ -2764,11 +2693,11 @@ "description": "A string non-fungible id", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" @@ -2780,6 +2709,21 @@ } } ] + }, + "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_response.json b/schema/out/schema/decompile_unknown_transaction_intent_response.json index 754a9856..a32fdadc 100644 --- a/schema/out/schema/decompile_unknown_transaction_intent_response.json +++ b/schema/out/schema/decompile_unknown_transaction_intent_response.json @@ -2043,105 +2043,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2149,6 +2053,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -2341,12 +2248,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2355,18 +2258,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -2375,95 +2277,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -2471,6 +2296,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -2645,6 +2473,106 @@ "Bytes" ] }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "NodeIdentifier": { "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", "type": "string", @@ -2652,23 +2580,31 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, "TransientIdentifier": { "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" ] }, - "identifier": { + "value": { "description": "A string identifier", "type": "string" } @@ -2677,17 +2613,17 @@ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "U32" ] }, - "identifier": { + "value": { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "string", "pattern": "[0-9]+" @@ -2696,21 +2632,14 @@ } ] }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } ] }, - "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]+" - }, "NonFungibleId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ @@ -2718,11 +2647,11 @@ "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Number" @@ -2738,11 +2667,11 @@ "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "UUID" @@ -2758,11 +2687,11 @@ "description": "An byte array non-fungible id type which is serialized as a hex string", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "Bytes" @@ -2778,11 +2707,11 @@ "description": "A string non-fungible id", "type": "object", "required": [ - "value", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" @@ -2795,6 +2724,21 @@ } ] }, + "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`].", "type": "object", diff --git a/schema/out/schema/derive_virtual_account_address_response.json b/schema/out/schema/derive_virtual_account_address_response.json index 64747b02..71ca1797 100644 --- a/schema/out/schema/derive_virtual_account_address_response.json +++ b/schema/out/schema/derive_virtual_account_address_response.json @@ -512,105 +512,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -618,6 +522,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -810,12 +717,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -824,18 +727,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -844,95 +746,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -940,6 +765,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -1114,6 +942,106 @@ "Bytes" ] }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "NodeIdentifier": { "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", "type": "string", @@ -1121,23 +1049,31 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, "TransientIdentifier": { "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" ] }, - "identifier": { + "value": { "description": "A string identifier", "type": "string" } @@ -1146,17 +1082,17 @@ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "U32" ] }, - "identifier": { + "value": { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "string", "pattern": "[0-9]+" @@ -1165,6 +1101,98 @@ } ] }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "NonFungibleId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Number" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "UUID" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An byte array non-fungible id type which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "Expression": { "description": "Represents a transaction manifest expression.", "type": "string", diff --git a/schema/out/schema/known_entity_addresses_response.json b/schema/out/schema/known_entity_addresses_response.json index 21a7f0e8..894c4eac 100644 --- a/schema/out/schema/known_entity_addresses_response.json +++ b/schema/out/schema/known_entity_addresses_response.json @@ -584,105 +584,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -690,6 +594,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -882,12 +789,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -896,18 +799,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -916,95 +818,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -1012,6 +837,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -1186,6 +1014,106 @@ "Bytes" ] }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "NodeIdentifier": { "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", "type": "string", @@ -1193,23 +1121,31 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, "TransientIdentifier": { "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" ] }, - "identifier": { + "value": { "description": "A string identifier", "type": "string" } @@ -1218,17 +1154,17 @@ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "U32" ] }, - "identifier": { + "value": { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "string", "pattern": "[0-9]+" @@ -1237,6 +1173,98 @@ } ] }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "NonFungibleId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Number" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "UUID" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An byte array non-fungible id type which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "Expression": { "description": "Represents a transaction manifest expression.", "type": "string", diff --git a/schema/out/schema/sbor_decode_response.json b/schema/out/schema/sbor_decode_response.json index 1234f3c9..c932f7e5 100644 --- a/schema/out/schema/sbor_decode_response.json +++ b/schema/out/schema/sbor_decode_response.json @@ -496,105 +496,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -602,6 +506,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -794,12 +701,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -808,18 +711,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -828,95 +730,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -924,6 +749,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -1548,105 +1376,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -1654,6 +1386,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -1846,12 +1581,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -1860,18 +1591,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -1880,95 +1610,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -1976,6 +1629,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -2106,6 +1762,106 @@ "Bytes" ] }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "NodeIdentifier": { "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", "type": "string", @@ -2113,23 +1869,31 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, "TransientIdentifier": { "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" ] }, - "identifier": { + "value": { "description": "A string identifier", "type": "string" } @@ -2138,17 +1902,17 @@ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "U32" ] }, - "identifier": { + "value": { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "string", "pattern": "[0-9]+" @@ -2157,6 +1921,98 @@ } ] }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "NonFungibleId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Number" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "UUID" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An byte array non-fungible id type which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "Expression": { "description": "Represents a transaction manifest expression.", "type": "string", diff --git a/schema/out/schema/sbor_encode_request.json b/schema/out/schema/sbor_encode_request.json index f56ec081..e6088cf0 100644 --- a/schema/out/schema/sbor_encode_request.json +++ b/schema/out/schema/sbor_encode_request.json @@ -496,105 +496,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -602,6 +506,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -794,12 +701,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -808,18 +711,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -828,95 +730,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -924,6 +749,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -1548,105 +1376,9 @@ { "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "type": "object", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -1654,6 +1386,9 @@ "enum": [ "Own" ] + }, + "value": { + "$ref": "#/definitions/Own" } } }, @@ -1846,12 +1581,8 @@ { "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -1860,18 +1591,17 @@ "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 number.", "type": "object", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ], "required": [ + "identifier", "type" ], "properties": { @@ -1880,95 +1610,18 @@ "enum": [ "Proof" ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Number" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "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", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id", - "type": "object", - "required": [ - "value", - "variant" - ], - "properties": { - "variant": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - } - ], "required": [ - "type" + "type", + "value" ], "properties": { "type": { @@ -1976,6 +1629,9 @@ "enum": [ "NonFungibleId" ] + }, + "value": { + "$ref": "#/definitions/NonFungibleId" } } }, @@ -2106,6 +1762,106 @@ "Bytes" ] }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "NodeIdentifier": { "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", "type": "string", @@ -2113,23 +1869,31 @@ "minLength": 72, "pattern": "[0-9a-fA-F]+" }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, "TransientIdentifier": { "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "String" ] }, - "identifier": { + "value": { "description": "A string identifier", "type": "string" } @@ -2138,17 +1902,17 @@ { "type": "object", "required": [ - "identifier", - "variant" + "type", + "value" ], "properties": { - "variant": { + "type": { "type": "string", "enum": [ "U32" ] }, - "identifier": { + "value": { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "string", "pattern": "[0-9]+" @@ -2157,6 +1921,98 @@ } ] }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "NonFungibleId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Number" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "UUID" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An byte array non-fungible id type which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, "Expression": { "description": "Represents a transaction manifest expression.", "type": "string", From 441d6357e686ade2cd2e26fc8d608873f675ea8d Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 27 Jan 2023 14:10:46 +0300 Subject: [PATCH 084/110] Update to develop-9055c6 --- radix-engine-toolkit/Cargo.toml | 10 ++++----- .../src/model/address/entity_address.rs | 1 + .../src/model/address/entity_type.rs | 3 +++ radix-engine-toolkit/src/model/instruction.rs | 22 +++++++++++++++---- schema/Cargo.toml | 10 ++++----- 5 files changed, 32 insertions(+), 14 deletions(-) diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index 9e4ed215..3bd426b4 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -16,11 +16,11 @@ schemars = { version = "0.8.11", features = ["preserve_order"] } serializable = { path = "../serializable" } # Scrypto dependencies required for the core-toolkit -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6" } +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211" } # Hex is used for the internal hex encoding and decoding of values - serde_with::Hex is used for the # hex representation during serialization. diff --git a/radix-engine-toolkit/src/model/address/entity_address.rs b/radix-engine-toolkit/src/model/address/entity_address.rs index de7b473f..56a37f0b 100644 --- a/radix-engine-toolkit/src/model/address/entity_address.rs +++ b/radix-engine-toolkit/src/model/address/entity_address.rs @@ -90,6 +90,7 @@ impl EntityAddress { Self::SystemAddress { address } => match address.address { scrypto::prelude::SystemAddress::EpochManager(_) => EntityType::EpochManager, scrypto::prelude::SystemAddress::Clock(_) => EntityType::Clock, + scrypto::prelude::SystemAddress::Validator(_) => EntityType::Validator, }, } } diff --git a/radix-engine-toolkit/src/model/address/entity_type.rs b/radix-engine-toolkit/src/model/address/entity_type.rs index defa3233..4e366998 100644 --- a/radix-engine-toolkit/src/model/address/entity_type.rs +++ b/radix-engine-toolkit/src/model/address/entity_type.rs @@ -33,6 +33,7 @@ pub enum EntityType { EddsaEd25519VirtualAccountComponent, EpochManager, Clock, + Validator, } // ============ @@ -54,6 +55,7 @@ impl From for NativeEntityType { } EntityType::EpochManager => Self::EpochManager, EntityType::Clock => Self::Clock, + EntityType::Validator => Self::Validator, } } } @@ -73,6 +75,7 @@ impl From for EntityType { } NativeEntityType::EpochManager => Self::EpochManager, NativeEntityType::Clock => Self::Clock, + NativeEntityType::Validator => Self::Validator, } } } diff --git a/radix-engine-toolkit/src/model/instruction.rs b/radix-engine-toolkit/src/model/instruction.rs index 20ce34fa..163a6ae6 100644 --- a/radix-engine-toolkit/src/model/instruction.rs +++ b/radix-engine-toolkit/src/model/instruction.rs @@ -503,15 +503,21 @@ pub enum Instruction { initial_supply: Value, }, - /// An instruction to registers a new validator given the public key of the validator - RegisterValidator { + CreateValidator { /// The public key of the validator + key: Value, + }, + + /// An instruction to registers a new validator given the system component address of the + /// validator + RegisterValidator { + /// the system component address of the validator validator: Value, }, - /// An instruction to unregister a validator given it's public key + /// An instruction to unregister a validator given the system component address of the validator UnregisterValidator { - /// The public key of the validator to unregister + /// the system component address of the validator to unregister validator: Value, }, } @@ -809,6 +815,9 @@ impl Instruction { resource_address: resource_address.to_ast_value(bech32_coder)?, entries: entries.to_ast_value(bech32_coder)?, }, + Self::CreateValidator { key } => ast::Instruction::CreateValidator { + key: key.to_ast_value(bech32_coder)?, + }, Self::RegisterValidator { validator } => ast::Instruction::RegisterValidator { validator: validator.to_ast_value(bech32_coder)?, }, @@ -1129,6 +1138,9 @@ impl Instruction { resource_address: Value::from_ast_value(resource_address, bech32_coder)?, entries: Value::from_ast_value(entries, bech32_coder)?, }, + ast::Instruction::CreateValidator { key } => Self::CreateValidator { + key: Value::from_ast_value(key, bech32_coder)?, + }, ast::Instruction::RegisterValidator { validator } => Self::RegisterValidator { validator: Value::from_ast_value(validator, bech32_coder)?, }, @@ -1391,6 +1403,7 @@ impl ValueRef for Instruction { values.push(initial_supply); } + Self::CreateValidator { key } => values.push(key), Self::RegisterValidator { validator } => values.push(validator), Self::UnregisterValidator { validator } => values.push(validator), @@ -1651,6 +1664,7 @@ impl ValueRef for Instruction { values.push(initial_supply); } + Self::CreateValidator { key } => values.push(key), Self::RegisterValidator { validator } => values.push(validator), Self::UnregisterValidator { validator } => values.push(validator), diff --git a/schema/Cargo.toml b/schema/Cargo.toml index 2accc7e2..350fe73d 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -15,8 +15,8 @@ radix_engine_toolkit = { path = "../radix-engine-toolkit" } serde = "1.0.152" convert_case = "0.6.0" -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-9055c6" } \ No newline at end of file +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211" } \ No newline at end of file From d063a6b242a3defafb36031716a07301412ca388 Mon Sep 17 00:00:00 2001 From: Omar Date: Fri, 27 Jan 2023 14:14:01 +0300 Subject: [PATCH 085/110] Update schema and examples --- schema/out/examples/request-examples.md | 72 +++++++++---------- ...compile_notarized_transaction_request.json | 31 ++++++-- ...ile_signed_transaction_intent_request.json | 31 ++++++-- .../compile_transaction_intent_request.json | 31 ++++++-- .../out/schema/convert_manifest_request.json | 31 ++++++-- .../out/schema/convert_manifest_response.json | 31 ++++++-- .../out/schema/decode_address_response.json | 3 +- ...ompile_notarized_transaction_response.json | 31 ++++++-- ...le_signed_transaction_intent_response.json | 31 ++++++-- ...decompile_transaction_intent_response.json | 31 ++++++-- ...e_unknown_transaction_intent_response.json | 31 ++++++-- 11 files changed, 281 insertions(+), 73 deletions(-) diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index 67125b4a..06a210e5 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -836,7 +836,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221123038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042303810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" + "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" } ``` @@ -856,7 +856,7 @@ This document contains examples and descriptions of the different requests and r ```json { "instructions_output_kind": "Parsed", - "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221123038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042303810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" + "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" } ``` @@ -1411,30 +1411,30 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" + "signature": "01eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb31" }, { "curve": "EcdsaSecp256k1", - "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" + "signature": "004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d" }, { "curve": "EcdsaSecp256k1", - "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" + "signature": "011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" + "signature": "55a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" + "signature": "0fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee309" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" + "signature": "38bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404" } ] } @@ -1446,7 +1446,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221123038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042303810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf10001b20004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c0001b201607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b97290102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b430fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c492080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e5070102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb49df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" + "compiled_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b201eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb310001b2004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d0001b2011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b455a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d0102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b40fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee3090102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb438bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404" } ``` @@ -1466,7 +1466,7 @@ This document contains examples and descriptions of the different requests and r ```json { "instructions_output_kind": "Parsed", - "compiled_signed_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221123038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042303810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf10001b20004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c0001b201607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b97290102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b430fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c492080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e5070102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb49df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" + "compiled_signed_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b201eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb310001b2004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d0001b2011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b455a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d0102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b40fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee3090102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb438bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404" } ``` @@ -1742,30 +1742,30 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" + "signature": "01eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb31" }, { "curve": "EcdsaSecp256k1", - "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" + "signature": "004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d" }, { "curve": "EcdsaSecp256k1", - "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" + "signature": "011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" + "signature": "55a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" + "signature": "0fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee309" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" + "signature": "38bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404" } ] } @@ -2053,36 +2053,36 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" + "signature": "01eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb31" }, { "curve": "EcdsaSecp256k1", - "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" + "signature": "004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d" }, { "curve": "EcdsaSecp256k1", - "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" + "signature": "011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" + "signature": "55a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" + "signature": "0fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee309" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" + "signature": "38bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404" } ] }, "notary_signature": { "curve": "EcdsaSecp256k1", - "signature": "00c2daa118a8541ef384a38f431a3dde3bf023463e49c124dca7631e2083495dbc1a50968d3bd21033c2bdf0b22c64d56c84a3f1c8e61b847e0208c694627835ef" + "signature": "0031718d5ccfbedb3eba71baca8d4ad51a0c10b178cc469fa1c59faf8a5b45944b273a5f093d4e6e376c583f43949b20f91d8c24425e524a922a4238cbad5b70fb" } } ``` @@ -2093,7 +2093,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221123038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042303810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf10001b20004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c0001b201607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b97290102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b430fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c492080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e5070102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb49df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409220001b200c2daa118a8541ef384a38f431a3dde3bf023463e49c124dca7631e2083495dbc1a50968d3bd21033c2bdf0b22c64d56c84a3f1c8e61b847e0208c694627835ef" + "compiled_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b201eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb310001b2004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d0001b2011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b455a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d0102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b40fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee3090102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb438bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404220001b20031718d5ccfbedb3eba71baca8d4ad51a0c10b178cc469fa1c59faf8a5b45944b273a5f093d4e6e376c583f43949b20f91d8c24425e524a922a4238cbad5b70fb" } ``` @@ -2113,7 +2113,7 @@ This document contains examples and descriptions of the different requests and r ```json { "instructions_output_kind": "Parsed", - "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221123038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042303810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf10001b20004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c0001b201607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b97290102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b430fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c492080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e5070102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb49df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409220001b200c2daa118a8541ef384a38f431a3dde3bf023463e49c124dca7631e2083495dbc1a50968d3bd21033c2bdf0b22c64d56c84a3f1c8e61b847e0208c694627835ef" + "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b201eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb310001b2004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d0001b2011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b455a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d0102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b40fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee3090102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb438bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404220001b20031718d5ccfbedb3eba71baca8d4ad51a0c10b178cc469fa1c59faf8a5b45944b273a5f093d4e6e376c583f43949b20f91d8c24425e524a922a4238cbad5b70fb" } ``` @@ -2390,36 +2390,36 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "00d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1" + "signature": "01eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb31" }, { "curve": "EcdsaSecp256k1", - "signature": "0004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c" + "signature": "004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d" }, { "curve": "EcdsaSecp256k1", - "signature": "01607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b9729" + "signature": "011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "30fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c49208" + "signature": "55a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e507" + "signature": "0fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee309" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "9df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409" + "signature": "38bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404" } ] }, "notary_signature": { "curve": "EcdsaSecp256k1", - "signature": "00c2daa118a8541ef384a38f431a3dde3bf023463e49c124dca7631e2083495dbc1a50968d3bd21033c2bdf0b22c64d56c84a3f1c8e61b847e0208c694627835ef" + "signature": "0031718d5ccfbedb3eba71baca8d4ad51a0c10b178cc469fa1c59faf8a5b45944b273a5f093d4e6e376c583f43949b20f91d8c24425e524a922a4238cbad5b70fb" } } ``` @@ -2746,7 +2746,7 @@ This document contains examples and descriptions of the different requests and r { "virtual_account_address": { "type": "ComponentAddress", - "address": "account_sim1qcpveqrdmh7kw0vefxrzjw5e0fgw3sgdj4zrh66jkphqqc62xd" + "address": "account_sim1qupveqrdmh7kw0vefxrzjw5e0fgw3sgdj4zrh66jkphqj9h5gl" } } ``` @@ -2766,7 +2766,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221123038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042303810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100023038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf10001b20004671578e1f5eac6b80754041380680c4a2aade0173dbac78452e2681b0fdb2b4856070494ee3e1857a3c6ab840a214f2e3b88bbb140b258a5eac5fdfa60001c0001b201607f3ec615db0e08d0b9b8aebe07eaa1f8694c83c1c0d7015c5b1a0ad0371b9c57967a57c302e9145df831b0f083116ae700bb9f50da0111d5ed9630f08b97290102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b430fccf0b2fff1e261e24fd7d5de8e4b31ce7d01a5ef609acca19e4f75cab58a2ec42f7c80b70ff0f866e4f37ff27108da11f779e97da5f1ad3b239a6f3c492080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4638000d190edda9c5a724cd3cc53a3b3093ebb2a00966830224bbfd29c80f351b416005e7883e5d70e35b5cbab5893c27585f7302cccbb72997be0c7bfe5e5070102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb49df6945807370c409e0890efff264637c04acc9289b2ad050910add5dcedab305ec84b73ef1b50c763d9fbe97c85806b16542b465d9d34879922ae06cd91f409220001b200d97c6ee042ea5e522a609bd2b7ea30e32f081e89d9ca4c857a405a50fe16779b3198b51ed7b2ef033e9866643a8125524bd96438bb960ec1c3c02ac86eeabaf1", + "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b201eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb310001b2004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d0001b2011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b455a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d0102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b40fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee3090102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb438bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404220001b201eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb31", "validation_config": { "network_id": "242", "min_cost_unit_limit": "1000000", @@ -2844,11 +2844,11 @@ This document contains examples and descriptions of the different requests and r }, "epoch_manager_system_address": { "type": "SystemAddress", - "address": "system_rdx1qjjmc80hcmx4sfnyahhg4varselspsrm8gsuqa8dmsxs6y0ppl" + "address": "system_rdx1qs3eheg7mcydm2xms66n397udu8awhhj0xz6c99dtnmsjfw9hh" }, "clock_system_address": { "type": "SystemAddress", - "address": "system_rdx1q53eheg7mcydm2xms66n397udu8awhhj0xz6c99dtnmsq5rme9" + "address": "system_rdx1q6jmc80hcmx4sfnyahhg4varselspsrm8gsuqa8dmsxshh45aj" } } ``` diff --git a/schema/out/schema/compile_notarized_transaction_request.json b/schema/out/schema/compile_notarized_transaction_request.json index dbaefc06..6bd27db1 100644 --- a/schema/out/schema/compile_notarized_transaction_request.json +++ b/schema/out/schema/compile_notarized_transaction_request.json @@ -1536,7 +1536,30 @@ } }, { - "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_VALIDATOR" + ] + }, + "key": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1550,7 +1573,7 @@ ] }, "validator": { - "description": "The public key of the validator", + "description": "the system component address of the validator", "allOf": [ { "$ref": "#/definitions/Value" @@ -1560,7 +1583,7 @@ } }, { - "description": "An instruction to unregister a validator given it's public key", + "description": "An instruction to unregister a validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1574,7 +1597,7 @@ ] }, "validator": { - "description": "The public key of the validator to unregister", + "description": "the system component address of the validator to unregister", "allOf": [ { "$ref": "#/definitions/Value" diff --git a/schema/out/schema/compile_signed_transaction_intent_request.json b/schema/out/schema/compile_signed_transaction_intent_request.json index c18eb007..2a5f9fbf 100644 --- a/schema/out/schema/compile_signed_transaction_intent_request.json +++ b/schema/out/schema/compile_signed_transaction_intent_request.json @@ -1510,7 +1510,30 @@ } }, { - "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_VALIDATOR" + ] + }, + "key": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1524,7 +1547,7 @@ ] }, "validator": { - "description": "The public key of the validator", + "description": "the system component address of the validator", "allOf": [ { "$ref": "#/definitions/Value" @@ -1534,7 +1557,7 @@ } }, { - "description": "An instruction to unregister a validator given it's public key", + "description": "An instruction to unregister a validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1548,7 +1571,7 @@ ] }, "validator": { - "description": "The public key of the validator to unregister", + "description": "the system component address of the validator to unregister", "allOf": [ { "$ref": "#/definitions/Value" diff --git a/schema/out/schema/compile_transaction_intent_request.json b/schema/out/schema/compile_transaction_intent_request.json index bf91d5c5..8ab28008 100644 --- a/schema/out/schema/compile_transaction_intent_request.json +++ b/schema/out/schema/compile_transaction_intent_request.json @@ -1485,7 +1485,30 @@ } }, { - "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_VALIDATOR" + ] + }, + "key": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1499,7 +1522,7 @@ ] }, "validator": { - "description": "The public key of the validator", + "description": "the system component address of the validator", "allOf": [ { "$ref": "#/definitions/Value" @@ -1509,7 +1532,7 @@ } }, { - "description": "An instruction to unregister a validator given it's public key", + "description": "An instruction to unregister a validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1523,7 +1546,7 @@ ] }, "validator": { - "description": "The public key of the validator to unregister", + "description": "the system component address of the validator to unregister", "allOf": [ { "$ref": "#/definitions/Value" diff --git a/schema/out/schema/convert_manifest_request.json b/schema/out/schema/convert_manifest_request.json index 9aa1abd2..dc4671c0 100644 --- a/schema/out/schema/convert_manifest_request.json +++ b/schema/out/schema/convert_manifest_request.json @@ -1393,7 +1393,30 @@ } }, { - "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_VALIDATOR" + ] + }, + "key": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1407,7 +1430,7 @@ ] }, "validator": { - "description": "The public key of the validator", + "description": "the system component address of the validator", "allOf": [ { "$ref": "#/definitions/Value" @@ -1417,7 +1440,7 @@ } }, { - "description": "An instruction to unregister a validator given it's public key", + "description": "An instruction to unregister a validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1431,7 +1454,7 @@ ] }, "validator": { - "description": "The public key of the validator to unregister", + "description": "the system component address of the validator to unregister", "allOf": [ { "$ref": "#/definitions/Value" diff --git a/schema/out/schema/convert_manifest_response.json b/schema/out/schema/convert_manifest_response.json index bdf191ca..b8078f16 100644 --- a/schema/out/schema/convert_manifest_response.json +++ b/schema/out/schema/convert_manifest_response.json @@ -1353,7 +1353,30 @@ } }, { - "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_VALIDATOR" + ] + }, + "key": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1367,7 +1390,7 @@ ] }, "validator": { - "description": "The public key of the validator", + "description": "the system component address of the validator", "allOf": [ { "$ref": "#/definitions/Value" @@ -1377,7 +1400,7 @@ } }, { - "description": "An instruction to unregister a validator given it's public key", + "description": "An instruction to unregister a validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1391,7 +1414,7 @@ ] }, "validator": { - "description": "The public key of the validator to unregister", + "description": "the system component address of the validator to unregister", "allOf": [ { "$ref": "#/definitions/Value" diff --git a/schema/out/schema/decode_address_response.json b/schema/out/schema/decode_address_response.json index ef1f797a..9976ccee 100644 --- a/schema/out/schema/decode_address_response.json +++ b/schema/out/schema/decode_address_response.json @@ -51,7 +51,8 @@ "EcdsaSecp256k1VirtualAccountComponent", "EddsaEd25519VirtualAccountComponent", "EpochManager", - "Clock" + "Clock", + "Validator" ] } } diff --git a/schema/out/schema/decompile_notarized_transaction_response.json b/schema/out/schema/decompile_notarized_transaction_response.json index 211607b5..7643dda6 100644 --- a/schema/out/schema/decompile_notarized_transaction_response.json +++ b/schema/out/schema/decompile_notarized_transaction_response.json @@ -1536,7 +1536,30 @@ } }, { - "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_VALIDATOR" + ] + }, + "key": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1550,7 +1573,7 @@ ] }, "validator": { - "description": "The public key of the validator", + "description": "the system component address of the validator", "allOf": [ { "$ref": "#/definitions/Value" @@ -1560,7 +1583,7 @@ } }, { - "description": "An instruction to unregister a validator given it's public key", + "description": "An instruction to unregister a validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1574,7 +1597,7 @@ ] }, "validator": { - "description": "The public key of the validator to unregister", + "description": "the system component address of the validator to unregister", "allOf": [ { "$ref": "#/definitions/Value" diff --git a/schema/out/schema/decompile_signed_transaction_intent_response.json b/schema/out/schema/decompile_signed_transaction_intent_response.json index f331cee9..3151d4d2 100644 --- a/schema/out/schema/decompile_signed_transaction_intent_response.json +++ b/schema/out/schema/decompile_signed_transaction_intent_response.json @@ -1510,7 +1510,30 @@ } }, { - "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_VALIDATOR" + ] + }, + "key": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1524,7 +1547,7 @@ ] }, "validator": { - "description": "The public key of the validator", + "description": "the system component address of the validator", "allOf": [ { "$ref": "#/definitions/Value" @@ -1534,7 +1557,7 @@ } }, { - "description": "An instruction to unregister a validator given it's public key", + "description": "An instruction to unregister a validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1548,7 +1571,7 @@ ] }, "validator": { - "description": "The public key of the validator to unregister", + "description": "the system component address of the validator to unregister", "allOf": [ { "$ref": "#/definitions/Value" diff --git a/schema/out/schema/decompile_transaction_intent_response.json b/schema/out/schema/decompile_transaction_intent_response.json index 3418898f..843dc749 100644 --- a/schema/out/schema/decompile_transaction_intent_response.json +++ b/schema/out/schema/decompile_transaction_intent_response.json @@ -1485,7 +1485,30 @@ } }, { - "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_VALIDATOR" + ] + }, + "key": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1499,7 +1522,7 @@ ] }, "validator": { - "description": "The public key of the validator", + "description": "the system component address of the validator", "allOf": [ { "$ref": "#/definitions/Value" @@ -1509,7 +1532,7 @@ } }, { - "description": "An instruction to unregister a validator given it's public key", + "description": "An instruction to unregister a validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1523,7 +1546,7 @@ ] }, "validator": { - "description": "The public key of the validator to unregister", + "description": "the system component address of the validator to unregister", "allOf": [ { "$ref": "#/definitions/Value" diff --git a/schema/out/schema/decompile_unknown_transaction_intent_response.json b/schema/out/schema/decompile_unknown_transaction_intent_response.json index a32fdadc..648ca1af 100644 --- a/schema/out/schema/decompile_unknown_transaction_intent_response.json +++ b/schema/out/schema/decompile_unknown_transaction_intent_response.json @@ -1499,7 +1499,30 @@ } }, { - "description": "An instruction to registers a new validator given the public key of the validator", + "type": "object", + "required": [ + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_VALIDATOR" + ] + }, + "key": { + "description": "The public key of the validator", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } + }, + { + "description": "An instruction to registers a new validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1513,7 +1536,7 @@ ] }, "validator": { - "description": "The public key of the validator", + "description": "the system component address of the validator", "allOf": [ { "$ref": "#/definitions/Value" @@ -1523,7 +1546,7 @@ } }, { - "description": "An instruction to unregister a validator given it's public key", + "description": "An instruction to unregister a validator given the system component address of the validator", "type": "object", "required": [ "instruction", @@ -1537,7 +1560,7 @@ ] }, "validator": { - "description": "The public key of the validator to unregister", + "description": "the system component address of the validator to unregister", "allOf": [ { "$ref": "#/definitions/Value" From 4a40fe7acf8f99e41e56e0347fe26a50e944fe9e Mon Sep 17 00:00:00 2001 From: Omar Date: Sun, 29 Jan 2023 02:20:52 +0300 Subject: [PATCH 086/110] Update to latest develop branch --- radix-engine-toolkit/Cargo.toml | 10 +- radix-engine-toolkit/src/error.rs | 4 +- .../src/model/address/coder.rs | 23 +- .../src/model/address/entity_address.rs | 32 +-- .../src/model/address/entity_type.rs | 20 ++ radix-engine-toolkit/src/model/address/mod.rs | 8 +- .../model/address/network_aware_address.rs | 5 - ...e_address.rs => non_fungible_global_id.rs} | 26 +- ...ungible_id.rs => non_fungible_local_id.rs} | 38 +-- radix-engine-toolkit/src/model/instruction.rs | 173 ++++++++---- radix-engine-toolkit/src/model/value.rs | 262 ++++++------------ .../src/request/known_entity_addresses.rs | 13 +- .../tests/test_vector/manifest/worktop.rtm | 2 +- .../tests/test_vector/value.rs | 74 +++-- schema/Cargo.toml | 10 +- schema/out/examples/request-examples.md | 120 ++++---- ...compile_notarized_transaction_request.json | 149 +++++----- ...ile_signed_transaction_intent_request.json | 149 +++++----- .../compile_transaction_intent_request.json | 149 +++++----- .../out/schema/convert_manifest_request.json | 149 +++++----- .../out/schema/convert_manifest_response.json | 149 +++++----- .../out/schema/decode_address_response.json | 6 +- ...ompile_notarized_transaction_response.json | 149 +++++----- ...le_signed_transaction_intent_response.json | 149 +++++----- ...decompile_transaction_intent_response.json | 149 +++++----- ...e_unknown_transaction_intent_response.json | 149 +++++----- ...rive_virtual_account_address_response.json | 54 ++-- .../out/schema/encode_address_response.json | 27 -- .../known_entity_addresses_response.json | 58 ++-- schema/out/schema/sbor_decode_response.json | 89 ++---- schema/out/schema/sbor_encode_request.json | 89 ++---- 31 files changed, 1249 insertions(+), 1235 deletions(-) rename radix-engine-toolkit/src/model/address/{non_fungible_address.rs => non_fungible_global_id.rs} (70%) rename radix-engine-toolkit/src/model/address/{non_fungible_id.rs => non_fungible_local_id.rs} (60%) diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index 3bd426b4..48c9a155 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -16,11 +16,11 @@ schemars = { version = "0.8.11", features = ["preserve_order"] } serializable = { path = "../serializable" } # Scrypto dependencies required for the core-toolkit -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211" } +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop" } # Hex is used for the internal hex encoding and decoding of values - serde_with::Hex is used for the # hex representation during serialization. diff --git a/radix-engine-toolkit/src/error.rs b/radix-engine-toolkit/src/error.rs index f171a2ff..a69923bb 100644 --- a/radix-engine-toolkit/src/error.rs +++ b/radix-engine-toolkit/src/error.rs @@ -212,8 +212,8 @@ impl_from_parse_error! { scrypto::prelude::ParseDecimalError => Decimal, scrypto::prelude::ParsePreciseDecimalError => PreciseDecimal, scrypto::prelude::ParseHashError => Hash, - scrypto::prelude::ParseNonFungibleIdError => NonFungibleId, - scrypto::prelude::ParseNonFungibleAddressError => NonFungibleAddress, + scrypto::prelude::ParseNonFungibleLocalIdError => NonFungibleLocalId, + scrypto::prelude::ParseNonFungibleGlobalIdError => NonFungibleGlobalId, scrypto::prelude::ParseManifestBlobRefError => Blob, scrypto::prelude::ParseEcdsaSecp256k1PublicKeyError => EcdsaSecp256k1PublicKey, scrypto::prelude::ParseEcdsaSecp256k1SignatureError => EcdsaSecp256k1Signature, diff --git a/radix-engine-toolkit/src/model/address/coder.rs b/radix-engine-toolkit/src/model/address/coder.rs index b5e43d3b..adc3374a 100644 --- a/radix-engine-toolkit/src/model/address/coder.rs +++ b/radix-engine-toolkit/src/model/address/coder.rs @@ -21,7 +21,7 @@ use crate::utils::{ network_definition_from_network_id, network_id_from_address_string, network_id_from_hrp, }; use crate::Error; -use scrypto::prelude::{ComponentAddress, PackageAddress, ResourceAddress, SystemAddress}; +use scrypto::prelude::{ComponentAddress, PackageAddress, ResourceAddress}; use scrypto::radix_engine_interface::address::{Bech32Decoder, Bech32Encoder}; use scrypto::radix_engine_interface::node::NetworkDefinition; @@ -81,10 +81,6 @@ impl Bech32Coder { .encode_resource_address_to_string(resource_address) } - pub fn encode_system_address(&self, system_address: &SystemAddress) -> String { - self.encoder.encode_system_address_to_string(system_address) - } - pub fn encode_package_address(&self, package_address: &PackageAddress) -> String { self.encoder .encode_package_address_to_string(package_address) @@ -108,12 +104,6 @@ impl Bech32Coder { .map_err(Error::from) } - pub fn decode_system_address>(&self, system_address: S) -> Result { - self.decoder - .validate_and_decode_system_address(system_address.as_ref()) - .map_err(Error::from) - } - pub fn decode_package_address>( &self, package_address: S, @@ -145,17 +135,6 @@ impl Bech32Coder { }) } - pub fn decode_to_network_aware_system_address>( - &self, - system_address: S, - ) -> Result { - self.decode_system_address(system_address) - .map(|system_address| NetworkAwareSystemAddress { - network_id: self.network_id(), - address: system_address, - }) - } - pub fn decode_to_network_aware_package_address>( &self, package_address: S, diff --git a/radix-engine-toolkit/src/model/address/entity_address.rs b/radix-engine-toolkit/src/model/address/entity_address.rs index 56a37f0b..ca3e09ee 100644 --- a/radix-engine-toolkit/src/model/address/entity_address.rs +++ b/radix-engine-toolkit/src/model/address/entity_address.rs @@ -47,14 +47,6 @@ pub enum EntityAddress { address: NetworkAwareResourceAddress, }, - /// Represents a Bech32m encoded human-readable system address. This address is serialized - /// as a human-readable bech32m encoded string. - SystemAddress { - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - address: NetworkAwareSystemAddress, - }, - /// Represents a Bech32m encoded human-readable package address. This address is serialized /// as a human-readable bech32m encoded string. PackageAddress { @@ -72,7 +64,10 @@ impl EntityAddress { pub fn kind(&self) -> EntityType { match self { Self::ComponentAddress { address } => match address.address { - scrypto::prelude::ComponentAddress::Normal(_) => EntityType::NormalComponent, + scrypto::prelude::ComponentAddress::Normal(_) + | scrypto::prelude::ComponentAddress::AccessController(_) => { + EntityType::NormalComponent + } scrypto::prelude::ComponentAddress::Account(_) => EntityType::AccountComponent, scrypto::prelude::ComponentAddress::EcdsaSecp256k1VirtualAccount(_) => { EntityType::EcdsaSecp256k1VirtualAccountComponent @@ -80,6 +75,16 @@ impl EntityAddress { 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::Normal(_) => EntityType::Resource, @@ -87,11 +92,6 @@ impl EntityAddress { Self::PackageAddress { address } => match address.address { scrypto::prelude::PackageAddress::Normal(_) => EntityType::Package, }, - Self::SystemAddress { address } => match address.address { - scrypto::prelude::SystemAddress::EpochManager(_) => EntityType::EpochManager, - scrypto::prelude::SystemAddress::Clock(_) => EntityType::Clock, - scrypto::prelude::SystemAddress::Validator(_) => EntityType::Validator, - }, } } @@ -100,7 +100,6 @@ impl EntityAddress { Self::ComponentAddress { address } => address.network_id, Self::ResourceAddress { address } => address.network_id, Self::PackageAddress { address } => address.network_id, - Self::SystemAddress { address } => address.network_id, } } @@ -111,8 +110,6 @@ impl EntityAddress { Ok(Self::ResourceAddress { address }) } else if let Ok(address) = NetworkAwarePackageAddress::from_u8_array(array, network_id) { Ok(Self::PackageAddress { address }) - } else if let Ok(address) = NetworkAwareSystemAddress::from_u8_array(array, network_id) { - Ok(Self::SystemAddress { address }) } else { Err(Error::UnrecognizedAddressFormat) } @@ -129,7 +126,6 @@ impl Display for EntityAddress { EntityAddress::ComponentAddress { address } => write!(f, "{}", address), EntityAddress::ResourceAddress { address } => write!(f, "{}", address), EntityAddress::PackageAddress { address } => write!(f, "{}", address), - EntityAddress::SystemAddress { address } => write!(f, "{}", address), } } } diff --git a/radix-engine-toolkit/src/model/address/entity_type.rs b/radix-engine-toolkit/src/model/address/entity_type.rs index 4e366998..13153bc0 100644 --- a/radix-engine-toolkit/src/model/address/entity_type.rs +++ b/radix-engine-toolkit/src/model/address/entity_type.rs @@ -34,6 +34,10 @@ pub enum EntityType { EpochManager, Clock, Validator, + IdentityComponent, + EcdsaSecp256k1VirtualIdentityComponent, + EddsaEd25519VirtualIdentityComponent, + AccessControllerComponent, } // ============ @@ -56,6 +60,14 @@ impl From for NativeEntityType { 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, } } } @@ -76,6 +88,14 @@ impl From for EntityType { 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/mod.rs b/radix-engine-toolkit/src/model/address/mod.rs index de6ff329..6661b20c 100644 --- a/radix-engine-toolkit/src/model/address/mod.rs +++ b/radix-engine-toolkit/src/model/address/mod.rs @@ -19,12 +19,12 @@ pub mod coder; pub mod entity_address; pub mod entity_type; pub mod network_aware_address; -pub mod non_fungible_address; -pub mod non_fungible_id; +pub mod non_fungible_global_id; +pub mod non_fungible_local_id; pub use coder::*; pub use entity_address::*; pub use entity_type::*; pub use network_aware_address::*; -pub use non_fungible_address::*; -pub use non_fungible_id::*; +pub use non_fungible_global_id::*; +pub use non_fungible_local_id::*; diff --git a/radix-engine-toolkit/src/model/address/network_aware_address.rs b/radix-engine-toolkit/src/model/address/network_aware_address.rs index 8b669683..8d0605c1 100644 --- a/radix-engine-toolkit/src/model/address/network_aware_address.rs +++ b/radix-engine-toolkit/src/model/address/network_aware_address.rs @@ -89,8 +89,3 @@ define_network_aware_address!( encode_resource_address, decode_resource_address ); -define_network_aware_address!( - scrypto::prelude::SystemAddress => NetworkAwareSystemAddress, - encode_system_address, - decode_system_address -); diff --git a/radix-engine-toolkit/src/model/address/non_fungible_address.rs b/radix-engine-toolkit/src/model/address/non_fungible_global_id.rs similarity index 70% rename from radix-engine-toolkit/src/model/address/non_fungible_address.rs rename to radix-engine-toolkit/src/model/address/non_fungible_global_id.rs index c5527eea..f3b89865 100644 --- a/radix-engine-toolkit/src/model/address/non_fungible_address.rs +++ b/radix-engine-toolkit/src/model/address/non_fungible_global_id.rs @@ -16,7 +16,7 @@ // under the License. use scrypto::prelude::{ - FromPublicKey, NonFungibleAddress as NativeNonFungibleAddress, NonFungibleId, PublicKey, + FromPublicKey, NonFungibleGlobalId as NativeNonFungibleGlobalId, NonFungibleLocalId, PublicKey, }; use serializable::serializable; @@ -27,44 +27,44 @@ use crate::model::NetworkAwareResourceAddress; /// unit. #[serializable] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct NonFungibleAddress { +pub struct NonFungibleGlobalId { #[schemars(with = "crate::Value")] #[serde_as(as = "serde_with::TryFromInto")] pub resource_address: NetworkAwareResourceAddress, #[serde_as(as = "serde_with::TryFromInto")] #[schemars(with = "crate::Value")] - pub non_fungible_id: NonFungibleId, + pub non_fungible_local_id: NonFungibleLocalId, } -impl NonFungibleAddress { +impl NonFungibleGlobalId { pub fn new( resource_address: NetworkAwareResourceAddress, - non_fungible_id: NonFungibleId, + non_fungible_local_id: NonFungibleLocalId, ) -> Self { Self { resource_address, - non_fungible_id, + non_fungible_local_id, } } pub fn from_public_key + Clone>(public_key: &P, network_id: u8) -> Self { - let native_non_fungible_address = NativeNonFungibleAddress::from_public_key(public_key); + let native_non_fungible_global_id = NativeNonFungibleGlobalId::from_public_key(public_key); Self { resource_address: NetworkAwareResourceAddress { network_id, - address: native_non_fungible_address.resource_address(), + address: native_non_fungible_global_id.resource_address(), }, - non_fungible_id: native_non_fungible_address.non_fungible_id().clone(), + non_fungible_local_id: native_non_fungible_global_id.local_id().clone(), } } } -impl From for scrypto::prelude::NonFungibleAddress { - fn from(value: NonFungibleAddress) -> Self { - scrypto::prelude::NonFungibleAddress::new( +impl From for scrypto::prelude::NonFungibleGlobalId { + fn from(value: NonFungibleGlobalId) -> Self { + scrypto::prelude::NonFungibleGlobalId::new( value.resource_address.address, - value.non_fungible_id, + value.non_fungible_local_id, ) } } diff --git a/radix-engine-toolkit/src/model/address/non_fungible_id.rs b/radix-engine-toolkit/src/model/address/non_fungible_local_id.rs similarity index 60% rename from radix-engine-toolkit/src/model/address/non_fungible_id.rs rename to radix-engine-toolkit/src/model/address/non_fungible_local_id.rs index 5f958e88..44c0cf6d 100644 --- a/radix-engine-toolkit/src/model/address/non_fungible_id.rs +++ b/radix-engine-toolkit/src/model/address/non_fungible_local_id.rs @@ -15,16 +15,16 @@ // specific language governing permissions and limitations // under the License. -use scrypto::prelude::NonFungibleId as ScryptoNonFungibleId; +use scrypto::prelude::NonFungibleLocalId as ScryptoNonFungibleLocalId; use serializable::serializable; #[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 NonFungibleId { +pub enum NonFungibleLocalId { /// A 64 bit unsigned integer non-fungible id type which is serialized as a string - Number( + Integer( #[schemars(regex(pattern = "[0-9]+"))] #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] @@ -40,36 +40,38 @@ pub enum NonFungibleId { u128, ), - /// An byte array non-fungible id type which is serialized as a hex string + /// 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. 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 - String(String), + /// A string non-fungible id. This can be between 1 and 64 characters long. + String(#[schemars(length(min = 1, max = 64))] String), } -impl From for NonFungibleId { - fn from(value: ScryptoNonFungibleId) -> Self { +impl From for NonFungibleLocalId { + fn from(value: ScryptoNonFungibleLocalId) -> Self { match value { - ScryptoNonFungibleId::Number(value) => Self::Number(value), - ScryptoNonFungibleId::UUID(value) => Self::UUID(value), - ScryptoNonFungibleId::String(value) => Self::String(value), - ScryptoNonFungibleId::Bytes(value) => Self::Bytes(value), + ScryptoNonFungibleLocalId::Integer(value) => Self::Integer(value), + ScryptoNonFungibleLocalId::UUID(value) => Self::UUID(value), + ScryptoNonFungibleLocalId::String(value) => Self::String(value), + ScryptoNonFungibleLocalId::Bytes(value) => Self::Bytes(value), } } } -impl From for ScryptoNonFungibleId { - fn from(value: NonFungibleId) -> Self { +impl From for ScryptoNonFungibleLocalId { + fn from(value: NonFungibleLocalId) -> Self { match value { - NonFungibleId::Number(value) => Self::Number(value), - NonFungibleId::UUID(value) => Self::UUID(value), - NonFungibleId::String(value) => Self::String(value), - NonFungibleId::Bytes(value) => Self::Bytes(value), + NonFungibleLocalId::Integer(value) => Self::Integer(value), + NonFungibleLocalId::UUID(value) => Self::UUID(value), + NonFungibleLocalId::String(value) => Self::String(value), + NonFungibleLocalId::Bytes(value) => Self::Bytes(value), } } } diff --git a/radix-engine-toolkit/src/model/instruction.rs b/radix-engine-toolkit/src/model/instruction.rs index 163a6ae6..9dc36f1b 100644 --- a/radix-engine-toolkit/src/model/instruction.rs +++ b/radix-engine-toolkit/src/model/instruction.rs @@ -113,8 +113,8 @@ pub enum Instruction { resource_address: Value, /// The non-fungible ids to take from the worktop. This is a set (serialized as a JSON - /// array) of `NonFungibleId`s from the Value model. - #[schemars(with = "HashSet")] + /// array) of `NonFungibleLocalId`s from the Value model. + #[schemars(with = "HashSet")] ids: Vec, /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from @@ -155,8 +155,8 @@ pub enum Instruction { resource_address: Value, /// The non-fungible ids of the resource to assert their existence in the worktop. This is - /// a set (serialized as a JSON array) of `NonFungibleId`s from the Value model. - #[schemars(with = "HashSet")] + /// a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model. + #[schemars(with = "HashSet")] ids: Vec, }, @@ -214,8 +214,8 @@ pub enum Instruction { resource_address: Value, /// The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) - /// of `NonFungibleId`s from the Value model. - #[schemars(with = "HashSet")] + /// of `NonFungibleLocalId`s from the Value model. + #[schemars(with = "HashSet")] ids: Vec, /// A proof to put the resource proof into. This field is serialized as a `Proof` from the @@ -289,7 +289,7 @@ pub enum Instruction { abi: Value, /// The non-fungible address of the owner badge of this package. This field is serialized - /// as a `NonFungibleAddress` from the Value model. + /// as a `NonFungibleGlobalId` from the Value model. owner_badge: Value, }, @@ -314,7 +314,7 @@ pub enum Instruction { 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 `SystemAddress`. + /// a `ComponentAddress`. entity_address: Value, /// A string of the key to set the metadata for. This field is serialized as a `String` @@ -399,8 +399,8 @@ pub enum Instruction { resource_address: Value, /// The non-fungible tokens to mint. The underlying type of this is a map which maps a - /// `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of - /// the immutable and mutable parts of the non-fungible data. + /// `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct + /// of the immutable and mutable parts of the non-fungible data. entries: Value, }, @@ -450,7 +450,7 @@ pub enum Instruction { metadata: Value, /// The non-fungible address of the owner badge of this resource. This field is serialized - /// as a `NonFungibleAddress` from the Value model. + /// as a `NonFungibleGlobalId` from the Value model. owner_badge: Value, /// An optional decimal value of the initial supply to mint during resource creation. If @@ -475,7 +475,7 @@ pub enum Instruction { access_rules: Value, /// An optional initial supply for the non-fungible resource being created. The underlying - /// type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` + /// type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` /// elements where each element is a struct of the immutable and mutable parts of /// the non-fungible data. initial_supply: Value, @@ -493,32 +493,54 @@ pub enum Instruction { metadata: Value, /// The non-fungible address of the owner badge of this resource. This field is serialized - /// as a `NonFungibleAddress` from the Value model. + /// as a `NonFungibleGlobalId` from the Value model. owner_badge: Value, /// An optional initial supply for the non-fungible resource being created. The underlying - /// type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` + /// type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` /// elements where each element is a struct of the immutable and mutable parts of /// the non-fungible data. initial_supply: Value, }, - CreateValidator { - /// The public key of the validator - key: Value, + /// 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. + CreateAccessController { + /// A bucket of the asset that will be controlled by the access controller. The underlying + /// type of this is a `Bucket` from the `Value` model. + controlled_asset: Value, + + /// The access rule to use for the primary role of the access controller. The underlying + /// type of this is an `Enum` from the `Value` model. + primary_role: Value, + + /// The access rule to use for the recovery role of the access controller. The underlying + /// type of this is an `Enum` from the `Value` model. + recovery_role: Value, + + /// The access rule to use for the confirmation role of the access controller. The + /// underlying type of this is an `Enum` from the `Value` model. + confirmation_role: Value, + + /// The recovery delay in minutes to use for the access controller. The underlying type of + /// this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer + /// of the time in minutes. + timed_recovery_delay_in_minutes: Value, }, - /// An instruction to registers a new validator given the system component address of the - /// validator - RegisterValidator { - /// the system component address of the validator - validator: Value, + /// Creates a new identity native component with the passed access rule. + CreateIdentity { + /// The access rule to protect the identity with. The underlying type of this is an `Enum` + /// from the `Value` model. + access_rule: Value, }, - /// An instruction to unregister a validator given the system component address of the validator - UnregisterValidator { - /// the system component address of the validator to unregister - validator: Value, + /// Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of + /// the transaction + AssertAccessRule { + /// The access rule to assert. The underlying type of this is an `Enum` from the `Value` + /// model which represents the access rule to assert. + access_rule: Value, }, } @@ -579,7 +601,7 @@ impl Instruction { into_bucket, } => ast::Instruction::TakeFromWorktopByIds { ids: Value::Array { - element_kind: crate::model::value::ValueKind::NonFungibleId, + element_kind: crate::model::value::ValueKind::NonFungibleLocalId, elements: ids.into_iter().collect::>(), } .to_ast_value(bech32_coder)?, @@ -609,7 +631,7 @@ impl Instruction { ids: Value::Array { // TODO: This was `ValueKind::Bucket` by mistake. What kind of test can we // introduce to catch this? - element_kind: crate::model::value::ValueKind::NonFungibleId, + element_kind: crate::model::value::ValueKind::NonFungibleLocalId, elements: ids.into_iter().collect::>(), } .to_ast_value(bech32_coder)?, @@ -646,7 +668,7 @@ impl Instruction { into_proof, } => ast::Instruction::CreateProofFromAuthZoneByIds { ids: Value::Array { - element_kind: crate::model::value::ValueKind::NonFungibleId, + element_kind: crate::model::value::ValueKind::NonFungibleLocalId, elements: ids.into_iter().collect::>(), } .to_ast_value(bech32_coder)?, @@ -815,14 +837,25 @@ impl Instruction { resource_address: resource_address.to_ast_value(bech32_coder)?, entries: entries.to_ast_value(bech32_coder)?, }, - Self::CreateValidator { key } => ast::Instruction::CreateValidator { - key: key.to_ast_value(bech32_coder)?, - }, - Self::RegisterValidator { validator } => ast::Instruction::RegisterValidator { - validator: validator.to_ast_value(bech32_coder)?, - }, - Self::UnregisterValidator { validator } => ast::Instruction::RegisterValidator { - validator: validator.to_ast_value(bech32_coder)?, + Self::AssertAccessRule { access_rule } => ast::Instruction::AssertAccessRule { + access_rule: access_rule.to_ast_value(bech32_coder)?, + }, + Self::CreateAccessController { + controlled_asset, + primary_role, + recovery_role, + confirmation_role, + timed_recovery_delay_in_minutes, + } => ast::Instruction::CreateAccessController { + controlled_asset: controlled_asset.to_ast_value(bech32_coder)?, + primary_role: primary_role.to_ast_value(bech32_coder)?, + recovery_role: recovery_role.to_ast_value(bech32_coder)?, + confirmation_role: confirmation_role.to_ast_value(bech32_coder)?, + 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)?, }, }; Ok(ast_instruction) @@ -1138,14 +1171,28 @@ impl Instruction { resource_address: Value::from_ast_value(resource_address, bech32_coder)?, entries: Value::from_ast_value(entries, bech32_coder)?, }, - ast::Instruction::CreateValidator { key } => Self::CreateValidator { - key: Value::from_ast_value(key, bech32_coder)?, - }, - ast::Instruction::RegisterValidator { validator } => Self::RegisterValidator { - validator: Value::from_ast_value(validator, bech32_coder)?, - }, - ast::Instruction::UnregisterValidator { validator } => Self::UnregisterValidator { - validator: Value::from_ast_value(validator, bech32_coder)?, + + ast::Instruction::CreateIdentity { access_rule } => Self::CreateIdentity { + access_rule: Value::from_ast_value(access_rule, bech32_coder)?, + }, + ast::Instruction::AssertAccessRule { access_rule } => Self::AssertAccessRule { + access_rule: Value::from_ast_value(access_rule, bech32_coder)?, + }, + ast::Instruction::CreateAccessController { + controlled_asset, + primary_role, + recovery_role, + confirmation_role, + timed_recovery_delay_in_minutes, + } => Self::CreateAccessController { + controlled_asset: Value::from_ast_value(controlled_asset, bech32_coder)?, + primary_role: Value::from_ast_value(primary_role, bech32_coder)?, + recovery_role: Value::from_ast_value(recovery_role, bech32_coder)?, + confirmation_role: Value::from_ast_value(confirmation_role, bech32_coder)?, + timed_recovery_delay_in_minutes: Value::from_ast_value( + timed_recovery_delay_in_minutes, + bech32_coder, + )?, }, }; Ok(instruction) @@ -1403,9 +1450,21 @@ impl ValueRef for Instruction { values.push(initial_supply); } - Self::CreateValidator { key } => values.push(key), - Self::RegisterValidator { validator } => values.push(validator), - Self::UnregisterValidator { validator } => values.push(validator), + Self::AssertAccessRule { access_rule } => values.push(access_rule), + Self::CreateIdentity { access_rule } => values.push(access_rule), + Self::CreateAccessController { + controlled_asset, + primary_role, + recovery_role, + confirmation_role, + timed_recovery_delay_in_minutes, + } => { + values.push(controlled_asset); + values.push(primary_role); + values.push(recovery_role); + values.push(confirmation_role); + values.push(timed_recovery_delay_in_minutes); + } Self::DropProof { proof } => values.push(proof), @@ -1664,9 +1723,21 @@ impl ValueRef for Instruction { values.push(initial_supply); } - Self::CreateValidator { key } => values.push(key), - Self::RegisterValidator { validator } => values.push(validator), - Self::UnregisterValidator { validator } => values.push(validator), + Self::AssertAccessRule { access_rule } => values.push(access_rule), + Self::CreateIdentity { access_rule } => values.push(access_rule), + Self::CreateAccessController { + controlled_asset, + primary_role, + recovery_role, + confirmation_role, + timed_recovery_delay_in_minutes, + } => { + values.push(controlled_asset); + values.push(primary_role); + values.push(recovery_role); + values.push(confirmation_role); + values.push(timed_recovery_delay_in_minutes); + } Self::DropProof { proof } => values.push(proof), diff --git a/radix-engine-toolkit/src/model/value.rs b/radix-engine-toolkit/src/model/value.rs index cdae8526..126faaaa 100644 --- a/radix-engine-toolkit/src/model/value.rs +++ b/radix-engine-toolkit/src/model/value.rs @@ -26,7 +26,7 @@ use native_transaction::manifest::generator::GeneratorError; use scrypto::prelude::ScryptoCustomValue; use scrypto::prelude::{ scrypto_decode, scrypto_encode, Decimal, EcdsaSecp256k1PublicKey, EcdsaSecp256k1Signature, - EddsaEd25519PublicKey, EddsaEd25519Signature, Hash, NonFungibleId, PreciseDecimal, + EddsaEd25519PublicKey, EddsaEd25519Signature, Hash, NonFungibleLocalId, PreciseDecimal, ScryptoCustomValueKind, ScryptoValue, ScryptoValueKind, }; use scrypto::runtime::{ManifestBlobRef, ManifestExpression, Own}; @@ -225,14 +225,6 @@ pub enum Value { address: NetworkAwareResourceAddress, }, - /// Represents a Bech32m encoded human-readable system address. This address is serialized - /// as a human-readable bech32m encoded string. - SystemAddress { - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - address: NetworkAwareSystemAddress, - }, - /// Represents a Bech32m encoded human-readable package address. This address is serialized /// as a human-readable bech32m encoded string. PackageAddress { @@ -243,7 +235,7 @@ pub enum Value { /// Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The /// hashing function that they use is SHA256 which produces 32 byte long hashes which are - /// serialized as a 64 character long hex string (since hex encoding doubles the number of + /// serialized as a 64 character long hex string (since hex encoding doubles the Integer of /// bytes needed) Hash { #[schemars(length(equal = 64))] @@ -297,27 +289,27 @@ pub enum Value { }, /// 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 number. + /// either a string or an unsigned 32-bit integer which is serialized as a Integer. Bucket { identifier: BucketId }, /// Represents a Scrypto proof which is identified through a transient identifier which is - /// either a string or an unsigned 32-bit integer which is serialized as a number. + /// either a string or an unsigned 32-bit integer which is serialized as a Integer. Proof { identifier: ProofId }, /// Represents non-fungible ids which is a discriminated union of the different types that /// non-fungible ids may be. - NonFungibleId { - #[schemars(with = "crate::NonFungibleId")] - #[serde_as(as = "serde_with::FromInto")] - value: NonFungibleId, + NonFungibleLocalId { + #[schemars(with = "crate::NonFungibleLocalId")] + #[serde_as(as = "serde_with::FromInto")] + 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. - NonFungibleAddress { + NonFungibleGlobalId { #[serde(flatten)] - address: NonFungibleAddress, + address: NonFungibleGlobalId, }, /// Represents a transaction manifest expression. @@ -382,7 +374,6 @@ pub enum ValueKind { ComponentAddress, ResourceAddress, - SystemAddress, PackageAddress, Hash, @@ -395,8 +386,8 @@ pub enum ValueKind { Bucket, Proof, - NonFungibleId, - NonFungibleAddress, + NonFungibleLocalId, + NonFungibleGlobalId, Expression, Blob, @@ -456,15 +447,14 @@ impl Value { Self::PackageAddress { .. } => ValueKind::PackageAddress, Self::ComponentAddress { .. } => ValueKind::ComponentAddress, Self::ResourceAddress { .. } => ValueKind::ResourceAddress, - Self::SystemAddress { .. } => ValueKind::SystemAddress, Self::Hash { .. } => ValueKind::Hash, Self::Bucket { .. } => ValueKind::Bucket, Self::Proof { .. } => ValueKind::Proof, - Self::NonFungibleId { .. } => ValueKind::NonFungibleId, - Self::NonFungibleAddress { .. } => ValueKind::NonFungibleAddress, + Self::NonFungibleLocalId { .. } => ValueKind::NonFungibleLocalId, + Self::NonFungibleGlobalId { .. } => ValueKind::NonFungibleGlobalId, Self::EcdsaSecp256k1PublicKey { .. } => ValueKind::EcdsaSecp256k1PublicKey, Self::EcdsaSecp256k1Signature { .. } => ValueKind::EcdsaSecp256k1Signature, @@ -558,9 +548,6 @@ impl Value { Value::ResourceAddress { address: value } => ast::Value::ResourceAddress(Box::new( ast::Value::String(bech32_coder.encode_resource_address(&value.address)), )), - Value::SystemAddress { address: value } => ast::Value::SystemAddress(Box::new( - ast::Value::String(bech32_coder.encode_system_address(&value.address)), - )), Value::Hash { value } => { ast::Value::Hash(Box::new(ast::Value::String(value.to_string()))) @@ -578,31 +565,16 @@ impl Value { TransientIdentifier::U32 { value: identifier } => ast::Value::U32(identifier), })), - Value::NonFungibleId { value } => ast::Value::NonFungibleId(Box::new(match value { - NonFungibleId::Number(value) => ast::Value::U64(*value), - NonFungibleId::UUID(value) => ast::Value::U128(*value), - NonFungibleId::String(ref value) => ast::Value::String(value.clone()), - NonFungibleId::Bytes(ref value) => { - ast::Value::Bytes(Box::new(ast::Value::String(hex::encode(value)))) - } - })), - Value::NonFungibleAddress { address } => { - let resource_address_string = address.resource_address.to_string(); - let resource_address = ast::Value::String(resource_address_string); - - let non_fungible_id = match address.non_fungible_id { - NonFungibleId::Number(value) => ast::Value::U64(value), - NonFungibleId::UUID(value) => ast::Value::U128(value), - NonFungibleId::String(ref value) => ast::Value::String(value.clone()), - NonFungibleId::Bytes(ref value) => { - ast::Value::Bytes(Box::new(ast::Value::String(hex::encode(value)))) - } - }; - - ast::Value::NonFungibleAddress( - Box::new(resource_address), - Box::new(non_fungible_id), - ) + Value::NonFungibleLocalId { value } => { + ast::Value::NonFungibleLocalId(Box::new(ast::Value::String(value.to_string()))) + } + Value::NonFungibleGlobalId { address } => { + let nf_global_id_string = format!( + "{}:{}", + bech32_coder.encode_resource_address(&address.resource_address.address), + address.non_fungible_local_id + ); + ast::Value::NonFungibleGlobalId(Box::new(ast::Value::String(nf_global_id_string))) } Value::Blob { hash } => { @@ -644,7 +616,7 @@ impl Value { /// Converts Scrypto's tx compiler's [`ast::Value`] to a [`Value`] given a bech32 coder as /// context. pub fn from_ast_value(value: &ast::Value, bech32_coder: &Bech32Coder) -> Result { - let parsing = ValueKind::from(value.type_id()); + let parsing = ValueKind::from(value.value_kind()); let value = match value { ast::Value::Bool(value) => Self::Bool { value: *value }, @@ -758,13 +730,6 @@ impl Value { .map(|address| Value::ComponentAddress { address }) })? } - ast::Value::SystemAddress(address) => { - map_if_value_string(parsing, address, |address_string| { - bech32_coder - .decode_to_network_aware_system_address(address_string) - .map(|address| Value::SystemAddress { address }) - })? - } ast::Value::Hash(value) => map_if_value_string(parsing, value, |string| { string .parse() @@ -788,7 +753,7 @@ impl Value { Err(Error::UnexpectedAstContents { parsing: ValueKind::Bucket, expected: vec![ValueKind::U32, ValueKind::String], - found: value.type_id().into(), + found: value.value_kind().into(), })? } } @@ -808,89 +773,44 @@ impl Value { Err(Error::UnexpectedAstContents { parsing: ValueKind::Proof, expected: vec![ValueKind::U32, ValueKind::String], - found: value.type_id().into(), + found: value.value_kind().into(), })? } } - ast::Value::NonFungibleId(value) => Self::NonFungibleId { + ast::Value::NonFungibleLocalId(value) => Self::NonFungibleLocalId { value: match &**value { - ast::Value::U64(value) => NonFungibleId::Number(*value), - ast::Value::U128(value) => NonFungibleId::UUID(*value), - ast::Value::String(value) => NonFungibleId::String(value.clone()), - ast::Value::Bytes(value) => { - if let ast::Value::String(value) = &**value { - NonFungibleId::Bytes(hex::decode(value)?) - } else { - Err(Error::UnexpectedAstContents { - parsing: ValueKind::NonFungibleId, - expected: vec![ValueKind::String], - found: value.type_id().into(), - })? - } - } + ast::Value::String(value) => value.parse()?, _ => Err(Error::UnexpectedAstContents { - parsing: ValueKind::NonFungibleId, - expected: vec![ - ValueKind::U32, - ValueKind::U64, - ValueKind::U128, - ValueKind::String, - ValueKind::Bytes, - ], - found: value.type_id().into(), + parsing: ValueKind::NonFungibleLocalId, + expected: vec![ValueKind::String], + found: value.value_kind().into(), })?, }, }, - ast::Value::NonFungibleAddress(resource_address, non_fungible_id) => { - let resource_address = - if let ast::Value::String(address_string) = &**resource_address { - bech32_coder.decode_to_network_aware_resource_address(address_string)? - } else { - Err(Error::UnexpectedAstContents { - parsing: ValueKind::NonFungibleAddress, - expected: vec![ValueKind::String], - found: resource_address.type_id().into(), - })? - }; - - // TODO: de-duplicate. Refactor out - let non_fungible_id = match &**non_fungible_id { - ast::Value::U64(value) => NonFungibleId::Number(*value), - ast::Value::U128(value) => NonFungibleId::UUID(*value), - ast::Value::String(value) => NonFungibleId::String(value.clone()), - ast::Value::Bytes(value) => { - if let ast::Value::String(value) = &**value { - NonFungibleId::Bytes(hex::decode(value)?) - } else { - Err(Error::UnexpectedAstContents { - parsing: ValueKind::NonFungibleAddress, - expected: vec![ValueKind::String], - found: value.type_id().into(), - })? - } + ast::Value::NonFungibleGlobalId(value) => match &**value { + ast::Value::String(string) => { + let native_global_id = + scrypto::prelude::NonFungibleGlobalId::try_from_canonical_string( + bech32_coder.decoder(), + string, + )?; + Self::NonFungibleGlobalId { + address: NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { + network_id: bech32_coder.network_id(), + address: native_global_id.resource_address(), + }, + non_fungible_local_id: native_global_id.local_id().clone(), + }, } - value => Err(Error::UnexpectedAstContents { - parsing: ValueKind::NonFungibleAddress, - expected: vec![ - ValueKind::U32, - ValueKind::U64, - ValueKind::U128, - ValueKind::String, - ValueKind::Bytes, - ], - found: value.type_id().into(), - })?, - }; - - let non_fungible_address = NonFungibleAddress { - resource_address, - non_fungible_id, - }; - Value::NonFungibleAddress { - address: non_fungible_address, } - } + _ => Err(Error::UnexpectedAstContents { + parsing: ValueKind::NonFungibleGlobalId, + expected: vec![ValueKind::String], + found: value.value_kind().into(), + })?, + }, ast::Value::Blob(value) => map_if_value_string(parsing, value, |blob_string| { let bytes = hex::decode(blob_string)?; @@ -1067,9 +987,6 @@ impl Value { Self::ResourceAddress { address } => ScryptoValue::Custom { value: ScryptoCustomValue::ResourceAddress(address.address), }, - Self::SystemAddress { address } => ScryptoValue::Custom { - value: ScryptoCustomValue::SystemAddress(address.address), - }, Self::Hash { value } => ScryptoValue::Custom { value: ScryptoCustomValue::Hash(*value), @@ -1096,17 +1013,17 @@ impl Value { value: identifier.try_into()?, }, - Self::NonFungibleId { value } => ScryptoValue::Custom { - value: ScryptoCustomValue::NonFungibleId(value.clone()), + Self::NonFungibleLocalId { value } => ScryptoValue::Custom { + value: ScryptoCustomValue::NonFungibleLocalId(value.clone()), }, - Self::NonFungibleAddress { address } => ScryptoValue::Tuple { + Self::NonFungibleGlobalId { address } => ScryptoValue::Tuple { fields: vec![ Self::ResourceAddress { address: address.resource_address, } .to_scrypto_value()?, - Self::NonFungibleId { - value: address.non_fungible_id.clone(), + Self::NonFungibleLocalId { + value: address.non_fungible_local_id.clone(), } .to_scrypto_value()?, ], @@ -1235,14 +1152,6 @@ impl Value { address: *address, }, }, - ScryptoValue::Custom { - value: ScryptoCustomValue::SystemAddress(address), - } => Self::SystemAddress { - address: NetworkAwareSystemAddress { - network_id, - address: *address, - }, - }, ScryptoValue::Custom { value: ScryptoCustomValue::Bucket(identifier), @@ -1296,8 +1205,8 @@ impl Value { } => Self::PreciseDecimal { value: *value }, ScryptoValue::Custom { - value: ScryptoCustomValue::NonFungibleId(value), - } => Self::NonFungibleId { + value: ScryptoCustomValue::NonFungibleLocalId(value), + } => Self::NonFungibleLocalId { value: value.clone(), }, @@ -1309,26 +1218,26 @@ impl Value { } } - /// Handles the aliasing of certain [`Value`] kinds such as [`Value::NonFungibleAddress`]. This + /// Handles the aliasing of certain [`Value`] kinds such as [`Value::NonFungibleGlobalId`]. This /// is typically used during request post processing to ensure that all responses include /// aliased values pub fn alias(&mut self) { match self { Self::Tuple { ref elements } => { - // Case: NonFungibleAddress - A tuple of ResourceAddress and NonFungibleId + // Case: NonFungibleGlobalId - A tuple of ResourceAddress and NonFungibleLocalId match (elements.get(0), elements.get(1)) { ( Some(Value::ResourceAddress { address: resource_address, }), - Some(Value::NonFungibleId { - value: non_fungible_id, + Some(Value::NonFungibleLocalId { + value: non_fungible_local_id, }), ) if elements.len() == 2 => { - *self = Value::NonFungibleAddress { - address: NonFungibleAddress { + *self = Value::NonFungibleGlobalId { + address: NonFungibleGlobalId { resource_address: *resource_address, - non_fungible_id: non_fungible_id.clone(), + non_fungible_local_id: non_fungible_local_id.clone(), }, }; } @@ -1368,8 +1277,7 @@ impl Value { Self::ComponentAddress { address } => address.network_id, Self::PackageAddress { address } => address.network_id, Self::ResourceAddress { address } => address.network_id, - Self::SystemAddress { address } => address.network_id, - Self::NonFungibleAddress { address } => address.resource_address.network_id, + Self::NonFungibleGlobalId { address } => address.resource_address.network_id, _ => return Ok(()), }; @@ -1478,15 +1386,14 @@ impl From for ast::Type { ValueKind::PackageAddress => ast::Type::PackageAddress, ValueKind::ComponentAddress => ast::Type::ComponentAddress, ValueKind::ResourceAddress => ast::Type::ResourceAddress, - ValueKind::SystemAddress => ast::Type::SystemAddress, ValueKind::Hash => ast::Type::Hash, ValueKind::Bucket => ast::Type::Bucket, ValueKind::Proof => ast::Type::Proof, - ValueKind::NonFungibleId => ast::Type::NonFungibleId, - ValueKind::NonFungibleAddress => ast::Type::NonFungibleAddress, + ValueKind::NonFungibleLocalId => ast::Type::NonFungibleLocalId, + ValueKind::NonFungibleGlobalId => ast::Type::NonFungibleGlobalId, ValueKind::Blob => ast::Type::Blob, ValueKind::Bytes => ast::Type::Bytes, @@ -1530,7 +1437,6 @@ impl From for ValueKind { ast::Type::PackageAddress => Self::PackageAddress, ast::Type::ComponentAddress => Self::ComponentAddress, ast::Type::ResourceAddress => Self::ResourceAddress, - ast::Type::SystemAddress => Self::SystemAddress, ast::Type::Hash => Self::Hash, ast::Type::EcdsaSecp256k1PublicKey => Self::EcdsaSecp256k1PublicKey, @@ -1541,8 +1447,8 @@ impl From for ValueKind { ast::Type::Bucket => Self::Bucket, ast::Type::Proof => Self::Proof, - ast::Type::NonFungibleId => Self::NonFungibleId, - ast::Type::NonFungibleAddress => Self::NonFungibleAddress, + ast::Type::NonFungibleLocalId => Self::NonFungibleLocalId, + ast::Type::NonFungibleGlobalId => Self::NonFungibleGlobalId, ast::Type::Blob => Self::Blob, ast::Type::Expression => Self::Expression, @@ -1576,11 +1482,10 @@ impl From for ValueKind { ScryptoValueKind::Array => ValueKind::Array, ScryptoValueKind::Tuple => ValueKind::Tuple, - ScryptoValueKind::Custom(custom_type_id) => match custom_type_id { + ScryptoValueKind::Custom(custom_value_kind) => match custom_value_kind { ScryptoCustomValueKind::PackageAddress => ValueKind::PackageAddress, ScryptoCustomValueKind::ComponentAddress => ValueKind::ComponentAddress, ScryptoCustomValueKind::ResourceAddress => ValueKind::ResourceAddress, - ScryptoCustomValueKind::SystemAddress => ValueKind::SystemAddress, ScryptoCustomValueKind::Bucket => ValueKind::Bucket, ScryptoCustomValueKind::Proof => ValueKind::Proof, @@ -1601,7 +1506,7 @@ impl From for ValueKind { ScryptoCustomValueKind::Decimal => ValueKind::Decimal, ScryptoCustomValueKind::PreciseDecimal => ValueKind::PreciseDecimal, - ScryptoCustomValueKind::NonFungibleId => ValueKind::NonFungibleId, + ScryptoCustomValueKind::NonFungibleLocalId => ValueKind::NonFungibleLocalId, ScryptoCustomValueKind::Own => ValueKind::Own, }, } @@ -1639,9 +1544,6 @@ impl From for ScryptoValueKind { ValueKind::Bytes => ScryptoValueKind::Array, ValueKind::Tuple => ScryptoValueKind::Tuple, - ValueKind::SystemAddress => { - ScryptoValueKind::Custom(ScryptoCustomValueKind::SystemAddress) - } ValueKind::PackageAddress => { ScryptoValueKind::Custom(ScryptoCustomValueKind::PackageAddress) } @@ -1657,7 +1559,7 @@ impl From for ScryptoValueKind { ValueKind::Expression => ScryptoValueKind::Custom(ScryptoCustomValueKind::Expression), ValueKind::Blob => ScryptoValueKind::Custom(ScryptoCustomValueKind::Blob), - ValueKind::NonFungibleAddress => ScryptoValueKind::Tuple, + ValueKind::NonFungibleGlobalId => ScryptoValueKind::Tuple, ValueKind::Hash => ScryptoValueKind::Custom(ScryptoCustomValueKind::Hash), ValueKind::EcdsaSecp256k1PublicKey => { @@ -1676,8 +1578,8 @@ impl From for ScryptoValueKind { ValueKind::PreciseDecimal => { ScryptoValueKind::Custom(ScryptoCustomValueKind::PreciseDecimal) } - ValueKind::NonFungibleId => { - ScryptoValueKind::Custom(ScryptoCustomValueKind::NonFungibleId) + ValueKind::NonFungibleLocalId => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::NonFungibleLocalId) } ValueKind::Own => ScryptoValueKind::Custom(ScryptoCustomValueKind::Own), } @@ -1724,9 +1626,8 @@ value_invertible! {Decimal, Decimal, value} value_invertible! {Proof, ProofId, identifier} value_invertible! {Blob, ManifestBlobRef, hash} value_invertible! {Bucket, BucketId, identifier} -value_invertible! {NonFungibleId, NonFungibleId, value} -value_invertible! {NonFungibleAddress, NonFungibleAddress, address} -value_invertible! {SystemAddress, NetworkAwareSystemAddress, address} +value_invertible! {NonFungibleLocalId, NonFungibleLocalId, value} +value_invertible! {NonFungibleGlobalId, NonFungibleGlobalId, address} value_invertible! {PackageAddress, NetworkAwarePackageAddress, address} value_invertible! {ResourceAddress, NetworkAwareResourceAddress, address} value_invertible! {ComponentAddress, NetworkAwareComponentAddress, address} @@ -1740,7 +1641,6 @@ impl TryFrom for Value { EntityAddress::ComponentAddress { address } => Ok(Value::ComponentAddress { address }), EntityAddress::ResourceAddress { address } => Ok(Value::ResourceAddress { address }), EntityAddress::PackageAddress { address } => Ok(Value::PackageAddress { address }), - EntityAddress::SystemAddress { address } => Ok(Value::SystemAddress { address }), } } } @@ -1753,13 +1653,11 @@ impl TryFrom for EntityAddress { Value::ComponentAddress { address } => Ok(EntityAddress::ComponentAddress { address }), Value::ResourceAddress { address } => Ok(EntityAddress::ResourceAddress { address }), Value::PackageAddress { address } => Ok(EntityAddress::PackageAddress { address }), - Value::SystemAddress { address } => Ok(EntityAddress::SystemAddress { address }), _ => Err(Error::InvalidKind { expected: vec![ ValueKind::ComponentAddress, ValueKind::ResourceAddress, ValueKind::PackageAddress, - ValueKind::SystemAddress, ], found: value.kind(), }), @@ -1781,7 +1679,7 @@ where Err(Error::UnexpectedAstContents { parsing, expected: vec![ValueKind::String], - found: value.type_id().into(), + found: value.value_kind().into(), }) } } diff --git a/radix-engine-toolkit/src/request/known_entity_addresses.rs b/radix-engine-toolkit/src/request/known_entity_addresses.rs index 277935d0..bf445498 100644 --- a/radix-engine-toolkit/src/request/known_entity_addresses.rs +++ b/radix-engine-toolkit/src/request/known_entity_addresses.rs @@ -19,7 +19,6 @@ use crate::error::Result; use crate::request::Handler; use crate::{ NetworkAwareComponentAddress, NetworkAwarePackageAddress, NetworkAwareResourceAddress, - NetworkAwareSystemAddress, }; use scrypto::prelude::{ ACCOUNT_PACKAGE, CLOCK, ECDSA_SECP256K1_TOKEN, EDDSA_ED25519_TOKEN, EPOCH_MANAGER, @@ -91,17 +90,17 @@ pub struct KnownEntityAddressesResponse { #[serde_as(as = "serde_with::TryFromInto")] eddsa_ed25519_token_resource_address: NetworkAwareResourceAddress, - /// A system address serialized as a `SystemAddress` from the `Value` model which represents + /// A system address serialized as a `ComponentAddress` from the `Value` model which represents /// the address of the epoch manager on the requested network. #[schemars(with = "crate::model::value::Value")] #[serde_as(as = "serde_with::TryFromInto")] - epoch_manager_system_address: NetworkAwareSystemAddress, + epoch_manager_system_address: NetworkAwareComponentAddress, - /// A system address serialized as a `SystemAddress` from the `Value` model which represents + /// A system address serialized as a `ComponentAddress` from the `Value` model which represents /// the address of the clock on the requested network. #[schemars(with = "crate::model::value::Value")] #[serde_as(as = "serde_with::TryFromInto")] - clock_system_address: NetworkAwareSystemAddress, + clock_system_address: NetworkAwareComponentAddress, } // =============== @@ -148,11 +147,11 @@ impl Handler address: EDDSA_ED25519_TOKEN, network_id, }, - epoch_manager_system_address: NetworkAwareSystemAddress { + epoch_manager_system_address: NetworkAwareComponentAddress { address: EPOCH_MANAGER, network_id, }, - clock_system_address: NetworkAwareSystemAddress { + clock_system_address: NetworkAwareComponentAddress { address: CLOCK, network_id, }, diff --git a/radix-engine-toolkit/tests/test_vector/manifest/worktop.rtm b/radix-engine-toolkit/tests/test_vector/manifest/worktop.rtm index f97e87a7..7405d693 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/worktop.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/worktop.rtm @@ -21,7 +21,7 @@ DROP_PROOF Proof("proof3"); # Return a bucket to worktop RETURN_TO_WORKTOP Bucket("some_xrd"); -TAKE_FROM_WORKTOP_BY_IDS Array(NonFungibleId(1u64)) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("nfts"); +TAKE_FROM_WORKTOP_BY_IDS Array(NonFungibleLocalId("#1#")) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("nfts"); # Drop all proofs, cancel all buckets and move resources to account DROP_ALL_PROOFS; diff --git a/radix-engine-toolkit/tests/test_vector/value.rs b/radix-engine-toolkit/tests/test_vector/value.rs index b292ab70..6c102cd1 100644 --- a/radix-engine-toolkit/tests/test_vector/value.rs +++ b/radix-engine-toolkit/tests/test_vector/value.rs @@ -288,16 +288,6 @@ lazy_static::lazy_static! { r#"{"type": "PackageAddress", "address": "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq"}"#, r#"PackageAddress("package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq")"#, ), - ValueRepresentationTestVector::new( - Value::SystemAddress { - address: NetworkAwareSystemAddress { - network_id: 0xf2, - address: scrypto::prelude::SystemAddress::EpochManager([0; 26]), - }, - }, - r#"{"type": "SystemAddress", "address": "system_sim1qsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsglvqq"}"#, - r#"SystemAddress("system_sim1qsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsglvqq")"#, - ), // ============== // Cryptographic // ============== @@ -356,77 +346,77 @@ lazy_static::lazy_static! { // ========================== ValueRepresentationTestVector::new( - Value::NonFungibleId { value: scrypto::prelude::NonFungibleId::Number(114441894733333) }, - r#"{"type": "NonFungibleId", "value": {"type": "Number", "value": "114441894733333"}}"#, - r#"NonFungibleId(114441894733333u64)"#, + Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::Integer(114441894733333) }, + r#"{"type": "NonFungibleLocalId", "value": {"type": "Integer", "value": "114441894733333"}}"#, + "NonFungibleLocalId(\"#114441894733333#\")" ), ValueRepresentationTestVector::new( - Value::NonFungibleId { value: scrypto::prelude::NonFungibleId::UUID(11444189334733333) }, - r#"{"type": "NonFungibleId", "value": {"type": "UUID", "value": "11444189334733333"}}"#, - r#"NonFungibleId(11444189334733333u128)"#, + Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::UUID(238510006928098330588051703199685491739) }, + r#"{"type": "NonFungibleLocalId", "value": {"type": "UUID", "value": "238510006928098330588051703199685491739"}}"#, + r#"NonFungibleLocalId("{b36f5b3f-835b-406c-980f-7788d8f13c1b}")"#, ), ValueRepresentationTestVector::new( - Value::NonFungibleId { value: scrypto::prelude::NonFungibleId::String("hello_world".into()) }, - r#"{"type": "NonFungibleId", "value": {"type": "String", "value": "hello_world"}}"#, - r#"NonFungibleId("hello_world")"#, + Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::String("hello_world".into()) }, + r#"{"type": "NonFungibleLocalId", "value": {"type": "String", "value": "hello_world"}}"#, + r#"NonFungibleLocalId("")"#, ), ValueRepresentationTestVector::new( - Value::NonFungibleId { value: scrypto::prelude::NonFungibleId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) }, - r#"{"type": "NonFungibleId", "value": {"type": "Bytes", "value": "10a23101"}}"#, - r#"NonFungibleId(Bytes("10a23101"))"#, + Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) }, + r#"{"type": "NonFungibleLocalId", "value": {"type": "Bytes", "value": "10a23101"}}"#, + r#"NonFungibleLocalId("[10a23101]")"#, ), ValueRepresentationTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit::model::NonFungibleAddress { + Value::NonFungibleGlobalId { + address: radix_engine_toolkit::model::NonFungibleGlobalId { resource_address: NetworkAwareResourceAddress { network_id: 0xf2, address: scrypto::prelude::ResourceAddress::Normal([0; 26]), }, - non_fungible_id: scrypto::prelude::NonFungibleId::Number(114441894733333) + non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::Integer(114441894733333) } }, - r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "value": {"type": "Number", "value": "114441894733333"}}}"#, - r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", 114441894733333u64)"#, + r#"{"type": "NonFungibleGlobalId", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_local_id": {"type": "NonFungibleLocalId", "value": {"type": "Integer", "value": "114441894733333"}}}"#, + r#"NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:#114441894733333#")"#, ), ValueRepresentationTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit::model::NonFungibleAddress { + Value::NonFungibleGlobalId { + address: radix_engine_toolkit::model::NonFungibleGlobalId { resource_address: NetworkAwareResourceAddress { network_id: 0xf2, address: scrypto::prelude::ResourceAddress::Normal([0; 26]), }, - non_fungible_id: scrypto::prelude::NonFungibleId::UUID(11444189334733333) + non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::UUID(238510006928098330588051703199685491739) } }, - r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "value": {"type": "UUID", "value": "11444189334733333"}}}"#, - r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", 11444189334733333u128)"#, + r#"{"type": "NonFungibleGlobalId", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_local_id": {"type": "NonFungibleLocalId", "value": {"type": "UUID", "value": "238510006928098330588051703199685491739"}}}"#, + r#"NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:{b36f5b3f-835b-406c-980f-7788d8f13c1b}")"#, ), ValueRepresentationTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit::model::NonFungibleAddress { + Value::NonFungibleGlobalId { + address: radix_engine_toolkit::model::NonFungibleGlobalId { resource_address: NetworkAwareResourceAddress { network_id: 0xf2, address: scrypto::prelude::ResourceAddress::Normal([0; 26]), }, - non_fungible_id: scrypto::prelude::NonFungibleId::String("hello_world".into()) + non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::String("hello_world".into()) } }, - r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "value": {"type": "String", "value": "hello_world"}}}"#, - r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", "hello_world")"#, + r#"{"type": "NonFungibleGlobalId", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_local_id": {"type": "NonFungibleLocalId", "value": {"type": "String", "value": "hello_world"}}}"#, + r#"NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:")"#, ), ValueRepresentationTestVector::new( - Value::NonFungibleAddress { - address: radix_engine_toolkit::model::NonFungibleAddress { + Value::NonFungibleGlobalId { + address: radix_engine_toolkit::model::NonFungibleGlobalId { resource_address: NetworkAwareResourceAddress { network_id: 0xf2, address: scrypto::prelude::ResourceAddress::Normal([0; 26]), }, - non_fungible_id: scrypto::prelude::NonFungibleId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) + non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) } }, - r#"{"type": "NonFungibleAddress", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_id": {"type": "NonFungibleId", "value": {"type": "Bytes", "value": "10a23101"}}}"#, - r#"NonFungibleAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety", Bytes("10a23101"))"#, + r#"{"type": "NonFungibleGlobalId", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_local_id": {"type": "NonFungibleLocalId", "value": {"type": "Bytes", "value": "10a23101"}}}"#, + r#"NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:[10a23101]"))"#, ), // ================= diff --git a/schema/Cargo.toml b/schema/Cargo.toml index 350fe73d..583d5bfc 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -15,8 +15,8 @@ radix_engine_toolkit = { path = "../radix-engine-toolkit" } serde = "1.0.152" convert_case = "0.6.0" -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "develop-dac211" } \ No newline at end of file +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop" } \ No newline at end of file diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index 06a210e5..e7633e6b 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -255,9 +255,9 @@ This document contains examples and descriptions of the different requests and r }, "ids": [ { - "type": "NonFungibleId", + "type": "NonFungibleLocalId", "value": { - "type": "Number", + "type": "Integer", "value": "1" } } @@ -510,9 +510,9 @@ This document contains examples and descriptions of the different requests and r }, "ids": [ { - "type": "NonFungibleId", + "type": "NonFungibleLocalId", "value": { - "type": "Number", + "type": "Integer", "value": "1" } } @@ -788,9 +788,9 @@ This document contains examples and descriptions of the different requests and r }, "ids": [ { - "type": "NonFungibleId", + "type": "NonFungibleLocalId", "value": { - "type": "Number", + "type": "Integer", "value": "1" } } @@ -836,7 +836,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" + "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" } ``` @@ -856,7 +856,7 @@ This document contains examples and descriptions of the different requests and r ```json { "instructions_output_kind": "Parsed", - "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" + "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" } ``` @@ -1088,9 +1088,9 @@ This document contains examples and descriptions of the different requests and r }, "ids": [ { - "type": "NonFungibleId", + "type": "NonFungibleLocalId", "value": { - "type": "Number", + "type": "Integer", "value": "1" } } @@ -1368,9 +1368,9 @@ This document contains examples and descriptions of the different requests and r }, "ids": [ { - "type": "NonFungibleId", + "type": "NonFungibleLocalId", "value": { - "type": "Number", + "type": "Integer", "value": "1" } } @@ -1411,30 +1411,30 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "01eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb31" + "signature": "004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f804" }, { "curve": "EcdsaSecp256k1", - "signature": "004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d" + "signature": "007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e872" }, { "curve": "EcdsaSecp256k1", - "signature": "011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c" + "signature": "01aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "55a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d" + "signature": "5ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be307" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "0fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee309" + "signature": "8c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "38bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404" + "signature": "726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808" } ] } @@ -1446,7 +1446,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b201eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb310001b2004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d0001b2011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b455a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d0102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b40fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee3090102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb438bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404" + "compiled_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b2004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f8040001b2007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e8720001b201aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b45ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be3070102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b48c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b0102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808" } ``` @@ -1466,7 +1466,7 @@ This document contains examples and descriptions of the different requests and r ```json { "instructions_output_kind": "Parsed", - "compiled_signed_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b201eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb310001b2004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d0001b2011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b455a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d0102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b40fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee3090102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb438bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404" + "compiled_signed_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b2004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f8040001b2007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e8720001b201aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b45ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be3070102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b48c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b0102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808" } ``` @@ -1699,9 +1699,9 @@ This document contains examples and descriptions of the different requests and r }, "ids": [ { - "type": "NonFungibleId", + "type": "NonFungibleLocalId", "value": { - "type": "Number", + "type": "Integer", "value": "1" } } @@ -1742,30 +1742,30 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "01eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb31" + "signature": "004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f804" }, { "curve": "EcdsaSecp256k1", - "signature": "004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d" + "signature": "007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e872" }, { "curve": "EcdsaSecp256k1", - "signature": "011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c" + "signature": "01aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "55a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d" + "signature": "5ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be307" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "0fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee309" + "signature": "8c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "38bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404" + "signature": "726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808" } ] } @@ -2010,9 +2010,9 @@ This document contains examples and descriptions of the different requests and r }, "ids": [ { - "type": "NonFungibleId", + "type": "NonFungibleLocalId", "value": { - "type": "Number", + "type": "Integer", "value": "1" } } @@ -2053,36 +2053,36 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "01eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb31" + "signature": "004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f804" }, { "curve": "EcdsaSecp256k1", - "signature": "004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d" + "signature": "007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e872" }, { "curve": "EcdsaSecp256k1", - "signature": "011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c" + "signature": "01aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "55a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d" + "signature": "5ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be307" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "0fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee309" + "signature": "8c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "38bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404" + "signature": "726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808" } ] }, "notary_signature": { "curve": "EcdsaSecp256k1", - "signature": "0031718d5ccfbedb3eba71baca8d4ad51a0c10b178cc469fa1c59faf8a5b45944b273a5f093d4e6e376c583f43949b20f91d8c24425e524a922a4238cbad5b70fb" + "signature": "0129cd0549e5a0e73d13c832b6ddb875b4a75e75a1c4abc16e9da516bd66700f243944d32277cb854d70a513c17d3b5c1c285f7728918b6ad55dac598940d3b009" } } ``` @@ -2093,7 +2093,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b201eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb310001b2004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d0001b2011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b455a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d0102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b40fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee3090102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb438bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404220001b20031718d5ccfbedb3eba71baca8d4ad51a0c10b178cc469fa1c59faf8a5b45944b273a5f093d4e6e376c583f43949b20f91d8c24425e524a922a4238cbad5b70fb" + "compiled_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b2004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f8040001b2007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e8720001b201aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b45ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be3070102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b48c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b0102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808220001b20129cd0549e5a0e73d13c832b6ddb875b4a75e75a1c4abc16e9da516bd66700f243944d32277cb854d70a513c17d3b5c1c285f7728918b6ad55dac598940d3b009" } ``` @@ -2113,7 +2113,7 @@ This document contains examples and descriptions of the different requests and r ```json { "instructions_output_kind": "Parsed", - "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b201eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb310001b2004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d0001b2011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b455a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d0102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b40fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee3090102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb438bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404220001b20031718d5ccfbedb3eba71baca8d4ad51a0c10b178cc469fa1c59faf8a5b45944b273a5f093d4e6e376c583f43949b20f91d8c24425e524a922a4238cbad5b70fb" + "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b2004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f8040001b2007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e8720001b201aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b45ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be3070102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b48c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b0102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808220001b20129cd0549e5a0e73d13c832b6ddb875b4a75e75a1c4abc16e9da516bd66700f243944d32277cb854d70a513c17d3b5c1c285f7728918b6ad55dac598940d3b009" } ``` @@ -2347,9 +2347,9 @@ This document contains examples and descriptions of the different requests and r }, "ids": [ { - "type": "NonFungibleId", + "type": "NonFungibleLocalId", "value": { - "type": "Number", + "type": "Integer", "value": "1" } } @@ -2390,36 +2390,36 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "01eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb31" + "signature": "004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f804" }, { "curve": "EcdsaSecp256k1", - "signature": "004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d" + "signature": "007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e872" }, { "curve": "EcdsaSecp256k1", - "signature": "011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c" + "signature": "01aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "55a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d" + "signature": "5ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be307" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "0fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee309" + "signature": "8c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "38bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404" + "signature": "726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808" } ] }, "notary_signature": { "curve": "EcdsaSecp256k1", - "signature": "0031718d5ccfbedb3eba71baca8d4ad51a0c10b178cc469fa1c59faf8a5b45944b273a5f093d4e6e376c583f43949b20f91d8c24425e524a922a4238cbad5b70fb" + "signature": "0129cd0549e5a0e73d13c832b6ddb875b4a75e75a1c4abc16e9da516bd66700f243944d32277cb854d70a513c17d3b5c1c285f7728918b6ad55dac598940d3b009" } } ``` @@ -2766,7 +2766,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70100010000000000000082000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b201eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb310001b2004fccb792f0bc3e999c51be3574ba0efc973267e69a8282a84c7d3d1b3a98866e33ef222dbfb9faad692a1768bf62924365cf32cb67ece791d61eb14cda63e13d0001b2011f3905b4867e10e8e6eac884d5a7f86818239d44f91636d453d34d9833d0a7594c6abdde1410e100fd1252c98175984e4f43aeef031fb577521fdcbb6310fb3c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b455a0186073f7737690a357a792fc6670cd0a8063985f478386400992b7671f1b6f367cfd758c4178513eeb55dc3fa725f1a70115e2e29e8a01f06809ff0b9a0d0102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b40fac777fa5a8b15ca576caad18dc465f4d59bc58a9f6e06092781aa1c980776a81debf0715fc5e6bcfc85fbff23de2c6f84b96df8ed39590d95266ae65eee3090102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb438bafe133d978cf1ce8d83b3789a4d84aff4f225e95cc8e8284d53b656ecee668421d6bafc8057c7da96bbebb1a3666ad4fb05adaff1e3abebf0846009cda404220001b201eca1141a6e8f83c49d3dd1953f033c5c6aa560be8f2d1bac8b0b759990e34fc81835d035adaa65f9da686f9c9f2d70e02fee565833213e226ce5a49d026bdb31", + "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b2004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f8040001b2007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e8720001b201aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b45ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be3070102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b48c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b0102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808220001b2004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f804", "validation_config": { "network_id": "242", "min_cost_unit_limit": "1000000", @@ -2816,39 +2816,39 @@ This document contains examples and descriptions of the different requests and r { "faucet_component_address": { "type": "ComponentAddress", - "address": "component_rdx1qg5fe67sukas49kytvluq72uederg3wfehh0rjfl2qsqe58dfx" + "address": "component_rdx1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sq5kftu" }, "faucet_package_address": { "type": "PackageAddress", - "address": "package_rdx1qx9kvuz62mchk6kzwexh4exqerlxreps0h5656mf2a5sevg7d6" + "address": "package_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqp7hql" }, "account_package_address": { "type": "PackageAddress", - "address": "package_rdx1q8fqfj78l4t4vdlp5rgh6ghke6x7pg8vxmdam6g2y98su3qsvj" + "address": "package_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs4qk04v" }, "xrd_resource_address": { "type": "ResourceAddress", - "address": "resource_rdx1qpflrslzpnprsd27ywcpmm9mqzncshp2sfjg6h59n48say30yn" + "address": "resource_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqy99qqm" }, "system_token_resource_address": { "type": "ResourceAddress", - "address": "resource_rdx1qrkx57yl3uxamygyyh370at22450nh2xxgrxmm2dyzqq9pl8qr" + "address": "resource_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqps7ezz7w" }, "ecdsa_secp256k1_token_resource_address": { "type": "ResourceAddress", - "address": "resource_rdx1qzms24rcrka4kdr2pn9zsw8jcghdvw6q2tux0rzq6gfs44jzu2" + "address": "resource_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs3ydc4g" }, "eddsa_ed25519_token_resource_address": { "type": "ResourceAddress", - "address": "resource_rdx1qraaz8dkuk98cyl0sjhch5ekt3thklgaxpssclgxs0gqdd62m6" + "address": "resource_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqtc26ta" }, "epoch_manager_system_address": { - "type": "SystemAddress", - "address": "system_rdx1qs3eheg7mcydm2xms66n397udu8awhhj0xz6c99dtnmsjfw9hh" + "type": "ComponentAddress", + "address": "system_rdx1qsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk264tl" }, "clock_system_address": { - "type": "SystemAddress", - "address": "system_rdx1q6jmc80hcmx4sfnyahhg4varselspsrm8gsuqa8dmsxshh45aj" + "type": "ComponentAddress", + "address": "system_rdx1qcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmeqqhj" } } ``` diff --git a/schema/out/schema/compile_notarized_transaction_request.json b/schema/out/schema/compile_notarized_transaction_request.json index 6bd27db1..2a9f1579 100644 --- a/schema/out/schema/compile_notarized_transaction_request.json +++ b/schema/out/schema/compile_notarized_transaction_request.json @@ -450,10 +450,10 @@ ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -572,10 +572,10 @@ ] }, "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 `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true } @@ -744,10 +744,10 @@ ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -959,7 +959,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1042,7 +1042,7 @@ ] }, "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 `SystemAddress`.", + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1289,7 +1289,7 @@ ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1416,7 +1416,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1475,7 +1475,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1518,7 +1518,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1526,7 +1526,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1536,20 +1536,57 @@ } }, { + "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.", "type": "object", "required": [ + "confirmation_role", + "controlled_asset", "instruction", - "key" + "primary_role", + "recovery_role", + "timed_recovery_delay_in_minutes" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_VALIDATOR" + "CREATE_ACCESS_CONTROLLER" ] }, - "key": { - "description": "The public key of the validator", + "controlled_asset": { + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "primary_role": { + "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "recovery_role": { + "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "confirmation_role": { + "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "timed_recovery_delay_in_minutes": { + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1559,21 +1596,21 @@ } }, { - "description": "An instruction to registers a new validator given the system component address of the validator", + "description": "Creates a new identity native component with the passed access rule.", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "REGISTER_VALIDATOR" + "CREATE_IDENTITY" ] }, - "validator": { - "description": "the system component address of the validator", + "access_rule": { + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1583,21 +1620,21 @@ } }, { - "description": "An instruction to unregister a validator given the system component address of the validator", + "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "UNREGISTER_VALIDATOR" + "ASSERT_ACCESS_RULE" ] }, - "validator": { - "description": "the system component address of the validator to unregister", + "access_rule": { + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", "allOf": [ { "$ref": "#/definitions/Value" @@ -2157,25 +2194,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -2196,7 +2214,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -2306,7 +2324,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2325,7 +2343,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2354,11 +2372,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -2366,7 +2384,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -2374,13 +2392,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -2517,7 +2535,6 @@ "Own", "ComponentAddress", "ResourceAddress", - "SystemAddress", "PackageAddress", "Hash", "EcdsaSecp256k1PublicKey", @@ -2526,8 +2543,8 @@ "EddsaEd25519Signature", "Bucket", "Proof", - "NonFungibleId", - "NonFungibleAddress", + "NonFungibleLocalId", + "NonFungibleGlobalId", "Expression", "Blob", "Bytes" @@ -2700,7 +2717,7 @@ } ] }, - "NonFungibleId": { + "NonFungibleLocalId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { @@ -2714,7 +2731,7 @@ "type": { "type": "string", "enum": [ - "Number" + "Integer" ] }, "value": { @@ -2744,7 +2761,7 @@ } }, { - "description": "An byte array non-fungible id type which is serialized as a hex string", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", "type": "object", "required": [ "type", @@ -2759,12 +2776,14 @@ }, "value": { "type": "string", + "maxLength": 128, + "minLength": 2, "pattern": "[0-9a-fA-F]+" } } }, { - "description": "A string non-fungible id", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", "type": "object", "required": [ "type", @@ -2778,7 +2797,9 @@ ] }, "value": { - "type": "string" + "type": "string", + "maxLength": 64, + "minLength": 1 } } } diff --git a/schema/out/schema/compile_signed_transaction_intent_request.json b/schema/out/schema/compile_signed_transaction_intent_request.json index 2a5f9fbf..87318549 100644 --- a/schema/out/schema/compile_signed_transaction_intent_request.json +++ b/schema/out/schema/compile_signed_transaction_intent_request.json @@ -424,10 +424,10 @@ ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -546,10 +546,10 @@ ] }, "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 `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true } @@ -718,10 +718,10 @@ ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -933,7 +933,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1016,7 +1016,7 @@ ] }, "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 `SystemAddress`.", + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1263,7 +1263,7 @@ ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1390,7 +1390,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1449,7 +1449,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1492,7 +1492,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1500,7 +1500,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1510,20 +1510,57 @@ } }, { + "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.", "type": "object", "required": [ + "confirmation_role", + "controlled_asset", "instruction", - "key" + "primary_role", + "recovery_role", + "timed_recovery_delay_in_minutes" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_VALIDATOR" + "CREATE_ACCESS_CONTROLLER" ] }, - "key": { - "description": "The public key of the validator", + "controlled_asset": { + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "primary_role": { + "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "recovery_role": { + "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "confirmation_role": { + "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "timed_recovery_delay_in_minutes": { + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1533,21 +1570,21 @@ } }, { - "description": "An instruction to registers a new validator given the system component address of the validator", + "description": "Creates a new identity native component with the passed access rule.", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "REGISTER_VALIDATOR" + "CREATE_IDENTITY" ] }, - "validator": { - "description": "the system component address of the validator", + "access_rule": { + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1557,21 +1594,21 @@ } }, { - "description": "An instruction to unregister a validator given the system component address of the validator", + "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "UNREGISTER_VALIDATOR" + "ASSERT_ACCESS_RULE" ] }, - "validator": { - "description": "the system component address of the validator to unregister", + "access_rule": { + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", "allOf": [ { "$ref": "#/definitions/Value" @@ -2131,25 +2168,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -2170,7 +2188,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -2280,7 +2298,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2299,7 +2317,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2328,11 +2346,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -2340,7 +2358,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -2348,13 +2366,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -2491,7 +2509,6 @@ "Own", "ComponentAddress", "ResourceAddress", - "SystemAddress", "PackageAddress", "Hash", "EcdsaSecp256k1PublicKey", @@ -2500,8 +2517,8 @@ "EddsaEd25519Signature", "Bucket", "Proof", - "NonFungibleId", - "NonFungibleAddress", + "NonFungibleLocalId", + "NonFungibleGlobalId", "Expression", "Blob", "Bytes" @@ -2674,7 +2691,7 @@ } ] }, - "NonFungibleId": { + "NonFungibleLocalId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { @@ -2688,7 +2705,7 @@ "type": { "type": "string", "enum": [ - "Number" + "Integer" ] }, "value": { @@ -2718,7 +2735,7 @@ } }, { - "description": "An byte array non-fungible id type which is serialized as a hex string", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", "type": "object", "required": [ "type", @@ -2733,12 +2750,14 @@ }, "value": { "type": "string", + "maxLength": 128, + "minLength": 2, "pattern": "[0-9a-fA-F]+" } } }, { - "description": "A string non-fungible id", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", "type": "object", "required": [ "type", @@ -2752,7 +2771,9 @@ ] }, "value": { - "type": "string" + "type": "string", + "maxLength": 64, + "minLength": 1 } } } diff --git a/schema/out/schema/compile_transaction_intent_request.json b/schema/out/schema/compile_transaction_intent_request.json index 8ab28008..7b59bf79 100644 --- a/schema/out/schema/compile_transaction_intent_request.json +++ b/schema/out/schema/compile_transaction_intent_request.json @@ -399,10 +399,10 @@ ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -521,10 +521,10 @@ ] }, "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 `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true } @@ -693,10 +693,10 @@ ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -908,7 +908,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -991,7 +991,7 @@ ] }, "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 `SystemAddress`.", + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1238,7 +1238,7 @@ ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1365,7 +1365,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1424,7 +1424,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1467,7 +1467,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1475,7 +1475,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1485,20 +1485,57 @@ } }, { + "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.", "type": "object", "required": [ + "confirmation_role", + "controlled_asset", "instruction", - "key" + "primary_role", + "recovery_role", + "timed_recovery_delay_in_minutes" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_VALIDATOR" + "CREATE_ACCESS_CONTROLLER" ] }, - "key": { - "description": "The public key of the validator", + "controlled_asset": { + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "primary_role": { + "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "recovery_role": { + "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "confirmation_role": { + "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "timed_recovery_delay_in_minutes": { + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1508,21 +1545,21 @@ } }, { - "description": "An instruction to registers a new validator given the system component address of the validator", + "description": "Creates a new identity native component with the passed access rule.", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "REGISTER_VALIDATOR" + "CREATE_IDENTITY" ] }, - "validator": { - "description": "the system component address of the validator", + "access_rule": { + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1532,21 +1569,21 @@ } }, { - "description": "An instruction to unregister a validator given the system component address of the validator", + "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "UNREGISTER_VALIDATOR" + "ASSERT_ACCESS_RULE" ] }, - "validator": { - "description": "the system component address of the validator to unregister", + "access_rule": { + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", "allOf": [ { "$ref": "#/definitions/Value" @@ -2106,25 +2143,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -2145,7 +2163,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -2255,7 +2273,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2274,7 +2292,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2303,11 +2321,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -2315,7 +2333,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -2323,13 +2341,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -2466,7 +2484,6 @@ "Own", "ComponentAddress", "ResourceAddress", - "SystemAddress", "PackageAddress", "Hash", "EcdsaSecp256k1PublicKey", @@ -2475,8 +2492,8 @@ "EddsaEd25519Signature", "Bucket", "Proof", - "NonFungibleId", - "NonFungibleAddress", + "NonFungibleLocalId", + "NonFungibleGlobalId", "Expression", "Blob", "Bytes" @@ -2649,7 +2666,7 @@ } ] }, - "NonFungibleId": { + "NonFungibleLocalId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { @@ -2663,7 +2680,7 @@ "type": { "type": "string", "enum": [ - "Number" + "Integer" ] }, "value": { @@ -2693,7 +2710,7 @@ } }, { - "description": "An byte array non-fungible id type which is serialized as a hex string", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", "type": "object", "required": [ "type", @@ -2708,12 +2725,14 @@ }, "value": { "type": "string", + "maxLength": 128, + "minLength": 2, "pattern": "[0-9a-fA-F]+" } } }, { - "description": "A string non-fungible id", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", "type": "object", "required": [ "type", @@ -2727,7 +2746,9 @@ ] }, "value": { - "type": "string" + "type": "string", + "maxLength": 64, + "minLength": 1 } } } diff --git a/schema/out/schema/convert_manifest_request.json b/schema/out/schema/convert_manifest_request.json index dc4671c0..004608c3 100644 --- a/schema/out/schema/convert_manifest_request.json +++ b/schema/out/schema/convert_manifest_request.json @@ -307,10 +307,10 @@ ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -429,10 +429,10 @@ ] }, "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 `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true } @@ -601,10 +601,10 @@ ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -816,7 +816,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -899,7 +899,7 @@ ] }, "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 `SystemAddress`.", + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1146,7 +1146,7 @@ ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1273,7 +1273,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1332,7 +1332,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1375,7 +1375,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1383,7 +1383,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1393,20 +1393,57 @@ } }, { + "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.", "type": "object", "required": [ + "confirmation_role", + "controlled_asset", "instruction", - "key" + "primary_role", + "recovery_role", + "timed_recovery_delay_in_minutes" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_VALIDATOR" + "CREATE_ACCESS_CONTROLLER" ] }, - "key": { - "description": "The public key of the validator", + "controlled_asset": { + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "primary_role": { + "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "recovery_role": { + "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "confirmation_role": { + "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "timed_recovery_delay_in_minutes": { + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1416,21 +1453,21 @@ } }, { - "description": "An instruction to registers a new validator given the system component address of the validator", + "description": "Creates a new identity native component with the passed access rule.", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "REGISTER_VALIDATOR" + "CREATE_IDENTITY" ] }, - "validator": { - "description": "the system component address of the validator", + "access_rule": { + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1440,21 +1477,21 @@ } }, { - "description": "An instruction to unregister a validator given the system component address of the validator", + "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "UNREGISTER_VALIDATOR" + "ASSERT_ACCESS_RULE" ] }, - "validator": { - "description": "the system component address of the validator to unregister", + "access_rule": { + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", "allOf": [ { "$ref": "#/definitions/Value" @@ -2014,25 +2051,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -2053,7 +2071,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -2163,7 +2181,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2182,7 +2200,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2211,11 +2229,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -2223,7 +2241,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -2231,13 +2249,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -2374,7 +2392,6 @@ "Own", "ComponentAddress", "ResourceAddress", - "SystemAddress", "PackageAddress", "Hash", "EcdsaSecp256k1PublicKey", @@ -2383,8 +2400,8 @@ "EddsaEd25519Signature", "Bucket", "Proof", - "NonFungibleId", - "NonFungibleAddress", + "NonFungibleLocalId", + "NonFungibleGlobalId", "Expression", "Blob", "Bytes" @@ -2557,7 +2574,7 @@ } ] }, - "NonFungibleId": { + "NonFungibleLocalId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { @@ -2571,7 +2588,7 @@ "type": { "type": "string", "enum": [ - "Number" + "Integer" ] }, "value": { @@ -2601,7 +2618,7 @@ } }, { - "description": "An byte array non-fungible id type which is serialized as a hex string", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", "type": "object", "required": [ "type", @@ -2616,12 +2633,14 @@ }, "value": { "type": "string", + "maxLength": 128, + "minLength": 2, "pattern": "[0-9a-fA-F]+" } } }, { - "description": "A string non-fungible id", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", "type": "object", "required": [ "type", @@ -2635,7 +2654,9 @@ ] }, "value": { - "type": "string" + "type": "string", + "maxLength": 64, + "minLength": 1 } } } diff --git a/schema/out/schema/convert_manifest_response.json b/schema/out/schema/convert_manifest_response.json index b8078f16..5de924a5 100644 --- a/schema/out/schema/convert_manifest_response.json +++ b/schema/out/schema/convert_manifest_response.json @@ -267,10 +267,10 @@ ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -389,10 +389,10 @@ ] }, "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 `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true } @@ -561,10 +561,10 @@ ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -776,7 +776,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -859,7 +859,7 @@ ] }, "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 `SystemAddress`.", + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1106,7 +1106,7 @@ ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1233,7 +1233,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1292,7 +1292,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1335,7 +1335,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1343,7 +1343,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1353,20 +1353,57 @@ } }, { + "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.", "type": "object", "required": [ + "confirmation_role", + "controlled_asset", "instruction", - "key" + "primary_role", + "recovery_role", + "timed_recovery_delay_in_minutes" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_VALIDATOR" + "CREATE_ACCESS_CONTROLLER" ] }, - "key": { - "description": "The public key of the validator", + "controlled_asset": { + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "primary_role": { + "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "recovery_role": { + "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "confirmation_role": { + "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "timed_recovery_delay_in_minutes": { + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1376,21 +1413,21 @@ } }, { - "description": "An instruction to registers a new validator given the system component address of the validator", + "description": "Creates a new identity native component with the passed access rule.", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "REGISTER_VALIDATOR" + "CREATE_IDENTITY" ] }, - "validator": { - "description": "the system component address of the validator", + "access_rule": { + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1400,21 +1437,21 @@ } }, { - "description": "An instruction to unregister a validator given the system component address of the validator", + "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "UNREGISTER_VALIDATOR" + "ASSERT_ACCESS_RULE" ] }, - "validator": { - "description": "the system component address of the validator to unregister", + "access_rule": { + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1974,25 +2011,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -2013,7 +2031,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -2123,7 +2141,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2142,7 +2160,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2171,11 +2189,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -2183,7 +2201,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -2191,13 +2209,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -2334,7 +2352,6 @@ "Own", "ComponentAddress", "ResourceAddress", - "SystemAddress", "PackageAddress", "Hash", "EcdsaSecp256k1PublicKey", @@ -2343,8 +2360,8 @@ "EddsaEd25519Signature", "Bucket", "Proof", - "NonFungibleId", - "NonFungibleAddress", + "NonFungibleLocalId", + "NonFungibleGlobalId", "Expression", "Blob", "Bytes" @@ -2517,7 +2534,7 @@ } ] }, - "NonFungibleId": { + "NonFungibleLocalId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { @@ -2531,7 +2548,7 @@ "type": { "type": "string", "enum": [ - "Number" + "Integer" ] }, "value": { @@ -2561,7 +2578,7 @@ } }, { - "description": "An byte array non-fungible id type which is serialized as a hex string", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", "type": "object", "required": [ "type", @@ -2576,12 +2593,14 @@ }, "value": { "type": "string", + "maxLength": 128, + "minLength": 2, "pattern": "[0-9a-fA-F]+" } } }, { - "description": "A string non-fungible id", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", "type": "object", "required": [ "type", @@ -2595,7 +2614,9 @@ ] }, "value": { - "type": "string" + "type": "string", + "maxLength": 64, + "minLength": 1 } } } diff --git a/schema/out/schema/decode_address_response.json b/schema/out/schema/decode_address_response.json index 9976ccee..34d945cf 100644 --- a/schema/out/schema/decode_address_response.json +++ b/schema/out/schema/decode_address_response.json @@ -52,7 +52,11 @@ "EddsaEd25519VirtualAccountComponent", "EpochManager", "Clock", - "Validator" + "Validator", + "IdentityComponent", + "EcdsaSecp256k1VirtualIdentityComponent", + "EddsaEd25519VirtualIdentityComponent", + "AccessControllerComponent" ] } } diff --git a/schema/out/schema/decompile_notarized_transaction_response.json b/schema/out/schema/decompile_notarized_transaction_response.json index 7643dda6..7dc76c93 100644 --- a/schema/out/schema/decompile_notarized_transaction_response.json +++ b/schema/out/schema/decompile_notarized_transaction_response.json @@ -450,10 +450,10 @@ ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -572,10 +572,10 @@ ] }, "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 `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true } @@ -744,10 +744,10 @@ ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -959,7 +959,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1042,7 +1042,7 @@ ] }, "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 `SystemAddress`.", + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1289,7 +1289,7 @@ ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1416,7 +1416,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1475,7 +1475,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1518,7 +1518,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1526,7 +1526,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1536,20 +1536,57 @@ } }, { + "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.", "type": "object", "required": [ + "confirmation_role", + "controlled_asset", "instruction", - "key" + "primary_role", + "recovery_role", + "timed_recovery_delay_in_minutes" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_VALIDATOR" + "CREATE_ACCESS_CONTROLLER" ] }, - "key": { - "description": "The public key of the validator", + "controlled_asset": { + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "primary_role": { + "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "recovery_role": { + "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "confirmation_role": { + "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "timed_recovery_delay_in_minutes": { + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1559,21 +1596,21 @@ } }, { - "description": "An instruction to registers a new validator given the system component address of the validator", + "description": "Creates a new identity native component with the passed access rule.", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "REGISTER_VALIDATOR" + "CREATE_IDENTITY" ] }, - "validator": { - "description": "the system component address of the validator", + "access_rule": { + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1583,21 +1620,21 @@ } }, { - "description": "An instruction to unregister a validator given the system component address of the validator", + "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "UNREGISTER_VALIDATOR" + "ASSERT_ACCESS_RULE" ] }, - "validator": { - "description": "the system component address of the validator to unregister", + "access_rule": { + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", "allOf": [ { "$ref": "#/definitions/Value" @@ -2157,25 +2194,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -2196,7 +2214,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -2306,7 +2324,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2325,7 +2343,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2354,11 +2372,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -2366,7 +2384,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -2374,13 +2392,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -2517,7 +2535,6 @@ "Own", "ComponentAddress", "ResourceAddress", - "SystemAddress", "PackageAddress", "Hash", "EcdsaSecp256k1PublicKey", @@ -2526,8 +2543,8 @@ "EddsaEd25519Signature", "Bucket", "Proof", - "NonFungibleId", - "NonFungibleAddress", + "NonFungibleLocalId", + "NonFungibleGlobalId", "Expression", "Blob", "Bytes" @@ -2700,7 +2717,7 @@ } ] }, - "NonFungibleId": { + "NonFungibleLocalId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { @@ -2714,7 +2731,7 @@ "type": { "type": "string", "enum": [ - "Number" + "Integer" ] }, "value": { @@ -2744,7 +2761,7 @@ } }, { - "description": "An byte array non-fungible id type which is serialized as a hex string", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", "type": "object", "required": [ "type", @@ -2759,12 +2776,14 @@ }, "value": { "type": "string", + "maxLength": 128, + "minLength": 2, "pattern": "[0-9a-fA-F]+" } } }, { - "description": "A string non-fungible id", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", "type": "object", "required": [ "type", @@ -2778,7 +2797,9 @@ ] }, "value": { - "type": "string" + "type": "string", + "maxLength": 64, + "minLength": 1 } } } diff --git a/schema/out/schema/decompile_signed_transaction_intent_response.json b/schema/out/schema/decompile_signed_transaction_intent_response.json index 3151d4d2..a4dd2dfe 100644 --- a/schema/out/schema/decompile_signed_transaction_intent_response.json +++ b/schema/out/schema/decompile_signed_transaction_intent_response.json @@ -424,10 +424,10 @@ ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -546,10 +546,10 @@ ] }, "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 `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true } @@ -718,10 +718,10 @@ ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -933,7 +933,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1016,7 +1016,7 @@ ] }, "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 `SystemAddress`.", + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1263,7 +1263,7 @@ ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1390,7 +1390,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1449,7 +1449,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1492,7 +1492,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1500,7 +1500,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1510,20 +1510,57 @@ } }, { + "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.", "type": "object", "required": [ + "confirmation_role", + "controlled_asset", "instruction", - "key" + "primary_role", + "recovery_role", + "timed_recovery_delay_in_minutes" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_VALIDATOR" + "CREATE_ACCESS_CONTROLLER" ] }, - "key": { - "description": "The public key of the validator", + "controlled_asset": { + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "primary_role": { + "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "recovery_role": { + "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "confirmation_role": { + "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "timed_recovery_delay_in_minutes": { + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1533,21 +1570,21 @@ } }, { - "description": "An instruction to registers a new validator given the system component address of the validator", + "description": "Creates a new identity native component with the passed access rule.", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "REGISTER_VALIDATOR" + "CREATE_IDENTITY" ] }, - "validator": { - "description": "the system component address of the validator", + "access_rule": { + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1557,21 +1594,21 @@ } }, { - "description": "An instruction to unregister a validator given the system component address of the validator", + "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "UNREGISTER_VALIDATOR" + "ASSERT_ACCESS_RULE" ] }, - "validator": { - "description": "the system component address of the validator to unregister", + "access_rule": { + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", "allOf": [ { "$ref": "#/definitions/Value" @@ -2131,25 +2168,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -2170,7 +2188,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -2280,7 +2298,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2299,7 +2317,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2328,11 +2346,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -2340,7 +2358,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -2348,13 +2366,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -2491,7 +2509,6 @@ "Own", "ComponentAddress", "ResourceAddress", - "SystemAddress", "PackageAddress", "Hash", "EcdsaSecp256k1PublicKey", @@ -2500,8 +2517,8 @@ "EddsaEd25519Signature", "Bucket", "Proof", - "NonFungibleId", - "NonFungibleAddress", + "NonFungibleLocalId", + "NonFungibleGlobalId", "Expression", "Blob", "Bytes" @@ -2674,7 +2691,7 @@ } ] }, - "NonFungibleId": { + "NonFungibleLocalId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { @@ -2688,7 +2705,7 @@ "type": { "type": "string", "enum": [ - "Number" + "Integer" ] }, "value": { @@ -2718,7 +2735,7 @@ } }, { - "description": "An byte array non-fungible id type which is serialized as a hex string", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", "type": "object", "required": [ "type", @@ -2733,12 +2750,14 @@ }, "value": { "type": "string", + "maxLength": 128, + "minLength": 2, "pattern": "[0-9a-fA-F]+" } } }, { - "description": "A string non-fungible id", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", "type": "object", "required": [ "type", @@ -2752,7 +2771,9 @@ ] }, "value": { - "type": "string" + "type": "string", + "maxLength": 64, + "minLength": 1 } } } diff --git a/schema/out/schema/decompile_transaction_intent_response.json b/schema/out/schema/decompile_transaction_intent_response.json index 843dc749..a799a588 100644 --- a/schema/out/schema/decompile_transaction_intent_response.json +++ b/schema/out/schema/decompile_transaction_intent_response.json @@ -399,10 +399,10 @@ ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -521,10 +521,10 @@ ] }, "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 `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true } @@ -693,10 +693,10 @@ ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -908,7 +908,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -991,7 +991,7 @@ ] }, "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 `SystemAddress`.", + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1238,7 +1238,7 @@ ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1365,7 +1365,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1424,7 +1424,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1467,7 +1467,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1475,7 +1475,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1485,20 +1485,57 @@ } }, { + "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.", "type": "object", "required": [ + "confirmation_role", + "controlled_asset", "instruction", - "key" + "primary_role", + "recovery_role", + "timed_recovery_delay_in_minutes" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_VALIDATOR" + "CREATE_ACCESS_CONTROLLER" ] }, - "key": { - "description": "The public key of the validator", + "controlled_asset": { + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "primary_role": { + "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "recovery_role": { + "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "confirmation_role": { + "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "timed_recovery_delay_in_minutes": { + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1508,21 +1545,21 @@ } }, { - "description": "An instruction to registers a new validator given the system component address of the validator", + "description": "Creates a new identity native component with the passed access rule.", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "REGISTER_VALIDATOR" + "CREATE_IDENTITY" ] }, - "validator": { - "description": "the system component address of the validator", + "access_rule": { + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1532,21 +1569,21 @@ } }, { - "description": "An instruction to unregister a validator given the system component address of the validator", + "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "UNREGISTER_VALIDATOR" + "ASSERT_ACCESS_RULE" ] }, - "validator": { - "description": "the system component address of the validator to unregister", + "access_rule": { + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", "allOf": [ { "$ref": "#/definitions/Value" @@ -2106,25 +2143,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -2145,7 +2163,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -2255,7 +2273,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2274,7 +2292,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2303,11 +2321,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -2315,7 +2333,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -2323,13 +2341,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -2466,7 +2484,6 @@ "Own", "ComponentAddress", "ResourceAddress", - "SystemAddress", "PackageAddress", "Hash", "EcdsaSecp256k1PublicKey", @@ -2475,8 +2492,8 @@ "EddsaEd25519Signature", "Bucket", "Proof", - "NonFungibleId", - "NonFungibleAddress", + "NonFungibleLocalId", + "NonFungibleGlobalId", "Expression", "Blob", "Bytes" @@ -2649,7 +2666,7 @@ } ] }, - "NonFungibleId": { + "NonFungibleLocalId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { @@ -2663,7 +2680,7 @@ "type": { "type": "string", "enum": [ - "Number" + "Integer" ] }, "value": { @@ -2693,7 +2710,7 @@ } }, { - "description": "An byte array non-fungible id type which is serialized as a hex string", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", "type": "object", "required": [ "type", @@ -2708,12 +2725,14 @@ }, "value": { "type": "string", + "maxLength": 128, + "minLength": 2, "pattern": "[0-9a-fA-F]+" } } }, { - "description": "A string non-fungible id", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", "type": "object", "required": [ "type", @@ -2727,7 +2746,9 @@ ] }, "value": { - "type": "string" + "type": "string", + "maxLength": 64, + "minLength": 1 } } } diff --git a/schema/out/schema/decompile_unknown_transaction_intent_response.json b/schema/out/schema/decompile_unknown_transaction_intent_response.json index 648ca1af..175655b3 100644 --- a/schema/out/schema/decompile_unknown_transaction_intent_response.json +++ b/schema/out/schema/decompile_unknown_transaction_intent_response.json @@ -413,10 +413,10 @@ ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -535,10 +535,10 @@ ] }, "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 `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true } @@ -707,10 +707,10 @@ ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", "type": "array", "items": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" }, "uniqueItems": true }, @@ -922,7 +922,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1005,7 +1005,7 @@ ] }, "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 `SystemAddress`.", + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1252,7 +1252,7 @@ ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1379,7 +1379,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1438,7 +1438,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1481,7 +1481,7 @@ ] }, "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleAddress` from the Value model.", + "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1489,7 +1489,7 @@ ] }, "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 `NonFungibleId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1499,20 +1499,57 @@ } }, { + "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.", "type": "object", "required": [ + "confirmation_role", + "controlled_asset", "instruction", - "key" + "primary_role", + "recovery_role", + "timed_recovery_delay_in_minutes" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_VALIDATOR" + "CREATE_ACCESS_CONTROLLER" ] }, - "key": { - "description": "The public key of the validator", + "controlled_asset": { + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "primary_role": { + "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "recovery_role": { + "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "confirmation_role": { + "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + }, + "timed_recovery_delay_in_minutes": { + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1522,21 +1559,21 @@ } }, { - "description": "An instruction to registers a new validator given the system component address of the validator", + "description": "Creates a new identity native component with the passed access rule.", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "REGISTER_VALIDATOR" + "CREATE_IDENTITY" ] }, - "validator": { - "description": "the system component address of the validator", + "access_rule": { + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", "allOf": [ { "$ref": "#/definitions/Value" @@ -1546,21 +1583,21 @@ } }, { - "description": "An instruction to unregister a validator given the system component address of the validator", + "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", "type": "object", "required": [ - "instruction", - "validator" + "access_rule", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "UNREGISTER_VALIDATOR" + "ASSERT_ACCESS_RULE" ] }, - "validator": { - "description": "the system component address of the validator to unregister", + "access_rule": { + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", "allOf": [ { "$ref": "#/definitions/Value" @@ -2120,25 +2157,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -2159,7 +2177,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -2269,7 +2287,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2288,7 +2306,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2317,11 +2335,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -2329,7 +2347,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -2337,13 +2355,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -2480,7 +2498,6 @@ "Own", "ComponentAddress", "ResourceAddress", - "SystemAddress", "PackageAddress", "Hash", "EcdsaSecp256k1PublicKey", @@ -2489,8 +2506,8 @@ "EddsaEd25519Signature", "Bucket", "Proof", - "NonFungibleId", - "NonFungibleAddress", + "NonFungibleLocalId", + "NonFungibleGlobalId", "Expression", "Blob", "Bytes" @@ -2663,7 +2680,7 @@ } ] }, - "NonFungibleId": { + "NonFungibleLocalId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { @@ -2677,7 +2694,7 @@ "type": { "type": "string", "enum": [ - "Number" + "Integer" ] }, "value": { @@ -2707,7 +2724,7 @@ } }, { - "description": "An byte array non-fungible id type which is serialized as a hex string", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", "type": "object", "required": [ "type", @@ -2722,12 +2739,14 @@ }, "value": { "type": "string", + "maxLength": 128, + "minLength": 2, "pattern": "[0-9a-fA-F]+" } } }, { - "description": "A string non-fungible id", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", "type": "object", "required": [ "type", @@ -2741,7 +2760,9 @@ ] }, "value": { - "type": "string" + "type": "string", + "maxLength": 64, + "minLength": 1 } } } diff --git a/schema/out/schema/derive_virtual_account_address_response.json b/schema/out/schema/derive_virtual_account_address_response.json index 71ca1797..3040b5af 100644 --- a/schema/out/schema/derive_virtual_account_address_response.json +++ b/schema/out/schema/derive_virtual_account_address_response.json @@ -566,25 +566,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -605,7 +586,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -715,7 +696,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -734,7 +715,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -763,11 +744,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -775,7 +756,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -783,13 +764,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -926,7 +907,6 @@ "Own", "ComponentAddress", "ResourceAddress", - "SystemAddress", "PackageAddress", "Hash", "EcdsaSecp256k1PublicKey", @@ -935,8 +915,8 @@ "EddsaEd25519Signature", "Bucket", "Proof", - "NonFungibleId", - "NonFungibleAddress", + "NonFungibleLocalId", + "NonFungibleGlobalId", "Expression", "Blob", "Bytes" @@ -1109,7 +1089,7 @@ } ] }, - "NonFungibleId": { + "NonFungibleLocalId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { @@ -1123,7 +1103,7 @@ "type": { "type": "string", "enum": [ - "Number" + "Integer" ] }, "value": { @@ -1153,7 +1133,7 @@ } }, { - "description": "An byte array non-fungible id type which is serialized as a hex string", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", "type": "object", "required": [ "type", @@ -1168,12 +1148,14 @@ }, "value": { "type": "string", + "maxLength": 128, + "minLength": 2, "pattern": "[0-9a-fA-F]+" } } }, { - "description": "A string non-fungible id", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", "type": "object", "required": [ "type", @@ -1187,7 +1169,9 @@ ] }, "value": { - "type": "string" + "type": "string", + "maxLength": 64, + "minLength": 1 } } } diff --git a/schema/out/schema/encode_address_response.json b/schema/out/schema/encode_address_response.json index 37902d75..f22bba18 100644 --- a/schema/out/schema/encode_address_response.json +++ b/schema/out/schema/encode_address_response.json @@ -58,33 +58,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "object", - "required": [ - "address" - ], - "properties": { - "address": { - "type": "string" - } - } - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", diff --git a/schema/out/schema/known_entity_addresses_response.json b/schema/out/schema/known_entity_addresses_response.json index 894c4eac..4c226810 100644 --- a/schema/out/schema/known_entity_addresses_response.json +++ b/schema/out/schema/known_entity_addresses_response.json @@ -72,7 +72,7 @@ ] }, "epoch_manager_system_address": { - "description": "A system address serialized as a `SystemAddress` from the `Value` model which represents the address of the epoch manager on the requested network.", + "description": "A system address serialized as a `ComponentAddress` from the `Value` model which represents the address of the epoch manager on the requested network.", "allOf": [ { "$ref": "#/definitions/Value" @@ -80,7 +80,7 @@ ] }, "clock_system_address": { - "description": "A system address serialized as a `SystemAddress` from the `Value` model which represents the address of the clock on the requested network.", + "description": "A system address serialized as a `ComponentAddress` from the `Value` model which represents the address of the clock on the requested network.", "allOf": [ { "$ref": "#/definitions/Value" @@ -638,25 +638,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -677,7 +658,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -787,7 +768,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -806,7 +787,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -835,11 +816,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -847,7 +828,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -855,13 +836,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -998,7 +979,6 @@ "Own", "ComponentAddress", "ResourceAddress", - "SystemAddress", "PackageAddress", "Hash", "EcdsaSecp256k1PublicKey", @@ -1007,8 +987,8 @@ "EddsaEd25519Signature", "Bucket", "Proof", - "NonFungibleId", - "NonFungibleAddress", + "NonFungibleLocalId", + "NonFungibleGlobalId", "Expression", "Blob", "Bytes" @@ -1181,7 +1161,7 @@ } ] }, - "NonFungibleId": { + "NonFungibleLocalId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { @@ -1195,7 +1175,7 @@ "type": { "type": "string", "enum": [ - "Number" + "Integer" ] }, "value": { @@ -1225,7 +1205,7 @@ } }, { - "description": "An byte array non-fungible id type which is serialized as a hex string", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", "type": "object", "required": [ "type", @@ -1240,12 +1220,14 @@ }, "value": { "type": "string", + "maxLength": 128, + "minLength": 2, "pattern": "[0-9a-fA-F]+" } } }, { - "description": "A string non-fungible id", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", "type": "object", "required": [ "type", @@ -1259,7 +1241,9 @@ ] }, "value": { - "type": "string" + "type": "string", + "maxLength": 64, + "minLength": 1 } } } diff --git a/schema/out/schema/sbor_decode_response.json b/schema/out/schema/sbor_decode_response.json index c932f7e5..37a99750 100644 --- a/schema/out/schema/sbor_decode_response.json +++ b/schema/out/schema/sbor_decode_response.json @@ -550,25 +550,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -589,7 +570,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -699,7 +680,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -718,7 +699,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -747,11 +728,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -759,7 +740,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -767,13 +748,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -1430,25 +1411,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -1469,7 +1431,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -1579,7 +1541,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -1598,7 +1560,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -1627,11 +1589,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -1639,7 +1601,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -1647,13 +1609,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -1746,7 +1708,6 @@ "Own", "ComponentAddress", "ResourceAddress", - "SystemAddress", "PackageAddress", "Hash", "EcdsaSecp256k1PublicKey", @@ -1755,8 +1716,8 @@ "EddsaEd25519Signature", "Bucket", "Proof", - "NonFungibleId", - "NonFungibleAddress", + "NonFungibleLocalId", + "NonFungibleGlobalId", "Expression", "Blob", "Bytes" @@ -1929,7 +1890,7 @@ } ] }, - "NonFungibleId": { + "NonFungibleLocalId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { @@ -1943,7 +1904,7 @@ "type": { "type": "string", "enum": [ - "Number" + "Integer" ] }, "value": { @@ -1973,7 +1934,7 @@ } }, { - "description": "An byte array non-fungible id type which is serialized as a hex string", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", "type": "object", "required": [ "type", @@ -1988,12 +1949,14 @@ }, "value": { "type": "string", + "maxLength": 128, + "minLength": 2, "pattern": "[0-9a-fA-F]+" } } }, { - "description": "A string non-fungible id", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", "type": "object", "required": [ "type", @@ -2007,7 +1970,9 @@ ] }, "value": { - "type": "string" + "type": "string", + "maxLength": 64, + "minLength": 1 } } } diff --git a/schema/out/schema/sbor_encode_request.json b/schema/out/schema/sbor_encode_request.json index e6088cf0..7095201c 100644 --- a/schema/out/schema/sbor_encode_request.json +++ b/schema/out/schema/sbor_encode_request.json @@ -550,25 +550,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -589,7 +570,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -699,7 +680,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -718,7 +699,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -747,11 +728,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -759,7 +740,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -767,13 +748,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -1430,25 +1411,6 @@ } } }, - { - "description": "Represents a Bech32m encoded human-readable system address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SystemAddress" - ] - }, - "address": { - "type": "string" - } - } - }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", @@ -1469,7 +1431,7 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the number of bytes needed)", + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", "type": "object", "required": [ "type", @@ -1579,7 +1541,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -1598,7 +1560,7 @@ } }, { - "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 number.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -1627,11 +1589,11 @@ "type": { "type": "string", "enum": [ - "NonFungibleId" + "NonFungibleLocalId" ] }, "value": { - "$ref": "#/definitions/NonFungibleId" + "$ref": "#/definitions/NonFungibleLocalId" } } }, @@ -1639,7 +1601,7 @@ "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_id", + "non_fungible_local_id", "resource_address", "type" ], @@ -1647,13 +1609,13 @@ "type": { "type": "string", "enum": [ - "NonFungibleAddress" + "NonFungibleGlobalId" ] }, "resource_address": { "$ref": "#/definitions/Value" }, - "non_fungible_id": { + "non_fungible_local_id": { "$ref": "#/definitions/Value" } } @@ -1746,7 +1708,6 @@ "Own", "ComponentAddress", "ResourceAddress", - "SystemAddress", "PackageAddress", "Hash", "EcdsaSecp256k1PublicKey", @@ -1755,8 +1716,8 @@ "EddsaEd25519Signature", "Bucket", "Proof", - "NonFungibleId", - "NonFungibleAddress", + "NonFungibleLocalId", + "NonFungibleGlobalId", "Expression", "Blob", "Bytes" @@ -1929,7 +1890,7 @@ } ] }, - "NonFungibleId": { + "NonFungibleLocalId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { @@ -1943,7 +1904,7 @@ "type": { "type": "string", "enum": [ - "Number" + "Integer" ] }, "value": { @@ -1973,7 +1934,7 @@ } }, { - "description": "An byte array non-fungible id type which is serialized as a hex string", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", "type": "object", "required": [ "type", @@ -1988,12 +1949,14 @@ }, "value": { "type": "string", + "maxLength": 128, + "minLength": 2, "pattern": "[0-9a-fA-F]+" } } }, { - "description": "A string non-fungible id", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", "type": "object", "required": [ "type", @@ -2007,7 +1970,9 @@ ] }, "value": { - "type": "string" + "type": "string", + "maxLength": 64, + "minLength": 1 } } } From 1423ca7a546135869d9c6356803902ee2f188ca5 Mon Sep 17 00:00:00 2001 From: Omar Date: Sun, 29 Jan 2023 16:13:46 +0300 Subject: [PATCH 087/110] Instruction test vectors --- .../src/enum_discriminator.rs | 2 +- radix-engine-toolkit/src/model/instruction.rs | 1 + radix-engine-toolkit/src/model/value.rs | 2 +- radix-engine-toolkit/tests/instruction.rs | 95 ++ .../tests/test_vector/instruction.rs | 1472 +++++++++++++++++ radix-engine-toolkit/tests/test_vector/mod.rs | 2 + 6 files changed, 1572 insertions(+), 2 deletions(-) create mode 100644 radix-engine-toolkit/tests/instruction.rs create mode 100644 radix-engine-toolkit/tests/test_vector/instruction.rs diff --git a/radix-engine-toolkit/src/enum_discriminator.rs b/radix-engine-toolkit/src/enum_discriminator.rs index 32837f19..af2cc247 100644 --- a/radix-engine-toolkit/src/enum_discriminator.rs +++ b/radix-engine-toolkit/src/enum_discriminator.rs @@ -27,7 +27,7 @@ use serializable::serializable; /// 8-bit unsigned number. #[serializable] #[serde(tag = "type")] -#[derive(PartialEq, Eq, Hash)] +#[derive(Hash, Eq, PartialEq, PartialOrd, Ord)] pub enum EnumDiscriminator { String { /// A string discriminator of the fully qualified well-known enum name diff --git a/radix-engine-toolkit/src/model/instruction.rs b/radix-engine-toolkit/src/model/instruction.rs index 9dc36f1b..cb0b9319 100644 --- a/radix-engine-toolkit/src/model/instruction.rs +++ b/radix-engine-toolkit/src/model/instruction.rs @@ -39,6 +39,7 @@ use serializable::serializable; /// 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. diff --git a/radix-engine-toolkit/src/model/value.rs b/radix-engine-toolkit/src/model/value.rs index 126faaaa..ff9cd7b9 100644 --- a/radix-engine-toolkit/src/model/value.rs +++ b/radix-engine-toolkit/src/model/value.rs @@ -37,7 +37,7 @@ use serializable::serializable; /// returns. #[serializable] #[serde(tag = "type")] -#[derive(PartialEq, Eq, Hash)] +#[derive(Hash, Eq, PartialEq)] pub enum Value { /// A boolean value which can either be true or false Bool { value: bool }, diff --git a/radix-engine-toolkit/tests/instruction.rs b/radix-engine-toolkit/tests/instruction.rs new file mode 100644 index 00000000..3879d663 --- /dev/null +++ b/radix-engine-toolkit/tests/instruction.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. + +mod test_vector; + +use radix_engine_toolkit::model::{Bech32Coder, Instruction}; +use test_vector::*; + +#[test] +fn serialized_instructions_match_expected() { + // Checking that the serialization of instructions matches + for test_vector in INSTRUCTION_CONVERSION_TEST_VECTORS.iter() { + // Act + let expected_serialized_instruction: serde_json::Value = + serde_json::from_str(&test_vector.json_representation) + .expect("Failed to deserialize trusted instruction"); + let serialized_instruction = serde_json::to_value(&test_vector.instruction) + .expect("Failed to serialize trusted instruction"); + + // Assert + assert_eq!(expected_serialized_instruction, serialized_instruction); + } +} + +#[test] +fn deserialized_instructions_match_expected() { + // Checking that the deserialization of instructions matches + for test_vector in INSTRUCTION_CONVERSION_TEST_VECTORS.iter() { + // Act + let expected_instruction = &test_vector.instruction; + let deserialized_instruction = serde_json::from_str(&test_vector.json_representation) + .expect("Deserialization failed!"); + + // Assert + assert_eq!(*expected_instruction, deserialized_instruction) + } +} + +#[test] +fn instruction_ast_conversions_match_that_produced_by_transaction_compiler() { + // Arrange + let bech32_coder = Bech32Coder::new(0xf2); + + // Testing that the Instruction -> AstInstruction conversion matches that obtained from parsing the manifest + for test_vector in INSTRUCTION_CONVERSION_TEST_VECTORS.iter() { + let expected_ast_instruction = test_vector.manifest_representation_as_ast_instruction(); + + // Act + let ast_instruction = test_vector + .instruction + .to_ast_instruction(&bech32_coder) + .expect("Instruction -> AstInstruction conversion of trusted instruction failed"); + + // Assert + assert_eq!(expected_ast_instruction, ast_instruction) + } +} + +#[test] +fn no_information_is_lost_when_converting_instruction_to_ast_instruction_and_back() { + // Arrange + let bech32_coder = Bech32Coder::new(0xf2); + + // Testing that the Instruction -> AstInstruction conversion matches that obtained from parsing the manifest + for test_vector in INSTRUCTION_CONVERSION_TEST_VECTORS.iter() { + let expected_instruction = &test_vector.instruction; + + // Act + let ast_instruction = Instruction::from_ast_instruction( + &test_vector + .instruction + .to_ast_instruction(&bech32_coder) + .expect("Instruction -> AstInstruction conversion of trusted instruction failed"), + &bech32_coder, + ) + .expect("AstInstruction -> Instruction for a trusted instruction failed"); + + // Assert + assert_eq!(*expected_instruction, ast_instruction) + } +} diff --git a/radix-engine-toolkit/tests/test_vector/instruction.rs b/radix-engine-toolkit/tests/test_vector/instruction.rs new file mode 100644 index 00000000..715b1885 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/instruction.rs @@ -0,0 +1,1472 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#![allow(dead_code)] +#![macro_use] +extern crate lazy_static; + +use native_transaction::manifest::lexer::tokenize; +use radix_engine_toolkit::{model::*, EnumDiscriminator}; +use scrypto::prelude::{NonFungibleLocalId, *}; + +pub struct InstructionRepresentationTestVector { + pub instruction: Instruction, + pub json_representation: String, + pub manifest_representation: String, +} + +impl InstructionRepresentationTestVector { + pub fn new, T: AsRef>( + instruction: Instruction, + json_representation: S, + manifest_representation: T, + ) -> Self { + Self { + instruction, + json_representation: json_representation.as_ref().into(), + manifest_representation: manifest_representation.as_ref().into(), + } + } + + pub fn manifest_representation_as_ast_instruction( + &self, + ) -> native_transaction::manifest::ast::Instruction { + native_transaction::manifest::parser::Parser::new( + tokenize(&self.manifest_representation).expect("Failed to tokenize trusted value"), + ) + .parse_instruction() + .expect("Failed to parse trusted value to ast value") + } +} + +lazy_static::lazy_static! { + pub static ref INSTRUCTION_CONVERSION_TEST_VECTORS: Vec = vec![ + InstructionRepresentationTestVector::new( + Instruction::CallFunction { + package_address: Value::PackageAddress { + address: NetworkAwarePackageAddress { + network_id: 0xf2, + address: PackageAddress::Normal([0; 26]), + }, + }, + blueprint_name: Value::String { + value: "HelloWorld".into(), + }, + function_name: Value::String { + value: "world_hello".into(), + }, + arguments: Some(vec![Value::Decimal { + value: "129333".parse().unwrap(), + }]), + }, + r#" + { + "instruction": "CALL_FUNCTION", + "package_address": { + "type": "PackageAddress", + "address": "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq" + }, + "blueprint_name": { + "type": "String", + "value": "HelloWorld" + }, + "function_name": { + "type": "String", + "value": "world_hello" + }, + "arguments": [ + { + "type": "Decimal", + "value": "129333" + } + ] + } + "#, + r#"CALL_FUNCTION PackageAddress("package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq") "HelloWorld" "world_hello" Decimal("129333");"#, + ), + InstructionRepresentationTestVector::new( + Instruction::CallMethod { + component_address: Value::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0xf2, + address: scrypto::prelude::ComponentAddress::Normal([0; 26]), + }, + }, + method_name: Value::String { + value: "remove_user".into(), + }, + arguments: Some(vec![Value::Decimal { + value: "12".parse().unwrap(), + }]), + }, + r#" + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "ComponentAddress", + "address": "component_sim1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq8ecz5v" + }, + "method_name": { + "type": "String", + "value": "remove_user" + }, + "arguments": [ + { + "type": "Decimal", + "value": "12" + } + ] + } + "#, + r#" + CALL_METHOD + ComponentAddress("component_sim1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq8ecz5v") + "remove_user" + Decimal("12"); + "#, + ), + InstructionRepresentationTestVector::new( + Instruction::TakeFromWorktop { + resource_address: Value::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, + into_bucket: Value::Bucket { + identifier: BucketId(TransientIdentifier::U32 { value: 1 }), + }, + }, + r#" + { + "instruction": "TAKE_FROM_WORKTOP", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + }, + "into_bucket": { + "type": "Bucket", + "identifier": { + "type": "U32", + "value": "1" + } + } + } + "#, + r#" + TAKE_FROM_WORKTOP + ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") + Bucket(1u32); + "#, + ), + InstructionRepresentationTestVector::new( + Instruction::TakeFromWorktopByAmount { + resource_address: Value::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, + amount: Value::Decimal { + value: "1".parse().unwrap(), + }, + into_bucket: Value::Bucket { + identifier: BucketId(TransientIdentifier::U32 { value: 1 }), + }, + }, + r#" + { + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + }, + "amount": { + "type": "Decimal", + "value": "1" + }, + "into_bucket": { + "type": "Bucket", + "identifier": { + "type": "U32", + "value": "1" + } + } + } + "#, + r#" + TAKE_FROM_WORKTOP_BY_AMOUNT + Decimal("1") + ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") + Bucket(1u32); + "#, + ), + InstructionRepresentationTestVector::new( + Instruction::TakeFromWorktopByIds { + resource_address: Value::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, + ids: vec![Value::NonFungibleLocalId { + value: scrypto::prelude::NonFungibleLocalId::Integer(1), + }], + into_bucket: Value::Bucket { + identifier: BucketId(TransientIdentifier::U32 { value: 1 }), + }, + }, + r#" + { + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + }, + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "into_bucket": { + "type": "Bucket", + "identifier": { + "type": "U32", + "value": "1" + } + } + } + "#, + r##" + TAKE_FROM_WORKTOP_BY_IDS + Array(NonFungibleLocalId("#1#")) + ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") + Bucket(1u32); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::ReturnToWorktop { + bucket: Value::Bucket { + identifier: BucketId(TransientIdentifier::U32 { value: 1 }), + }, + }, + r#" + { + "instruction": "RETURN_TO_WORKTOP", + "bucket": { + "type": "Bucket", + "identifier": { + "type": "U32", + "value": "1" + } + } + } + "#, + r##" + RETURN_TO_WORKTOP + Bucket(1u32); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::AssertWorktopContains { + resource_address: Value::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, + }, + r#" + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + } + } + "#, + r#" + ASSERT_WORKTOP_CONTAINS + ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"); + "#, + ), + InstructionRepresentationTestVector::new( + Instruction::AssertWorktopContainsByAmount { + resource_address: Value::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, + amount: Value::Decimal { + value: "1".parse().unwrap(), + }, + }, + r#" + { + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + }, + "amount": { + "type": "Decimal", + "value": "1" + } + } + "#, + r#" + ASSERT_WORKTOP_CONTAINS_BY_AMOUNT + Decimal("1") + ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"); + "#, + ), + InstructionRepresentationTestVector::new( + Instruction::AssertWorktopContainsByIds { + resource_address: Value::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, + ids: vec![Value::NonFungibleLocalId { + value: scrypto::prelude::NonFungibleLocalId::Integer(1), + }], + }, + r#" + { + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + }, + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ] + } + "#, + r##" + ASSERT_WORKTOP_CONTAINS_BY_IDS + Array(NonFungibleLocalId("#1#")) + ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::PopFromAuthZone { + into_proof: Value::Proof { + identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + }, + }, + r#" + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "type": "Proof", + "identifier": { + "type": "U32", + "value": "1" + } + } + } + "#, + r##" + POP_FROM_AUTH_ZONE + Proof(1u32); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::PushToAuthZone { + proof: Value::Proof { + identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + }, + }, + r#" + { + "instruction": "PUSH_TO_AUTH_ZONE", + "proof": { + "type": "Proof", + "identifier": { + "type": "U32", + "value": "1" + } + } + } + "#, + r##" + PUSH_TO_AUTH_ZONE + Proof(1u32); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::ClearAuthZone, + r#" + { + "instruction": "CLEAR_AUTH_ZONE" + } + "#, + r##" + CLEAR_AUTH_ZONE; + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::CreateProofFromAuthZone { + resource_address: Value::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, + into_proof: Value::Proof { + identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + }, + }, + r#" + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + }, + "into_proof": { + "type": "Proof", + "identifier": { + "type": "U32", + "value": "1" + } + } + } + "#, + r#" + CREATE_PROOF_FROM_AUTH_ZONE + ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") + Proof(1u32); + "#, + ), + InstructionRepresentationTestVector::new( + Instruction::CreateProofFromAuthZoneByAmount { + resource_address: Value::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, + amount: Value::Decimal { + value: "1".parse().unwrap(), + }, + into_proof: Value::Proof { + identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + }, + }, + r#" + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + }, + "amount": { + "type": "Decimal", + "value": "1" + }, + "into_proof": { + "type": "Proof", + "identifier": { + "type": "U32", + "value": "1" + } + } + } + "#, + r#" + CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT + Decimal("1") + ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") + Proof(1u32); + "#, + ), + InstructionRepresentationTestVector::new( + Instruction::CreateProofFromAuthZoneByIds { + resource_address: Value::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, + ids: vec![Value::NonFungibleLocalId { + value: scrypto::prelude::NonFungibleLocalId::Integer(1), + }], + into_proof: Value::Proof { + identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + }, + }, + r#" + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + }, + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "into_proof": { + "type": "Proof", + "identifier": { + "type": "U32", + "value": "1" + } + } + } + "#, + r##" + CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS + Array(NonFungibleLocalId("#1#")) + ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") + Proof(1u32); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::CloneProof { + proof: Value::Proof { + identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + }, + into_proof: Value::Proof { + identifier: ProofId(TransientIdentifier::U32 { value: 2 }), + }, + }, + r#" + { + "instruction": "CLONE_PROOF", + "proof": { + "type": "Proof", + "identifier": { + "type": "U32", + "value": "1" + } + }, + "into_proof": { + "type": "Proof", + "identifier": { + "type": "U32", + "value": "2" + } + } + } + "#, + r##" + CLONE_PROOF + Proof(1u32) + Proof(2u32); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::DropProof { + proof: Value::Proof { + identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + }, + }, + r#" + { + "instruction": "DROP_PROOF", + "proof": { + "type": "Proof", + "identifier": { + "type": "U32", + "value": "1" + } + } + } + "#, + r##" + DROP_PROOF + Proof(1u32); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::DropAllProofs, + r#" + { + "instruction": "DROP_ALL_PROOFS" + } + "#, + r##" + DROP_ALL_PROOFS; + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::PublishPackage { + code: Value::Blob { + hash: Hash::from_str( + "36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618", + ) + .map(ManifestBlobRef) + .unwrap(), + }, + abi: Value::Blob { + hash: Hash::from_str( + "15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d", + ) + .map(ManifestBlobRef) + .unwrap(), + }, + royalty_config: Value::Map { + key_value_kind: ValueKind::String, + value_value_kind: ValueKind::Tuple, + entries: Vec::new(), + }, + metadata: Value::Map { + key_value_kind: ValueKind::String, + value_value_kind: ValueKind::String, + entries: Vec::new(), + }, + access_rules: Value::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + }, + r#" + { + "instruction": "PUBLISH_PACKAGE", + "code": { + "type": "Blob", + "hash": "36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618" + }, + "abi": { + "type": "Blob", + "hash": "15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d" + }, + "royalty_config": { + "type": "Map", + "key_value_kind": "String", + "value_value_kind": "Tuple", + "entries": [] + }, + "metadata": { + "type": "Map", + "key_value_kind": "String", + "value_value_kind": "String", + "entries": [] + }, + "access_rules": { + "type": "Enum", + "variant": { + "type": "U8", + "discriminator": "0" + } + } + } + "#, + r##" + PUBLISH_PACKAGE + Blob("36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618") + Blob("15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d") + Map() + Map() + Enum(0u8); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::PublishPackageWithOwner { + code: Value::Blob { + hash: Hash::from_str( + "36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618", + ) + .map(ManifestBlobRef) + .unwrap(), + }, + abi: Value::Blob { + hash: Hash::from_str( + "15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d", + ) + .map(ManifestBlobRef) + .unwrap(), + }, + owner_badge: Value::NonFungibleGlobalId { + address: radix_engine_toolkit::NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + non_fungible_local_id: NonFungibleLocalId::Integer(1), + }, + }, + }, + r#" + { + "instruction": "PUBLISH_PACKAGE_WITH_OWNER", + "code": { + "type": "Blob", + "hash": "36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618" + }, + "abi": { + "type": "Blob", + "hash": "15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d" + }, + "owner_badge": { + "type": "NonFungibleGlobalId", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + }, + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + } + } + "#, + r##" + PUBLISH_PACKAGE_WITH_OWNER + Blob("36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618") + Blob("15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d") + NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:#1#"); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::BurnResource { + bucket: Value::Bucket { + identifier: BucketId(TransientIdentifier::U32 { value: 1 }), + }, + }, + r#" + { + "instruction": "BURN_RESOURCE", + "bucket": { + "type": "Bucket", + "identifier": { + "type": "U32", + "value": "1" + } + } + } + "#, + r##" + BURN_RESOURCE + Bucket(1u32); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::RecallResource { + vault_id: Value::Bytes { + value: hex::decode( + "776e134adba9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492", + ) + .unwrap(), + }, + amount: Value::Decimal { + value: "1".parse().unwrap(), + }, + }, + r#" + { + "instruction": "RECALL_RESOURCE", + "vault_id": { + "type": "Bytes", + "value": "776e134adba9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492" + }, + "amount": { + "type": "Decimal", + "value": "1" + } + } + "#, + r##" + RECALL_RESOURCE + Bytes("776e134adba9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492") + Decimal("1"); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::SetMetadata { + entity_address: Value::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0xf2, + address: FAUCET_COMPONENT, + }, + }, + key: Value::String { + value: "name".into(), + }, + value: Value::String { + value: "deadbeef".into(), + }, + }, + r#" + { + "instruction": "SET_METADATA", + "entity_address": { + "type": "ComponentAddress", + "address": "component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr" + }, + "key": { + "type": "String", + "value": "name" + }, + "value": { + "type": "String", + "value": "deadbeef" + } + } + "#, + r##" + SET_METADATA + ComponentAddress("component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr") + "name" + "deadbeef"; + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::SetMetadata { + entity_address: Value::PackageAddress { + address: NetworkAwarePackageAddress { + network_id: 0xf2, + address: FAUCET_PACKAGE, + }, + }, + key: Value::String { + value: "name".into(), + }, + value: Value::String { + value: "deadbeef".into(), + }, + }, + r#" + { + "instruction": "SET_METADATA", + "entity_address": { + "type": "PackageAddress", + "address": "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq" + }, + "key": { + "type": "String", + "value": "name" + }, + "value": { + "type": "String", + "value": "deadbeef" + } + } + "#, + r##" + SET_METADATA + PackageAddress("package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq") + "name" + "deadbeef"; + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::SetMetadata { + entity_address: Value::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, + key: Value::String { + value: "name".into(), + }, + value: Value::String { + value: "deadbeef".into(), + }, + }, + r#" + { + "instruction": "SET_METADATA", + "entity_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + }, + "key": { + "type": "String", + "value": "name" + }, + "value": { + "type": "String", + "value": "deadbeef" + } + } + "#, + r##" + SET_METADATA + ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") + "name" + "deadbeef"; + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::SetPackageRoyaltyConfig { + package_address: Value::PackageAddress { + address: NetworkAwarePackageAddress { + network_id: 0xf2, + address: FAUCET_PACKAGE, + }, + }, + royalty_config: Value::Map { + key_value_kind: ValueKind::String, + value_value_kind: ValueKind::Tuple, + entries: Vec::new(), + }, + }, + r#" + { + "instruction": "SET_PACKAGE_ROYALTY_CONFIG", + "package_address": { + "type": "PackageAddress", + "address": "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq" + }, + "royalty_config": { + "type": "Map", + "key_value_kind": "String", + "value_value_kind": "Tuple", + "entries": [] + } + } + "#, + r##" + SET_PACKAGE_ROYALTY_CONFIG + PackageAddress("package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq") + Map(); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::SetComponentRoyaltyConfig { + component_address: Value::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0xf2, + address: FAUCET_COMPONENT, + }, + }, + royalty_config: Value::Map { + key_value_kind: ValueKind::String, + value_value_kind: ValueKind::Tuple, + entries: Vec::new(), + }, + }, + r#" + { + "instruction": "SET_COMPONENT_ROYALTY_CONFIG", + "component_address": { + "type": "ComponentAddress", + "address": "component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr" + }, + "royalty_config": { + "type": "Map", + "key_value_kind": "String", + "value_value_kind": "Tuple", + "entries": [] + } + } + "#, + r##" + SET_COMPONENT_ROYALTY_CONFIG + ComponentAddress("component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr") + Map(); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::ClaimPackageRoyalty { + package_address: Value::PackageAddress { + address: NetworkAwarePackageAddress { + network_id: 0xf2, + address: FAUCET_PACKAGE, + }, + }, + }, + r#" + { + "instruction": "CLAIM_PACKAGE_ROYALTY", + "package_address": { + "type": "PackageAddress", + "address": "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq" + } + } + "#, + r##" + CLAIM_PACKAGE_ROYALTY + PackageAddress("package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq"); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::ClaimComponentRoyalty { + component_address: Value::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0xf2, + address: FAUCET_COMPONENT, + }, + }, + }, + r#" + { + "instruction": "CLAIM_COMPONENT_ROYALTY", + "component_address": { + "type": "ComponentAddress", + "address": "component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr" + } + } + "#, + r##" + CLAIM_COMPONENT_ROYALTY + ComponentAddress("component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr"); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::SetMethodAccessRule { + entity_address: Value::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0xf2, + address: FAUCET_COMPONENT, + }, + }, + index: Value::U8 { value: 0 }, + key: Value::String { + value: "get_token".into(), + }, + rule: Value::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + }, + r#" + { + "instruction": "SET_METHOD_ACCESS_RULE", + "entity_address": { + "type": "ComponentAddress", + "address": "component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr" + }, + "index": { + "type": "U8", + "value": "0" + }, + "key": { + "type": "String", + "value": "get_token" + }, + "rule": { + "type": "Enum", + "variant": { + "type": "U8", + "discriminator": "0" + } + } + } + "#, + r##" + SET_METHOD_ACCESS_RULE + ComponentAddress("component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr") + 0u8 + "get_token" + Enum(0u8); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::MintFungible { + resource_address: Value::ResourceAddress { address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + } }, + amount: Value::Decimal { value: "1".parse().unwrap() } + }, + r#" + { + "instruction": "MINT_FUNGIBLE", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + }, + "amount": { + "type": "Decimal", + "value": "1" + } + } + "#, + r##" + MINT_FUNGIBLE + ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") + Decimal("1"); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::MintNonFungible { + resource_address: Value::ResourceAddress { address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + } }, + entries: Value::Map { + key_value_kind: ValueKind::NonFungibleLocalId, + value_value_kind: ValueKind::Tuple, + entries: Vec::new() + } + }, + r#" + { + "instruction": "MINT_NON_FUNGIBLE", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + }, + "entries": { + "type": "Map", + "key_value_kind": "NonFungibleLocalId", + "value_value_kind": "Tuple", + "entries": [] + } + } + "#, + r##" + MINT_NON_FUNGIBLE + ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") + Map(); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::CreateFungibleResource { + divisibility: Value::U8 { value: 18 }, + metadata: Value::Map { + key_value_kind: ValueKind::String, + value_value_kind: ValueKind::String, + entries: Vec::new() + }, + access_rules: Value::Map { + key_value_kind: ValueKind::String, + value_value_kind: ValueKind::Enum, + entries: Vec::new() + }, + initial_supply: Value::None + }, + r#" + { + "instruction": "CREATE_FUNGIBLE_RESOURCE", + "divisibility": { + "type": "U8", + "value": "18" + }, + "metadata": { + "type": "Map", + "key_value_kind": "String", + "value_value_kind": "String", + "entries": [] + }, + "access_rules": { + "type": "Map", + "key_value_kind": "String", + "value_value_kind": "Enum", + "entries": [] + }, + "initial_supply": { + "type": "None" + } + } + "#, + r##" + CREATE_FUNGIBLE_RESOURCE + 18u8 + Map() + Map() + None; + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::CreateFungibleResourceWithOwner { + divisibility: Value::U8 { value: 18 }, + metadata: Value::Map { + key_value_kind: ValueKind::String, + value_value_kind: ValueKind::String, + entries: Vec::new() + }, + owner_badge: Value::NonFungibleGlobalId { + address: radix_engine_toolkit::NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + non_fungible_local_id: NonFungibleLocalId::Integer(1), + }, + }, + initial_supply: Value::None + }, + r#" + { + "instruction": "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER", + "divisibility": { + "type": "U8", + "value": "18" + }, + "metadata": { + "type": "Map", + "key_value_kind": "String", + "value_value_kind": "String", + "entries": [] + }, + "owner_badge": { + "type": "NonFungibleGlobalId", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + }, + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + }, + "initial_supply": { + "type": "None" + } + } + "#, + r##" + CREATE_FUNGIBLE_RESOURCE_WITH_OWNER + 18u8 + Map() + NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:#1#") + None; + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::CreateNonFungibleResource { + id_type: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, + metadata: Value::Map { + key_value_kind: ValueKind::String, + value_value_kind: ValueKind::String, + entries: Vec::new() + }, + access_rules: Value::Map { + key_value_kind: ValueKind::String, + value_value_kind: ValueKind::Enum, + entries: Vec::new() + }, + initial_supply: Value::None + }, + r#" + { + "instruction": "CREATE_NON_FUNGIBLE_RESOURCE", + "id_type": { + "type": "Enum", + "variant": { + "type": "U8", + "discriminator": "0" + } + }, + "metadata": { + "type": "Map", + "key_value_kind": "String", + "value_value_kind": "String", + "entries": [] + }, + "access_rules": { + "type": "Map", + "key_value_kind": "String", + "value_value_kind": "Enum", + "entries": [] + }, + "initial_supply": { + "type": "None" + } + } + "#, + r##" + CREATE_NON_FUNGIBLE_RESOURCE + Enum(0u8) + Map() + Map() + None; + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::CreateNonFungibleResourceWithOwner { + id_type: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, + metadata: Value::Map { + key_value_kind: ValueKind::String, + value_value_kind: ValueKind::String, + entries: Vec::new() + }, + owner_badge: Value::NonFungibleGlobalId { + address: radix_engine_toolkit::NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + non_fungible_local_id: NonFungibleLocalId::Integer(1), + }, + }, + initial_supply: Value::None + }, + r#" + { + "instruction": "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER", + "id_type": { + "type": "Enum", + "variant": { + "type": "U8", + "discriminator": "0" + } + }, + "metadata": { + "type": "Map", + "key_value_kind": "String", + "value_value_kind": "String", + "entries": [] + }, + "owner_badge": { + "type": "NonFungibleGlobalId", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" + }, + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + }, + "initial_supply": { + "type": "None" + } + } + "#, + r##" + CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER + Enum(0u8) + Map() + NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:#1#") + None; + "##, + ), + // InstructionRepresentationTestVector::new( + // Instruction::CreateAccessController { + // controlled_asset: Value::Bucket { identifier: BucketId(TransientIdentifier::U32 { value: 1 }) }, + // primary_role: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, + // recovery_role: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, + // confirmation_role: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, + // timed_recovery_delay_in_minutes: Value::Some { value: Box::new(Value::U32 { value: 1 }) } + // }, + // r#" + // { + // "instruction": "CREATE_ACCESS_CONTROLLER", + // "controlled_asset": { + // "type": "Bucket", + // "identifier": { + // "type": "U32", + // "value": "1" + // } + // }, + // "primary_role": { + // "type": "Enum", + // "variant": { + // "type": "U8", + // "discriminator": "0" + // } + // }, + // "recovery_role": { + // "type": "Enum", + // "variant": { + // "type": "U8", + // "discriminator": "0" + // } + // }, + // "confirmation_role": { + // "type": "Enum", + // "variant": { + // "type": "U8", + // "discriminator": "0" + // } + // }, + // "timed_recovery_delay_in_minutes": { + // "type": "Some", + // "value": { + // "type": "U32", + // "value": "1" + // } + // } + // } + // "#, + // r##" + // CREATE_ACCESS_CONTROLLER + // Bucket(1u32) + // Enum(0u32) + // Enum(0u32) + // Enum(0u32) + // Some(1u32); + // "##, + // ), + InstructionRepresentationTestVector::new( + Instruction::CreateIdentity { + access_rule: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None } + }, + r#" + { + "instruction": "CREATE_IDENTITY", + "access_rule": { + "type": "Enum", + "variant": { + "type": "U8", + "discriminator": "0" + } + } + } + "#, + r##" + CREATE_IDENTITY + Enum(0u8); + "##, + ), + InstructionRepresentationTestVector::new( + Instruction::AssertAccessRule { + access_rule: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None } + }, + r#" + { + "instruction": "ASSERT_ACCESS_RULE", + "access_rule": { + "type": "Enum", + "variant": { + "type": "U8", + "discriminator": "0" + } + } + } + "#, + r##" + ASSERT_ACCESS_RULE + Enum(0u8); + "##, + ), + ]; +} diff --git a/radix-engine-toolkit/tests/test_vector/mod.rs b/radix-engine-toolkit/tests/test_vector/mod.rs index a78c6e3f..71be00be 100644 --- a/radix-engine-toolkit/tests/test_vector/mod.rs +++ b/radix-engine-toolkit/tests/test_vector/mod.rs @@ -1,3 +1,5 @@ +pub mod instruction; pub mod value; +pub use instruction::*; pub use value::*; From fe6894369b16df4026e86e2905ee3a85d8118892 Mon Sep 17 00:00:00 2001 From: Omar Date: Sun, 29 Jan 2023 16:17:16 +0300 Subject: [PATCH 088/110] trigger --- schema/src/main.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/schema/src/main.rs b/schema/src/main.rs index bdd9a7ba..2525816f 100644 --- a/schema/src/main.rs +++ b/schema/src/main.rs @@ -29,7 +29,6 @@ use radix_engine_toolkit::request::*; 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 From c1acf23d653bfc620896efe0350b1d58f299c4ef Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 30 Jan 2023 03:26:56 +0300 Subject: [PATCH 089/110] Redefine cbindgen pointer type --- native-json-interface/cbindgen.toml | 2 +- native-json-interface/src/lib.rs | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/native-json-interface/cbindgen.toml b/native-json-interface/cbindgen.toml index e60d9131..e28c509e 100644 --- a/native-json-interface/cbindgen.toml +++ b/native-json-interface/cbindgen.toml @@ -7,4 +7,4 @@ include = ["radix-engine-toolkit"] extra_bindings = ["radix-engine-toolkit"] [parse.expand] -crates = ["native-json-interface"] \ No newline at end of file +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 index 523d87de..a306f76a 100644 --- a/native-json-interface/src/lib.rs +++ b/native-json-interface/src/lib.rs @@ -6,8 +6,11 @@ pub mod native { use radix_engine_toolkit::request::*; use serde::{Deserialize, Serialize}; + // Redefinition since CBindgen has trouble with this + pub type Pointer = *mut std::ffi::c_char; + pub unsafe fn deserialize_from_memory<'a, T: Deserialize<'a>>( - string_pointer: radix_engine_toolkit::buffer::Pointer, + string_pointer: Pointer, ) -> Result { std::ffi::CStr::from_ptr(string_pointer as *const std::ffi::c_char) .to_str() @@ -21,9 +24,7 @@ pub mod native { }) } - pub unsafe fn write_serializable_to_memory( - object: &T, - ) -> Result { + pub unsafe fn write_serializable_to_memory(object: &T) -> Result { serde_json::to_string(object) .map_err( |error| radix_engine_toolkit::error::Error::InvalidRequestString { @@ -36,7 +37,7 @@ pub mod native { 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, + [object_bytes, &[0]].concat().as_ptr() as Pointer, byte_count, ); @@ -47,9 +48,7 @@ pub mod native { 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 { + pub unsafe extern "C" fn $handler_ident(string_pointer: Pointer) -> Pointer { let result_pointers = deserialize_from_memory(string_pointer) .and_then($handler::fulfill) .and_then(|response| write_serializable_to_memory(&response)) From b3542edc963f7277b1415ecfc9a01c47d7f7e904 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 30 Jan 2023 03:28:13 +0300 Subject: [PATCH 090/110] Update decompile unknown intent serialization --- .../src/request/decompile_unknown_intent.rs | 4 +- ...e_unknown_transaction_intent_response.json | 55 +++++++++++++++++-- 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/radix-engine-toolkit/src/request/decompile_unknown_intent.rs b/radix-engine-toolkit/src/request/decompile_unknown_intent.rs index deeadc1f..c34f6284 100644 --- a/radix-engine-toolkit/src/request/decompile_unknown_intent.rs +++ b/radix-engine-toolkit/src/request/decompile_unknown_intent.rs @@ -52,12 +52,12 @@ pub struct DecompileUnknownTransactionIntentRequest { pub compiled_unknown_intent: Vec, } -/// The response from [`DecompileUnknownTransactionIntentRequest`]. This is an untagged union which +/// 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(untagged)] +#[serde(tag = "type", content = "value")] pub enum DecompileUnknownTransactionIntentResponse { TransactionIntent(DecompileTransactionIntentResponse), SignedTransactionIntent(DecompileSignedTransactionIntentResponse), diff --git a/schema/out/schema/decompile_unknown_transaction_intent_response.json b/schema/out/schema/decompile_unknown_transaction_intent_response.json index 175655b3..b28fc18f 100644 --- a/schema/out/schema/decompile_unknown_transaction_intent_response.json +++ b/schema/out/schema/decompile_unknown_transaction_intent_response.json @@ -1,16 +1,61 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "DecompileUnknownTransactionIntentResponse", - "description": "The response from [`DecompileUnknownTransactionIntentRequest`]. This is an untagged union which can either be a [`DecompileTransactionIntentResponse`], [`DecompileSignedTransactionIntentResponse`], or [`DecompileNotarizedTransactionResponse`] depending on the passed intent.", - "anyOf": [ + "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": [ { - "$ref": "#/definitions/DecompileTransactionIntentResponse" + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "TransactionIntent" + ] + }, + "value": { + "$ref": "#/definitions/DecompileTransactionIntentResponse" + } + } }, { - "$ref": "#/definitions/DecompileSignedTransactionIntentResponse" + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "SignedTransactionIntent" + ] + }, + "value": { + "$ref": "#/definitions/DecompileSignedTransactionIntentResponse" + } + } }, { - "$ref": "#/definitions/DecompileNotarizedTransactionResponse" + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NotarizedTransactionIntent" + ] + }, + "value": { + "$ref": "#/definitions/DecompileNotarizedTransactionResponse" + } + } } ], "definitions": { From 41a75c574bbb139327408a5e35baf05cf2f651be Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 30 Jan 2023 13:55:02 +0300 Subject: [PATCH 091/110] Update SBOR Decode request format --- .../src/request/sbor_decode.rs | 1 - schema/out/examples/request-examples.md | 170 ++-- schema/out/schema/sbor_decode_response.json | 909 ++---------------- 3 files changed, 140 insertions(+), 940 deletions(-) diff --git a/radix-engine-toolkit/src/request/sbor_decode.rs b/radix-engine-toolkit/src/request/sbor_decode.rs index b735a3df..4b3b0b6d 100644 --- a/radix-engine-toolkit/src/request/sbor_decode.rs +++ b/radix-engine-toolkit/src/request/sbor_decode.rs @@ -50,7 +50,6 @@ pub struct SborDecodeRequest { #[serializable] pub struct SborDecodeResponse { /// A value representing the SBOR decoded form of the passed SBOR buffer. - #[serde(flatten)] pub value: Value, } diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index e7633e6b..8f50ebef 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -2628,90 +2628,92 @@ This document contains examples and descriptions of the different requests and r ```json { - "type": "Tuple", - "elements": [ - { - "type": "Decimal", - "value": "10" - }, - { - "type": "PreciseDecimal", - "value": "10" - }, - { - "type": "String", - "value": "Hello World!" - }, - { - "type": "Tuple", - "elements": [ - { - "type": "Decimal", - "value": "10" - }, - { - "type": "PreciseDecimal", - "value": "10" - }, - { - "type": "String", - "value": "Hello World!" - }, - { - "type": "Tuple", - "elements": [ - { - "type": "Decimal", - "value": "10" - }, - { - "type": "PreciseDecimal", - "value": "10" - }, - { - "type": "String", - "value": "Hello World!" - }, - { - "type": "Tuple", - "elements": [ - { - "type": "Decimal", - "value": "10" - }, - { - "type": "PreciseDecimal", - "value": "10" - }, - { - "type": "String", - "value": "Hello World!" - }, - { - "type": "Array", - "element_kind": "Decimal", - "elements": [ - { - "type": "Decimal", - "value": "20" - }, - { - "type": "Decimal", - "value": "100" - }, - { - "type": "Decimal", - "value": "192.31" - } - ] - } - ] - } - ] - } - ] - } - ] + "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" + } + ] + } + ] + } + ] + } + ] + } + ] + } } ``` diff --git a/schema/out/schema/sbor_decode_response.json b/schema/out/schema/sbor_decode_response.json index 37a99750..17b03bd4 100644 --- a/schema/out/schema/sbor_decode_response.json +++ b/schema/out/schema/sbor_decode_response.json @@ -3,865 +3,20 @@ "title": "SborDecodeResponse", "description": "The response from the [`SborDecodeRequest`].", "type": "object", - "oneOf": [ - { - "description": "A boolean value which can either be true or false", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bool" - ] - }, - "value": { - "type": "boolean" - } - } - }, - { - "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "An 8-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A type representing a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", - "type": "object", - "required": [ - "type", - "variant" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Enum" - ] - }, - "variant": { - "description": "The name of the variant of the enum", - "allOf": [ - { - "$ref": "#/definitions/EnumDiscriminator" - } - ] - }, - "fields": { - "description": "Optional fields that the enum may have", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "The `Some` case of Rust Options where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Some" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `None` case of Rust Options where there is value", - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - } - }, - { - "description": "The `Ok` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Ok" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `Err` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Err" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "An array values of a single value kind", - "type": "object", - "required": [ - "element_kind", - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Array" - ] - }, - "element_kind": { - "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "elements": { - "description": "The elements of the array which may contain 0 or more elements.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", - "type": "object", - "required": [ - "entries", - "key_value_kind", - "type", - "value_value_kind" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Map" - ] - }, - "key_value_kind": { - "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "value_value_kind": { - "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "entries": { - "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", - "type": "array", - "items": { - "type": "array", - "items": [ - { - "$ref": "#/definitions/Value" - }, - { - "$ref": "#/definitions/Value" - } - ], - "maxItems": 2, - "minItems": 2 - } - } - } - }, - { - "description": "An array of elements where elements could be of different kinds.", - "type": "object", - "required": [ - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Tuple" - ] - }, - "elements": { - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Decimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PreciseDecimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] - }, - "value": { - "$ref": "#/definitions/Own" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ComponentAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ResourceAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PackageAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Hash" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "identifier": { - "$ref": "#/definitions/BucketId" - } - } - }, - { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" - } - } - }, - { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] - }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" - } - } - }, - { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", - "type": "object", - "required": [ - "non_fungible_local_id", - "resource_address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleGlobalId" - ] - }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Expression" - ] - }, - "value": { - "$ref": "#/definitions/Expression" - } - } - }, - { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Blob" - ] - }, - "hash": { - "$ref": "#/definitions/Blob" - } - } - }, - { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string" - } - } - } + "required": [ + "value" ], - "definitions": { - "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", - "oneOf": [ - { - "type": "object", - "required": [ - "discriminator", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "discriminator": { - "description": "A string discriminator of the fully qualified well-known enum name", - "type": "string" - } - } - }, + "properties": { + "value": { + "description": "A value representing the SBOR decoded form of the passed SBOR buffer.", + "allOf": [ { - "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]+" - } - } + "$ref": "#/definitions/Value" } ] - }, + } + }, + "definitions": { "Value": { "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", "oneOf": [ @@ -1679,6 +834,50 @@ } ] }, + "EnumDiscriminator": { + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ + { + "type": "object", + "required": [ + "discriminator", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "discriminator": { + "description": "A string discriminator of the fully qualified well-known enum name", + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "discriminator", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "discriminator": { + "description": "An 8-bit unsigned integer serialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } + } + ] + }, "ValueKind": { "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", From b87a265220101a371fe82b8e083cac6dc6db76c3 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 30 Jan 2023 14:00:58 +0300 Subject: [PATCH 092/110] Derive virtual identity address request --- native-json-interface/src/lib.rs | 5 ++ .../derive_virtual_identity_address.rs | 87 +++++++++++++++++++ radix-engine-toolkit/src/request/mod.rs | 2 + schema/out/examples/request-examples.md | 36 ++++++++ schema/src/examples.rs | 16 ++++ schema/src/main.rs | 1 + 6 files changed, 147 insertions(+) create mode 100644 radix-engine-toolkit/src/request/derive_virtual_identity_address.rs diff --git a/native-json-interface/src/lib.rs b/native-json-interface/src/lib.rs index a306f76a..36e4ad0f 100644 --- a/native-json-interface/src/lib.rs +++ b/native-json-interface/src/lib.rs @@ -80,6 +80,7 @@ pub mod native { ); export_handler!(DeriveVirtualAccountAddressHandler as derive_virtual_account_address); + export_handler!(DeriveVirtualIdentityAddressHandler as derive_virtual_identity_address); export_handler!(EncodeAddressHandler as encode_address); export_handler!(DecodeAddressHandler as decode_address); @@ -196,6 +197,10 @@ pub mod jni { DeriveVirtualAccountAddressHandler as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_deriveVirtualAccountAddress ); + export_handler!( + DeriveVirtualIdentityAddressHandler + as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_deriveVirtualIdentityAddress + ); export_handler!( EncodeAddressHandler as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_encodeAddress diff --git a/radix-engine-toolkit/src/request/derive_virtual_identity_address.rs b/radix-engine-toolkit/src/request/derive_virtual_identity_address.rs new file mode 100644 index 00000000..0d7f885c --- /dev/null +++ b/radix-engine-toolkit/src/request/derive_virtual_identity_address.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 scrypto::prelude::{ComponentAddress, PublicKey}; +use serializable::serializable; + +use crate::error::Result; +use crate::{Handler, NetworkAwareComponentAddress}; + +// ================= +// 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 = "crate::model::Value")] + #[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, + ) -> DeriveVirtualIdentityAddressResponse { + response + } +} diff --git a/radix-engine-toolkit/src/request/mod.rs b/radix-engine-toolkit/src/request/mod.rs index 836a9856..422347c0 100644 --- a/radix-engine-toolkit/src/request/mod.rs +++ b/radix-engine-toolkit/src/request/mod.rs @@ -37,6 +37,7 @@ pub mod sbor_decode; pub mod sbor_encode; pub mod derive_virtual_account_address; +pub mod derive_virtual_identity_address; pub mod known_entity_addresses; pub mod statically_validate_transaction; @@ -52,6 +53,7 @@ pub use decompile_signed_transaction_intent::*; pub use decompile_transaction_intent::*; pub use decompile_unknown_intent::*; pub use derive_virtual_account_address::*; +pub use derive_virtual_identity_address::*; pub use encode_address::*; pub use information::*; pub use known_entity_addresses::*; diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index 8f50ebef..9034b891 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -2754,6 +2754,42 @@ This document contains examples and descriptions of the different requests and r ``` +## 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. | +| 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_sim1pgpveqrdmh7kw0vefxrzjw5e0fgw3sgdj4zrh66jkphq06jcsf" + } +} +``` +
    + ## Statically Validate Transaction | Function Name | `statically_validate_transaction` | diff --git a/schema/src/examples.rs b/schema/src/examples.rs index c01d2112..3e333ff2 100644 --- a/schema/src/examples.rs +++ b/schema/src/examples.rs @@ -389,6 +389,22 @@ 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 for KnownEntityAddressesHandler { diff --git a/schema/src/main.rs b/schema/src/main.rs index 2525816f..2d0a55a1 100644 --- a/schema/src/main.rs +++ b/schema/src/main.rs @@ -137,6 +137,7 @@ fn generate_request_examples() -> Result<(), GenerationError> { .add_example::() .add_example::() .add_example::() + .add_example::() .add_example::() .add_example::() .build(); From 6046ecec1e92bcb0ae2ce278ee36a069e8e3e6c6 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 30 Jan 2023 15:40:06 +0300 Subject: [PATCH 093/110] Fix CBindgen --- native-json-interface/Cargo.toml | 2 +- native-json-interface/src/lib.rs | 15 ++++++++------- radix-engine-toolkit/Cargo.toml | 2 +- schema/Cargo.toml | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/native-json-interface/Cargo.toml b/native-json-interface/Cargo.toml index 4b8aa53f..80d0195d 100644 --- a/native-json-interface/Cargo.toml +++ b/native-json-interface/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] jni = { version = "0.20.0", default-features = false, optional = true } -radix_engine_toolkit = { path = "../radix-engine-toolkit" } +radix-engine-toolkit = { path = "../radix-engine-toolkit" } serde = "1.0.152" serde_json = "1.0.91" diff --git a/native-json-interface/src/lib.rs b/native-json-interface/src/lib.rs index 36e4ad0f..6937a7aa 100644 --- a/native-json-interface/src/lib.rs +++ b/native-json-interface/src/lib.rs @@ -6,11 +6,8 @@ pub mod native { use radix_engine_toolkit::request::*; use serde::{Deserialize, Serialize}; - // Redefinition since CBindgen has trouble with this - pub type Pointer = *mut std::ffi::c_char; - pub unsafe fn deserialize_from_memory<'a, T: Deserialize<'a>>( - string_pointer: Pointer, + string_pointer: radix_engine_toolkit::buffer::Pointer, ) -> Result { std::ffi::CStr::from_ptr(string_pointer as *const std::ffi::c_char) .to_str() @@ -24,7 +21,9 @@ pub mod native { }) } - pub unsafe fn write_serializable_to_memory(object: &T) -> Result { + pub unsafe fn write_serializable_to_memory( + object: &T, + ) -> Result { serde_json::to_string(object) .map_err( |error| radix_engine_toolkit::error::Error::InvalidRequestString { @@ -37,7 +36,7 @@ pub mod native { let pointer = radix_engine_toolkit::buffer::toolkit_alloc(byte_count); pointer.copy_from( - [object_bytes, &[0]].concat().as_ptr() as Pointer, + [object_bytes, &[0]].concat().as_ptr() as radix_engine_toolkit::buffer::Pointer, byte_count, ); @@ -48,7 +47,9 @@ pub mod native { macro_rules! export_handler { ($handler: ident as $handler_ident: ident) => { #[no_mangle] - pub unsafe extern "C" fn $handler_ident(string_pointer: Pointer) -> Pointer { + 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)) diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index 48c9a155..08e6ba54 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "radix_engine_toolkit" +name = "radix-engine-toolkit" version = "0.7.0" edition = "2021" build = "build.rs" diff --git a/schema/Cargo.toml b/schema/Cargo.toml index 583d5bfc..c7125838 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -11,7 +11,7 @@ schemars = { version = "0.8.11", features = ["preserve_order"] } serde_json = "1.0.91" # Importing core to get the models to generate it -radix_engine_toolkit = { path = "../radix-engine-toolkit" } +radix-engine-toolkit = { path = "../radix-engine-toolkit" } serde = "1.0.152" convert_case = "0.6.0" From 5cdb3ff4f2f9160cbaf0687a0c1d22872ab05ec3 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 30 Jan 2023 17:34:02 +0300 Subject: [PATCH 094/110] Update to Betanet V2 tag --- radix-engine-toolkit/Cargo.toml | 10 +- radix-engine-toolkit/tests/instruction.rs | 6 +- .../tests/test_vector/instruction.rs | 114 +++++++++--------- schema/Cargo.toml | 10 +- 4 files changed, 71 insertions(+), 69 deletions(-) diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index 08e6ba54..441fb120 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -16,11 +16,11 @@ schemars = { version = "0.8.11", features = ["preserve_order"] } serializable = { path = "../serializable" } # Scrypto dependencies required for the core-toolkit -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop" } +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2" } # Hex is used for the internal hex encoding and decoding of values - serde_with::Hex is used for the # hex representation during serialization. diff --git a/radix-engine-toolkit/tests/instruction.rs b/radix-engine-toolkit/tests/instruction.rs index 3879d663..3ce45380 100644 --- a/radix-engine-toolkit/tests/instruction.rs +++ b/radix-engine-toolkit/tests/instruction.rs @@ -55,7 +55,8 @@ fn instruction_ast_conversions_match_that_produced_by_transaction_compiler() { // Arrange let bech32_coder = Bech32Coder::new(0xf2); - // Testing that the Instruction -> AstInstruction conversion matches that obtained from parsing the manifest + // Testing that the Instruction -> AstInstruction conversion matches that obtained from parsing + // the manifest for test_vector in INSTRUCTION_CONVERSION_TEST_VECTORS.iter() { let expected_ast_instruction = test_vector.manifest_representation_as_ast_instruction(); @@ -75,7 +76,8 @@ fn no_information_is_lost_when_converting_instruction_to_ast_instruction_and_bac // Arrange let bech32_coder = Bech32Coder::new(0xf2); - // Testing that the Instruction -> AstInstruction conversion matches that obtained from parsing the manifest + // Testing that the Instruction -> AstInstruction conversion matches that obtained from parsing + // the manifest for test_vector in INSTRUCTION_CONVERSION_TEST_VECTORS.iter() { let expected_instruction = &test_vector.instruction; diff --git a/radix-engine-toolkit/tests/test_vector/instruction.rs b/radix-engine-toolkit/tests/test_vector/instruction.rs index 715b1885..ddd82292 100644 --- a/radix-engine-toolkit/tests/test_vector/instruction.rs +++ b/radix-engine-toolkit/tests/test_vector/instruction.rs @@ -1369,63 +1369,63 @@ lazy_static::lazy_static! { None; "##, ), - // InstructionRepresentationTestVector::new( - // Instruction::CreateAccessController { - // controlled_asset: Value::Bucket { identifier: BucketId(TransientIdentifier::U32 { value: 1 }) }, - // primary_role: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, - // recovery_role: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, - // confirmation_role: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, - // timed_recovery_delay_in_minutes: Value::Some { value: Box::new(Value::U32 { value: 1 }) } - // }, - // r#" - // { - // "instruction": "CREATE_ACCESS_CONTROLLER", - // "controlled_asset": { - // "type": "Bucket", - // "identifier": { - // "type": "U32", - // "value": "1" - // } - // }, - // "primary_role": { - // "type": "Enum", - // "variant": { - // "type": "U8", - // "discriminator": "0" - // } - // }, - // "recovery_role": { - // "type": "Enum", - // "variant": { - // "type": "U8", - // "discriminator": "0" - // } - // }, - // "confirmation_role": { - // "type": "Enum", - // "variant": { - // "type": "U8", - // "discriminator": "0" - // } - // }, - // "timed_recovery_delay_in_minutes": { - // "type": "Some", - // "value": { - // "type": "U32", - // "value": "1" - // } - // } - // } - // "#, - // r##" - // CREATE_ACCESS_CONTROLLER - // Bucket(1u32) - // Enum(0u32) - // Enum(0u32) - // Enum(0u32) - // Some(1u32); - // "##, - // ), + InstructionRepresentationTestVector::new( + Instruction::CreateAccessController { + controlled_asset: Value::Bucket { identifier: BucketId(TransientIdentifier::U32 { value: 1 }) }, + primary_role: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, + recovery_role: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, + confirmation_role: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, + timed_recovery_delay_in_minutes: Value::Some { value: Box::new(Value::U8 { value: 1 }) } + }, + r#" + { + "instruction": "CREATE_ACCESS_CONTROLLER", + "controlled_asset": { + "type": "Bucket", + "identifier": { + "type": "U32", + "value": "1" + } + }, + "primary_role": { + "type": "Enum", + "variant": { + "type": "U8", + "discriminator": "0" + } + }, + "recovery_role": { + "type": "Enum", + "variant": { + "type": "U8", + "discriminator": "0" + } + }, + "confirmation_role": { + "type": "Enum", + "variant": { + "type": "U8", + "discriminator": "0" + } + }, + "timed_recovery_delay_in_minutes": { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } + } + "#, + r##" + CREATE_ACCESS_CONTROLLER + Bucket(1u32) + Enum(0u8) + Enum(0u8) + Enum(0u8) + Some(1u8); + "##, + ), InstructionRepresentationTestVector::new( Instruction::CreateIdentity { access_rule: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None } diff --git a/schema/Cargo.toml b/schema/Cargo.toml index c7125838..6e24b44f 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -15,8 +15,8 @@ radix-engine-toolkit = { path = "../radix-engine-toolkit" } serde = "1.0.152" convert_case = "0.6.0" -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", branch = "develop" } \ No newline at end of file +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2" } \ No newline at end of file From 797b2b8732985a7b5a1d72684f52cc04c2257e10 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 30 Jan 2023 17:35:36 +0300 Subject: [PATCH 095/110] Update crate versions to match Scrypto --- native-json-interface/Cargo.toml | 2 +- radix-engine-toolkit/Cargo.toml | 2 +- schema/Cargo.toml | 2 +- schema/out/examples/request-examples.md | 2 +- serializable/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/native-json-interface/Cargo.toml b/native-json-interface/Cargo.toml index 80d0195d..9fcfd577 100644 --- a/native-json-interface/Cargo.toml +++ b/native-json-interface/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "native-json-interface" -version = "0.7.0" +version = "0.8.0" edition = "2021" [dependencies] diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index 441fb120..7abcc246 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "radix-engine-toolkit" -version = "0.7.0" +version = "0.8.0" edition = "2021" build = "build.rs" diff --git a/schema/Cargo.toml b/schema/Cargo.toml index 6e24b44f..dea75da7 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "schema" -version = "0.7.0" +version = "0.8.0" edition = "2021" [dependencies] diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index 9034b891..9bebdcc8 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -25,7 +25,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "package_version": "0.7.0", + "package_version": "0.8.0", "git_hash": "This is just an example. We don't have a commit hash here :)" } ``` diff --git a/serializable/Cargo.toml b/serializable/Cargo.toml index 102aca5e..d216fbba 100644 --- a/serializable/Cargo.toml +++ b/serializable/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serializable" -version = "0.7.0" +version = "0.8.0" edition = "2021" [dependencies] From 8179b4d1bd833b1ac13e1deb0ec862eb8667e074 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 30 Jan 2023 19:48:12 +0300 Subject: [PATCH 096/110] derive non-fungible global id from public key request --- native-json-interface/src/lib.rs | 5 + ..._non_fungible_global_id_from_public_key.rs | 110 + radix-engine-toolkit/src/request/mod.rs | 3 + schema/out/examples/request-examples.md | 44 + ...ble_global_id_from_public_key_request.json | 75 + ...le_global_id_from_public_key_response.json | 1997 +++++++++++++++++ ...rive_virtual_identity_address_request.json | 76 + ...ive_virtual_identity_address_response.json | 1196 ++++++++++ schema/src/examples.rs | 19 + schema/src/main.rs | 5 + 10 files changed, 3530 insertions(+) create mode 100644 radix-engine-toolkit/src/request/derive_non_fungible_global_id_from_public_key.rs create mode 100644 schema/out/schema/derive_non_fungible_global_id_from_public_key_request.json create mode 100644 schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json create mode 100644 schema/out/schema/derive_virtual_identity_address_request.json create mode 100644 schema/out/schema/derive_virtual_identity_address_response.json diff --git a/native-json-interface/src/lib.rs b/native-json-interface/src/lib.rs index 6937a7aa..c8ac1284 100644 --- a/native-json-interface/src/lib.rs +++ b/native-json-interface/src/lib.rs @@ -82,6 +82,10 @@ pub mod native { 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); @@ -202,6 +206,7 @@ pub mod jni { 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 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 new file mode 100644 index 00000000..23dd88d7 --- /dev/null +++ b/radix-engine-toolkit/src/request/derive_non_fungible_global_id_from_public_key.rs @@ -0,0 +1,110 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES 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::Handler; +use crate::traits::ValueRef; +use crate::{NonFungibleGlobalId, Value}; +use scrypto::prelude::{FromPublicKey, PublicKey}; +use serializable::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. + #[serde(flatten)] + pub non_fungible_global_id: Value, +} + +// =============== +// 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::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: Value::NonFungibleGlobalId { + address: non_fungible_global_id, + }, + }) + } + + fn post_process( + _: &DeriveNonFungibleGlobalIdFromPublicKeyRequest, + mut response: DeriveNonFungibleGlobalIdFromPublicKeyResponse, + ) -> DeriveNonFungibleGlobalIdFromPublicKeyResponse { + for value in response.borrow_values_mut().iter_mut() { + value.alias(); + } + response + } +} + +impl ValueRef for DeriveNonFungibleGlobalIdFromPublicKeyResponse { + fn borrow_values(&self) -> Vec<&crate::Value> { + vec![&self.non_fungible_global_id] + } + + fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { + vec![&mut self.non_fungible_global_id] + } +} diff --git a/radix-engine-toolkit/src/request/mod.rs b/radix-engine-toolkit/src/request/mod.rs index 422347c0..fa68efc8 100644 --- a/radix-engine-toolkit/src/request/mod.rs +++ b/radix-engine-toolkit/src/request/mod.rs @@ -36,8 +36,10 @@ pub mod encode_address; pub mod sbor_decode; pub mod sbor_encode; +pub mod derive_non_fungible_global_id_from_public_key; pub mod derive_virtual_account_address; pub mod derive_virtual_identity_address; + pub mod known_entity_addresses; pub mod statically_validate_transaction; @@ -52,6 +54,7 @@ pub use decompile_notarized_transaction::*; pub use decompile_signed_transaction_intent::*; pub use decompile_transaction_intent::*; pub use decompile_unknown_intent::*; +pub use derive_non_fungible_global_id_from_public_key::*; pub use derive_virtual_account_address::*; pub use derive_virtual_identity_address::*; pub use encode_address::*; diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index 9bebdcc8..c683e744 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -2790,6 +2790,50 @@ This document contains examples and descriptions of the different requests and r ``` +## 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 | +| Request Type | `DeriveNonFungibleGlobalIdFromPublicKeyRequest` | +| Response Type | `DeriveNonFungibleGlobalIdFromPublicKeyResponse` | + +
    + Request Example + +```json +{ + "network_id": "242", + "public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" + } +} +``` +
    + +
    + Response Example + +```json +{ + "type": "NonFungibleGlobalId", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqshxgp7h" + }, + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "02cc806dddfd673d994986293a997a50e8c10d95443beb52b06e" + } + } +} +``` +
    + ## Statically Validate Transaction | Function Name | `statically_validate_transaction` | 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 new file mode 100644 index 00000000..dae59d5b --- /dev/null +++ b/schema/out/schema/derive_non_fungible_global_id_from_public_key_request.json @@ -0,0 +1,75 @@ +{ + "$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.", + "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.", + "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 new file mode 100644 index 00000000..98ea601a --- /dev/null +++ b/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json @@ -0,0 +1,1997 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "DeriveNonFungibleGlobalIdFromPublicKeyResponse", + "description": "The response from [`DeriveNonFungibleGlobalIdFromPublicKeyRequest`].", + "type": "object", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + }, + "value": { + "$ref": "#/definitions/Own" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "identifier": { + "$ref": "#/definitions/BucketId" + } + } + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + "value": { + "$ref": "#/definitions/NonFungibleLocalId" + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_local_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_local_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ], + "definitions": { + "EnumDiscriminator": { + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ + { + "type": "object", + "required": [ + "discriminator", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "discriminator": { + "description": "A string discriminator of the fully qualified well-known enum name", + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "discriminator", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "discriminator": { + "description": "An 8-bit unsigned integer serialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } + } + ] + }, + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + }, + "value": { + "$ref": "#/definitions/Own" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "identifier": { + "$ref": "#/definitions/BucketId" + } + } + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + "value": { + "$ref": "#/definitions/NonFungibleLocalId" + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_local_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_local_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Map", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleLocalId", + "NonFungibleGlobalId", + "Expression", + "Blob", + "Bytes" + ] + }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ + { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "description": "A string identifier", + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "NonFungibleLocalId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Integer" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "UUID" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "maxLength": 128, + "minLength": 2, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 1 + } + } + } + ] + }, + "Expression": { + "description": "Represents a transaction manifest expression.", + "type": "string", + "enum": [ + "ENTIRE_WORKTOP", + "ENTIRE_AUTH_ZONE" + ] + }, + "Blob": { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } +} \ No newline at end of file diff --git a/schema/out/schema/derive_virtual_identity_address_request.json b/schema/out/schema/derive_virtual_identity_address_request.json new file mode 100644 index 00000000..707fee23 --- /dev/null +++ b/schema/out/schema/derive_virtual_identity_address_request.json @@ -0,0 +1,76 @@ +{ + "$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.", + "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.", + "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 new file mode 100644 index 00000000..5bf5ead1 --- /dev/null +++ b/schema/out/schema/derive_virtual_identity_address_response.json @@ -0,0 +1,1196 @@ +{ + "$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/Value" + } + ] + } + }, + "definitions": { + "Value": { + "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + }, + "value": { + "$ref": "#/definitions/Own" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "identifier": { + "$ref": "#/definitions/BucketId" + } + } + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + "value": { + "$ref": "#/definitions/NonFungibleLocalId" + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_local_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_local_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "EnumDiscriminator": { + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ + { + "type": "object", + "required": [ + "discriminator", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "discriminator": { + "description": "A string discriminator of the fully qualified well-known enum name", + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "discriminator", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "discriminator": { + "description": "An 8-bit unsigned integer serialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } + } + ] + }, + "ValueKind": { + "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", + "type": "string", + "enum": [ + "Bool", + "U8", + "U16", + "U32", + "U64", + "U128", + "I8", + "I16", + "I32", + "I64", + "I128", + "String", + "Enum", + "Some", + "None", + "Ok", + "Err", + "Map", + "Array", + "Tuple", + "Decimal", + "PreciseDecimal", + "Own", + "ComponentAddress", + "ResourceAddress", + "PackageAddress", + "Hash", + "EcdsaSecp256k1PublicKey", + "EcdsaSecp256k1Signature", + "EddsaEd25519PublicKey", + "EddsaEd25519Signature", + "Bucket", + "Proof", + "NonFungibleLocalId", + "NonFungibleGlobalId", + "Expression", + "Blob", + "Bytes" + ] + }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "KeyValueStore" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Component", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Component" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 72, + "minLength": 72, + "pattern": "[0-9a-fA-F]+" + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ + { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "description": "A string identifier", + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "NonFungibleLocalId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Integer" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "UUID" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "maxLength": 128, + "minLength": 2, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 1 + } + } + } + ] + }, + "Expression": { + "description": "Represents a transaction manifest expression.", + "type": "string", + "enum": [ + "ENTIRE_WORKTOP", + "ENTIRE_AUTH_ZONE" + ] + }, + "Blob": { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } +} \ No newline at end of file diff --git a/schema/src/examples.rs b/schema/src/examples.rs index 3e333ff2..145e114c 100644 --- a/schema/src/examples.rs +++ b/schema/src/examples.rs @@ -405,6 +405,25 @@ impl ExampleData 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 for KnownEntityAddressesHandler { diff --git a/schema/src/main.rs b/schema/src/main.rs index 2d0a55a1..646a9bef 100644 --- a/schema/src/main.rs +++ b/schema/src/main.rs @@ -86,6 +86,10 @@ pub fn generate_json_schema() -> Result<(), GenerationError> { radix_engine_toolkit::request::SborDecodeResponse, radix_engine_toolkit::request::DeriveVirtualAccountAddressRequest, radix_engine_toolkit::request::DeriveVirtualAccountAddressResponse, + radix_engine_toolkit::request::DeriveVirtualIdentityAddressRequest, + radix_engine_toolkit::request::DeriveVirtualIdentityAddressResponse, + radix_engine_toolkit::request::DeriveNonFungibleGlobalIdFromPublicKeyRequest, + radix_engine_toolkit::request::DeriveNonFungibleGlobalIdFromPublicKeyResponse, radix_engine_toolkit::request::KnownEntityAddressesRequest, radix_engine_toolkit::request::KnownEntityAddressesResponse, radix_engine_toolkit::request::StaticallyValidateTransactionRequest, @@ -138,6 +142,7 @@ fn generate_request_examples() -> Result<(), GenerationError> { .add_example::() .add_example::() .add_example::() + .add_example::() .add_example::() .add_example::() .build(); From fdaa8018aaf346e29833ca1b163287ba17dbdce2 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 30 Jan 2023 20:02:39 +0300 Subject: [PATCH 097/110] Additional known entity addresses --- .../src/request/known_entity_addresses.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/radix-engine-toolkit/src/request/known_entity_addresses.rs b/radix-engine-toolkit/src/request/known_entity_addresses.rs index bf445498..006dca5d 100644 --- a/radix-engine-toolkit/src/request/known_entity_addresses.rs +++ b/radix-engine-toolkit/src/request/known_entity_addresses.rs @@ -22,7 +22,7 @@ use crate::{ }; use scrypto::prelude::{ ACCOUNT_PACKAGE, CLOCK, ECDSA_SECP256K1_TOKEN, EDDSA_ED25519_TOKEN, EPOCH_MANAGER, - FAUCET_COMPONENT, FAUCET_PACKAGE, RADIX_TOKEN, SYSTEM_TOKEN, + FAUCET_COMPONENT, FAUCET_PACKAGE, PACKAGE_TOKEN, RADIX_TOKEN, SYSTEM_TOKEN, }; use serializable::serializable; @@ -90,6 +90,12 @@ pub struct KnownEntityAddressesResponse { #[serde_as(as = "serde_with::TryFromInto")] eddsa_ed25519_token_resource_address: NetworkAwareResourceAddress, + /// A resource address serialized as a `ResourceAddress` from the `Value` model which + /// represents the address of the package token resource on the requested network. + #[schemars(with = "crate::model::value::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + package_token_resource_address: NetworkAwareResourceAddress, + /// A system address serialized as a `ComponentAddress` from the `Value` model which represents /// the address of the epoch manager on the requested network. #[schemars(with = "crate::model::value::Value")] @@ -147,6 +153,10 @@ impl Handler 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, From 737386e27098097e6ee442a687845751177af6f3 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 30 Jan 2023 20:03:22 +0300 Subject: [PATCH 098/110] Update schema and example --- schema/out/examples/request-examples.md | 4 ++++ schema/out/schema/known_entity_addresses_response.json | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index c683e744..eaf2fb11 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -2924,6 +2924,10 @@ This document contains examples and descriptions of the different requests and r "type": "ResourceAddress", "address": "resource_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqtc26ta" }, + "package_token_resource_address": { + "type": "ResourceAddress", + "address": "resource_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzq6kmakh" + }, "epoch_manager_system_address": { "type": "ComponentAddress", "address": "system_rdx1qsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk264tl" diff --git a/schema/out/schema/known_entity_addresses_response.json b/schema/out/schema/known_entity_addresses_response.json index 4c226810..c7ea6a12 100644 --- a/schema/out/schema/known_entity_addresses_response.json +++ b/schema/out/schema/known_entity_addresses_response.json @@ -11,6 +11,7 @@ "epoch_manager_system_address", "faucet_component_address", "faucet_package_address", + "package_token_resource_address", "system_token_resource_address", "xrd_resource_address" ], @@ -71,6 +72,14 @@ } ] }, + "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/Value" + } + ] + }, "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": [ From aaec52b9ae9cda7bcfb8dd17bcf72b21c5968656 Mon Sep 17 00:00:00 2001 From: Omar Date: Tue, 31 Jan 2023 19:46:14 +0300 Subject: [PATCH 099/110] Updated to betanet-v2-5d33b620 --- radix-engine-toolkit/Cargo.toml | 10 +-- radix-engine-toolkit/src/model/instruction.rs | 15 ++++ .../tests/test_vector/instruction.rs | 20 ++++++ schema/Cargo.toml | 10 +-- schema/out/examples/request-examples.md | 70 +++++++++---------- ...compile_notarized_transaction_request.json | 24 +++++++ ...ile_signed_transaction_intent_request.json | 24 +++++++ .../compile_transaction_intent_request.json | 24 +++++++ .../out/schema/convert_manifest_request.json | 24 +++++++ .../out/schema/convert_manifest_response.json | 24 +++++++ ...ompile_notarized_transaction_response.json | 24 +++++++ ...le_signed_transaction_intent_response.json | 24 +++++++ ...decompile_transaction_intent_response.json | 24 +++++++ ...e_unknown_transaction_intent_response.json | 24 +++++++ 14 files changed, 296 insertions(+), 45 deletions(-) diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index 7abcc246..e63cd633 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -16,11 +16,11 @@ schemars = { version = "0.8.11", features = ["preserve_order"] } serializable = { path = "../serializable" } # Scrypto dependencies required for the core-toolkit -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2" } +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620" } # Hex is used for the internal hex encoding and decoding of values - serde_with::Hex is used for the # hex representation during serialization. diff --git a/radix-engine-toolkit/src/model/instruction.rs b/radix-engine-toolkit/src/model/instruction.rs index cb0b9319..3eff98c4 100644 --- a/radix-engine-toolkit/src/model/instruction.rs +++ b/radix-engine-toolkit/src/model/instruction.rs @@ -543,6 +543,13 @@ pub enum Instruction { /// model which represents the access rule to assert. access_rule: Value, }, + + /// Creates a validator given the public key of the owner who controls it + CreateValidator { + /// The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of + /// this is an `EcdsaSecp256k1PublicKey` from the `Value` model. + key: Value, + }, } // ============ @@ -858,6 +865,9 @@ impl Instruction { Self::CreateIdentity { access_rule } => ast::Instruction::CreateIdentity { access_rule: access_rule.to_ast_value(bech32_coder)?, }, + Self::CreateValidator { key } => ast::Instruction::CreateValidator { + key: key.to_ast_value(bech32_coder)?, + }, }; Ok(ast_instruction) } @@ -1195,6 +1205,9 @@ impl Instruction { bech32_coder, )?, }, + ast::Instruction::CreateValidator { key } => Self::CreateValidator { + key: Value::from_ast_value(key, bech32_coder)?, + }, }; Ok(instruction) } @@ -1468,6 +1481,7 @@ impl ValueRef for Instruction { } Self::DropProof { proof } => values.push(proof), + Self::CreateValidator { key } => values.push(key), Self::DropAllProofs | Self::ClearAuthZone => {} } @@ -1741,6 +1755,7 @@ impl ValueRef for Instruction { } Self::DropProof { proof } => values.push(proof), + Self::CreateValidator { key } => values.push(key), Self::DropAllProofs | Self::ClearAuthZone => {} } diff --git a/radix-engine-toolkit/tests/test_vector/instruction.rs b/radix-engine-toolkit/tests/test_vector/instruction.rs index ddd82292..27a2bb14 100644 --- a/radix-engine-toolkit/tests/test_vector/instruction.rs +++ b/radix-engine-toolkit/tests/test_vector/instruction.rs @@ -1468,5 +1468,25 @@ lazy_static::lazy_static! { Enum(0u8); "##, ), + InstructionRepresentationTestVector::new( + Instruction::CreateValidator { + key: Value::EcdsaSecp256k1PublicKey { + public_key: "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798".parse().unwrap() + }, + }, + r#" + { + "instruction": "CREATE_VALIDATOR", + "key": { + "type": "EcdsaSecp256k1PublicKey", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + } + } + "#, + r##" + CREATE_VALIDATOR + EcdsaSecp256k1PublicKey("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"); + "##, + ), ]; } diff --git a/schema/Cargo.toml b/schema/Cargo.toml index dea75da7..0000790b 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -15,8 +15,8 @@ radix-engine-toolkit = { path = "../radix-engine-toolkit" } serde = "1.0.152" convert_case = "0.6.0" -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-b393d4df2" } \ No newline at end of file +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620" } \ No newline at end of file diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index eaf2fb11..ed852f0f 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -836,7 +836,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" + "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221127038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042703810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" } ``` @@ -856,7 +856,7 @@ This document contains examples and descriptions of the different requests and r ```json { "instructions_output_kind": "Parsed", - "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" + "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221127038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042703810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" } ``` @@ -1411,30 +1411,30 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f804" + "signature": "00a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa" }, { "curve": "EcdsaSecp256k1", - "signature": "007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e872" + "signature": "0133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e" }, { "curve": "EcdsaSecp256k1", - "signature": "01aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c" + "signature": "01578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e8" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "5ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be307" + "signature": "623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c08" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "8c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b" + "signature": "630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be198951504" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808" + "signature": "e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d" } ] } @@ -1446,7 +1446,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b2004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f8040001b2007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e8720001b201aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b45ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be3070102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b48c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b0102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808" + "compiled_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221127038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042703810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa0001b20133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e0001b201578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e80102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b4623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be1989515040102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d" } ``` @@ -1466,7 +1466,7 @@ This document contains examples and descriptions of the different requests and r ```json { "instructions_output_kind": "Parsed", - "compiled_signed_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b2004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f8040001b2007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e8720001b201aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b45ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be3070102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b48c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b0102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808" + "compiled_signed_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221127038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042703810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa0001b20133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e0001b201578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e80102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b4623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be1989515040102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d" } ``` @@ -1742,30 +1742,30 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f804" + "signature": "00a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa" }, { "curve": "EcdsaSecp256k1", - "signature": "007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e872" + "signature": "0133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e" }, { "curve": "EcdsaSecp256k1", - "signature": "01aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c" + "signature": "01578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e8" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "5ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be307" + "signature": "623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c08" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "8c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b" + "signature": "630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be198951504" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808" + "signature": "e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d" } ] } @@ -2053,36 +2053,36 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f804" + "signature": "00a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa" }, { "curve": "EcdsaSecp256k1", - "signature": "007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e872" + "signature": "0133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e" }, { "curve": "EcdsaSecp256k1", - "signature": "01aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c" + "signature": "01578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e8" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "5ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be307" + "signature": "623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c08" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "8c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b" + "signature": "630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be198951504" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808" + "signature": "e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d" } ] }, "notary_signature": { "curve": "EcdsaSecp256k1", - "signature": "0129cd0549e5a0e73d13c832b6ddb875b4a75e75a1c4abc16e9da516bd66700f243944d32277cb854d70a513c17d3b5c1c285f7728918b6ad55dac598940d3b009" + "signature": "0161d5430b6d8051ed9b4a68e96cedd25594afb3da0d8fdcbb5783faffbce188185345bbd0eefb743860614be4184a2c2d5374fd71c7cbb8422b38f89e9c79fd00" } } ``` @@ -2093,7 +2093,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b2004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f8040001b2007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e8720001b201aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b45ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be3070102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b48c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b0102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808220001b20129cd0549e5a0e73d13c832b6ddb875b4a75e75a1c4abc16e9da516bd66700f243944d32277cb854d70a513c17d3b5c1c285f7728918b6ad55dac598940d3b009" + "compiled_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221127038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042703810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa0001b20133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e0001b201578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e80102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b4623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be1989515040102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d220001b20161d5430b6d8051ed9b4a68e96cedd25594afb3da0d8fdcbb5783faffbce188185345bbd0eefb743860614be4184a2c2d5374fd71c7cbb8422b38f89e9c79fd00" } ``` @@ -2113,7 +2113,7 @@ This document contains examples and descriptions of the different requests and r ```json { "instructions_output_kind": "Parsed", - "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b2004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f8040001b2007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e8720001b201aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b45ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be3070102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b48c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b0102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808220001b20129cd0549e5a0e73d13c832b6ddb875b4a75e75a1c4abc16e9da516bd66700f243944d32277cb854d70a513c17d3b5c1c285f7728918b6ad55dac598940d3b009" + "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221127038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042703810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa0001b20133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e0001b201578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e80102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b4623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be1989515040102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d220001b20161d5430b6d8051ed9b4a68e96cedd25594afb3da0d8fdcbb5783faffbce188185345bbd0eefb743860614be4184a2c2d5374fd71c7cbb8422b38f89e9c79fd00" } ``` @@ -2390,36 +2390,36 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f804" + "signature": "00a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa" }, { "curve": "EcdsaSecp256k1", - "signature": "007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e872" + "signature": "0133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e" }, { "curve": "EcdsaSecp256k1", - "signature": "01aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c" + "signature": "01578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e8" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "5ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be307" + "signature": "623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c08" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "8c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b" + "signature": "630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be198951504" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808" + "signature": "e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d" } ] }, "notary_signature": { "curve": "EcdsaSecp256k1", - "signature": "0129cd0549e5a0e73d13c832b6ddb875b4a75e75a1c4abc16e9da516bd66700f243944d32277cb854d70a513c17d3b5c1c285f7728918b6ad55dac598940d3b009" + "signature": "0161d5430b6d8051ed9b4a68e96cedd25594afb3da0d8fdcbb5783faffbce188185345bbd0eefb743860614be4184a2c2d5374fd71c7cbb8422b38f89e9c79fd00" } } ``` @@ -2848,7 +2848,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221126038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042603810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100026038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b2004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f8040001b2007fc98d4cabf06299da6e64807d20f783c2bbe68ebf1a335213083d53fb37cdf34a9e17e26784bcf861f8f53245e0c22c891e85b9dc74cdcf339634db9168e8720001b201aec90b79aeb112f7fc5fd0b30e0a4d82cffd0dcc1bc425fc9d8346812bf10569285f80da497f62975476c128605e8d9a2a7aa13de01401b99abe22ef9a69460c0102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b45ec2d6903068e43a5562827826a173f2d68132d5a78e207543194fcbd63c110a19f29d7ff6d34aee1b4e9fcd8a19a7707b5d93d3d89be3e6e24c6bd0327be3070102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b48c6eb51fe7efee9a4ae0c6518164622e566001b41f6e9315a80abae1daeaba6b842fe852279c2f4fd9126538bc86787b4112649f922ee497d1ecf311a4266b0b0102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4726e06eaeb0a922664d8f8ce25002d431c32aebcf452597ba448ea39ea042ee4e27657f6f6ab27ed182731732b5bd063453064d88d5cc03a922090f7c2885808220001b2004a1d51e34d460fe73024e2cbd0e6cf27661db6dc16e90bb289c6c47516e06d6f6a96f71440bd014eb5cb929cad7e3213fc95feaf6b79a212f181eaea5ae0f804", + "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221127038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042703810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa0001b20133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e0001b201578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e80102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b4623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be1989515040102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d220001b200a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa", "validation_config": { "network_id": "242", "min_cost_unit_limit": "1000000", @@ -2930,11 +2930,11 @@ This document contains examples and descriptions of the different requests and r }, "epoch_manager_system_address": { "type": "ComponentAddress", - "address": "system_rdx1qsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk264tl" + "address": "epochmanager_rdx1qsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq2xdjnl" }, "clock_system_address": { "type": "ComponentAddress", - "address": "system_rdx1qcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmeqqhj" + "address": "clock_rdx1qcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqm2y56s" } } ``` diff --git a/schema/out/schema/compile_notarized_transaction_request.json b/schema/out/schema/compile_notarized_transaction_request.json index 2a9f1579..4c415fab 100644 --- a/schema/out/schema/compile_notarized_transaction_request.json +++ b/schema/out/schema/compile_notarized_transaction_request.json @@ -1642,6 +1642,30 @@ ] } } + }, + { + "description": "Creates a validator given the public key of the owner who controls it", + "type": "object", + "required": [ + "instruction", + "key" + ], + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } } ] }, diff --git a/schema/out/schema/compile_signed_transaction_intent_request.json b/schema/out/schema/compile_signed_transaction_intent_request.json index 87318549..21ab9639 100644 --- a/schema/out/schema/compile_signed_transaction_intent_request.json +++ b/schema/out/schema/compile_signed_transaction_intent_request.json @@ -1616,6 +1616,30 @@ ] } } + }, + { + "description": "Creates a validator given the public key of the owner who controls it", + "type": "object", + "required": [ + "instruction", + "key" + ], + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } } ] }, diff --git a/schema/out/schema/compile_transaction_intent_request.json b/schema/out/schema/compile_transaction_intent_request.json index 7b59bf79..e88fa92e 100644 --- a/schema/out/schema/compile_transaction_intent_request.json +++ b/schema/out/schema/compile_transaction_intent_request.json @@ -1591,6 +1591,30 @@ ] } } + }, + { + "description": "Creates a validator given the public key of the owner who controls it", + "type": "object", + "required": [ + "instruction", + "key" + ], + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } } ] }, diff --git a/schema/out/schema/convert_manifest_request.json b/schema/out/schema/convert_manifest_request.json index 004608c3..34d7917b 100644 --- a/schema/out/schema/convert_manifest_request.json +++ b/schema/out/schema/convert_manifest_request.json @@ -1499,6 +1499,30 @@ ] } } + }, + { + "description": "Creates a validator given the public key of the owner who controls it", + "type": "object", + "required": [ + "instruction", + "key" + ], + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } } ] }, diff --git a/schema/out/schema/convert_manifest_response.json b/schema/out/schema/convert_manifest_response.json index 5de924a5..62569eeb 100644 --- a/schema/out/schema/convert_manifest_response.json +++ b/schema/out/schema/convert_manifest_response.json @@ -1459,6 +1459,30 @@ ] } } + }, + { + "description": "Creates a validator given the public key of the owner who controls it", + "type": "object", + "required": [ + "instruction", + "key" + ], + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } } ] }, diff --git a/schema/out/schema/decompile_notarized_transaction_response.json b/schema/out/schema/decompile_notarized_transaction_response.json index 7dc76c93..e2db4c65 100644 --- a/schema/out/schema/decompile_notarized_transaction_response.json +++ b/schema/out/schema/decompile_notarized_transaction_response.json @@ -1642,6 +1642,30 @@ ] } } + }, + { + "description": "Creates a validator given the public key of the owner who controls it", + "type": "object", + "required": [ + "instruction", + "key" + ], + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } } ] }, diff --git a/schema/out/schema/decompile_signed_transaction_intent_response.json b/schema/out/schema/decompile_signed_transaction_intent_response.json index a4dd2dfe..97f95bd5 100644 --- a/schema/out/schema/decompile_signed_transaction_intent_response.json +++ b/schema/out/schema/decompile_signed_transaction_intent_response.json @@ -1616,6 +1616,30 @@ ] } } + }, + { + "description": "Creates a validator given the public key of the owner who controls it", + "type": "object", + "required": [ + "instruction", + "key" + ], + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } } ] }, diff --git a/schema/out/schema/decompile_transaction_intent_response.json b/schema/out/schema/decompile_transaction_intent_response.json index a799a588..6c681d16 100644 --- a/schema/out/schema/decompile_transaction_intent_response.json +++ b/schema/out/schema/decompile_transaction_intent_response.json @@ -1591,6 +1591,30 @@ ] } } + }, + { + "description": "Creates a validator given the public key of the owner who controls it", + "type": "object", + "required": [ + "instruction", + "key" + ], + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } } ] }, diff --git a/schema/out/schema/decompile_unknown_transaction_intent_response.json b/schema/out/schema/decompile_unknown_transaction_intent_response.json index b28fc18f..dcc960bc 100644 --- a/schema/out/schema/decompile_unknown_transaction_intent_response.json +++ b/schema/out/schema/decompile_unknown_transaction_intent_response.json @@ -1650,6 +1650,30 @@ ] } } + }, + { + "description": "Creates a validator given the public key of the owner who controls it", + "type": "object", + "required": [ + "instruction", + "key" + ], + "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 `Value` model.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] + } + } } ] }, From 965ebfd7cf87de4e22e78d542b54ba27ab4db52a Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 1 Feb 2023 01:54:50 +0300 Subject: [PATCH 100/110] Update entity address serialization --- .../src/model/address/entity_address.rs | 2 +- schema/out/examples/request-examples.md | 4 +-- .../out/schema/encode_address_response.json | 30 ++----------------- 3 files changed, 5 insertions(+), 31 deletions(-) diff --git a/radix-engine-toolkit/src/model/address/entity_address.rs b/radix-engine-toolkit/src/model/address/entity_address.rs index ca3e09ee..49e07e12 100644 --- a/radix-engine-toolkit/src/model/address/entity_address.rs +++ b/radix-engine-toolkit/src/model/address/entity_address.rs @@ -29,7 +29,7 @@ use std::str::FromStr; /// A discriminated union of entity addresses where addresses are serialized as a Bech32m encoded /// string. #[serializable] -#[serde(tag = "type", content = "address")] +#[serde(tag = "type")] pub enum EntityAddress { /// Represents a Bech32m encoded human-readable component address. This address is serialized /// as a human-readable bech32m encoded string. diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index ed852f0f..6928a8f0 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -2451,9 +2451,7 @@ This document contains examples and descriptions of the different requests and r ```json { "type": "ResourceAddress", - "address": { - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqd60rqz" - } + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqd60rqz" } ``` diff --git a/schema/out/schema/encode_address_response.json b/schema/out/schema/encode_address_response.json index f22bba18..cb815548 100644 --- a/schema/out/schema/encode_address_response.json +++ b/schema/out/schema/encode_address_response.json @@ -19,15 +19,7 @@ ] }, "address": { - "type": "object", - "required": [ - "address" - ], - "properties": { - "address": { - "type": "string" - } - } + "type": "string" } } }, @@ -46,15 +38,7 @@ ] }, "address": { - "type": "object", - "required": [ - "address" - ], - "properties": { - "address": { - "type": "string" - } - } + "type": "string" } } }, @@ -73,15 +57,7 @@ ] }, "address": { - "type": "object", - "required": [ - "address" - ], - "properties": { - "address": { - "type": "string" - } - } + "type": "string" } } } From 253eae6a8f3ccbbf637c163d7db614b25a7dd2dd Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 1 Feb 2023 05:55:25 +0300 Subject: [PATCH 101/110] Added convert manifest tests --- radix-engine-toolkit/src/model/value.rs | 61 ------ .../tests/common_manifests.rs | 148 ++++++++++++++ .../manifest/access_controller/create.rtm | 6 + .../manifest/access_rule/access_rule.rtm | 5 + .../access_rule/assert_access_rule.rtm | 21 ++ .../multi_account_resource_transfer.rtm | 54 +++++ .../manifest/account/resource_transfer.rtm | 26 +++ .../test_vector/manifest/call/invocation.rtm | 11 + .../test_vector/manifest/call/values.rtm | 87 ++++++++ .../manifest/faucet/free_funds.rtm | 27 +++ .../manifest/metadata/metadata.rtm | 14 ++ .../test_vector/manifest/package/abi.blob | Bin 0 -> 7 bytes .../test_vector/manifest/package/code.blob | Bin 0 -> 210 bytes .../test_vector/manifest/package/publish.rtm | 190 ++++++++++++++++++ .../manifest/package/publish_with_owner.rtm | 19 ++ .../creation/fungible/no_initial_supply.rtm | 55 +++++ .../fungible/no_initial_supply_with_owner.rtm | 26 +++ .../creation/fungible/with_initial_supply.rtm | 62 ++++++ .../with_initial_supply_with_owner.rtm | 33 +++ .../non_fungible/no_initial_supply.rtm | 53 +++++ .../no_initial_supply_with_owner.rtm | 24 +++ .../non_fungible/with_initial_supply.rtm | 68 +++++++ .../with_initial_supply_with_owner.rtm | 39 ++++ .../manifest/resources/mint/fungible/mint.rtm | 37 ++++ .../resources/mint/non_fungible/mint.rtm | 45 +++++ .../test_vector/manifest/resources/recall.rtm | 1 + .../manifest/{ => resources}/worktop.rtm | 0 .../test_vector/manifest/royalty/royalty.rtm | 26 +++ schema/src/examples.rs | 4 +- 29 files changed, 1080 insertions(+), 62 deletions(-) create mode 100644 radix-engine-toolkit/tests/common_manifests.rs create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/access_controller/create.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/access_rule/access_rule.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/access_rule/assert_access_rule.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/account/multi_account_resource_transfer.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/account/resource_transfer.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/call/invocation.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/call/values.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/faucet/free_funds.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/metadata/metadata.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/package/abi.blob create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/package/code.blob create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/package/publish.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/package/publish_with_owner.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply_with_owner.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply_with_owner.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply_with_owner.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply_with_owner.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/resources/mint/fungible/mint.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/resources/mint/non_fungible/mint.rtm create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/resources/recall.rtm rename radix-engine-toolkit/tests/test_vector/manifest/{ => resources}/worktop.rtm (100%) create mode 100644 radix-engine-toolkit/tests/test_vector/manifest/royalty/royalty.rtm diff --git a/radix-engine-toolkit/src/model/value.rs b/radix-engine-toolkit/src/model/value.rs index ff9cd7b9..028ccba2 100644 --- a/radix-engine-toolkit/src/model/value.rs +++ b/radix-engine-toolkit/src/model/value.rs @@ -1267,7 +1267,6 @@ impl Value { if let Some(network_id) = network_id { self.validate_network(network_id)? } - self.validate_collections()?; Ok(()) } @@ -1290,66 +1289,6 @@ impl Value { }) } } - - /// Validates [`Value`] collections to ensure that they're of a single kind. - fn validate_collections(&self) -> Result<()> { - match self { - Self::Array { - element_kind, - elements, - } => { - if let Some(offending_value_kind) = elements - .iter() - .map(|value| value.kind()) - .find(|kind| *kind != *element_kind) - { - Err(Error::UnexpectedAstContents { - parsing: ValueKind::Array, - expected: vec![*element_kind], - found: offending_value_kind, - }) - } else { - Ok(()) - } - } - Self::Map { - key_value_kind, - value_value_kind, - entries, - } => { - if let Some(offending_value_kind) = entries - .iter() - .enumerate() - .filter(|(i, _)| i % 2 == 0) - .map(|(_, (key, _))| key) - .map(|value| value.kind()) - .find(|kind| *kind != *key_value_kind) - { - Err(Error::UnexpectedAstContents { - parsing: ValueKind::Array, - expected: vec![*key_value_kind], - found: offending_value_kind, - }) - } else if let Some(offending_value_kind) = entries - .iter() - .enumerate() - .filter(|(i, _)| i % 2 == 0) - .map(|(_, (_, value))| value) - .map(|value| value.kind()) - .find(|kind| *kind != *key_value_kind) - { - Err(Error::UnexpectedAstContents { - parsing: ValueKind::Array, - expected: vec![*value_value_kind], - found: offending_value_kind, - }) - } else { - Ok(()) - } - } - _ => Ok(()), - } - } } impl From for ast::Type { diff --git a/radix-engine-toolkit/tests/common_manifests.rs b/radix-engine-toolkit/tests/common_manifests.rs new file mode 100644 index 00000000..a08c0701 --- /dev/null +++ b/radix-engine-toolkit/tests/common_manifests.rs @@ -0,0 +1,148 @@ +use std::path::{Path, PathBuf}; + +use radix_engine_toolkit::{ + ConvertManifestHandler, ConvertManifestRequest, Handler, InstructionKind, InstructionList, + TransactionManifest, +}; + +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(), [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_sim1qzkcyv5dwq3r6kawy6pxpvcythx8rh8ntum6ws62p95sqjjpwr", + ) + .replace( + "{faucet_component_address}", + "component_sim1qftacppvmr9ezmekxqpq58en0nk954x0a7jv2zz0hc7q8utaxr", + ) + .replace( + "{this_account_component_address}", + "account_sim1qwskd4q5jdywfw6f7jlwmcyp2xxq48uuwruc003x2kcskxh3na", + ) + .replace( + "{account_component_address}", + "account_sim1qwskd4q5jdywfw6f7jlwmcyp2xxq48uuwruc003x2kcskxh3na", + ) + .replace( + "{other_account_component_address}", + "account_sim1qdy4jqfpehf8nv4n7680cw0vhxqvhgh5lf3ae8jkjz6q5hmzed", + ) + .replace( + "{account_a_component_address}", + "account_sim1qwssydet6r0wen92wzs3nex8x9ch5ye0uz9tzgq5nchq86xmpm", + ) + .replace( + "{account_b_component_address}", + "account_sim1qdxpdrpjtsqmumccye045u4cfw2fqa3a9gujh6qvdresgnl2nh", + ) + .replace( + "{account_c_component_address}", + "account_sim1qd4jtjgqxtmk2m7ze0cpa6ugae8jwfhgxqenvw6m6uwqgqmp4q", + ) + .replace( + "{owner_badge_resource_address}", + "resource_sim1qrtkj5zx7tcpuhwjxerhhnmwv58k9v5yyjqgqt7rtnxsnqyl3s", + ) + .replace( + "{minter_badge_resource_address}", + "resource_sim1qp075qmn6389pkq30ppzzsuadd55ry04mjx69v86r4wq0feh02", + ) + .replace( + "{auth_badge_resource_address}", + "resource_sim1qp075qmn6389pkq30ppzzsuadd55ry04mjx69v86r4wq0feh02", + ) + .replace( + "{mintable_resource_address}", + "resource_sim1qqgvpz8q7ypeueqcv4qthsv7ezt8h9m3depmqqw7pc4sfmucfx", + ) + .replace("{owner_badge_non_fungible_local_id}", "#1#") + .replace("{auth_badge_non_fungible_local_id}", "#1#") + .replace( + "{code_blob_hash}", + "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + ) + .replace( + "{abi_blob_hash}", + "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + ) + .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/test_vector/manifest/access_controller/create.rtm b/radix-engine-toolkit/tests/test_vector/manifest/access_controller/create.rtm new file mode 100644 index 00000000..44ef229d --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/access_controller/create.rtm @@ -0,0 +1,6 @@ +CREATE_ACCESS_CONTROLLER + Bucket(1u32) + Enum(0u8) + Enum(0u8) + Enum(0u8) + Some(1u32); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/access_rule/access_rule.rtm b/radix-engine-toolkit/tests/test_vector/manifest/access_rule/access_rule.rtm new file mode 100644 index 00000000..e0a752f7 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/access_rule/access_rule.rtm @@ -0,0 +1,5 @@ +SET_METHOD_ACCESS_RULE + ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") + 0u32 + Enum("AccessRuleKey::Scrypto", "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 new file mode 100644 index 00000000..f5f4abf4 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/access_rule/assert_access_rule.rtm @@ -0,0 +1,21 @@ +CALL_METHOD + ComponentAddress("account_sim1qwskd4q5jdywfw6f7jlwmcyp2xxq48uuwruc003x2kcskxh3na") + "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/multi_account_resource_transfer.rtm b/radix-engine-toolkit/tests/test_vector/manifest/account/multi_account_resource_transfer.rtm new file mode 100644 index 00000000..7b318503 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/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 + ComponentAddress("${this_account_component_address}") + "lock_fee" + Decimal("10"); + +# Withdrawing 330 XRD from the account component +CALL_METHOD + ComponentAddress("${this_account_component_address}") + "withdraw_by_amount" + Decimal("330") + ResourceAddress("${xrd_resource_address}"); + +# Taking 150 XRD from the worktop and depositing them into Account A +TAKE_FROM_WORKTOP_BY_AMOUNT + Decimal("150") + ResourceAddress("${xrd_resource_address}") + Bucket("account_a_bucket"); +CALL_METHOD + ComponentAddress("${account_a_component_address}") + "deposit" + Bucket("account_a_bucket"); + +# Taking 130 XRD from the worktop and depositing them into Account B +TAKE_FROM_WORKTOP_BY_AMOUNT + Decimal("130") + ResourceAddress("${xrd_resource_address}") + Bucket("account_b_bucket"); +CALL_METHOD + ComponentAddress("${account_b_component_address}") + "deposit" + Bucket("account_b_bucket"); + +# Taking 50 XRD from the worktop and depositing them into Account C +TAKE_FROM_WORKTOP_BY_AMOUNT + Decimal("50") + ResourceAddress("${xrd_resource_address}") + Bucket("account_c_bucket"); +CALL_METHOD + ComponentAddress("${account_c_component_address}") + "deposit" + Bucket("account_c_bucket"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/account/resource_transfer.rtm b/radix-engine-toolkit/tests/test_vector/manifest/account/resource_transfer.rtm new file mode 100644 index 00000000..dc9b4ead --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/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 + ComponentAddress("${this_account_component_address}") + "lock_fee" + Decimal("10"); + +# Withdrawing 100 XRD from the account component +CALL_METHOD + ComponentAddress("${this_account_component_address}") + "withdraw_by_amount" + Decimal("100") + ResourceAddress("${xrd_resource_address}"); + +# Depositing all of the XRD withdrawn from the account into the other account +CALL_METHOD + ComponentAddress("${other_account_component_address}") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/call/invocation.rtm b/radix-engine-toolkit/tests/test_vector/manifest/call/invocation.rtm new file mode 100644 index 00000000..67cdfd22 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/call/invocation.rtm @@ -0,0 +1,11 @@ +CALL_FUNCTION + PackageAddress("package_sim1qy4hrp8a9apxldp5cazvxgwdj80cxad4u8cpkaqqnhlsa3lfpe") + "BlueprintName" + "f" + "string"; + +CALL_METHOD + ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") + "complicated_method" + Decimal("1") + PreciseDecimal("2"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/call/values.rtm b/radix-engine-toolkit/tests/test_vector/manifest/call/values.rtm new file mode 100644 index 00000000..87c622e7 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/call/values.rtm @@ -0,0 +1,87 @@ +TAKE_FROM_WORKTOP + ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") + Bucket("temp1"); +CREATE_PROOF_FROM_AUTH_ZONE + ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") + Proof("temp2"); + +CALL_METHOD + ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") + "with_some_basic_types" + + # Unit + Tuple() + ; + +CALL_METHOD + ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") + "with_aliases" + + # enum + None + Enum(0u8) + Some("hello") + Enum(1u8, "hello") + Ok("test") + Enum(0u8, "test") + Err("test123") + Enum(1u8, "test123") + Enum("Option::None") + Enum("Option::Some", "a") + Enum("Result::Ok", "b") + Enum("Result::Err", "c") + + # bytes + Bytes("deadbeef") + Array(5u8, 10u8, 255u8) + + # non-fungible address + NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:") + NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:#123#") + NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:#456#") + NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:[031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f]") + NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:#1234567890#") + Tuple(ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), NonFungibleLocalId("#1#")) + + # array + Array(Bytes("dead"), Array(5u8, 10u8, 255u8)) + Array(Bytes("dead"), Array(5u8, 10u8, 255u8)) + Array(NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:"), Tuple(ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), NonFungibleLocalId("#1#"))) + Array(NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:"), Tuple(ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), NonFungibleLocalId("#1#"))) + ; + +CALL_METHOD + ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") + "with_all_scrypto_custom_types" + + # RE global address types + PackageAddress("package_sim1qyqzcexvnyg60z7lnlwauh66nhzg3m8tch2j8wc0e70qkydk8r") + ComponentAddress("account_sim1q0u9gxewjxj8nhxuaschth2mgencma2hpkgwz30s9wlslthace") + ComponentAddress("epochmanager_sim1qsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvygtcq") + ComponentAddress("clock_sim1qcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqagpd30") + ComponentAddress("validator_sim1q5qszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqsvkh36j") + ComponentAddress("accesscontroller_sim1pspqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqq397jz") + ResourceAddress("resource_sim1qq8cays25704xdyap2vhgmshkkfyr023uxdtk59ddd4qs8cr5v") + + # RE interpreted types + # TODO: fix own syntax OR disallow own type in manifest + # Own("000000000000000000000000000000000000000000000000000000000000000005000000") + Blob("01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b") + + # TX interpreted types + Bucket("temp1") + Proof("temp2") + Expression("ENTIRE_WORKTOP") + + # Uninterpreted + Hash("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824") + EcdsaSecp256k1PublicKey("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798") + EcdsaSecp256k1Signature("0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e") + EddsaEd25519PublicKey("4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29") + EddsaEd25519Signature("ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09") + Decimal("1.2") + PreciseDecimal("1.2") + NonFungibleLocalId("") + NonFungibleLocalId("#12#") + NonFungibleLocalId("[031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f]") + NonFungibleLocalId("{43968a72-5954-45da-9678-8659dd399faa}"); diff --git a/radix-engine-toolkit/tests/test_vector/manifest/faucet/free_funds.rtm b/radix-engine-toolkit/tests/test_vector/manifest/faucet/free_funds.rtm new file mode 100644 index 00000000..adefd459 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/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 + ComponentAddress("${faucet_component_address}") + "lock_fee" + Decimal("10"); + +# Calling the "free" method on the faucet component which is the method responsible for dispensing +# XRD from the faucet. +CALL_METHOD + ComponentAddress("${faucet_component_address}") + "free"; + +# Depositing all of the XRD dispensed from the faucet into our account component. +CALL_METHOD + ComponentAddress("${account_component_address}") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/metadata/metadata.rtm b/radix-engine-toolkit/tests/test_vector/manifest/metadata/metadata.rtm new file mode 100644 index 00000000..ad284600 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/metadata/metadata.rtm @@ -0,0 +1,14 @@ +SET_METADATA + PackageAddress("package_sim1qy4hrp8a9apxldp5cazvxgwdj80cxad4u8cpkaqqnhlsa3lfpe") + "k" + "v"; + +SET_METADATA + ComponentAddress("component_sim1qg2jwzl3hxnkqye8tfj5v3p2wp7cv9xdcjv4nl63refs785pvt") + "k" + "v"; + +SET_METADATA + ResourceAddress("resource_sim1qq8cays25704xdyap2vhgmshkkfyr023uxdtk59ddd4qs8cr5v") + "k" + "v"; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/package/abi.blob b/radix-engine-toolkit/tests/test_vector/manifest/package/abi.blob new file mode 100644 index 0000000000000000000000000000000000000000..0f54d027e4439141b2872a20f5200a510a24b4e9 GIT binary patch literal 7 McmXrw5nuoU00I2~PXGV_ literal 0 HcmV?d00001 diff --git a/radix-engine-toolkit/tests/test_vector/manifest/package/code.blob b/radix-engine-toolkit/tests/test_vector/manifest/package/code.blob new file mode 100644 index 0000000000000000000000000000000000000000..1410dba7c5abcd2860c56268e15249e08788f717 GIT binary patch literal 210 zcmY+9J#NB45JqRbHVzmmRyr4v+#rR*XuT+rC^-O4E-)H3!9g1^}Sr=S*PV;H)sh9uXsjkS;QH$K&JigyatY9dFd4k*0G~04pNP1Cz8?VM25f z?x|ugDu66(xsmt{;g!e_Twkg0e%e7CoR+=o>{yHQ!OM-?^T=nx@O$(Ftmml~@5L6? kgpr$D{a)@q4?CTI9Bf&cQh!Nqv@wM?h1qY-I{ka`3x?h_pa1{> literal 0 HcmV?d00001 diff --git a/radix-engine-toolkit/tests/test_vector/manifest/package/publish.rtm b/radix-engine-toolkit/tests/test_vector/manifest/package/publish.rtm new file mode 100644 index 00000000..ef53ce7f --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/package/publish.rtm @@ -0,0 +1,190 @@ +# This transaction manifest shows how a package can be published to the ledger + +# ================================================================================================== +# WARNING: If you will be submitting this transaction through the Babylon wallet then you MUST +# remove the "lock_fee" instruction that you see below. Otherwise your transaction will fail. If all +# that you are using is resim then you can safely ignore this warning. +# ================================================================================================== + +# Locking 10 XRD in fees from the account component. +CALL_METHOD + ComponentAddress("${account_component_address}") + "lock_fee" + Decimal("10"); + +# Publishing a new package and setting some of its royalty and access rules. +PUBLISH_PACKAGE + Blob("${code_blob_hash}") + Blob("${abi_blob_hash}") + Map() # Royalty Configuration + Map() # Metadata + Tuple( # Access Rules Struct + Map( # Method auth Field + Enum( + "AccessRuleKey::Native", + Enum( + "NativeFn::Package", + Enum("PackageFn::SetRoyaltyConfig") + ) + ), + 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}") + ) + ) + ) + ) + ), + Enum( + "AccessRuleKey::Native", + Enum( + "NativeFn::Package", + Enum("PackageFn::ClaimRoyalty") + ) + ), + 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}") + ) + ) + ) + ) + ), + Enum( + "AccessRuleKey::Native", + Enum( + "NativeFn::Metadata", + Enum("MetadataFn::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}") + ) + ) + ) + ) + ), + Enum( + "AccessRuleKey::Native", + Enum( + "NativeFn::Metadata", + Enum("MetadataFn::Get") + ) + ), + Enum( + "AccessRuleEntry::AccessRule", + Enum("AccessRule::AllowAll") + ) + ), + Map(), # Grouped Auth Field + Enum("AccessRule::DenyAll"), # Default Auth Field + Map( # Method Auth Mutability Field + Enum( + "AccessRuleKey::Native", + Enum( + "NativeFn::Package", + Enum("PackageFn::SetRoyaltyConfig") + ) + ), + Enum( + "AccessRule::Protected", + Enum( + "AccessRuleNode::ProofRule", + Enum( + "ProofRule::Require", + Enum( + "SoftResourceOrNonFungible::StaticNonFungible", + NonFungibleGlobalId("${auth_badge_resource_address}:${auth_badge_non_fungible_local_id}") + ) + ) + ) + ), + Enum( + "AccessRuleKey::Native", + Enum( + "NativeFn::Package", + Enum("PackageFn::ClaimRoyalty") + ) + ), + Enum( + "AccessRule::Protected", + Enum( + "AccessRuleNode::ProofRule", + Enum( + "ProofRule::Require", + Enum( + "SoftResourceOrNonFungible::StaticNonFungible", + NonFungibleGlobalId("${auth_badge_resource_address}:${auth_badge_non_fungible_local_id}") + ) + ) + ) + ), + Enum( + "AccessRuleKey::Native", + Enum( + "NativeFn::Metadata", + Enum("MetadataFn::Set") + ) + ), + Enum( + "AccessRule::Protected", + Enum( + "AccessRuleNode::ProofRule", + Enum( + "ProofRule::Require", + Enum( + "SoftResourceOrNonFungible::StaticNonFungible", + NonFungibleGlobalId("${auth_badge_resource_address}:${auth_badge_non_fungible_local_id}") + ) + ) + ) + ), + Enum( + "AccessRuleKey::Native", + Enum( + "NativeFn::Metadata", + Enum("MetadataFn::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/publish_with_owner.rtm b/radix-engine-toolkit/tests/test_vector/manifest/package/publish_with_owner.rtm new file mode 100644 index 00000000..48f8d251 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/package/publish_with_owner.rtm @@ -0,0 +1,19 @@ +# This transaction manifest shows how a package can be published to the ledger + +# ================================================================================================== +# WARNING: If you will be submitting this transaction through the Babylon wallet then you MUST +# remove the "lock_fee" instruction that you see below. Otherwise your transaction will fail. If all +# that you are using is resim then you can safely ignore this warning. +# ================================================================================================== + +# Locking 10 XRD in fees from the account component. +CALL_METHOD + ComponentAddress("${account_component_address}") + "lock_fee" + Decimal("10"); + +# Publishing a new package with an owner badge +PUBLISH_PACKAGE_WITH_OWNER + Blob("${code_blob_hash}") + Blob("${abi_blob_hash}") + NonFungibleGlobalId("${owner_badge_resource_address}:${owner_badge_non_fungible_local_id}"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply.rtm new file mode 100644 index 00000000..e5c46e97 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply.rtm @@ -0,0 +1,55 @@ +# 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 + ComponentAddress("${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")) + ) + None; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply_with_owner.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply_with_owner.rtm new file mode 100644 index 00000000..f6867a10 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply_with_owner.rtm @@ -0,0 +1,26 @@ +# This transaction manifest creates a new fungible resource with no initial supply and with an owner +# badge + +# ================================================================================================== +# WARNING: If you will be submitting this transaction through the Babylon wallet then you MUST +# remove the "lock_fee" instruction that you see below. Otherwise your transaction will fail. If all +# that you are using is resim then you can safely ignore this warning. +# ================================================================================================== + +# Locking 10 XRD in fees from the account component. +CALL_METHOD + ComponentAddress("${account_component_address}") + "lock_fee" + Decimal("10"); + +# Creating a new resource with a divisibility of 18 and a name of `MyResource`. This resource has +# the default set of behaviors associated with owner badges. +CREATE_FUNGIBLE_RESOURCE_WITH_OWNER + 18u8 + Map( + "name", "MyResource", # Resource Name + "symbol", "RSRC", # Resource Symbol + "description", "A very innovative and important resource" # Resource Description + ) + NonFungibleGlobalId("${owner_badge_resource_address}:${owner_badge_non_fungible_local_id}") + None; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply.rtm new file mode 100644 index 00000000..cbb643d6 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply.rtm @@ -0,0 +1,62 @@ +# 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 + ComponentAddress("${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")) + ) + Some(Decimal("${initial_supply}")); + +# Depositing the entirety of the initial supply of the newly created resource into our account +# component. +CALL_METHOD + ComponentAddress("${account_component_address}") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply_with_owner.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply_with_owner.rtm new file mode 100644 index 00000000..f3d2bf37 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply_with_owner.rtm @@ -0,0 +1,33 @@ +# This transaction manifest creates a new fungible resource with initial supply and with an owner +# badge + +# ================================================================================================== +# WARNING: If you will be submitting this transaction through the Babylon wallet then you MUST +# remove the "lock_fee" instruction that you see below. Otherwise your transaction will fail. If all +# that you are using is resim then you can safely ignore this warning. +# ================================================================================================== + +# Locking 10 XRD in fees from the account component. +CALL_METHOD + ComponentAddress("${account_component_address}") + "lock_fee" + Decimal("10"); + +# Creating a new resource with a divisibility of 18 and a name of `MyResource`. This resource has +# the default set of behaviors associated with owner badges. +CREATE_FUNGIBLE_RESOURCE_WITH_OWNER + 18u8 + Map( + "name", "MyResource", # Resource Name + "symbol", "RSRC", # Resource Symbol + "description", "A very innovative and important resource" # Resource Description + ) + NonFungibleGlobalId("${owner_badge_resource_address}:${owner_badge_non_fungible_local_id}") + Some(Decimal("${initial_supply}")); + +# Depositing the entirety of the initial supply of the newly created resource into our account +# component. +CALL_METHOD + ComponentAddress("${account_component_address}") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply.rtm new file mode 100644 index 00000000..5eec51bb --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply.rtm @@ -0,0 +1,53 @@ +# 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 + ComponentAddress("${account_component_address}") + "lock_fee" + Decimal("10"); + +# Creating a new resource +CREATE_NON_FUNGIBLE_RESOURCE + Enum("NonFungibleIdType::Integer") + 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")) + ) + None; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply_with_owner.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply_with_owner.rtm new file mode 100644 index 00000000..51a290f1 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply_with_owner.rtm @@ -0,0 +1,24 @@ +# This transaction manifest creates a new non-fungible resource with no initial supply and with an +# owner badge + +# ================================================================================================== +# WARNING: If you will be submitting this transaction through the Babylon wallet then you MUST +# remove the "lock_fee" instruction that you see below. Otherwise your transaction will fail. If all +# that you are using is resim then you can safely ignore this warning. +# ================================================================================================== + +# Locking 10 XRD in fees from the account component. +CALL_METHOD + ComponentAddress("${account_component_address}") + "lock_fee" + Decimal("10"); + +# Creating a new resource +CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER + Enum("NonFungibleIdType::Integer") + Map( + "name", "MyResource", # Resource Name + "description", "A very innovative and important resource" # Resource Description + ) + NonFungibleGlobalId("${owner_badge_resource_address}:${owner_badge_non_fungible_local_id}") + None; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply.rtm new file mode 100644 index 00000000..0c4b2cec --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply.rtm @@ -0,0 +1,68 @@ +# 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 + ComponentAddress("${account_component_address}") + "lock_fee" + Decimal("10"); + +# Creating a new resource +CREATE_NON_FUNGIBLE_RESOURCE + Enum("NonFungibleIdType::Integer") + 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")) + ) + Some( + Map( + NonFungibleLocalId("${non_fungible_local_id}"), + Tuple( + Tuple("Hello World", Decimal("12")), # The immutable part of the data + Tuple(12u8, 19u128) # The mutable part of the data + ) + ) + ); + +# Depositing the entirety of the initial supply of the newly created resource into our account +# component. +CALL_METHOD + ComponentAddress("${account_component_address}") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply_with_owner.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply_with_owner.rtm new file mode 100644 index 00000000..25d278ac --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply_with_owner.rtm @@ -0,0 +1,39 @@ +# This transaction manifest creates a new non-fungible resource with initial supply and with an +# owner badge + +# ================================================================================================== +# WARNING: If you will be submitting this transaction through the Babylon wallet then you MUST +# remove the "lock_fee" instruction that you see below. Otherwise your transaction will fail. If all +# that you are using is resim then you can safely ignore this warning. +# ================================================================================================== + +# Locking 10 XRD in fees from the account component. +CALL_METHOD + ComponentAddress("${account_component_address}") + "lock_fee" + Decimal("10"); + +# Creating a new resource +CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER + Enum("NonFungibleIdType::Integer") + Map( + "name", "MyResource", # Resource Name + "description", "A very innovative and important resource" # Resource Description + ) + NonFungibleGlobalId("${owner_badge_resource_address}:${owner_badge_non_fungible_local_id}") + Some( + Map( + NonFungibleLocalId("${non_fungible_local_id}"), + Tuple( + Tuple("Hello World", Decimal("12")), # The immutable part of the data + Tuple(12u8, 19u128) # The mutable part of the data + ) + ) + ); + +# Depositing the entirety of the initial supply of the newly created resource into our account +# component. +CALL_METHOD + ComponentAddress("${account_component_address}") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/fungible/mint.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/fungible/mint.rtm new file mode 100644 index 00000000..e294a76f --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/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 + ComponentAddress("${account_component_address}") + "lock_fee" + Decimal("10"); + +# We have a badge in our account component which allows us to mint this resource. So, we create a +# proof from this badge which will allow us to mint the resource +CALL_METHOD + ComponentAddress("${account_component_address}") + "create_proof_by_amount" + Decimal("1") + ResourceAddress("${minter_badge_resource_address}"); + +# Minting some amount of tokens from the mintable fungible resource +MINT_FUNGIBLE + ResourceAddress("${mintable_resource_address}") + Decimal("${mint_amount}"); + +# Depositing the entirety of the newly minted tokens into out account +CALL_METHOD + ComponentAddress("${account_component_address}") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/non_fungible/mint.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/non_fungible/mint.rtm new file mode 100644 index 00000000..776cd418 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/non_fungible/mint.rtm @@ -0,0 +1,45 @@ +# 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 + ComponentAddress("${account_component_address}") + "lock_fee" + Decimal("10"); + +# We have a badge in our account component which allows us to mint this resource. So, we create a +# proof from this badge which will allow us to mint the resource +CALL_METHOD + ComponentAddress("${account_component_address}") + "create_proof_by_amount" + Decimal("1") + ResourceAddress("${minter_badge_resource_address}"); + +# Minting a single non-fungible token from the resource. This non-fungible token has no data (this +# is what the 5c2100 bit means, it's the SBOR representation of an empty struct) and has an id that +# is user specified. +MINT_NON_FUNGIBLE + ResourceAddress("${mintable_resource_address}") + Map( + NonFungibleLocalId("${non_fungible_local_id}"), + Tuple( + Tuple("Hello World", Decimal("12")), # The immutable part of the data + Tuple(12u8, 19u128) # The mutable part of the data + ) + ); + +# Depositing the entirety of the newly minted tokens into out account +CALL_METHOD + ComponentAddress("${account_component_address}") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/recall.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/recall.rtm new file mode 100644 index 00000000..3b9fc3d7 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/recall.rtm @@ -0,0 +1 @@ +RECALL_RESOURCE Bytes("49cd9235ba62b2c217e32e5b4754c08219ef16389761356eaccbf6f6bdbfa44d00000000") Decimal("1.2"); diff --git a/radix-engine-toolkit/tests/test_vector/manifest/worktop.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/worktop.rtm similarity index 100% rename from radix-engine-toolkit/tests/test_vector/manifest/worktop.rtm rename to radix-engine-toolkit/tests/test_vector/manifest/resources/worktop.rtm diff --git a/radix-engine-toolkit/tests/test_vector/manifest/royalty/royalty.rtm b/radix-engine-toolkit/tests/test_vector/manifest/royalty/royalty.rtm new file mode 100644 index 00000000..9f02219d --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/royalty/royalty.rtm @@ -0,0 +1,26 @@ +SET_PACKAGE_ROYALTY_CONFIG + PackageAddress("package_sim1qy4hrp8a9apxldp5cazvxgwdj80cxad4u8cpkaqqnhlsa3lfpe") + Map( + "Blueprint", + Tuple( + Map( + "method", 1u32 + ), + 0u32 + ) + ); + +SET_COMPONENT_ROYALTY_CONFIG + ComponentAddress("component_sim1qg2jwzl3hxnkqye8tfj5v3p2wp7cv9xdcjv4nl63refs785pvt") + Tuple( + Map( + "method", 1u32 + ), + 0u32 + ); + +CLAIM_PACKAGE_ROYALTY + PackageAddress("package_sim1qy4hrp8a9apxldp5cazvxgwdj80cxad4u8cpkaqqnhlsa3lfpe"); + +CLAIM_COMPONENT_ROYALTY + ComponentAddress("component_sim1qg2jwzl3hxnkqye8tfj5v3p2wp7cv9xdcjv4nl63refs785pvt"); \ No newline at end of file diff --git a/schema/src/examples.rs b/schema/src/examples.rs index 145e114c..25eec063 100644 --- a/schema/src/examples.rs +++ b/schema/src/examples.rs @@ -32,7 +32,9 @@ pub fn notarized_intent() -> NotarizedTransaction { TransactionBuilder::new() .manifest( compile( - include_str!("../../radix-engine-toolkit/tests/test_vector/manifest/worktop.rtm"), + include_str!( + "../../radix-engine-toolkit/tests/test_vector/manifest/resources/worktop.rtm" + ), &network_definition(), vec![], ) From c6ebbd2a3dad31886b7424c97ca85bc36177fff8 Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 1 Feb 2023 15:14:49 +0300 Subject: [PATCH 102/110] Fixed instruction tests --- .../tests/test_vector/instruction.rs | 455 ++++++++++++------ 1 file changed, 312 insertions(+), 143 deletions(-) diff --git a/radix-engine-toolkit/tests/test_vector/instruction.rs b/radix-engine-toolkit/tests/test_vector/instruction.rs index 27a2bb14..f797d731 100644 --- a/radix-engine-toolkit/tests/test_vector/instruction.rs +++ b/radix-engine-toolkit/tests/test_vector/instruction.rs @@ -19,7 +19,14 @@ #![macro_use] extern crate lazy_static; -use native_transaction::manifest::lexer::tokenize; +use native_transaction::{ + manifest::{ + ast, + generator::{generate_instruction, NameResolver}, + lexer::tokenize, + }, + validation::{ManifestIdValidator, ProofKind}, +}; use radix_engine_toolkit::{model::*, EnumDiscriminator}; use scrypto::prelude::{NonFungibleLocalId, *}; @@ -42,14 +49,69 @@ impl InstructionRepresentationTestVector { } } - pub fn manifest_representation_as_ast_instruction( - &self, - ) -> native_transaction::manifest::ast::Instruction { - native_transaction::manifest::parser::Parser::new( + pub fn manifest_representation_as_ast_instruction(&self) -> ast::Instruction { + let ast_instruction = native_transaction::manifest::parser::Parser::new( tokenize(&self.manifest_representation).expect("Failed to tokenize trusted value"), ) .parse_instruction() - .expect("Failed to parse trusted value to ast value") + .expect("Failed to parse trusted value to ast value"); + + // Compiling the AST instruction - this is done to ensure that the manifest representation + // in the test vector actually compiles since the AST is unstructured. + { + let bech32_coder = Bech32Coder::new(0xf2); + let mut id_validator = ManifestIdValidator::new(); + let mut name_resolver = NameResolver::new(); + let blobs = [( + "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b" + .parse() + .unwrap(), + [10].into(), + )] + .into(); + + match ast_instruction { + ast::Instruction::ReturnToWorktop { ref bucket } + | ast::Instruction::BurnResource { ref bucket } + | ast::Instruction::CreateAccessController { + controlled_asset: ref bucket, + .. + } => { + if let ast::Value::Bucket(bucket_name) = bucket { + if let ast::Value::String(bucket_name) = &**bucket_name { + let bucket_id = id_validator.new_bucket().unwrap(); + name_resolver + .insert_bucket(bucket_name.to_owned(), bucket_id) + .unwrap(); + } + } + } + ast::Instruction::PushToAuthZone { ref proof } + | ast::Instruction::CloneProof { ref proof, .. } + | ast::Instruction::DropProof { ref proof, .. } => { + if let ast::Value::Proof(proof_name) = proof { + if let ast::Value::String(proof_name) = &**proof_name { + let proof_id = id_validator.new_proof(ProofKind::VirtualProof).unwrap(); + name_resolver + .insert_proof(proof_name.to_owned(), proof_id) + .unwrap(); + } + } + } + _ => {} + } + + generate_instruction( + &ast_instruction, + &mut id_validator, + &mut name_resolver, + bech32_coder.decoder(), + &blobs, + ) + .expect(format!("failed to compile instruction: {:?}", ast_instruction).as_str()); + } + + ast_instruction } } @@ -148,7 +210,7 @@ lazy_static::lazy_static! { }, }, into_bucket: Value::Bucket { - identifier: BucketId(TransientIdentifier::U32 { value: 1 }), + identifier: BucketId(TransientIdentifier::String { value: "ident".into() }), }, }, r#" @@ -161,8 +223,8 @@ lazy_static::lazy_static! { "into_bucket": { "type": "Bucket", "identifier": { - "type": "U32", - "value": "1" + "type": "String", + "value": "ident" } } } @@ -170,7 +232,7 @@ lazy_static::lazy_static! { r#" TAKE_FROM_WORKTOP ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - Bucket(1u32); + Bucket("ident"); "#, ), InstructionRepresentationTestVector::new( @@ -185,7 +247,7 @@ lazy_static::lazy_static! { value: "1".parse().unwrap(), }, into_bucket: Value::Bucket { - identifier: BucketId(TransientIdentifier::U32 { value: 1 }), + identifier: BucketId(TransientIdentifier::String { value: "ident".into() }), }, }, r#" @@ -202,8 +264,8 @@ lazy_static::lazy_static! { "into_bucket": { "type": "Bucket", "identifier": { - "type": "U32", - "value": "1" + "type": "String", + "value": "ident" } } } @@ -212,7 +274,7 @@ lazy_static::lazy_static! { TAKE_FROM_WORKTOP_BY_AMOUNT Decimal("1") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - Bucket(1u32); + Bucket("ident"); "#, ), InstructionRepresentationTestVector::new( @@ -227,7 +289,7 @@ lazy_static::lazy_static! { value: scrypto::prelude::NonFungibleLocalId::Integer(1), }], into_bucket: Value::Bucket { - identifier: BucketId(TransientIdentifier::U32 { value: 1 }), + identifier: BucketId(TransientIdentifier::String { value: "ident".into() }), }, }, r#" @@ -249,8 +311,8 @@ lazy_static::lazy_static! { "into_bucket": { "type": "Bucket", "identifier": { - "type": "U32", - "value": "1" + "type": "String", + "value": "ident" } } } @@ -259,13 +321,13 @@ lazy_static::lazy_static! { TAKE_FROM_WORKTOP_BY_IDS Array(NonFungibleLocalId("#1#")) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - Bucket(1u32); + Bucket("ident"); "##, ), InstructionRepresentationTestVector::new( Instruction::ReturnToWorktop { bucket: Value::Bucket { - identifier: BucketId(TransientIdentifier::U32 { value: 1 }), + identifier: BucketId(TransientIdentifier::String { value: "ident".into() }), }, }, r#" @@ -274,15 +336,15 @@ lazy_static::lazy_static! { "bucket": { "type": "Bucket", "identifier": { - "type": "U32", - "value": "1" + "type": "String", + "value": "ident" } } } "#, r##" RETURN_TO_WORKTOP - Bucket(1u32); + Bucket("ident"); "##, ), InstructionRepresentationTestVector::new( @@ -378,7 +440,7 @@ lazy_static::lazy_static! { InstructionRepresentationTestVector::new( Instruction::PopFromAuthZone { into_proof: Value::Proof { - identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), }, }, r#" @@ -387,21 +449,21 @@ lazy_static::lazy_static! { "into_proof": { "type": "Proof", "identifier": { - "type": "U32", - "value": "1" + "type": "String", + "value": "ident" } } } "#, r##" POP_FROM_AUTH_ZONE - Proof(1u32); + Proof("ident"); "##, ), InstructionRepresentationTestVector::new( Instruction::PushToAuthZone { proof: Value::Proof { - identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), }, }, r#" @@ -410,15 +472,15 @@ lazy_static::lazy_static! { "proof": { "type": "Proof", "identifier": { - "type": "U32", - "value": "1" + "type": "String", + "value": "ident" } } } "#, r##" PUSH_TO_AUTH_ZONE - Proof(1u32); + Proof("ident"); "##, ), InstructionRepresentationTestVector::new( @@ -441,7 +503,7 @@ lazy_static::lazy_static! { }, }, into_proof: Value::Proof { - identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), }, }, r#" @@ -454,8 +516,8 @@ lazy_static::lazy_static! { "into_proof": { "type": "Proof", "identifier": { - "type": "U32", - "value": "1" + "type": "String", + "value": "ident" } } } @@ -463,7 +525,7 @@ lazy_static::lazy_static! { r#" CREATE_PROOF_FROM_AUTH_ZONE ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - Proof(1u32); + Proof("ident"); "#, ), InstructionRepresentationTestVector::new( @@ -478,7 +540,7 @@ lazy_static::lazy_static! { value: "1".parse().unwrap(), }, into_proof: Value::Proof { - identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), }, }, r#" @@ -495,8 +557,8 @@ lazy_static::lazy_static! { "into_proof": { "type": "Proof", "identifier": { - "type": "U32", - "value": "1" + "type": "String", + "value": "ident" } } } @@ -505,7 +567,7 @@ lazy_static::lazy_static! { CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT Decimal("1") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - Proof(1u32); + Proof("ident"); "#, ), InstructionRepresentationTestVector::new( @@ -520,7 +582,7 @@ lazy_static::lazy_static! { value: scrypto::prelude::NonFungibleLocalId::Integer(1), }], into_proof: Value::Proof { - identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), }, }, r#" @@ -542,8 +604,8 @@ lazy_static::lazy_static! { "into_proof": { "type": "Proof", "identifier": { - "type": "U32", - "value": "1" + "type": "String", + "value": "ident" } } } @@ -552,16 +614,16 @@ lazy_static::lazy_static! { CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS Array(NonFungibleLocalId("#1#")) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - Proof(1u32); + Proof("ident"); "##, ), InstructionRepresentationTestVector::new( Instruction::CloneProof { proof: Value::Proof { - identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), }, into_proof: Value::Proof { - identifier: ProofId(TransientIdentifier::U32 { value: 2 }), + identifier: ProofId(TransientIdentifier::String { value: "ident2".into() }), }, }, r#" @@ -570,29 +632,29 @@ lazy_static::lazy_static! { "proof": { "type": "Proof", "identifier": { - "type": "U32", - "value": "1" + "type": "String", + "value": "ident" } }, "into_proof": { "type": "Proof", "identifier": { - "type": "U32", - "value": "2" + "type": "String", + "value": "ident2" } } } "#, r##" CLONE_PROOF - Proof(1u32) - Proof(2u32); + Proof("ident") + Proof("ident2"); "##, ), InstructionRepresentationTestVector::new( Instruction::DropProof { proof: Value::Proof { - identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), }, }, r#" @@ -601,15 +663,15 @@ lazy_static::lazy_static! { "proof": { "type": "Proof", "identifier": { - "type": "U32", - "value": "1" + "type": "String", + "value": "ident" } } } "#, r##" DROP_PROOF - Proof(1u32); + Proof("ident"); "##, ), InstructionRepresentationTestVector::new( @@ -627,14 +689,14 @@ lazy_static::lazy_static! { Instruction::PublishPackage { code: Value::Blob { hash: Hash::from_str( - "36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618", + "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", ) .map(ManifestBlobRef) .unwrap(), }, abi: Value::Blob { hash: Hash::from_str( - "15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d", + "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", ) .map(ManifestBlobRef) .unwrap(), @@ -649,21 +711,18 @@ lazy_static::lazy_static! { value_value_kind: ValueKind::String, entries: Vec::new(), }, - access_rules: Value::Enum { - variant: EnumDiscriminator::U8 { discriminator: 0 }, - fields: None, - }, + access_rules: Value::decode(scrypto_encode(&AccessRules::new()).unwrap(), 0xf2).unwrap(), }, r#" { "instruction": "PUBLISH_PACKAGE", "code": { "type": "Blob", - "hash": "36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618" + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b" }, "abi": { "type": "Blob", - "hash": "15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d" + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b" }, "royalty_config": { "type": "Map", @@ -678,35 +737,78 @@ lazy_static::lazy_static! { "entries": [] }, "access_rules": { - "type": "Enum", - "variant": { - "type": "U8", - "discriminator": "0" - } + "type": "Tuple", + "elements": [ + { + "type": "Map", + "key_value_kind": "Enum", + "value_value_kind": "Enum", + "entries": [] + }, + { + "type": "Map", + "key_value_kind": "String", + "value_value_kind": "Enum", + "entries": [] + }, + { + "type": "Enum", + "variant": { + "type": "U8", + "discriminator": "1" + } + }, + { + "type": "Map", + "key_value_kind": "Enum", + "value_value_kind": "Enum", + "entries": [] + }, + { + "type": "Map", + "key_value_kind": "String", + "value_value_kind": "Enum", + "entries": [] + }, + { + "type": "Enum", + "variant": { + "type": "U8", + "discriminator": "1" + } + } + ] } } "#, r##" PUBLISH_PACKAGE - Blob("36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618") - Blob("15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d") + Blob("01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b") + Blob("01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b") Map() Map() - Enum(0u8); + Tuple( + Map(), + Map(), + Enum("AccessRule::DenyAll"), + Map(), + Map(), + Enum("AccessRule::DenyAll") + ); "##, ), InstructionRepresentationTestVector::new( Instruction::PublishPackageWithOwner { code: Value::Blob { hash: Hash::from_str( - "36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618", + "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", ) .map(ManifestBlobRef) .unwrap(), }, abi: Value::Blob { hash: Hash::from_str( - "15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d", + "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", ) .map(ManifestBlobRef) .unwrap(), @@ -726,11 +828,11 @@ lazy_static::lazy_static! { "instruction": "PUBLISH_PACKAGE_WITH_OWNER", "code": { "type": "Blob", - "hash": "36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618" + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b" }, "abi": { "type": "Blob", - "hash": "15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d" + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b" }, "owner_badge": { "type": "NonFungibleGlobalId", @@ -750,15 +852,15 @@ lazy_static::lazy_static! { "#, r##" PUBLISH_PACKAGE_WITH_OWNER - Blob("36dae540b7889956f1f1d8d46ba23e5e44bf5723aef2a8e6b698686c02583618") - Blob("15e8699a6d63a96f66f6feeb609549be2688b96b02119f260ae6dfd012d16a5d") + Blob("01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b") + Blob("01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b") NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:#1#"); "##, ), InstructionRepresentationTestVector::new( Instruction::BurnResource { bucket: Value::Bucket { - identifier: BucketId(TransientIdentifier::U32 { value: 1 }), + identifier: BucketId(TransientIdentifier::String { value: "ident".into() }), }, }, r#" @@ -767,15 +869,15 @@ lazy_static::lazy_static! { "bucket": { "type": "Bucket", "identifier": { - "type": "U32", - "value": "1" + "type": "String", + "value": "ident" } } } "#, r##" BURN_RESOURCE - Bucket(1u32); + Bucket("ident"); "##, ), InstructionRepresentationTestVector::new( @@ -969,10 +1071,15 @@ lazy_static::lazy_static! { address: FAUCET_COMPONENT, }, }, - royalty_config: Value::Map { - key_value_kind: ValueKind::String, - value_value_kind: ValueKind::Tuple, - entries: Vec::new(), + royalty_config: Value::Tuple { + elements: vec![ + Value::Map { + key_value_kind: ValueKind::String, + value_value_kind: ValueKind::U32, + entries: vec![] + }, + Value::U32 { value: 1 } + ] }, }, r#" @@ -983,17 +1090,29 @@ lazy_static::lazy_static! { "address": "component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr" }, "royalty_config": { - "type": "Map", - "key_value_kind": "String", - "value_value_kind": "Tuple", - "entries": [] + "type": "Tuple", + "elements": [ + { + "type": "Map", + "key_value_kind": "String", + "value_value_kind": "U32", + "entries": [] + }, + { + "type": "U32", + "value": "1" + } + ] } } "#, r##" SET_COMPONENT_ROYALTY_CONFIG ComponentAddress("component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr") - Map(); + Tuple( + Map(), + 1u32 + ); "##, ), InstructionRepresentationTestVector::new( @@ -1050,9 +1169,16 @@ lazy_static::lazy_static! { address: FAUCET_COMPONENT, }, }, - index: Value::U8 { value: 0 }, - key: Value::String { - value: "get_token".into(), + index: Value::U32 { value: 0 }, + key: Value::Enum { + variant: EnumDiscriminator::U8 { + discriminator: 0 + }, + fields: Some(vec![ + Value::String { + value: "get_token".into() + } + ]) }, rule: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, @@ -1067,12 +1193,21 @@ lazy_static::lazy_static! { "address": "component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr" }, "index": { - "type": "U8", + "type": "U32", "value": "0" }, "key": { - "type": "String", - "value": "get_token" + "type": "Enum", + "variant": { + "type": "U8", + "discriminator": "0" + }, + "fields": [ + { + "type": "String", + "value": "get_token" + } + ] }, "rule": { "type": "Enum", @@ -1086,18 +1221,22 @@ lazy_static::lazy_static! { r##" SET_METHOD_ACCESS_RULE ComponentAddress("component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr") - 0u8 - "get_token" + 0u32 + Enum(0u8, "get_token") Enum(0u8); "##, ), InstructionRepresentationTestVector::new( Instruction::MintFungible { - resource_address: Value::ResourceAddress { address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - } }, - amount: Value::Decimal { value: "1".parse().unwrap() } + resource_address: Value::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, + amount: Value::Decimal { + value: "1".parse().unwrap(), + }, }, r#" { @@ -1120,15 +1259,17 @@ lazy_static::lazy_static! { ), InstructionRepresentationTestVector::new( Instruction::MintNonFungible { - resource_address: Value::ResourceAddress { address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - } }, + resource_address: Value::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, entries: Value::Map { key_value_kind: ValueKind::NonFungibleLocalId, value_value_kind: ValueKind::Tuple, - entries: Vec::new() - } + entries: Vec::new(), + }, }, r#" { @@ -1157,14 +1298,14 @@ lazy_static::lazy_static! { metadata: Value::Map { key_value_kind: ValueKind::String, value_value_kind: ValueKind::String, - entries: Vec::new() + entries: Vec::new(), }, access_rules: Value::Map { - key_value_kind: ValueKind::String, - value_value_kind: ValueKind::Enum, - entries: Vec::new() + key_value_kind: ValueKind::Enum, + value_value_kind: ValueKind::Tuple, + entries: Vec::new(), }, - initial_supply: Value::None + initial_supply: Value::None, }, r#" { @@ -1181,8 +1322,8 @@ lazy_static::lazy_static! { }, "access_rules": { "type": "Map", - "key_value_kind": "String", - "value_value_kind": "Enum", + "key_value_kind": "Enum", + "value_value_kind": "Tuple", "entries": [] }, "initial_supply": { @@ -1194,7 +1335,7 @@ lazy_static::lazy_static! { CREATE_FUNGIBLE_RESOURCE 18u8 Map() - Map() + Map() None; "##, ), @@ -1204,7 +1345,7 @@ lazy_static::lazy_static! { metadata: Value::Map { key_value_kind: ValueKind::String, value_value_kind: ValueKind::String, - entries: Vec::new() + entries: Vec::new(), }, owner_badge: Value::NonFungibleGlobalId { address: radix_engine_toolkit::NonFungibleGlobalId { @@ -1215,7 +1356,7 @@ lazy_static::lazy_static! { non_fungible_local_id: NonFungibleLocalId::Integer(1), }, }, - initial_supply: Value::None + initial_supply: Value::None, }, r#" { @@ -1259,18 +1400,21 @@ lazy_static::lazy_static! { ), InstructionRepresentationTestVector::new( Instruction::CreateNonFungibleResource { - id_type: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, + id_type: Value::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, metadata: Value::Map { key_value_kind: ValueKind::String, value_value_kind: ValueKind::String, - entries: Vec::new() + entries: Vec::new(), }, access_rules: Value::Map { - key_value_kind: ValueKind::String, - value_value_kind: ValueKind::Enum, - entries: Vec::new() + key_value_kind: ValueKind::Enum, + value_value_kind: ValueKind::Tuple, + entries: Vec::new(), }, - initial_supply: Value::None + initial_supply: Value::None, }, r#" { @@ -1290,8 +1434,8 @@ lazy_static::lazy_static! { }, "access_rules": { "type": "Map", - "key_value_kind": "String", - "value_value_kind": "Enum", + "key_value_kind": "Enum", + "value_value_kind": "Tuple", "entries": [] }, "initial_supply": { @@ -1303,17 +1447,20 @@ lazy_static::lazy_static! { CREATE_NON_FUNGIBLE_RESOURCE Enum(0u8) Map() - Map() + Map() None; "##, ), InstructionRepresentationTestVector::new( Instruction::CreateNonFungibleResourceWithOwner { - id_type: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, + id_type: Value::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, metadata: Value::Map { key_value_kind: ValueKind::String, value_value_kind: ValueKind::String, - entries: Vec::new() + entries: Vec::new(), }, owner_badge: Value::NonFungibleGlobalId { address: radix_engine_toolkit::NonFungibleGlobalId { @@ -1324,7 +1471,7 @@ lazy_static::lazy_static! { non_fungible_local_id: NonFungibleLocalId::Integer(1), }, }, - initial_supply: Value::None + initial_supply: Value::None, }, r#" { @@ -1371,11 +1518,24 @@ lazy_static::lazy_static! { ), InstructionRepresentationTestVector::new( Instruction::CreateAccessController { - controlled_asset: Value::Bucket { identifier: BucketId(TransientIdentifier::U32 { value: 1 }) }, - primary_role: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, - recovery_role: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, - confirmation_role: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None }, - timed_recovery_delay_in_minutes: Value::Some { value: Box::new(Value::U8 { value: 1 }) } + controlled_asset: Value::Bucket { + identifier: BucketId(TransientIdentifier::String { value: "ident".into() }), + }, + primary_role: Value::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + recovery_role: Value::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + confirmation_role: Value::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + timed_recovery_delay_in_minutes: Value::Some { + value: Box::new(Value::U32 { value: 1 }), + }, }, r#" { @@ -1383,8 +1543,8 @@ lazy_static::lazy_static! { "controlled_asset": { "type": "Bucket", "identifier": { - "type": "U32", - "value": "1" + "type": "String", + "value": "ident" } }, "primary_role": { @@ -1411,7 +1571,7 @@ lazy_static::lazy_static! { "timed_recovery_delay_in_minutes": { "type": "Some", "value": { - "type": "U8", + "type": "U32", "value": "1" } } @@ -1419,16 +1579,19 @@ lazy_static::lazy_static! { "#, r##" CREATE_ACCESS_CONTROLLER - Bucket(1u32) + Bucket("ident") Enum(0u8) Enum(0u8) Enum(0u8) - Some(1u8); + Some(1u32); "##, ), InstructionRepresentationTestVector::new( Instruction::CreateIdentity { - access_rule: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None } + access_rule: Value::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, }, r#" { @@ -1449,7 +1612,10 @@ lazy_static::lazy_static! { ), InstructionRepresentationTestVector::new( Instruction::AssertAccessRule { - access_rule: Value::Enum { variant: EnumDiscriminator::U8 { discriminator: 0 }, fields: None } + access_rule: Value::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, }, r#" { @@ -1471,7 +1637,10 @@ lazy_static::lazy_static! { InstructionRepresentationTestVector::new( Instruction::CreateValidator { key: Value::EcdsaSecp256k1PublicKey { - public_key: "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798".parse().unwrap() + public_key: + "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + .parse() + .unwrap(), }, }, r#" From 2117ac3061ceaf609331a90f995f0bc0e75eb386 Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 1 Feb 2023 15:40:02 +0300 Subject: [PATCH 103/110] Update to validator-owner-rule-639822 --- radix-engine-toolkit/Cargo.toml | 10 +++--- radix-engine-toolkit/src/model/instruction.rs | 32 ++++++++++++++++--- .../tests/test_vector/instruction.rs | 14 +++++++- schema/Cargo.toml | 10 +++--- 4 files changed, 51 insertions(+), 15 deletions(-) diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index e63cd633..021b268f 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -16,11 +16,11 @@ schemars = { version = "0.8.11", features = ["preserve_order"] } serializable = { path = "../serializable" } # Scrypto dependencies required for the core-toolkit -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620" } +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822" } # Hex is used for the internal hex encoding and decoding of values - serde_with::Hex is used for the # hex representation during serialization. diff --git a/radix-engine-toolkit/src/model/instruction.rs b/radix-engine-toolkit/src/model/instruction.rs index 3eff98c4..e0036a18 100644 --- a/radix-engine-toolkit/src/model/instruction.rs +++ b/radix-engine-toolkit/src/model/instruction.rs @@ -549,6 +549,10 @@ pub enum Instruction { /// The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of /// this is an `EcdsaSecp256k1PublicKey` from the `Value` model. key: Value, + + /// The access rule to protect the validator with. The underlying type of this is an `Enum` + /// from the `Value` model which represents the access rule to assert. + owner_access_rule: Value, }, } @@ -865,8 +869,12 @@ impl Instruction { Self::CreateIdentity { access_rule } => ast::Instruction::CreateIdentity { access_rule: access_rule.to_ast_value(bech32_coder)?, }, - Self::CreateValidator { key } => ast::Instruction::CreateValidator { + 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)?, }, }; Ok(ast_instruction) @@ -1205,8 +1213,12 @@ impl Instruction { bech32_coder, )?, }, - ast::Instruction::CreateValidator { key } => Self::CreateValidator { + ast::Instruction::CreateValidator { + key, + owner_access_rule, + } => Self::CreateValidator { key: Value::from_ast_value(key, bech32_coder)?, + owner_access_rule: Value::from_ast_value(owner_access_rule, bech32_coder)?, }, }; Ok(instruction) @@ -1481,7 +1493,13 @@ impl ValueRef for Instruction { } Self::DropProof { proof } => values.push(proof), - Self::CreateValidator { key } => values.push(key), + Self::CreateValidator { + key, + owner_access_rule, + } => { + values.push(key); + values.push(owner_access_rule); + } Self::DropAllProofs | Self::ClearAuthZone => {} } @@ -1755,7 +1773,13 @@ impl ValueRef for Instruction { } Self::DropProof { proof } => values.push(proof), - Self::CreateValidator { key } => values.push(key), + Self::CreateValidator { + key, + owner_access_rule, + } => { + values.push(key); + values.push(owner_access_rule); + } Self::DropAllProofs | Self::ClearAuthZone => {} } diff --git a/radix-engine-toolkit/tests/test_vector/instruction.rs b/radix-engine-toolkit/tests/test_vector/instruction.rs index f797d731..d0a013e8 100644 --- a/radix-engine-toolkit/tests/test_vector/instruction.rs +++ b/radix-engine-toolkit/tests/test_vector/instruction.rs @@ -1642,6 +1642,10 @@ lazy_static::lazy_static! { .parse() .unwrap(), }, + owner_access_rule: Value::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None + } }, r#" { @@ -1649,12 +1653,20 @@ lazy_static::lazy_static! { "key": { "type": "EcdsaSecp256k1PublicKey", "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "owner_access_rule": { + "type": "Enum", + "variant": { + "type": "U8", + "discriminator": "0" + } } } "#, r##" CREATE_VALIDATOR - EcdsaSecp256k1PublicKey("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"); + EcdsaSecp256k1PublicKey("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798") + Enum(0u8); "##, ), ]; diff --git a/schema/Cargo.toml b/schema/Cargo.toml index 0000790b..48f1a9b3 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -15,8 +15,8 @@ radix-engine-toolkit = { path = "../radix-engine-toolkit" } serde = "1.0.152" convert_case = "0.6.0" -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-5d33b620" } \ No newline at end of file +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822" } \ No newline at end of file From 55810a8b804c63b55b6a609f188733683487bbb5 Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 1 Feb 2023 18:57:49 +0300 Subject: [PATCH 104/110] Update to betanet-v2-1a8cfa1 --- radix-engine-toolkit/Cargo.toml | 10 +++++----- schema/Cargo.toml | 10 +++++----- .../schema/compile_notarized_transaction_request.json | 11 ++++++++++- .../compile_signed_transaction_intent_request.json | 11 ++++++++++- .../schema/compile_transaction_intent_request.json | 11 ++++++++++- schema/out/schema/convert_manifest_request.json | 11 ++++++++++- schema/out/schema/convert_manifest_response.json | 11 ++++++++++- .../decompile_notarized_transaction_response.json | 11 ++++++++++- .../decompile_signed_transaction_intent_response.json | 11 ++++++++++- .../schema/decompile_transaction_intent_response.json | 11 ++++++++++- ...decompile_unknown_transaction_intent_response.json | 11 ++++++++++- 11 files changed, 100 insertions(+), 19 deletions(-) diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index 021b268f..50a9a2e2 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -16,11 +16,11 @@ schemars = { version = "0.8.11", features = ["preserve_order"] } serializable = { path = "../serializable" } # Scrypto dependencies required for the core-toolkit -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822" } +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1" } # Hex is used for the internal hex encoding and decoding of values - serde_with::Hex is used for the # hex representation during serialization. diff --git a/schema/Cargo.toml b/schema/Cargo.toml index 48f1a9b3..ac409a5e 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -15,8 +15,8 @@ radix-engine-toolkit = { path = "../radix-engine-toolkit" } serde = "1.0.152" convert_case = "0.6.0" -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "validator-owner-rule-639822" } \ No newline at end of file +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1" } \ No newline at end of file diff --git a/schema/out/schema/compile_notarized_transaction_request.json b/schema/out/schema/compile_notarized_transaction_request.json index 4c415fab..2266174b 100644 --- a/schema/out/schema/compile_notarized_transaction_request.json +++ b/schema/out/schema/compile_notarized_transaction_request.json @@ -1648,7 +1648,8 @@ "type": "object", "required": [ "instruction", - "key" + "key", + "owner_access_rule" ], "properties": { "instruction": { @@ -1664,6 +1665,14 @@ "$ref": "#/definitions/Value" } ] + }, + "owner_access_rule": { + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } } diff --git a/schema/out/schema/compile_signed_transaction_intent_request.json b/schema/out/schema/compile_signed_transaction_intent_request.json index 21ab9639..f41d7032 100644 --- a/schema/out/schema/compile_signed_transaction_intent_request.json +++ b/schema/out/schema/compile_signed_transaction_intent_request.json @@ -1622,7 +1622,8 @@ "type": "object", "required": [ "instruction", - "key" + "key", + "owner_access_rule" ], "properties": { "instruction": { @@ -1638,6 +1639,14 @@ "$ref": "#/definitions/Value" } ] + }, + "owner_access_rule": { + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } } diff --git a/schema/out/schema/compile_transaction_intent_request.json b/schema/out/schema/compile_transaction_intent_request.json index e88fa92e..6c09961a 100644 --- a/schema/out/schema/compile_transaction_intent_request.json +++ b/schema/out/schema/compile_transaction_intent_request.json @@ -1597,7 +1597,8 @@ "type": "object", "required": [ "instruction", - "key" + "key", + "owner_access_rule" ], "properties": { "instruction": { @@ -1613,6 +1614,14 @@ "$ref": "#/definitions/Value" } ] + }, + "owner_access_rule": { + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } } diff --git a/schema/out/schema/convert_manifest_request.json b/schema/out/schema/convert_manifest_request.json index 34d7917b..813a5888 100644 --- a/schema/out/schema/convert_manifest_request.json +++ b/schema/out/schema/convert_manifest_request.json @@ -1505,7 +1505,8 @@ "type": "object", "required": [ "instruction", - "key" + "key", + "owner_access_rule" ], "properties": { "instruction": { @@ -1521,6 +1522,14 @@ "$ref": "#/definitions/Value" } ] + }, + "owner_access_rule": { + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } } diff --git a/schema/out/schema/convert_manifest_response.json b/schema/out/schema/convert_manifest_response.json index 62569eeb..d3cbfe97 100644 --- a/schema/out/schema/convert_manifest_response.json +++ b/schema/out/schema/convert_manifest_response.json @@ -1465,7 +1465,8 @@ "type": "object", "required": [ "instruction", - "key" + "key", + "owner_access_rule" ], "properties": { "instruction": { @@ -1481,6 +1482,14 @@ "$ref": "#/definitions/Value" } ] + }, + "owner_access_rule": { + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } } diff --git a/schema/out/schema/decompile_notarized_transaction_response.json b/schema/out/schema/decompile_notarized_transaction_response.json index e2db4c65..2aa978a5 100644 --- a/schema/out/schema/decompile_notarized_transaction_response.json +++ b/schema/out/schema/decompile_notarized_transaction_response.json @@ -1648,7 +1648,8 @@ "type": "object", "required": [ "instruction", - "key" + "key", + "owner_access_rule" ], "properties": { "instruction": { @@ -1664,6 +1665,14 @@ "$ref": "#/definitions/Value" } ] + }, + "owner_access_rule": { + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } } diff --git a/schema/out/schema/decompile_signed_transaction_intent_response.json b/schema/out/schema/decompile_signed_transaction_intent_response.json index 97f95bd5..73e3d849 100644 --- a/schema/out/schema/decompile_signed_transaction_intent_response.json +++ b/schema/out/schema/decompile_signed_transaction_intent_response.json @@ -1622,7 +1622,8 @@ "type": "object", "required": [ "instruction", - "key" + "key", + "owner_access_rule" ], "properties": { "instruction": { @@ -1638,6 +1639,14 @@ "$ref": "#/definitions/Value" } ] + }, + "owner_access_rule": { + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } } diff --git a/schema/out/schema/decompile_transaction_intent_response.json b/schema/out/schema/decompile_transaction_intent_response.json index 6c681d16..1afe7ba3 100644 --- a/schema/out/schema/decompile_transaction_intent_response.json +++ b/schema/out/schema/decompile_transaction_intent_response.json @@ -1597,7 +1597,8 @@ "type": "object", "required": [ "instruction", - "key" + "key", + "owner_access_rule" ], "properties": { "instruction": { @@ -1613,6 +1614,14 @@ "$ref": "#/definitions/Value" } ] + }, + "owner_access_rule": { + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } } diff --git a/schema/out/schema/decompile_unknown_transaction_intent_response.json b/schema/out/schema/decompile_unknown_transaction_intent_response.json index dcc960bc..a71ccd07 100644 --- a/schema/out/schema/decompile_unknown_transaction_intent_response.json +++ b/schema/out/schema/decompile_unknown_transaction_intent_response.json @@ -1656,7 +1656,8 @@ "type": "object", "required": [ "instruction", - "key" + "key", + "owner_access_rule" ], "properties": { "instruction": { @@ -1672,6 +1673,14 @@ "$ref": "#/definitions/Value" } ] + }, + "owner_access_rule": { + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/Value" + } + ] } } } From 1e76d46dd67cbd1c3a6d3119d73205e5e42869ac Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 8 Feb 2023 16:49:33 +0300 Subject: [PATCH 105/110] Switched to visitors for value and instruction --- radix-engine-toolkit/src/error.rs | 7 + radix-engine-toolkit/src/lib.rs | 2 + radix-engine-toolkit/src/model/instruction.rs | 564 +---------- .../src/model/transaction/instruction_list.rs | 23 - .../src/model/transaction/intent.rs | 11 - .../src/model/transaction/manifest.rs | 16 +- .../src/model/transaction/notarized_intent.rs | 12 +- .../src/model/transaction/signed_intent.rs | 12 +- .../request/compile_notarized_transaction.rs | 72 +- .../compile_signed_transaction_intent.rs | 55 +- .../src/request/compile_transaction_intent.rs | 55 +- .../src/request/convert_manifest.rs | 84 +- .../src/request/decode_address.rs | 4 +- .../decompile_notarized_transaction.rs | 45 +- .../decompile_signed_transaction_intent.rs | 40 +- .../request/decompile_transaction_intent.rs | 40 +- .../src/request/decompile_unknown_intent.rs | 109 ++- ..._non_fungible_global_id_from_public_key.rs | 32 +- .../request/derive_virtual_account_address.rs | 4 +- .../derive_virtual_identity_address.rs | 4 +- .../src/request/encode_address.rs | 5 +- .../src/request/information.rs | 7 +- .../src/request/known_entity_addresses.rs | 4 +- .../src/request/sbor_decode.rs | 27 +- .../src/request/sbor_encode.rs | 26 +- .../statically_validate_transaction.rs | 4 +- radix-engine-toolkit/src/request/traits.rs | 4 +- radix-engine-toolkit/src/traits.rs | 10 - .../instruction/instruction_visitor.rs | 791 +++++++++++++++ .../src/visitor/instruction/mod.rs | 3 + radix-engine-toolkit/src/visitor/mod.rs | 5 + .../src/visitor/value/aliasing_visitor.rs | 59 ++ radix-engine-toolkit/src/visitor/value/mod.rs | 7 + .../value/network_aggregator_visitor.rs | 55 ++ .../src/visitor/value/value_visitor.rs | 219 +++++ radix-engine-toolkit/tests/aliasing.rs | 101 ++ schema/out/examples/request-examples.md | 40 +- ...le_global_id_from_public_key_response.json | 909 ++---------------- 38 files changed, 1691 insertions(+), 1776 deletions(-) create mode 100644 radix-engine-toolkit/src/visitor/instruction/instruction_visitor.rs create mode 100644 radix-engine-toolkit/src/visitor/instruction/mod.rs create mode 100644 radix-engine-toolkit/src/visitor/mod.rs create mode 100644 radix-engine-toolkit/src/visitor/value/aliasing_visitor.rs create mode 100644 radix-engine-toolkit/src/visitor/value/mod.rs create mode 100644 radix-engine-toolkit/src/visitor/value/network_aggregator_visitor.rs create mode 100644 radix-engine-toolkit/src/visitor/value/value_visitor.rs create mode 100644 radix-engine-toolkit/tests/aliasing.rs diff --git a/radix-engine-toolkit/src/error.rs b/radix-engine-toolkit/src/error.rs index a69923bb..340732aa 100644 --- a/radix-engine-toolkit/src/error.rs +++ b/radix-engine-toolkit/src/error.rs @@ -156,6 +156,13 @@ pub enum Error { 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, + }, } impl Display for Error { diff --git a/radix-engine-toolkit/src/lib.rs b/radix-engine-toolkit/src/lib.rs index dd698bb9..5c38e0e3 100644 --- a/radix-engine-toolkit/src/lib.rs +++ b/radix-engine-toolkit/src/lib.rs @@ -22,6 +22,7 @@ pub mod model; pub mod request; pub mod traits; pub mod utils; +pub mod visitor; pub use buffer::*; pub use enum_discriminator::*; @@ -30,3 +31,4 @@ pub use model::*; pub use request::*; pub use traits::*; pub use utils::*; +pub use visitor::*; diff --git a/radix-engine-toolkit/src/model/instruction.rs b/radix-engine-toolkit/src/model/instruction.rs index e0036a18..b7fd7e38 100644 --- a/radix-engine-toolkit/src/model/instruction.rs +++ b/radix-engine-toolkit/src/model/instruction.rs @@ -19,7 +19,7 @@ use std::collections::HashSet; use crate::address::Bech32Coder; use crate::error::Result; -use crate::{Value, ValueRef}; +use crate::Value; use native_transaction::manifest::ast; @@ -1224,565 +1224,3 @@ impl Instruction { Ok(instruction) } } - -impl ValueRef for Instruction { - /// Mutably borrow all [`Value`]s that make up the instructions - fn borrow_values_mut(&mut self) -> Vec<&mut Value> { - let mut values = Vec::new(); - match self { - Self::CallFunction { - package_address, - blueprint_name, - function_name, - arguments, - } => { - values.push(package_address); - values.push(blueprint_name); - values.push(function_name); - if let Some(arguments) = arguments { - values.extend(arguments) - } - } - Self::CallMethod { - component_address, - method_name, - arguments, - } => { - values.push(component_address); - values.push(method_name); - if let Some(arguments) = arguments { - values.extend(arguments) - } - } - - Self::TakeFromWorktop { - resource_address, - into_bucket, - } => { - values.push(resource_address); - values.push(into_bucket) - } - Self::TakeFromWorktopByAmount { - resource_address, - amount, - into_bucket, - } => { - values.push(resource_address); - values.push(amount); - values.push(into_bucket) - } - Self::TakeFromWorktopByIds { - resource_address, - ids, - into_bucket, - } => { - values.push(resource_address); - values.push(into_bucket); - values.extend(ids); - } - - Self::ReturnToWorktop { bucket } => values.push(bucket), - - Self::AssertWorktopContains { resource_address } => values.push(resource_address), - Self::AssertWorktopContainsByAmount { - resource_address, - amount, - } => { - values.push(resource_address); - values.push(amount); - } - Self::AssertWorktopContainsByIds { - resource_address, - ids, - } => { - values.push(resource_address); - values.extend(ids) - } - - Self::PopFromAuthZone { into_proof } => values.push(into_proof), - Self::PushToAuthZone { proof } => values.push(proof), - - Self::CreateProofFromAuthZone { - resource_address, - into_proof, - } => { - values.push(resource_address); - values.push(into_proof); - } - Self::CreateProofFromAuthZoneByAmount { - resource_address, - amount, - into_proof, - } => { - values.push(resource_address); - values.push(amount); - values.push(into_proof); - } - Self::CreateProofFromAuthZoneByIds { - resource_address, - ids, - into_proof, - } => { - values.push(resource_address); - values.push(into_proof); - values.extend(ids); - } - - Self::CreateProofFromBucket { bucket, into_proof } => { - values.push(bucket); - values.push(into_proof); - } - - Self::CloneProof { proof, into_proof } => { - values.push(proof); - values.push(into_proof); - } - - Self::PublishPackage { - code, - abi, - royalty_config, - metadata, - access_rules, - } => { - values.push(code); - values.push(abi); - values.push(royalty_config); - values.push(metadata); - values.push(access_rules); - } - - Self::PublishPackageWithOwner { - code, - abi, - owner_badge, - } => { - values.push(code); - values.push(abi); - values.push(owner_badge); - } - - Self::BurnResource { bucket } => values.push(bucket), - Self::RecallResource { vault_id, amount } => { - values.push(vault_id); - values.push(amount); - } - - Self::SetMetadata { - entity_address, - key, - value, - } => { - values.push(entity_address); - values.push(key); - values.push(value) - } - - Self::SetPackageRoyaltyConfig { - package_address, - royalty_config, - } => { - values.push(package_address); - values.push(royalty_config); - } - - Self::SetComponentRoyaltyConfig { - component_address, - royalty_config, - } => { - values.push(component_address); - values.push(royalty_config); - } - - Self::ClaimPackageRoyalty { package_address } => values.push(package_address), - Self::ClaimComponentRoyalty { component_address } => values.push(component_address), - - Self::SetMethodAccessRule { - entity_address, - index, - key, - rule, - } => { - values.push(entity_address); - values.push(index); - values.push(key); - values.push(rule); - } - - Self::MintFungible { - resource_address, - amount, - } => { - values.push(resource_address); - values.push(amount); - } - Self::MintNonFungible { - resource_address, - entries, - } => { - values.push(resource_address); - values.push(entries); - } - Self::MintUuidNonFungible { - resource_address, - entries, - } => { - values.push(resource_address); - values.push(entries); - } - - Self::CreateFungibleResource { - divisibility, - metadata, - access_rules, - initial_supply, - } => { - values.push(divisibility); - values.push(metadata); - values.push(access_rules); - values.push(initial_supply); - } - Self::CreateFungibleResourceWithOwner { - divisibility, - metadata, - owner_badge, - initial_supply, - } => { - values.push(divisibility); - values.push(metadata); - values.push(owner_badge); - values.push(initial_supply); - } - Self::CreateNonFungibleResource { - id_type, - metadata, - access_rules, - initial_supply, - } => { - values.push(id_type); - values.push(metadata); - values.push(access_rules); - values.push(initial_supply); - } - Self::CreateNonFungibleResourceWithOwner { - id_type, - metadata, - owner_badge, - initial_supply, - } => { - values.push(id_type); - values.push(metadata); - values.push(owner_badge); - values.push(initial_supply); - } - - Self::AssertAccessRule { access_rule } => values.push(access_rule), - Self::CreateIdentity { access_rule } => values.push(access_rule), - Self::CreateAccessController { - controlled_asset, - primary_role, - recovery_role, - confirmation_role, - timed_recovery_delay_in_minutes, - } => { - values.push(controlled_asset); - values.push(primary_role); - values.push(recovery_role); - values.push(confirmation_role); - values.push(timed_recovery_delay_in_minutes); - } - - Self::DropProof { proof } => values.push(proof), - Self::CreateValidator { - key, - owner_access_rule, - } => { - values.push(key); - values.push(owner_access_rule); - } - - Self::DropAllProofs | Self::ClearAuthZone => {} - } - values - } - - /// Immutably borrow all [`Value`]s that make up the instructions - fn borrow_values(&self) -> Vec<&Value> { - let mut values = Vec::new(); - match self { - Self::CallFunction { - package_address, - blueprint_name, - function_name, - arguments, - } => { - values.push(package_address); - values.push(blueprint_name); - values.push(function_name); - if let Some(arguments) = arguments { - values.extend(arguments) - } - } - Self::CallMethod { - component_address, - method_name, - arguments, - } => { - values.push(component_address); - values.push(method_name); - if let Some(arguments) = arguments { - values.extend(arguments) - } - } - - Self::TakeFromWorktop { - resource_address, - into_bucket, - } => { - values.push(resource_address); - values.push(into_bucket) - } - Self::TakeFromWorktopByAmount { - resource_address, - amount, - into_bucket, - } => { - values.push(resource_address); - values.push(amount); - values.push(into_bucket) - } - Self::TakeFromWorktopByIds { - resource_address, - ids, - into_bucket, - } => { - values.push(resource_address); - values.push(into_bucket); - values.extend(ids); - } - - Self::ReturnToWorktop { bucket } => values.push(bucket), - - Self::AssertWorktopContains { resource_address } => values.push(resource_address), - Self::AssertWorktopContainsByAmount { - resource_address, - amount, - } => { - values.push(resource_address); - values.push(amount); - } - Self::AssertWorktopContainsByIds { - resource_address, - ids, - } => { - values.push(resource_address); - values.extend(ids) - } - - Self::PopFromAuthZone { into_proof } => values.push(into_proof), - Self::PushToAuthZone { proof } => values.push(proof), - - Self::CreateProofFromAuthZone { - resource_address, - into_proof, - } => { - values.push(resource_address); - values.push(into_proof); - } - Self::CreateProofFromAuthZoneByAmount { - resource_address, - amount, - into_proof, - } => { - values.push(resource_address); - values.push(amount); - values.push(into_proof); - } - Self::CreateProofFromAuthZoneByIds { - resource_address, - ids, - into_proof, - } => { - values.push(resource_address); - values.push(into_proof); - values.extend(ids); - } - - Self::CreateProofFromBucket { bucket, into_proof } => { - values.push(bucket); - values.push(into_proof); - } - - Self::CloneProof { proof, into_proof } => { - values.push(proof); - values.push(into_proof); - } - - Self::PublishPackage { - code, - abi, - royalty_config, - metadata, - access_rules, - } => { - values.push(code); - values.push(abi); - values.push(royalty_config); - values.push(metadata); - values.push(access_rules); - } - - Self::PublishPackageWithOwner { - code, - abi, - owner_badge, - } => { - values.push(code); - values.push(abi); - values.push(owner_badge); - } - - Self::BurnResource { bucket } => values.push(bucket), - Self::RecallResource { vault_id, amount } => { - values.push(vault_id); - values.push(amount); - } - - Self::SetMetadata { - entity_address, - key, - value, - } => { - values.push(entity_address); - values.push(key); - values.push(value) - } - - Self::SetPackageRoyaltyConfig { - package_address, - royalty_config, - } => { - values.push(package_address); - values.push(royalty_config); - } - - Self::SetComponentRoyaltyConfig { - component_address, - royalty_config, - } => { - values.push(component_address); - values.push(royalty_config); - } - - Self::ClaimPackageRoyalty { package_address } => values.push(package_address), - Self::ClaimComponentRoyalty { component_address } => values.push(component_address), - - Self::SetMethodAccessRule { - entity_address, - index, - key, - rule, - } => { - values.push(entity_address); - values.push(index); - values.push(key); - values.push(rule); - } - - Self::MintFungible { - resource_address, - amount, - } => { - values.push(resource_address); - values.push(amount); - } - Self::MintNonFungible { - resource_address, - entries, - } => { - values.push(resource_address); - values.push(entries); - } - Self::MintUuidNonFungible { - resource_address, - entries, - } => { - values.push(resource_address); - values.push(entries); - } - - Self::CreateFungibleResource { - divisibility, - metadata, - access_rules, - initial_supply, - } => { - values.push(divisibility); - values.push(metadata); - values.push(access_rules); - values.push(initial_supply); - } - Self::CreateFungibleResourceWithOwner { - divisibility, - metadata, - owner_badge, - initial_supply, - } => { - values.push(divisibility); - values.push(metadata); - values.push(owner_badge); - values.push(initial_supply); - } - Self::CreateNonFungibleResource { - id_type, - metadata, - access_rules, - initial_supply, - } => { - values.push(id_type); - values.push(metadata); - values.push(access_rules); - values.push(initial_supply); - } - Self::CreateNonFungibleResourceWithOwner { - id_type, - metadata, - owner_badge, - initial_supply, - } => { - values.push(id_type); - values.push(metadata); - values.push(owner_badge); - values.push(initial_supply); - } - - Self::AssertAccessRule { access_rule } => values.push(access_rule), - Self::CreateIdentity { access_rule } => values.push(access_rule), - Self::CreateAccessController { - controlled_asset, - primary_role, - recovery_role, - confirmation_role, - timed_recovery_delay_in_minutes, - } => { - values.push(controlled_asset); - values.push(primary_role); - values.push(recovery_role); - values.push(confirmation_role); - values.push(timed_recovery_delay_in_minutes); - } - - Self::DropProof { proof } => values.push(proof), - Self::CreateValidator { - key, - owner_access_rule, - } => { - values.push(key); - values.push(owner_access_rule); - } - - Self::DropAllProofs | Self::ClearAuthZone => {} - } - values - } -} diff --git a/radix-engine-toolkit/src/model/transaction/instruction_list.rs b/radix-engine-toolkit/src/model/transaction/instruction_list.rs index c877b769..8ff2a329 100644 --- a/radix-engine-toolkit/src/model/transaction/instruction_list.rs +++ b/radix-engine-toolkit/src/model/transaction/instruction_list.rs @@ -18,7 +18,6 @@ use crate::address::Bech32Coder; use crate::error::Result; use crate::model::Instruction; -use crate::ValueRef; use native_transaction::manifest::{ast, decompile}; use native_transaction::model as transaction; use scrypto::prelude::hash; @@ -211,25 +210,3 @@ impl InstructionList { } } } - -impl ValueRef for InstructionList { - fn borrow_values(&self) -> Vec<&crate::Value> { - match self { - Self::Parsed(parsed_instructions) => parsed_instructions - .iter() - .flat_map(|instruction| instruction.borrow_values()) - .collect(), - Self::String(..) => Vec::new(), - } - } - - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - match self { - Self::Parsed(parsed_instructions) => parsed_instructions - .iter_mut() - .flat_map(|instruction| instruction.borrow_values_mut()) - .collect(), - Self::String(..) => Vec::new(), - } - } -} diff --git a/radix-engine-toolkit/src/model/transaction/intent.rs b/radix-engine-toolkit/src/model/transaction/intent.rs index c1c0f0cb..47fec970 100644 --- a/radix-engine-toolkit/src/model/transaction/intent.rs +++ b/radix-engine-toolkit/src/model/transaction/intent.rs @@ -21,7 +21,6 @@ use serializable::serializable; use crate::address::Bech32Coder; use crate::error::Result; use crate::model::transaction::{TransactionHeader, TransactionManifest}; -use crate::traits::ValueRef; use crate::{CompilableIntent, Error, InstructionKind}; use native_transaction::model as native; @@ -44,16 +43,6 @@ pub struct TransactionIntent { // Implementation // =============== -impl ValueRef for TransactionIntent { - fn borrow_values(&self) -> Vec<&crate::Value> { - self.manifest.borrow_values() - } - - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - self.manifest.borrow_values_mut() - } -} - impl CompilableIntent for TransactionIntent { fn compile(&self) -> Result> { self.to_native_transaction_intent() diff --git a/radix-engine-toolkit/src/model/transaction/manifest.rs b/radix-engine-toolkit/src/model/transaction/manifest.rs index 04348eff..adffaa41 100644 --- a/radix-engine-toolkit/src/model/transaction/manifest.rs +++ b/radix-engine-toolkit/src/model/transaction/manifest.rs @@ -16,7 +16,7 @@ // under the License. use crate::error::Result; -use crate::{Bech32Coder, Error, InstructionKind, InstructionList, ValueRef}; +use crate::{Bech32Coder, Error, InstructionKind, InstructionList}; use native_transaction::manifest::decompile; use native_transaction::model as native; use serializable::serializable; @@ -38,20 +38,6 @@ pub struct TransactionManifest { pub blobs: Vec>, } -// =============== -// Implementation -// =============== - -impl ValueRef for TransactionManifest { - fn borrow_values(&self) -> Vec<&crate::Value> { - self.instructions.borrow_values() - } - - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - self.instructions.borrow_values_mut() - } -} - // ============ // Conversions // ============ diff --git a/radix-engine-toolkit/src/model/transaction/notarized_intent.rs b/radix-engine-toolkit/src/model/transaction/notarized_intent.rs index 36678248..1ddf8fc1 100644 --- a/radix-engine-toolkit/src/model/transaction/notarized_intent.rs +++ b/radix-engine-toolkit/src/model/transaction/notarized_intent.rs @@ -20,7 +20,7 @@ use native_transaction::model as native; use scrypto::prelude::{scrypto_decode, scrypto_encode, Signature}; use serializable::serializable; -use crate::{SignedTransactionIntent, ValueRef}; +use crate::SignedTransactionIntent; // ================= // Model Definition @@ -43,16 +43,6 @@ pub struct NotarizedTransaction { // Implementation // =============== -impl ValueRef for NotarizedTransaction { - fn borrow_values(&self) -> Vec<&crate::Value> { - self.signed_intent.borrow_values() - } - - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - self.signed_intent.borrow_values_mut() - } -} - impl CompilableIntent for NotarizedTransaction { fn compile(&self) -> Result> { self.to_native_notarized_transaction_intent() diff --git a/radix-engine-toolkit/src/model/transaction/signed_intent.rs b/radix-engine-toolkit/src/model/transaction/signed_intent.rs index 124ee6d2..a7c568b8 100644 --- a/radix-engine-toolkit/src/model/transaction/signed_intent.rs +++ b/radix-engine-toolkit/src/model/transaction/signed_intent.rs @@ -20,7 +20,7 @@ use native_transaction::model as native; use scrypto::prelude::{scrypto_decode, scrypto_encode, SignatureWithPublicKey}; use serializable::serializable; -use crate::{InstructionKind, TransactionIntent, ValueRef}; +use crate::{InstructionKind, TransactionIntent}; // ================= // Model Definition @@ -42,16 +42,6 @@ pub struct SignedTransactionIntent { // Implementation // =============== -impl ValueRef for SignedTransactionIntent { - fn borrow_values(&self) -> Vec<&crate::Value> { - self.intent.borrow_values() - } - - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - self.intent.borrow_values_mut() - } -} - impl CompilableIntent for SignedTransactionIntent { fn compile(&self) -> Result> { self.to_native_signed_transaction_intent() diff --git a/radix-engine-toolkit/src/request/compile_notarized_transaction.rs b/radix-engine-toolkit/src/request/compile_notarized_transaction.rs index 5fec4019..d06c89f2 100644 --- a/radix-engine-toolkit/src/request/compile_notarized_transaction.rs +++ b/radix-engine-toolkit/src/request/compile_notarized_transaction.rs @@ -18,7 +18,8 @@ use crate::error::Result; use crate::model::transaction::NotarizedTransaction; use crate::request::Handler; -use crate::traits::{CompilableIntent, ValueRef}; +use crate::traits::CompilableIntent; +use crate::{traverse_instruction, Instruction, InstructionList, ValueNetworkAggregatorVisitor}; use serializable::serializable; // ================= @@ -56,25 +57,48 @@ impl Handler Result { - // Validate all `Value`s in the request. Ensure that: - // 1. All addresses are of the network provided in the request. - // 2. All single-type collections are of a single kind. - request - .borrow_values() - .iter() - .map(|value| { - value.validate(Some( - request - .notarized_intent - .signed_intent - .intent - .header - .network_id, - )) + // 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::NetworkMismatchError { + found: *network_id, + expected: expected_network_id, + }); + } Ok(request) } @@ -90,17 +114,7 @@ impl Handler CompileNotarizedTransactionResponse { - response - } -} - -impl ValueRef for CompileNotarizedTransactionRequest { - fn borrow_values(&self) -> Vec<&crate::Value> { - self.notarized_intent.borrow_values() - } - - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - self.notarized_intent.borrow_values_mut() + ) -> 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 index 5b29b70c..d75eba53 100644 --- a/radix-engine-toolkit/src/request/compile_signed_transaction_intent.rs +++ b/radix-engine-toolkit/src/request/compile_signed_transaction_intent.rs @@ -18,7 +18,8 @@ use crate::error::Result; use crate::model::transaction::SignedTransactionIntent; use crate::request::Handler; -use crate::traits::{CompilableIntent, ValueRef}; +use crate::traits::CompilableIntent; +use crate::{traverse_instruction, Instruction, InstructionList, ValueNetworkAggregatorVisitor}; use serializable::serializable; // ================= @@ -55,16 +56,38 @@ impl Handler Result { - // Validate all `Value`s in the request. Ensure that: - // 1. All addresses are of the network provided in the request. - // 2. All single-type collections are of a single kind. - request - .borrow_values() - .iter() - .map(|value| value.validate(Some(request.signed_intent.intent.header.network_id))) + // 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::NetworkMismatchError { + found: *network_id, + expected: expected_network_id, + }); + } Ok(request) } @@ -80,17 +103,7 @@ impl Handler CompileSignedTransactionIntentResponse { - response - } -} - -impl ValueRef for CompileSignedTransactionIntentRequest { - fn borrow_values(&self) -> Vec<&crate::Value> { - self.signed_intent.borrow_values() - } - - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - self.signed_intent.borrow_values_mut() + ) -> 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 index 272a9127..af35657d 100644 --- a/radix-engine-toolkit/src/request/compile_transaction_intent.rs +++ b/radix-engine-toolkit/src/request/compile_transaction_intent.rs @@ -18,7 +18,8 @@ use crate::error::Result; use crate::model::transaction::TransactionIntent; use crate::request::Handler; -use crate::traits::{CompilableIntent, ValueRef}; +use crate::traits::CompilableIntent; +use crate::{traverse_instruction, Instruction, InstructionList, ValueNetworkAggregatorVisitor}; use serializable::serializable; // ================= @@ -54,16 +55,38 @@ impl Handler for CompileTransactionIntentHandler { fn pre_process( - request: CompileTransactionIntentRequest, + mut request: CompileTransactionIntentRequest, ) -> Result { - // Validate all `Value`s in the request. Ensure that: - // 1. All addresses are of the network provided in the request. - // 2. All single-type collections are of a single kind. - request - .borrow_values() - .iter() - .map(|value| value.validate(Some(request.transaction_intent.header.network_id))) + // 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::NetworkMismatchError { + found: *network_id, + expected: expected_network_id, + }); + } Ok(request) } @@ -79,17 +102,7 @@ impl Handler fn post_process( _: &CompileTransactionIntentRequest, response: CompileTransactionIntentResponse, - ) -> CompileTransactionIntentResponse { - response - } -} - -impl ValueRef for CompileTransactionIntentRequest { - fn borrow_values(&self) -> Vec<&crate::Value> { - self.transaction_intent.borrow_values() - } - - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - self.transaction_intent.borrow_values_mut() + ) -> Result { + Ok(response) } } diff --git a/radix-engine-toolkit/src/request/convert_manifest.rs b/radix-engine-toolkit/src/request/convert_manifest.rs index 66b2d89c..3452033d 100644 --- a/radix-engine-toolkit/src/request/convert_manifest.rs +++ b/radix-engine-toolkit/src/request/convert_manifest.rs @@ -19,7 +19,10 @@ use crate::error::Result; use crate::model::address::Bech32Coder; use crate::model::instruction_list::InstructionKind; use crate::model::TransactionManifest; -use crate::{Handler, ValueRef}; +use crate::{ + traverse_instruction, Handler, Instruction, InstructionList, ValueAliasingVisitor, + ValueNetworkAggregatorVisitor, +}; use serializable::serializable; // ================= @@ -76,15 +79,35 @@ pub struct ConvertManifestResponse { pub struct ConvertManifestHandler; impl Handler for ConvertManifestHandler { - fn pre_process(request: ConvertManifestRequest) -> Result { - // Validate all `Value`s in the request. Ensure that: - // 1. All addresses are of the network provided in the request. - // 2. All single-type collections are of a single kind. - request - .borrow_values() - .iter() - .map(|value| value.validate(Some(request.network_id))) + 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::NetworkMismatchError { + found: *network_id, + expected: request.network_id, + }); + } Ok(request) } @@ -108,30 +131,27 @@ impl Handler for ConvertManifes fn post_process( _: &ConvertManifestRequest, mut response: ConvertManifestResponse, - ) -> ConvertManifestResponse { - for value in response.borrow_values_mut().iter_mut() { - value.alias(); - } - response - } -} - -impl ValueRef for ConvertManifestRequest { - fn borrow_values(&self) -> Vec<&crate::Value> { - self.manifest.borrow_values() - } - - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - self.manifest.borrow_values_mut() - } -} + ) -> 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::>>()?; -impl ValueRef for ConvertManifestResponse { - fn borrow_values(&self) -> Vec<&crate::Value> { - self.manifest.borrow_values() - } + // The aliasing visitor performs all of the modifications in place as it meets them. Nothing + // else needs to be done here. - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - self.manifest.borrow_values_mut() + Ok(response) } } diff --git a/radix-engine-toolkit/src/request/decode_address.rs b/radix-engine-toolkit/src/request/decode_address.rs index 5471c644..d64c4e1f 100644 --- a/radix-engine-toolkit/src/request/decode_address.rs +++ b/radix-engine-toolkit/src/request/decode_address.rs @@ -106,7 +106,7 @@ impl Handler for DecodeAddressHandl fn post_process( _: &DecodeAddressRequest, response: DecodeAddressResponse, - ) -> DecodeAddressResponse { - response + ) -> 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 index 061f2337..d044b7bb 100644 --- a/radix-engine-toolkit/src/request/decompile_notarized_transaction.rs +++ b/radix-engine-toolkit/src/request/decompile_notarized_transaction.rs @@ -18,8 +18,10 @@ use crate::error::Result; use crate::model::transaction::NotarizedTransaction; use crate::request::Handler; -use crate::traits::{CompilableIntent, ValueRef}; -use crate::InstructionKind; +use crate::traits::CompilableIntent; +use crate::{ + traverse_instruction, Instruction, InstructionKind, InstructionList, ValueAliasingVisitor, +}; use serializable::serializable; // ================= @@ -80,20 +82,33 @@ impl Handler DecompileNotarizedTransactionResponse { - for value in response.borrow_values_mut().iter_mut() { - value.alias(); - } - response - } -} + ) -> Result { + // Visitors + let mut aliasing_visitor = ValueAliasingVisitor::default(); -impl ValueRef for DecompileNotarizedTransactionResponse { - fn borrow_values(&self) -> Vec<&crate::Value> { - self.notarized_intent.borrow_values() - } + // 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. - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - self.notarized_intent.borrow_values_mut() + 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 index 87b83091..ee4c119a 100644 --- a/radix-engine-toolkit/src/request/decompile_signed_transaction_intent.rs +++ b/radix-engine-toolkit/src/request/decompile_signed_transaction_intent.rs @@ -18,8 +18,10 @@ use crate::error::Result; use crate::model::transaction::SignedTransactionIntent; use crate::request::Handler; -use crate::traits::{CompilableIntent, ValueRef}; -use crate::InstructionKind; +use crate::traits::CompilableIntent; +use crate::{ + traverse_instruction, Instruction, InstructionKind, InstructionList, ValueAliasingVisitor, +}; use serializable::serializable; // ================= @@ -80,20 +82,28 @@ impl Handler DecompileSignedTransactionIntentResponse { - for value in response.borrow_values_mut().iter_mut() { - value.alias(); - } - response - } -} + ) -> Result { + // Visitors + let mut aliasing_visitor = ValueAliasingVisitor::default(); -impl ValueRef for DecompileSignedTransactionIntentResponse { - fn borrow_values(&self) -> Vec<&crate::Value> { - self.signed_intent.borrow_values() - } + // 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. - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - self.signed_intent.borrow_values_mut() + Ok(response) } } diff --git a/radix-engine-toolkit/src/request/decompile_transaction_intent.rs b/radix-engine-toolkit/src/request/decompile_transaction_intent.rs index 69ee699b..ef405628 100644 --- a/radix-engine-toolkit/src/request/decompile_transaction_intent.rs +++ b/radix-engine-toolkit/src/request/decompile_transaction_intent.rs @@ -18,8 +18,10 @@ use crate::error::Result; use crate::model::transaction::TransactionIntent; use crate::request::Handler; -use crate::traits::{CompilableIntent, ValueRef}; -use crate::InstructionKind; +use crate::traits::CompilableIntent; +use crate::{ + traverse_instruction, Instruction, InstructionKind, InstructionList, ValueAliasingVisitor, +}; use serializable::serializable; // ================= @@ -76,20 +78,28 @@ impl Handler DecompileTransactionIntentResponse { - for value in response.borrow_values_mut().iter_mut() { - value.alias(); - } - response - } -} + ) -> Result { + // Visitors + let mut aliasing_visitor = ValueAliasingVisitor::default(); -impl ValueRef for DecompileTransactionIntentResponse { - fn borrow_values(&self) -> Vec<&crate::Value> { - self.transaction_intent.borrow_values() - } + // 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. - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - self.transaction_intent.borrow_values_mut() + Ok(response) } } diff --git a/radix-engine-toolkit/src/request/decompile_unknown_intent.rs b/radix-engine-toolkit/src/request/decompile_unknown_intent.rs index c34f6284..5b293565 100644 --- a/radix-engine-toolkit/src/request/decompile_unknown_intent.rs +++ b/radix-engine-toolkit/src/request/decompile_unknown_intent.rs @@ -22,10 +22,11 @@ use crate::request::{ DecompileSignedTransactionIntentRequest, DecompileSignedTransactionIntentResponse, DecompileTransactionIntentRequest, DecompileTransactionIntentResponse, }; -use crate::traits::ValueRef; use crate::{ - DecompileNotarizedTransactionHandler, DecompileSignedTransactionIntentHandler, - DecompileTransactionIntentHandler, Error, InstructionKind, + traverse_instruction, DecompileNotarizedTransactionHandler, + DecompileSignedTransactionIntentHandler, DecompileTransactionIntentHandler, Error, Instruction, + InstructionKind, NotarizedTransaction, SignedTransactionIntent, TransactionIntent, + TransactionManifest, ValueAliasingVisitor, }; use serializable::serializable; @@ -149,30 +150,82 @@ impl Handler DecompileUnknownTransactionIntentResponse { - for value in response.borrow_values_mut().iter_mut() { - value.alias(); - } - response - } -} - -impl ValueRef for DecompileUnknownTransactionIntentResponse { - fn borrow_values(&self) -> Vec<&crate::Value> { - match self { - Self::TransactionIntent(intent) => intent.borrow_values(), - Self::SignedTransactionIntent(signed_intent) => signed_intent.borrow_values(), - Self::NotarizedTransactionIntent(notarized_intent) => notarized_intent.borrow_values(), - } - } - - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - match self { - Self::TransactionIntent(intent) => intent.borrow_values_mut(), - Self::SignedTransactionIntent(signed_intent) => signed_intent.borrow_values_mut(), - Self::NotarizedTransactionIntent(notarized_intent) => { - notarized_intent.borrow_values_mut() - } - } + ) -> 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: + crate::InstructionList::Parsed( + ref mut instructions, + ), + .. + }, + .. + }, + .. + }, + .. + }, + }, + ) + | DecompileUnknownTransactionIntentResponse::SignedTransactionIntent( + DecompileSignedTransactionIntentResponse { + signed_intent: + SignedTransactionIntent { + intent: + TransactionIntent { + manifest: + TransactionManifest { + instructions: + crate::InstructionList::Parsed(ref mut instructions), + .. + }, + .. + }, + .. + }, + }, + ) + | DecompileUnknownTransactionIntentResponse::TransactionIntent( + DecompileTransactionIntentResponse { + transaction_intent: + TransactionIntent { + manifest: + TransactionManifest { + instructions: + crate::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_non_fungible_global_id_from_public_key.rs b/radix-engine-toolkit/src/request/derive_non_fungible_global_id_from_public_key.rs index 23dd88d7..545bac0a 100644 --- a/radix-engine-toolkit/src/request/derive_non_fungible_global_id_from_public_key.rs +++ b/radix-engine-toolkit/src/request/derive_non_fungible_global_id_from_public_key.rs @@ -15,10 +15,8 @@ // specific language governing permissions and limitations // under the License. -use crate::error::Result; use crate::request::Handler; -use crate::traits::ValueRef; -use crate::{NonFungibleGlobalId, Value}; +use crate::{error::Result, NonFungibleGlobalId}; use scrypto::prelude::{FromPublicKey, PublicKey}; use serializable::serializable; @@ -47,8 +45,9 @@ pub struct DeriveNonFungibleGlobalIdFromPublicKeyRequest { pub struct DeriveNonFungibleGlobalIdFromPublicKeyResponse { /// The non-fungible global id of the virtual badge associated with the given public key. The /// underlying type of this is a `NonFungibleGlobalId` from the `Value` model. - #[serde(flatten)] - pub non_fungible_global_id: Value, + #[schemars(with = "crate::model::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + pub non_fungible_global_id: NonFungibleGlobalId, } // =============== @@ -82,29 +81,14 @@ impl non_fungible_local_id: non_fungible_global_id.local_id().clone(), }; Ok(DeriveNonFungibleGlobalIdFromPublicKeyResponse { - non_fungible_global_id: Value::NonFungibleGlobalId { - address: non_fungible_global_id, - }, + non_fungible_global_id, }) } fn post_process( _: &DeriveNonFungibleGlobalIdFromPublicKeyRequest, - mut response: DeriveNonFungibleGlobalIdFromPublicKeyResponse, - ) -> DeriveNonFungibleGlobalIdFromPublicKeyResponse { - for value in response.borrow_values_mut().iter_mut() { - value.alias(); - } - response - } -} - -impl ValueRef for DeriveNonFungibleGlobalIdFromPublicKeyResponse { - fn borrow_values(&self) -> Vec<&crate::Value> { - vec![&self.non_fungible_global_id] - } - - fn borrow_values_mut(&mut self) -> Vec<&mut crate::Value> { - vec![&mut self.non_fungible_global_id] + 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 index 125e9e10..c4d5c81d 100644 --- a/radix-engine-toolkit/src/request/derive_virtual_account_address.rs +++ b/radix-engine-toolkit/src/request/derive_virtual_account_address.rs @@ -81,7 +81,7 @@ impl Handler DeriveVirtualAccountAddressResponse { - response + ) -> 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 index 0d7f885c..3d64d932 100644 --- a/radix-engine-toolkit/src/request/derive_virtual_identity_address.rs +++ b/radix-engine-toolkit/src/request/derive_virtual_identity_address.rs @@ -81,7 +81,7 @@ impl Handler DeriveVirtualIdentityAddressResponse { - response + ) -> Result { + Ok(response) } } diff --git a/radix-engine-toolkit/src/request/encode_address.rs b/radix-engine-toolkit/src/request/encode_address.rs index d1cf8bb8..9b0a4180 100644 --- a/radix-engine-toolkit/src/request/encode_address.rs +++ b/radix-engine-toolkit/src/request/encode_address.rs @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. +use crate::error::Result; use crate::{model::address::EntityAddress, Handler}; use serializable::serializable; @@ -71,7 +72,7 @@ impl Handler for EncodeAddressHandl fn post_process( _: &EncodeAddressRequest, response: EncodeAddressResponse, - ) -> EncodeAddressResponse { - response + ) -> Result { + Ok(response) } } diff --git a/radix-engine-toolkit/src/request/information.rs b/radix-engine-toolkit/src/request/information.rs index f5052d71..0a654df4 100644 --- a/radix-engine-toolkit/src/request/information.rs +++ b/radix-engine-toolkit/src/request/information.rs @@ -62,7 +62,10 @@ impl Handler for InformationHandler { Ok(response) } - fn post_process(_: &InformationRequest, response: InformationResponse) -> InformationResponse { - 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 index 006dca5d..d39cf3d5 100644 --- a/radix-engine-toolkit/src/request/known_entity_addresses.rs +++ b/radix-engine-toolkit/src/request/known_entity_addresses.rs @@ -171,7 +171,7 @@ impl Handler fn post_process( _: &KnownEntityAddressesRequest, response: KnownEntityAddressesResponse, - ) -> KnownEntityAddressesResponse { - response + ) -> Result { + Ok(response) } } diff --git a/radix-engine-toolkit/src/request/sbor_decode.rs b/radix-engine-toolkit/src/request/sbor_decode.rs index 4b3b0b6d..34beef6e 100644 --- a/radix-engine-toolkit/src/request/sbor_decode.rs +++ b/radix-engine-toolkit/src/request/sbor_decode.rs @@ -17,8 +17,8 @@ use crate::error::Result; use crate::request::Handler; -use crate::traits::ValueRef; use crate::value::Value; +use crate::{traverse_value, ValueAliasingVisitor}; use serializable::serializable; // ================= @@ -69,20 +69,19 @@ impl Handler for SborDecodeHandler { .map(|value| SborDecodeResponse { value }) } - fn post_process(_: &SborDecodeRequest, mut response: SborDecodeResponse) -> SborDecodeResponse { - for value in response.borrow_values_mut().iter_mut() { - value.alias(); - } - response - } -} + fn post_process( + _: &SborDecodeRequest, + mut response: SborDecodeResponse, + ) -> Result { + // Visitors + let mut aliasing_visitor = ValueAliasingVisitor::default(); -impl ValueRef for SborDecodeResponse { - fn borrow_values(&self) -> Vec<&Value> { - vec![&self.value] - } + // Traverse value with visitors + traverse_value(&mut response.value, &mut [&mut aliasing_visitor])?; + + // The aliasing visitor performs all of the modifications in place as it meets them. Nothing + // else needs to be done here. - fn borrow_values_mut(&mut self) -> Vec<&mut Value> { - vec![&mut self.value] + Ok(response) } } diff --git a/radix-engine-toolkit/src/request/sbor_encode.rs b/radix-engine-toolkit/src/request/sbor_encode.rs index f61abb38..25f67ff6 100644 --- a/radix-engine-toolkit/src/request/sbor_encode.rs +++ b/radix-engine-toolkit/src/request/sbor_encode.rs @@ -17,7 +17,6 @@ use crate::error::Result; use crate::request::Handler; -use crate::traits::ValueRef; use crate::value::Value; use serializable::serializable; @@ -52,14 +51,6 @@ pub struct SborEncodeHandler; impl Handler for SborEncodeHandler { fn pre_process(request: SborEncodeRequest) -> Result { - // Validate all `Value`s in the request. Ensure that: - // 1. All addresses are of the network provided in the request. - // 2. All single-type collections are of a single kind. - request - .borrow_values() - .iter() - .map(|value| value.validate(None)) - .collect::>>()?; Ok(request) } @@ -70,17 +61,10 @@ impl Handler for SborEncodeHandler { .map(|encoded_value| SborEncodeResponse { encoded_value }) } - fn post_process(_: &SborEncodeRequest, response: SborEncodeResponse) -> SborEncodeResponse { - response - } -} - -impl ValueRef for SborEncodeRequest { - fn borrow_values(&self) -> Vec<&Value> { - vec![&self.value] - } - - fn borrow_values_mut(&mut self) -> Vec<&mut Value> { - vec![&mut self.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 index e149fbd4..9803a925 100644 --- a/radix-engine-toolkit/src/request/statically_validate_transaction.rs +++ b/radix-engine-toolkit/src/request/statically_validate_transaction.rs @@ -98,7 +98,7 @@ impl Handler StaticallyValidateTransactionResponse { - response + ) -> Result { + Ok(response) } } diff --git a/radix-engine-toolkit/src/request/traits.rs b/radix-engine-toolkit/src/request/traits.rs index c64053f8..e878b1c1 100644 --- a/radix-engine-toolkit/src/request/traits.rs +++ b/radix-engine-toolkit/src/request/traits.rs @@ -28,7 +28,7 @@ pub trait Handler { fn handle(request: &I) -> Result; /// Performs all post processing of requests - example, aliasing values. - fn post_process(request: &I, response: O) -> O; + fn post_process(request: &I, response: O) -> Result; /// Fulfills the request by performing preprocessing, handling, and post processing fn fulfill(request: I) -> Result { @@ -36,6 +36,6 @@ pub trait Handler { let request = Self::pre_process(request)?; // handle request and perform post-processing - Self::handle(&request).map(|response| Self::post_process(&request, response)) + Self::handle(&request).and_then(|response| Self::post_process(&request, response)) } } diff --git a/radix-engine-toolkit/src/traits.rs b/radix-engine-toolkit/src/traits.rs index d75aaada..d37e3383 100644 --- a/radix-engine-toolkit/src/traits.rs +++ b/radix-engine-toolkit/src/traits.rs @@ -1,16 +1,6 @@ -use crate::model::Value; use crate::{error::Result, InstructionKind}; use scrypto::prelude::{hash, Hash}; -/// A trait that defines a set of methods for aggregating value refs from objects -pub trait ValueRef { - /// Used to borrow all values immutably - fn borrow_values(&self) -> Vec<&Value>; - - /// Borrows all values mutably - fn borrow_values_mut(&mut self) -> Vec<&mut Value>; -} - /// A trait that defines the common interface of all compile-able intents pub trait CompilableIntent { fn compile(&self) -> Result>; diff --git a/radix-engine-toolkit/src/visitor/instruction/instruction_visitor.rs b/radix-engine-toolkit/src/visitor/instruction/instruction_visitor.rs new file mode 100644 index 00000000..4582b6d1 --- /dev/null +++ b/radix-engine-toolkit/src/visitor/instruction/instruction_visitor.rs @@ -0,0 +1,791 @@ +use crate::error::Result; +use crate::{traverse_value, Instruction, ValueVisitor}; + +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::Result<()> { + Ok(()) + } + )* + } + }; +} + +macro_rules! visit { + ($visitors: expr, $method: ident, $($value: expr),*) => { + $visitors + .iter_mut() + .map(|visitor| visitor.$method($($value,)*)) + .collect::<$crate::Result>>() + }; +} + +define_instruction_visitor! { + /// An visitor which operates on [`crate::Instruction`]s. + pub trait InstructionVisitor { + visit_call_function( + _package_address: &mut crate::Value, + _blueprint_name: &mut crate::Value, + _function_name: &mut crate::Value, + _arguments: &mut Option> + ), + + visit_call_method( + _component_address: &mut crate::Value, + _method_name: &mut crate::Value, + _arguments: &mut Option> + ), + + visit_take_from_worktop( + _resource_address: &mut crate::Value, + _into_bucket: &mut crate::Value + ), + + visit_take_from_worktop_by_amount( + _resource_address: &mut crate::Value, + _amount: &mut crate::Value, + _into_bucket: &mut crate::Value + ), + + visit_take_from_worktop_by_ids( + _resource_address: &mut crate::Value, + _ids: &mut Vec, + _into_bucket: &mut crate::Value + ), + + visit_return_to_worktop( + _bucket: &mut crate::Value + ), + + visit_assert_worktop_contains( + _resource_address: &mut crate::Value + ), + + visit_assert_worktop_contains_by_amount( + _resource_address: &mut crate::Value, + _amount: &mut crate::Value + ), + + visit_assert_worktop_contains_by_ids( + _resource_address: &mut crate::Value, + _ids: &mut Vec + ), + + visit_pop_from_auth_zone( + _into_proof: &mut crate::Value + ), + + visit_push_to_auth_zone( + _proof: &mut crate::Value + ), + + visit_create_proof_from_auth_zone( + _resource_address: &mut crate::Value, + _into_proof: &mut crate::Value + ), + + visit_create_proof_from_auth_zone_by_amount( + _resource_address: &mut crate::Value, + _amount: &mut crate::Value, + _into_proof: &mut crate::Value + ), + + visit_create_proof_from_auth_zone_by_ids( + _resource_address: &mut crate::Value, + _ids: &mut Vec, + _into_proof: &mut crate::Value + ), + + visit_create_proof_from_bucket( + _bucket: &mut crate::Value, + _into_proof: &mut crate::Value + ), + + visit_clone_proof( + _proof: &mut crate::Value, + _into_proof: &mut crate::Value + ), + + visit_drop_proof( + _proof: &mut crate::Value + ), + + visit_publish_package( + _code: &mut crate::Value, + _abi: &mut crate::Value, + _royalty_config: &mut crate::Value, + _metadata: &mut crate::Value, + _access_rules: &mut crate::Value + ), + + visit_publish_package_with_owner( + _code: &mut crate::Value, + _abi: &mut crate::Value, + _owner_badge: &mut crate::Value + ), + + visit_burn_resource( + _bucket: &mut crate::Value + ), + + visit_recall_resource( + _vault_id: &mut crate::Value, + _amount: &mut crate::Value + ), + + visit_set_metadata( + _entity_address: &mut crate::Value, + _key: &mut crate::Value, + _value: &mut crate::Value + ), + + visit_set_package_royalty_config( + _package_address: &mut crate::Value, + _royalty_config: &mut crate::Value + ), + + visit_set_component_royalty_config( + _component_address: &mut crate::Value, + _royalty_config: &mut crate::Value + ), + + visit_claim_package_royalty( + _package_address: &mut crate::Value + ), + + visit_claim_component_royalty( + _component_address: &mut crate::Value + ), + + visit_set_method_access_rule( + _entity_address: &mut crate::Value, + _index: &mut crate::Value, + _key: &mut crate::Value, + _rule: &mut crate::Value + ), + + visit_mint_fungible( + _resource_address: &mut crate::Value, + _amount: &mut crate::Value + ), + + visit_mint_non_fungible( + _resource_address: &mut crate::Value, + _entries: &mut crate::Value + ), + + visit_mint_uuid_non_fungible( + _resource_address: &mut crate::Value, + _entries: &mut crate::Value + ), + + visit_create_fungible_resource( + _divisibility: &mut crate::Value, + _metadata: &mut crate::Value, + _access_rules: &mut crate::Value, + _initial_supply: &mut crate::Value + ), + + visit_create_fungible_resource_with_owner( + _divisibility: &mut crate::Value, + _metadata: &mut crate::Value, + _owner_badge: &mut crate::Value, + _initial_supply: &mut crate::Value + ), + + visit_create_non_fungible_resource( + _id_type: &mut crate::Value, + _metadata: &mut crate::Value, + _access_rules: &mut crate::Value, + _initial_supply: &mut crate::Value + ), + + visit_create_non_fungible_resource_with_owner( + _id_type: &mut crate::Value, + _metadata: &mut crate::Value, + _owner_badge: &mut crate::Value, + _initial_supply: &mut crate::Value + ), + + visit_create_access_controller( + _controlled_asset: &mut crate::Value, + _primary_role: &mut crate::Value, + _recovery_role: &mut crate::Value, + _confirmation_role: &mut crate::Value, + _timed_recovery_delay_in_minutes: &mut crate::Value + ), + + visit_create_identity( + _access_rule: &mut crate::Value + ), + + visit_assert_access_rule( + _access_rule: &mut crate::Value + ), + + visit_create_validator( + _key: &mut crate::Value, + _owner_access_rule: &mut crate::Value + ), + + visit_clear_auth_zone(), + visit_drop_all_proofs() + } +} + +/// 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 ValueVisitor], + 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, + 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::PublishPackageWithOwner { + code, + abi, + owner_badge, + } => { + traverse_value(code, value_visitors)?; + traverse_value(abi, value_visitors)?; + traverse_value(owner_badge, value_visitors)?; + visit!( + instructions_visitors, + visit_publish_package_with_owner, + code, + abi, + owner_badge + )?; + } + + Instruction::BurnResource { bucket } => { + traverse_value(bucket, value_visitors)?; + visit!(instructions_visitors, visit_burn_resource, bucket)?; + } + + 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::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, + index, + key, + rule, + } => { + traverse_value(entity_address, value_visitors)?; + traverse_value(index, value_visitors)?; + traverse_value(key, value_visitors)?; + traverse_value(rule, value_visitors)?; + visit!( + instructions_visitors, + visit_set_method_access_rule, + entity_address, + index, + key, + rule + )?; + } + + 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, + initial_supply, + } => { + traverse_value(divisibility, value_visitors)?; + traverse_value(metadata, value_visitors)?; + traverse_value(access_rules, value_visitors)?; + traverse_value(initial_supply, value_visitors)?; + visit!( + instructions_visitors, + visit_create_fungible_resource, + divisibility, + metadata, + access_rules, + initial_supply + )?; + } + + Instruction::CreateFungibleResourceWithOwner { + divisibility, + metadata, + owner_badge, + initial_supply, + } => { + traverse_value(divisibility, value_visitors)?; + traverse_value(metadata, value_visitors)?; + traverse_value(owner_badge, value_visitors)?; + traverse_value(initial_supply, value_visitors)?; + visit!( + instructions_visitors, + visit_create_fungible_resource_with_owner, + divisibility, + metadata, + owner_badge, + initial_supply + )?; + } + + Instruction::CreateNonFungibleResource { + id_type, + metadata, + access_rules, + initial_supply, + } => { + traverse_value(id_type, value_visitors)?; + traverse_value(metadata, value_visitors)?; + traverse_value(access_rules, value_visitors)?; + traverse_value(initial_supply, value_visitors)?; + visit!( + instructions_visitors, + visit_create_non_fungible_resource, + id_type, + metadata, + access_rules, + initial_supply + )?; + } + + Instruction::CreateNonFungibleResourceWithOwner { + id_type, + metadata, + owner_badge, + initial_supply, + } => { + traverse_value(id_type, value_visitors)?; + traverse_value(metadata, value_visitors)?; + traverse_value(owner_badge, value_visitors)?; + traverse_value(initial_supply, value_visitors)?; + visit!( + instructions_visitors, + visit_create_non_fungible_resource_with_owner, + id_type, + metadata, + owner_badge, + initial_supply + )?; + } + + Instruction::CreateAccessController { + controlled_asset, + primary_role, + recovery_role, + confirmation_role, + timed_recovery_delay_in_minutes, + } => { + traverse_value(controlled_asset, value_visitors)?; + traverse_value(primary_role, value_visitors)?; + traverse_value(recovery_role, value_visitors)?; + traverse_value(confirmation_role, value_visitors)?; + traverse_value(timed_recovery_delay_in_minutes, value_visitors)?; + visit!( + instructions_visitors, + visit_create_access_controller, + controlled_asset, + primary_role, + recovery_role, + confirmation_role, + 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::DropAllProofs => { + visit!(instructions_visitors, visit_drop_all_proofs,)?; + } + Instruction::ClearAuthZone => { + visit!(instructions_visitors, visit_clear_auth_zone,)?; + } + }; + Ok(()) +} diff --git a/radix-engine-toolkit/src/visitor/instruction/mod.rs b/radix-engine-toolkit/src/visitor/instruction/mod.rs new file mode 100644 index 00000000..1378a01c --- /dev/null +++ b/radix-engine-toolkit/src/visitor/instruction/mod.rs @@ -0,0 +1,3 @@ +pub mod instruction_visitor; + +pub use instruction_visitor::*; diff --git a/radix-engine-toolkit/src/visitor/mod.rs b/radix-engine-toolkit/src/visitor/mod.rs new file mode 100644 index 00000000..998bc33b --- /dev/null +++ b/radix-engine-toolkit/src/visitor/mod.rs @@ -0,0 +1,5 @@ +mod instruction; +mod value; + +pub use instruction::*; +pub use value::*; diff --git a/radix-engine-toolkit/src/visitor/value/aliasing_visitor.rs b/radix-engine-toolkit/src/visitor/value/aliasing_visitor.rs new file mode 100644 index 00000000..98f5d99d --- /dev/null +++ b/radix-engine-toolkit/src/visitor/value/aliasing_visitor.rs @@ -0,0 +1,59 @@ +use super::ValueVisitor; +use crate::error::Error; +use crate::model::{NonFungibleGlobalId, Value}; + +/// A value visitor whose main responsibility is to perform aliasing on all encountered values. As +/// an example, this is the main visitor responsible for turing a Tuple(ResourceAddress, NFLocalId) +/// to a NonFungibleGlobalAddress +#[derive(Debug, Default)] +pub struct ValueAliasingVisitor; + +impl ValueVisitor for ValueAliasingVisitor { + fn visit_tuple(&mut self, value: &mut crate::Value) -> crate::Result<()> { + if let Value::Tuple { ref elements } = value { + // Case: NonFungibleGlobalId - A tuple of ResourceAddress and NonFungibleLocalId + match (elements.get(0), elements.get(1)) { + ( + Some(Value::ResourceAddress { + address: resource_address, + }), + Some(Value::NonFungibleLocalId { + value: non_fungible_local_id, + }), + ) if elements.len() == 2 => { + *value = Value::NonFungibleGlobalId { + address: NonFungibleGlobalId { + resource_address: *resource_address, + non_fungible_local_id: non_fungible_local_id.clone(), + }, + }; + Ok(()) + } + _ => Ok(()), + } + } else { + Err(Error::Infallible { + message: "Must be a tuple!".into(), + }) + } + } + + fn visit_array(&mut self, value: &mut crate::Value) -> crate::Result<()> { + if let Value::Array { ref elements, .. } = value { + // Case: Bytes - An array of u8 + let mut bytes = Vec::new(); + for element in elements.iter() { + match element { + Value::U8 { value } => bytes.push(*value), + _ => return Ok(()), + } + } + *value = Value::Bytes { value: bytes }; + 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 new file mode 100644 index 00000000..c2a946d5 --- /dev/null +++ b/radix-engine-toolkit/src/visitor/value/mod.rs @@ -0,0 +1,7 @@ +pub mod aliasing_visitor; +pub mod network_aggregator_visitor; +pub mod value_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 new file mode 100644 index 00000000..d07f7c43 --- /dev/null +++ b/radix-engine-toolkit/src/visitor/value/network_aggregator_visitor.rs @@ -0,0 +1,55 @@ +use std::collections::HashSet; + +use crate::{Value, ValueVisitor}; + +/// 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 HashSet); + +impl ValueVisitor for ValueNetworkAggregatorVisitor { + fn visit_component_address(&mut self, value: &mut crate::Value) -> crate::Result<()> { + if let Value::ComponentAddress { address } = value { + self.0.insert(address.network_id); + Ok(()) + } else { + Err(crate::Error::Infallible { + message: "Expected component address!".into(), + }) + } + } + + fn visit_resource_address(&mut self, value: &mut crate::Value) -> crate::Result<()> { + if let Value::ResourceAddress { address } = value { + self.0.insert(address.network_id); + Ok(()) + } else { + Err(crate::Error::Infallible { + message: "Expected resource address!".into(), + }) + } + } + + fn visit_package_address(&mut self, value: &mut crate::Value) -> crate::Result<()> { + if let Value::PackageAddress { address } = value { + self.0.insert(address.network_id); + Ok(()) + } else { + Err(crate::Error::Infallible { + message: "Expected package address!".into(), + }) + } + } + + fn visit_non_fungible_global_id(&mut self, value: &mut crate::Value) -> crate::Result<()> { + if let Value::NonFungibleGlobalId { address } = value { + self.0.insert(address.resource_address.network_id); + Ok(()) + } else { + Err(crate::Error::Infallible { + message: "Expected non-fungible global id!".into(), + }) + } + } +} diff --git a/radix-engine-toolkit/src/visitor/value/value_visitor.rs b/radix-engine-toolkit/src/visitor/value/value_visitor.rs new file mode 100644 index 00000000..58cf6afb --- /dev/null +++ b/radix-engine-toolkit/src/visitor/value/value_visitor.rs @@ -0,0 +1,219 @@ +use crate::{Value, ValueKind}; + +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::Value) -> $crate::Result<()> { + Ok(()) + } + )* + } + }; +} + +macro_rules! visit { + ($visitors: expr, $method: ident, $value: expr) => { + $visitors + .iter_mut() + .map(|visitor| visitor.$method($value)) + .collect::<$crate::Result>>() + }; +} + +define_value_visitor! { + /// A trait which defines a [`crate::Value`] visitor which operates on unstructured values, this + /// choice is made to allow the visitor to work with aliasing an dealiasing operations which + /// involves the visitor changing the value variant. + pub trait ValueVisitor { + 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_own, + + visit_component_address, + visit_resource_address, + visit_package_address, + + visit_hash, + visit_ecdsa_secp256k1_public_key, + visit_ecdsa_secp256k1_signature, + visit_eddsa_ed25519_public_key, + visit_eddsa_ed25519_signature, + + visit_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::Value, + visitors: &mut [&mut dyn ValueVisitor], +) -> crate::Result<()> { + // Visit the top level value parts + match value.kind() { + ValueKind::Bool => visit!(visitors, visit_bool, value)?, + + ValueKind::U8 => visit!(visitors, visit_u8, value)?, + ValueKind::U16 => visit!(visitors, visit_u16, value)?, + ValueKind::U32 => visit!(visitors, visit_u32, value)?, + ValueKind::U64 => visit!(visitors, visit_u64, value)?, + ValueKind::U128 => visit!(visitors, visit_u128, value)?, + + ValueKind::I8 => visit!(visitors, visit_i8, value)?, + ValueKind::I16 => visit!(visitors, visit_i16, value)?, + ValueKind::I32 => visit!(visitors, visit_i32, value)?, + ValueKind::I64 => visit!(visitors, visit_i64, value)?, + ValueKind::I128 => visit!(visitors, visit_i128, value)?, + + ValueKind::String => visit!(visitors, visit_string, value)?, + + ValueKind::Enum => visit!(visitors, visit_enum, value)?, + + ValueKind::Some => visit!(visitors, visit_some, value)?, + ValueKind::None => visit!(visitors, visit_none, value)?, + ValueKind::Ok => visit!(visitors, visit_ok, value)?, + ValueKind::Err => visit!(visitors, visit_err, value)?, + + ValueKind::Map => visit!(visitors, visit_map, value)?, + ValueKind::Array => visit!(visitors, visit_array, value)?, + ValueKind::Tuple => visit!(visitors, visit_tuple, value)?, + + ValueKind::Decimal => visit!(visitors, visit_decimal, value)?, + ValueKind::PreciseDecimal => visit!(visitors, visit_precise_decimal, value)?, + + ValueKind::Own => visit!(visitors, visit_own, value)?, + + ValueKind::ComponentAddress => visit!(visitors, visit_component_address, value)?, + ValueKind::ResourceAddress => visit!(visitors, visit_resource_address, value)?, + ValueKind::PackageAddress => visit!(visitors, visit_package_address, value)?, + + ValueKind::Hash => visit!(visitors, visit_hash, value)?, + + ValueKind::EcdsaSecp256k1PublicKey => { + visit!(visitors, visit_ecdsa_secp256k1_public_key, value)? + } + ValueKind::EcdsaSecp256k1Signature => { + visit!(visitors, visit_ecdsa_secp256k1_signature, value)? + } + ValueKind::EddsaEd25519PublicKey => { + visit!(visitors, visit_eddsa_ed25519_public_key, value)? + } + ValueKind::EddsaEd25519Signature => visit!(visitors, visit_eddsa_ed25519_signature, value)?, + + ValueKind::Bucket => visit!(visitors, visit_bucket, value)?, + ValueKind::Proof => visit!(visitors, visit_proof, value)?, + + ValueKind::NonFungibleLocalId => visit!(visitors, visit_non_fungible_local_id, value)?, + ValueKind::NonFungibleGlobalId => visit!(visitors, visit_non_fungible_global_id, value)?, + + ValueKind::Expression => visit!(visitors, visit_expression, value)?, + ValueKind::Blob => visit!(visitors, visit_blob, value)?, + ValueKind::Bytes => visit!(visitors, visit_bytes, value)?, + }; + + // Attempt to continue traversal on the value children (contained nested values). For future + // reference, any variant that has a `Value` inside of it should go here. + match value { + Value::Map { + entries: values, .. + } => { + values + .iter_mut() + .flat_map(|(x, y)| [x, y]) + .map(|value| traverse_value(value, visitors)) + .collect::>>()?; + } + Value::Enum { + fields: Some(values), + .. + } + | Value::Array { + elements: values, .. + } + | Value::Tuple { + elements: values, .. + } => { + values + .iter_mut() + .map(|value| traverse_value(value, visitors)) + .collect::>>()?; + } + Value::Some { value } | Value::Ok { value } | Value::Err { value } => { + traverse_value(value, visitors)?; + } + Value::Bool { .. } + | Value::U8 { .. } + | Value::U16 { .. } + | Value::U32 { .. } + | Value::U64 { .. } + | Value::U128 { .. } + | Value::I8 { .. } + | Value::I16 { .. } + | Value::I32 { .. } + | Value::I64 { .. } + | Value::I128 { .. } + | Value::String { .. } + | Value::Enum { fields: None, .. } + | Value::None { .. } + | Value::Decimal { .. } + | Value::PreciseDecimal { .. } + | Value::Own { .. } + | Value::ComponentAddress { .. } + | Value::ResourceAddress { .. } + | Value::PackageAddress { .. } + | Value::Hash { .. } + | Value::EcdsaSecp256k1PublicKey { .. } + | Value::EcdsaSecp256k1Signature { .. } + | Value::EddsaEd25519PublicKey { .. } + | Value::EddsaEd25519Signature { .. } + | Value::Bucket { .. } + | Value::Proof { .. } + | Value::NonFungibleLocalId { .. } + | Value::NonFungibleGlobalId { .. } + | Value::Expression { .. } + | Value::Blob { .. } + | Value::Bytes { .. } => { /* No OP. Doesn't contain a Value */ } + }; + + Ok(()) +} diff --git a/radix-engine-toolkit/tests/aliasing.rs b/radix-engine-toolkit/tests/aliasing.rs new file mode 100644 index 00000000..cf0badc2 --- /dev/null +++ b/radix-engine-toolkit/tests/aliasing.rs @@ -0,0 +1,101 @@ +use radix_engine_toolkit::{ + model::Value, traverse_value, NonFungibleGlobalId, ValueAliasingVisitor, ValueKind, +}; + +#[test] +fn aliasing_of_deeply_nested_structures_works() { + // Arrange + let mut value = Value::Map { + key_value_kind: ValueKind::String, + value_value_kind: ValueKind::Tuple, + entries: vec![ + ( + Value::String { + value: "HelloWorld".into(), + }, + Value::Tuple { + elements: vec![ + Value::Decimal { + value: "12".parse().unwrap(), + }, + Value::PreciseDecimal { + value: "12".parse().unwrap(), + }, + ], + }, + ), + ( + Value::String { + value: "WorldHello".into(), + }, + Value::Tuple { + elements: vec![Value::Tuple { + elements: vec![Value::Tuple { + elements: vec![Value::Array { + element_kind: ValueKind::Array, + elements: vec![Value::Array { + element_kind: ValueKind::Tuple, + elements: vec![Value::Tuple { elements: vec![ + Value::ResourceAddress { address: "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety".parse().unwrap() }, + Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::Integer(1) } , + ] }], + }], + }], + }], + }], + }, + ), + ], + }; + + let expected = Value::Map { + key_value_kind: ValueKind::String, + value_value_kind: ValueKind::Tuple, + entries: vec![ + ( + Value::String { + value: "HelloWorld".into(), + }, + Value::Tuple { + elements: vec![ + Value::Decimal { + value: "12".parse().unwrap(), + }, + Value::PreciseDecimal { + value: "12".parse().unwrap(), + }, + ], + }, + ), + ( + Value::String { + value: "WorldHello".into(), + }, + Value::Tuple { + elements: vec![Value::Tuple { + elements: vec![Value::Tuple { + elements: vec![Value::Array { + element_kind: ValueKind::Array, + elements: vec![Value::Array { + element_kind: ValueKind::Tuple, + elements: vec![Value::NonFungibleGlobalId { address: NonFungibleGlobalId { + resource_address: "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety".parse().unwrap(), + non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::Integer(1) + } }], + }], + }], + }], + }], + }, + ), + ], + }; + + let mut visitor = ValueAliasingVisitor::default(); + + // Act + traverse_value(&mut value, &mut [&mut visitor]).unwrap(); + + // Assert + assert_eq!(expected, value) +} diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index 6928a8f0..4ea95a71 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -2687,22 +2687,8 @@ This document contains examples and descriptions of the different requests and r "value": "Hello World!" }, { - "type": "Array", - "element_kind": "Decimal", - "elements": [ - { - "type": "Decimal", - "value": "20" - }, - { - "type": "Decimal", - "value": "100" - }, - { - "type": "Decimal", - "value": "192.31" - } - ] + "type": "Bytes", + "value": "" } ] } @@ -2816,16 +2802,18 @@ This document contains examples and descriptions of the different requests and r ```json { - "type": "NonFungibleGlobalId", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqshxgp7h" - }, - "non_fungible_local_id": { - "type": "NonFungibleLocalId", - "value": { - "type": "Bytes", - "value": "02cc806dddfd673d994986293a997a50e8c10d95443beb52b06e" + "non_fungible_global_id": { + "type": "NonFungibleGlobalId", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqshxgp7h" + }, + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "02cc806dddfd673d994986293a997a50e8c10d95443beb52b06e" + } } } } diff --git a/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json b/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json index 98ea601a..c135993f 100644 --- a/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json +++ b/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json @@ -3,865 +3,20 @@ "title": "DeriveNonFungibleGlobalIdFromPublicKeyResponse", "description": "The response from [`DeriveNonFungibleGlobalIdFromPublicKeyRequest`].", "type": "object", - "oneOf": [ - { - "description": "A boolean value which can either be true or false", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bool" - ] - }, - "value": { - "type": "boolean" - } - } - }, - { - "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "An 8-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A type representing a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", - "type": "object", - "required": [ - "type", - "variant" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Enum" - ] - }, - "variant": { - "description": "The name of the variant of the enum", - "allOf": [ - { - "$ref": "#/definitions/EnumDiscriminator" - } - ] - }, - "fields": { - "description": "Optional fields that the enum may have", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "The `Some` case of Rust Options where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Some" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `None` case of Rust Options where there is value", - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - } - }, - { - "description": "The `Ok` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Ok" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `Err` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Err" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "An array values of a single value kind", - "type": "object", - "required": [ - "element_kind", - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Array" - ] - }, - "element_kind": { - "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "elements": { - "description": "The elements of the array which may contain 0 or more elements.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", - "type": "object", - "required": [ - "entries", - "key_value_kind", - "type", - "value_value_kind" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Map" - ] - }, - "key_value_kind": { - "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "value_value_kind": { - "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "entries": { - "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", - "type": "array", - "items": { - "type": "array", - "items": [ - { - "$ref": "#/definitions/Value" - }, - { - "$ref": "#/definitions/Value" - } - ], - "maxItems": 2, - "minItems": 2 - } - } - } - }, - { - "description": "An array of elements where elements could be of different kinds.", - "type": "object", - "required": [ - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Tuple" - ] - }, - "elements": { - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Decimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PreciseDecimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] - }, - "value": { - "$ref": "#/definitions/Own" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ComponentAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ResourceAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PackageAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Hash" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "identifier": { - "$ref": "#/definitions/BucketId" - } - } - }, - { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" - } - } - }, - { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] - }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" - } - } - }, - { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", - "type": "object", - "required": [ - "non_fungible_local_id", - "resource_address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleGlobalId" - ] - }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Expression" - ] - }, - "value": { - "$ref": "#/definitions/Expression" - } - } - }, - { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Blob" - ] - }, - "hash": { - "$ref": "#/definitions/Blob" - } - } - }, - { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string" - } - } - } + "required": [ + "non_fungible_global_id" ], - "definitions": { - "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", - "oneOf": [ - { - "type": "object", - "required": [ - "discriminator", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "discriminator": { - "description": "A string discriminator of the fully qualified well-known enum name", - "type": "string" - } - } - }, + "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": [ { - "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]+" - } - } + "$ref": "#/definitions/Value" } ] - }, + } + }, + "definitions": { "Value": { "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", "oneOf": [ @@ -1679,6 +834,50 @@ } ] }, + "EnumDiscriminator": { + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ + { + "type": "object", + "required": [ + "discriminator", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "discriminator": { + "description": "A string discriminator of the fully qualified well-known enum name", + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "discriminator", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "discriminator": { + "description": "An 8-bit unsigned integer serialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } + } + ] + }, "ValueKind": { "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", From 13f9011cecb0640a5beac2ea6b064eb91689309d Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 8 Feb 2023 16:52:46 +0300 Subject: [PATCH 106/110] Removed leftover methods --- radix-engine-toolkit/src/model/value.rs | 72 ------------------------- radix-engine-toolkit/tests/value.rs | 11 ++-- 2 files changed, 8 insertions(+), 75 deletions(-) diff --git a/radix-engine-toolkit/src/model/value.rs b/radix-engine-toolkit/src/model/value.rs index 028ccba2..56facec0 100644 --- a/radix-engine-toolkit/src/model/value.rs +++ b/radix-engine-toolkit/src/model/value.rs @@ -1217,78 +1217,6 @@ impl Value { }, } } - - /// Handles the aliasing of certain [`Value`] kinds such as [`Value::NonFungibleGlobalId`]. This - /// is typically used during request post processing to ensure that all responses include - /// aliased values - pub fn alias(&mut self) { - match self { - Self::Tuple { ref elements } => { - // Case: NonFungibleGlobalId - A tuple of ResourceAddress and NonFungibleLocalId - match (elements.get(0), elements.get(1)) { - ( - Some(Value::ResourceAddress { - address: resource_address, - }), - Some(Value::NonFungibleLocalId { - value: non_fungible_local_id, - }), - ) if elements.len() == 2 => { - *self = Value::NonFungibleGlobalId { - address: NonFungibleGlobalId { - resource_address: *resource_address, - non_fungible_local_id: non_fungible_local_id.clone(), - }, - }; - } - _ => {} - } - } - // Case: Bytes - An array of bytes - Self::Array { - element_kind: ValueKind::U8, - elements, - } => { - let mut bytes = Vec::new(); - for element in elements.iter() { - match element { - Value::U8 { value } => bytes.push(*value), - _ => break, - } - } - *self = Value::Bytes { value: bytes } - } - _ => {} - } - } - - /// Top-level method for performing [`Value`] validation. - pub fn validate(&self, network_id: Option) -> Result<()> { - if let Some(network_id) = network_id { - self.validate_network(network_id)? - } - Ok(()) - } - - /// Validates the network of all network aware types against a given network id - fn validate_network(&self, expected_network_id: u8) -> Result<()> { - let found_network_id = match self { - Self::ComponentAddress { address } => address.network_id, - Self::PackageAddress { address } => address.network_id, - Self::ResourceAddress { address } => address.network_id, - Self::NonFungibleGlobalId { address } => address.resource_address.network_id, - _ => return Ok(()), - }; - - if found_network_id == expected_network_id { - Ok(()) - } else { - Err(Error::NetworkMismatchError { - found: found_network_id, - expected: expected_network_id, - }) - } - } } impl From for ast::Type { diff --git a/radix-engine-toolkit/tests/value.rs b/radix-engine-toolkit/tests/value.rs index 7ffa92a1..ae16a6d6 100644 --- a/radix-engine-toolkit/tests/value.rs +++ b/radix-engine-toolkit/tests/value.rs @@ -19,7 +19,7 @@ mod test_vector; use radix_engine_toolkit::{ model::{Bech32Coder, TransientIdentifier, Value}, - BucketId, ProofId, + traverse_value, BucketId, ProofId, ValueAliasingVisitor, }; use scrypto::prelude::*; pub use test_vector::*; @@ -178,7 +178,7 @@ fn no_information_is_lost_when_converting_value_to_scrypto_value_and_back() { .expect("Value -> AstValue conversion of trusted value failed"), bech32_coder.network_id(), ); - ast_value.alias(); + alias(&mut ast_value).unwrap(); // Assert assert_eq!(*expected_value, ast_value) @@ -251,9 +251,14 @@ fn sbor_decoding_value_yields_expected_result() { // Act let mut value = Value::decode(encoded_value, 0xf2).expect("Failed to SBOR decode trusted value"); - value.alias(); + alias(&mut value).unwrap(); // Assert assert_eq!(*expected_value, value) } } + +fn alias(value: &mut Value) -> radix_engine_toolkit::Result<()> { + let mut visitor = ValueAliasingVisitor::default(); + traverse_value(value, &mut [&mut visitor]) +} From b6a13585dcab834ac9c9186cd13677878d0fd89e Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 8 Feb 2023 16:55:00 +0300 Subject: [PATCH 107/110] Update Scrypto dependency --- radix-engine-toolkit/Cargo.toml | 10 +++++----- schema/Cargo.toml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index 50a9a2e2..ba8069d5 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -16,11 +16,11 @@ schemars = { version = "0.8.11", features = ["preserve_order"] } serializable = { path = "../serializable" } # Scrypto dependencies required for the core-toolkit -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1" } +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729" } # Hex is used for the internal hex encoding and decoding of values - serde_with::Hex is used for the # hex representation during serialization. diff --git a/schema/Cargo.toml b/schema/Cargo.toml index ac409a5e..23602b53 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -15,8 +15,8 @@ radix-engine-toolkit = { path = "../radix-engine-toolkit" } serde = "1.0.152" convert_case = "0.6.0" -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-1a8cfa1" } \ No newline at end of file +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729" } \ No newline at end of file From 2f6f02f513f80839300e1096ada7f19d826836ce Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 8 Feb 2023 16:55:56 +0300 Subject: [PATCH 108/110] restore flatten --- ..._non_fungible_global_id_from_public_key.rs | 1 + schema/out/examples/request-examples.md | 40 +- ...le_global_id_from_public_key_response.json | 909 ++++++++++++++++-- 3 files changed, 882 insertions(+), 68 deletions(-) diff --git a/radix-engine-toolkit/src/request/derive_non_fungible_global_id_from_public_key.rs b/radix-engine-toolkit/src/request/derive_non_fungible_global_id_from_public_key.rs index 545bac0a..85cb7f21 100644 --- a/radix-engine-toolkit/src/request/derive_non_fungible_global_id_from_public_key.rs +++ b/radix-engine-toolkit/src/request/derive_non_fungible_global_id_from_public_key.rs @@ -45,6 +45,7 @@ pub struct DeriveNonFungibleGlobalIdFromPublicKeyRequest { pub struct DeriveNonFungibleGlobalIdFromPublicKeyResponse { /// The non-fungible global id of the virtual badge associated with the given public key. The /// underlying type of this is a `NonFungibleGlobalId` from the `Value` model. + #[serde(flatten)] // TODO: Remove after betanet v2 #[schemars(with = "crate::model::Value")] #[serde_as(as = "serde_with::TryFromInto")] pub non_fungible_global_id: NonFungibleGlobalId, diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index 4ea95a71..6928a8f0 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -2687,8 +2687,22 @@ This document contains examples and descriptions of the different requests and r "value": "Hello World!" }, { - "type": "Bytes", - "value": "" + "type": "Array", + "element_kind": "Decimal", + "elements": [ + { + "type": "Decimal", + "value": "20" + }, + { + "type": "Decimal", + "value": "100" + }, + { + "type": "Decimal", + "value": "192.31" + } + ] } ] } @@ -2802,18 +2816,16 @@ This document contains examples and descriptions of the different requests and r ```json { - "non_fungible_global_id": { - "type": "NonFungibleGlobalId", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqshxgp7h" - }, - "non_fungible_local_id": { - "type": "NonFungibleLocalId", - "value": { - "type": "Bytes", - "value": "02cc806dddfd673d994986293a997a50e8c10d95443beb52b06e" - } + "type": "NonFungibleGlobalId", + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqshxgp7h" + }, + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "02cc806dddfd673d994986293a997a50e8c10d95443beb52b06e" } } } diff --git a/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json b/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json index c135993f..98ea601a 100644 --- a/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json +++ b/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json @@ -3,20 +3,865 @@ "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": [ - { + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The name of the variant of the enum", + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { "$ref": "#/definitions/Value" } - ] + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Value", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "An array values of a single value kind", + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Value" + }, + { + "$ref": "#/definitions/Value" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/Value" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + }, + "value": { + "$ref": "#/definitions/Own" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Hash" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EcdsaSecp256k1Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 130, + "minLength": 130, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "public_key", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519PublicKey" + ] + }, + "public_key": { + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "type": "object", + "required": [ + "signature", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "EddsaEd25519Signature" + ] + }, + "signature": { + "type": "string", + "maxLength": 128, + "minLength": 128, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "identifier": { + "$ref": "#/definitions/BucketId" + } + } + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + "value": { + "$ref": "#/definitions/NonFungibleLocalId" + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "type": "object", + "required": [ + "non_fungible_local_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] + }, + "resource_address": { + "$ref": "#/definitions/Value" + }, + "non_fungible_local_id": { + "$ref": "#/definitions/Value" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } } - }, + ], "definitions": { + "EnumDiscriminator": { + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "oneOf": [ + { + "type": "object", + "required": [ + "discriminator", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "discriminator": { + "description": "A string discriminator of the fully qualified well-known enum name", + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "discriminator", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "discriminator": { + "description": "An 8-bit unsigned integer serialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } + } + ] + }, "Value": { "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", "oneOf": [ @@ -834,50 +1679,6 @@ } ] }, - "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", - "oneOf": [ - { - "type": "object", - "required": [ - "discriminator", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "discriminator": { - "description": "A string discriminator of the fully qualified well-known enum name", - "type": "string" - } - } - }, - { - "type": "object", - "required": [ - "discriminator", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] - }, - "discriminator": { - "description": "An 8-bit unsigned integer serialized as a string.", - "type": "string", - "pattern": "[0-9]+" - } - } - } - ] - }, "ValueKind": { "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", "type": "string", From 335fdc5547ba86f8d0fc2a1a35dd9e84409c78a0 Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 8 Feb 2023 16:58:43 +0300 Subject: [PATCH 109/110] minor fix --- .../src/visitor/value/aliasing_visitor.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/radix-engine-toolkit/src/visitor/value/aliasing_visitor.rs b/radix-engine-toolkit/src/visitor/value/aliasing_visitor.rs index 98f5d99d..769a9abb 100644 --- a/radix-engine-toolkit/src/visitor/value/aliasing_visitor.rs +++ b/radix-engine-toolkit/src/visitor/value/aliasing_visitor.rs @@ -1,6 +1,7 @@ use super::ValueVisitor; use crate::error::Error; use crate::model::{NonFungibleGlobalId, Value}; +use crate::ValueKind; /// 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) @@ -39,17 +40,25 @@ impl ValueVisitor for ValueAliasingVisitor { } fn visit_array(&mut self, value: &mut crate::Value) -> crate::Result<()> { - if let Value::Array { ref elements, .. } = value { + if let Value::Array { + ref elements, + element_kind: ValueKind::U8, + } = value + { // Case: Bytes - An array of u8 let mut bytes = Vec::new(); for element in elements.iter() { match element { Value::U8 { value } => bytes.push(*value), + // If we encounter anything that is not a U8, then we stop the aliasing op and + // don't continue. _ => return Ok(()), } } *value = Value::Bytes { value: bytes }; Ok(()) + } else if let Value::Array { .. } = value { + Ok(()) } else { Err(Error::Infallible { message: "Must be an array!".into(), From d6dbcead25e6e7cc2fb229e3b1ef79ea6371f423 Mon Sep 17 00:00:00 2001 From: Omar Date: Mon, 13 Feb 2023 16:59:16 +0300 Subject: [PATCH 110/110] Update to betanet-v2-da72287e6 --- radix-engine-toolkit/Cargo.toml | 10 ++--- radix-engine-toolkit/src/error.rs | 9 ++++ .../model/address/non_fungible_local_id.rs | 44 +++++++++++++------ radix-engine-toolkit/src/model/value.rs | 2 +- radix-engine-toolkit/tests/aliasing.rs | 5 ++- .../tests/test_vector/instruction.rs | 12 ++--- .../tests/test_vector/value.rs | 21 +++++---- schema/Cargo.toml | 10 ++--- 8 files changed, 72 insertions(+), 41 deletions(-) diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index ba8069d5..c76e1fac 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -16,11 +16,11 @@ schemars = { version = "0.8.11", features = ["preserve_order"] } serializable = { path = "../serializable" } # Scrypto dependencies required for the core-toolkit -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729" } +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6" } # Hex is used for the internal hex encoding and decoding of values - serde_with::Hex is used for the # hex representation during serialization. diff --git a/radix-engine-toolkit/src/error.rs b/radix-engine-toolkit/src/error.rs index 340732aa..f478599c 100644 --- a/radix-engine-toolkit/src/error.rs +++ b/radix-engine-toolkit/src/error.rs @@ -149,6 +149,12 @@ pub enum Error { /// 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 // ========= @@ -199,6 +205,9 @@ generate_from_error!(std::str::Utf8Error as InvalidRequestString); generate_from_error!( native_transaction::manifest::generator::GeneratorError as ManifestGenerationError ); +generate_from_error!( + scrypto::radix_engine_interface::model::ContentValidationError as ContentValidationError +); macro_rules! impl_from_parse_error { ($($error_type: ty => $kind: ident,)*) => { diff --git a/radix-engine-toolkit/src/model/address/non_fungible_local_id.rs b/radix-engine-toolkit/src/model/address/non_fungible_local_id.rs index 44c0cf6d..404ae03c 100644 --- a/radix-engine-toolkit/src/model/address/non_fungible_local_id.rs +++ b/radix-engine-toolkit/src/model/address/non_fungible_local_id.rs @@ -15,9 +15,15 @@ // specific language governing permissions and limitations // under the License. -use scrypto::prelude::NonFungibleLocalId as ScryptoNonFungibleLocalId; +use scrypto::prelude::{ + BytesNonFungibleLocalId, IntegerNonFungibleLocalId, + NonFungibleLocalId as ScryptoNonFungibleLocalId, StringNonFungibleLocalId, + UUIDNonFungibleLocalId, +}; use serializable::serializable; +use crate::{Error, Result}; + #[serializable] #[serde(tag = "type", content = "value")] /// Represents non-fungible ids which is a discriminated union of the different types that @@ -54,24 +60,36 @@ pub enum NonFungibleLocalId { String(#[schemars(length(min = 1, max = 64))] String), } -impl From for NonFungibleLocalId { - fn from(value: ScryptoNonFungibleLocalId) -> Self { +impl TryFrom for NonFungibleLocalId { + type Error = Error; + + fn try_from(value: ScryptoNonFungibleLocalId) -> Result { match value { - ScryptoNonFungibleLocalId::Integer(value) => Self::Integer(value), - ScryptoNonFungibleLocalId::UUID(value) => Self::UUID(value), - ScryptoNonFungibleLocalId::String(value) => Self::String(value), - ScryptoNonFungibleLocalId::Bytes(value) => Self::Bytes(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 From for ScryptoNonFungibleLocalId { - fn from(value: NonFungibleLocalId) -> Self { +impl TryFrom for ScryptoNonFungibleLocalId { + type Error = Error; + + fn try_from(value: NonFungibleLocalId) -> Result { match value { - NonFungibleLocalId::Integer(value) => Self::Integer(value), - NonFungibleLocalId::UUID(value) => Self::UUID(value), - NonFungibleLocalId::String(value) => Self::String(value), - NonFungibleLocalId::Bytes(value) => Self::Bytes(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/value.rs b/radix-engine-toolkit/src/model/value.rs index 56facec0..4ab43980 100644 --- a/radix-engine-toolkit/src/model/value.rs +++ b/radix-engine-toolkit/src/model/value.rs @@ -300,7 +300,7 @@ pub enum Value { /// non-fungible ids may be. NonFungibleLocalId { #[schemars(with = "crate::NonFungibleLocalId")] - #[serde_as(as = "serde_with::FromInto")] + #[serde_as(as = "serde_with::TryFromInto")] value: NonFungibleLocalId, }, diff --git a/radix-engine-toolkit/tests/aliasing.rs b/radix-engine-toolkit/tests/aliasing.rs index cf0badc2..949fb480 100644 --- a/radix-engine-toolkit/tests/aliasing.rs +++ b/radix-engine-toolkit/tests/aliasing.rs @@ -1,6 +1,7 @@ use radix_engine_toolkit::{ model::Value, traverse_value, NonFungibleGlobalId, ValueAliasingVisitor, ValueKind, }; +use scrypto::prelude::IntegerNonFungibleLocalId; #[test] fn aliasing_of_deeply_nested_structures_works() { @@ -37,7 +38,7 @@ fn aliasing_of_deeply_nested_structures_works() { element_kind: ValueKind::Tuple, elements: vec![Value::Tuple { elements: vec![ Value::ResourceAddress { address: "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety".parse().unwrap() }, - Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::Integer(1) } , + Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)) } , ] }], }], }], @@ -80,7 +81,7 @@ fn aliasing_of_deeply_nested_structures_works() { element_kind: ValueKind::Tuple, elements: vec![Value::NonFungibleGlobalId { address: NonFungibleGlobalId { resource_address: "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety".parse().unwrap(), - non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::Integer(1) + non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)) } }], }], }], diff --git a/radix-engine-toolkit/tests/test_vector/instruction.rs b/radix-engine-toolkit/tests/test_vector/instruction.rs index d0a013e8..68b84ec2 100644 --- a/radix-engine-toolkit/tests/test_vector/instruction.rs +++ b/radix-engine-toolkit/tests/test_vector/instruction.rs @@ -286,7 +286,7 @@ lazy_static::lazy_static! { }, }, ids: vec![Value::NonFungibleLocalId { - value: scrypto::prelude::NonFungibleLocalId::Integer(1), + value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), }], into_bucket: Value::Bucket { identifier: BucketId(TransientIdentifier::String { value: "ident".into() }), @@ -410,7 +410,7 @@ lazy_static::lazy_static! { }, }, ids: vec![Value::NonFungibleLocalId { - value: scrypto::prelude::NonFungibleLocalId::Integer(1), + value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), }], }, r#" @@ -579,7 +579,7 @@ lazy_static::lazy_static! { }, }, ids: vec![Value::NonFungibleLocalId { - value: scrypto::prelude::NonFungibleLocalId::Integer(1), + value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), }], into_proof: Value::Proof { identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), @@ -819,7 +819,7 @@ lazy_static::lazy_static! { network_id: 0xf2, address: RADIX_TOKEN, }, - non_fungible_local_id: NonFungibleLocalId::Integer(1), + non_fungible_local_id: NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), }, }, }, @@ -1353,7 +1353,7 @@ lazy_static::lazy_static! { network_id: 0xf2, address: RADIX_TOKEN, }, - non_fungible_local_id: NonFungibleLocalId::Integer(1), + non_fungible_local_id: NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), }, }, initial_supply: Value::None, @@ -1468,7 +1468,7 @@ lazy_static::lazy_static! { network_id: 0xf2, address: RADIX_TOKEN, }, - non_fungible_local_id: NonFungibleLocalId::Integer(1), + non_fungible_local_id: NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), }, }, initial_supply: Value::None, diff --git a/radix-engine-toolkit/tests/test_vector/value.rs b/radix-engine-toolkit/tests/test_vector/value.rs index 6c102cd1..384d00f4 100644 --- a/radix-engine-toolkit/tests/test_vector/value.rs +++ b/radix-engine-toolkit/tests/test_vector/value.rs @@ -24,7 +24,10 @@ use native_transaction::manifest::generator::{generate_value, NameResolver}; use native_transaction::manifest::lexer::tokenize; use radix_engine_toolkit::{address::*, BucketId, ProofId, TransientIdentifier}; use radix_engine_toolkit::{Value, ValueKind}; -use scrypto::prelude::{Hash, ScryptoValue}; +use scrypto::prelude::{ + BytesNonFungibleLocalId, Hash, IntegerNonFungibleLocalId, ScryptoValue, + StringNonFungibleLocalId, UUIDNonFungibleLocalId, +}; use scrypto::runtime::ManifestBlobRef; extern crate lazy_static; @@ -346,22 +349,22 @@ lazy_static::lazy_static! { // ========================== ValueRepresentationTestVector::new( - Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::Integer(114441894733333) }, + Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(114441894733333)) }, r#"{"type": "NonFungibleLocalId", "value": {"type": "Integer", "value": "114441894733333"}}"#, "NonFungibleLocalId(\"#114441894733333#\")" ), ValueRepresentationTestVector::new( - Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::UUID(238510006928098330588051703199685491739) }, + Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::UUID(UUIDNonFungibleLocalId::new(238510006928098330588051703199685491739).unwrap()) }, r#"{"type": "NonFungibleLocalId", "value": {"type": "UUID", "value": "238510006928098330588051703199685491739"}}"#, r#"NonFungibleLocalId("{b36f5b3f-835b-406c-980f-7788d8f13c1b}")"#, ), ValueRepresentationTestVector::new( - Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::String("hello_world".into()) }, + Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::String(StringNonFungibleLocalId::new("hello_world".into()).unwrap()) }, r#"{"type": "NonFungibleLocalId", "value": {"type": "String", "value": "hello_world"}}"#, r#"NonFungibleLocalId("")"#, ), ValueRepresentationTestVector::new( - Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) }, + Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::Bytes(BytesNonFungibleLocalId::new(vec![0x10, 0xa2, 0x31, 0x01]).unwrap()) }, r#"{"type": "NonFungibleLocalId", "value": {"type": "Bytes", "value": "10a23101"}}"#, r#"NonFungibleLocalId("[10a23101]")"#, ), @@ -373,7 +376,7 @@ lazy_static::lazy_static! { network_id: 0xf2, address: scrypto::prelude::ResourceAddress::Normal([0; 26]), }, - non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::Integer(114441894733333) + non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(114441894733333)) } }, r#"{"type": "NonFungibleGlobalId", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_local_id": {"type": "NonFungibleLocalId", "value": {"type": "Integer", "value": "114441894733333"}}}"#, @@ -386,7 +389,7 @@ lazy_static::lazy_static! { network_id: 0xf2, address: scrypto::prelude::ResourceAddress::Normal([0; 26]), }, - non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::UUID(238510006928098330588051703199685491739) + non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::UUID(UUIDNonFungibleLocalId::new(238510006928098330588051703199685491739).unwrap()) } }, r#"{"type": "NonFungibleGlobalId", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_local_id": {"type": "NonFungibleLocalId", "value": {"type": "UUID", "value": "238510006928098330588051703199685491739"}}}"#, @@ -399,7 +402,7 @@ lazy_static::lazy_static! { network_id: 0xf2, address: scrypto::prelude::ResourceAddress::Normal([0; 26]), }, - non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::String("hello_world".into()) + non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::String(StringNonFungibleLocalId::new("hello_world".into()).unwrap()) } }, r#"{"type": "NonFungibleGlobalId", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_local_id": {"type": "NonFungibleLocalId", "value": {"type": "String", "value": "hello_world"}}}"#, @@ -412,7 +415,7 @@ lazy_static::lazy_static! { network_id: 0xf2, address: scrypto::prelude::ResourceAddress::Normal([0; 26]), }, - non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::Bytes(vec![0x10, 0xa2, 0x31, 0x01]) + non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::Bytes(BytesNonFungibleLocalId::new(vec![0x10, 0xa2, 0x31, 0x01]).unwrap()) } }, r#"{"type": "NonFungibleGlobalId", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_local_id": {"type": "NonFungibleLocalId", "value": {"type": "Bytes", "value": "10a23101"}}}"#, diff --git a/schema/Cargo.toml b/schema/Cargo.toml index 23602b53..aa6aaa9f 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -15,8 +15,8 @@ radix-engine-toolkit = { path = "../radix-engine-toolkit" } serde = "1.0.152" convert_case = "0.6.0" -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-c816729" } \ No newline at end of file +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6" } \ No newline at end of file

vTuL4LZWvE{i3Zsqe5}FeAOVazM?BHkXFvkP-iuALg=28<~#>^M`Gy4OfVPk z&@L<2u!2kO#_FoBW+SN>AIF)wjEIZSeRrOLReE}*ymwEwC89-x{AXP0_;>SEP&r{+ zU(e916ouKw*6hkJy^ZbLxfc61Rv#THRm{6%K;wXZ-;iXGpJ{Bb>9LTUF_ZjuktfQm zYEJJB759DAjB|zS?@(WX6Ck{7y=)M2|F2Z?r&>_^vewr@Y;wobXRz_wd!j^|O7eaF zIq@&LQ|GWD3iE}wDI|G7BaEOvq%6%IWt?w(hFI=dO=F@-BiaB*FRSbfSx;X=s@H)p zU*g;Y)c})UqgB0$nKE$s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