From dcad9cd1ab77586713a7a1af042377b37515acd0 Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Tue, 13 Feb 2024 12:26:51 +0100 Subject: [PATCH 01/13] Remove workspace, restructure folders, remove dependency on Radix crate 'transaction', bump RET version, bump Scrypto version, bump UniFFI to 0.26.0, WIP replace Github Workflows with test.yml copy pasted from RET repo. --- .github/workflows/rust.yml | 22 - .github/workflows/test.yml | 77 +++ .tarpaulin.toml | 4 +- Cargo.lock | 545 +++++++++++------- Cargo.toml | 61 +- README.md | 2 +- _typos.toml | 2 +- sargon/build.rs => build.rs | 0 sargon/Cargo.toml | 62 -- sargon/uniffi.toml | 104 ---- .../src/common => src/core}/assert_json.rs | 0 .../common => src/core}/error/common_error.rs | 0 {sargon/src/common => src/core}/error/mod.rs | 0 .../common => src/core}/has_placeholder.rs | 0 {sargon/src/common => src/core}/hash.rs | 0 {sargon/src/common => src/core}/mod.rs | 0 .../core}/secure_random_bytes.rs | 0 .../common => src/core}/types/bag_of_bytes.rs | 0 .../src/common => src/core}/types/decimal.rs | 64 +- .../common => src/core}/types/entity_kind.rs | 0 .../common => src/core}/types/hex_32bytes.rs | 0 .../core/types}/identified_vec_via.rs | 0 .../core}/types/keys/ed25519/mod.rs | 0 .../core}/types/keys/ed25519/private_key.rs | 21 +- .../core}/types/keys/ed25519/public_key.rs | 37 +- .../core}/types/keys/is_private_key.rs | 0 .../core}/types/keys/is_public_key.rs | 0 .../src/common => src/core}/types/keys/mod.rs | 0 .../core}/types/keys/private_key.rs | 0 .../core}/types/keys/public_key.rs | 18 +- .../core}/types/keys/secp256k1/mod.rs | 0 .../core}/types/keys/secp256k1/private_key.rs | 20 +- .../core}/types/keys/secp256k1/public_key.rs | 38 +- .../core}/types/keys/slip10_curve.rs | 0 .../core}/types/logged_result.rs | 0 {sargon/src/common => src/core}/types/mod.rs | 2 + .../common => src/core}/types/safe_to_log.rs | 0 .../common => src/core}/unsafe_id_stepper.rs | 0 .../src/common => src/core}/utils/factory.rs | 0 .../common => src/core}/utils/logged_panic.rs | 0 {sargon/src/common => src/core}/utils/mod.rs | 0 .../common => src/core}/utils/string_utils.rs | 0 .../bip32/hd_path.rs | 0 .../bip32/hd_path_component.rs | 0 .../hierarchical_deterministic/bip32/mod.rs | 0 .../bip39/bip39_passphrase.rs | 0 .../bip39/bip39_word/bip39_language.rs | 0 .../bip39/bip39_word/bip39_word.rs | 0 .../bip39/bip39_word/mod.rs | 0 .../bip39/bip39_word/u11.rs | 0 .../bip39/bip39_word_count.rs | 0 .../bip39/mnemonic.rs | 0 .../hierarchical_deterministic/bip39/mod.rs | 0 .../hierarchical_deterministic/bip44/bip44.rs | 0 .../bip44/bip44_like_path.rs | 0 .../hierarchical_deterministic/bip44/mod.rs | 0 .../cap26/cap26_entity_kind.rs | 0 .../cap26/cap26_key_kind.rs | 0 .../cap26/cap26_path/cap26_path.rs | 0 .../cap26/cap26_path/mod.rs | 0 .../cap26/cap26_path/paths/account_path.rs | 0 .../cap26/cap26_path/paths/getid_path.rs | 0 .../cap26/cap26_path/paths/identity_path.rs | 0 .../cap26/cap26_path/paths/is_entity_path.rs | 0 .../cap26/cap26_path/paths/mod.rs | 0 .../cap26/entity_cap26_path.rs | 0 .../hierarchical_deterministic/cap26/mod.rs | 0 .../derivation/derivation.rs | 0 .../derivation/derivation_path.rs | 0 .../derivation/derivation_path_scheme.rs | 0 .../hierarchical_deterministic_private_key.rs | 0 .../hierarchical_deterministic_public_key.rs | 0 .../derivation/mnemonic_with_passphrase.rs | 0 .../derivation/mod.rs | 0 .../hierarchical_deterministic/mod.rs | 0 {sargon/src => src}/lib.rs | 14 +- {sargon/src => src/profile}/logic/mod.rs | 0 .../profile}/logic/profile_next_derivation.rs | 0 src/profile/mod.rs | 7 + .../profile}/profilesnapshot_version.rs | 0 .../profile}/v100/address/account_address.rs | 0 .../v100/address/decode_address_helper.rs | 4 +- .../profile}/v100/address/entity_address.rs | 41 +- .../profile}/v100/address/identity_address.rs | 8 +- .../src => src/profile}/v100/address/mod.rs | 0 .../v100/address/non_fungible_global_id.rs | 40 +- .../v100/address/non_fungible_local_id.rs | 59 +- .../profile}/v100/address/resource_address.rs | 0 .../app_display_fiat_currency.rs | 0 .../app_display_settings.rs | 0 .../app_display_settings/mod.rs | 0 .../v100/app_preferences/app_preferences.rs | 0 .../v100/app_preferences/gateways/gateway.rs | 0 .../v100/app_preferences/gateways/gateways.rs | 0 .../v100/app_preferences/gateways/mod.rs | 0 .../gateways/network_definition.rs | 0 .../profile}/v100/app_preferences/mod.rs | 0 .../v100/app_preferences/p2p_links/mod.rs | 0 .../app_preferences/p2p_links/p2p_link.rs | 0 .../app_preferences/p2p_links/p2p_links.rs | 0 .../p2p_links/radix_connect_password.rs | 0 .../profile}/v100/app_preferences/security.rs | 0 .../transaction_preferences.rs | 0 .../v100/entity/abstract_entity_type.rs | 12 +- .../profile}/v100/entity/account/account.rs | 17 +- .../v100/entity/account/appearance_id.rs | 0 .../profile}/v100/entity/account/mod.rs | 0 .../entity/account/on_ledger_settings/mod.rs | 0 .../on_ledger_settings/on_ledger_settings.rs | 0 .../third_party_deposits/asset_exception.rs | 0 .../deposit_address_exception_rule.rs | 0 .../third_party_deposits/deposit_rule.rs | 0 .../third_party_deposits/mod.rs | 0 .../resource_or_non_fungible.rs | 0 .../third_party_deposits.rs | 0 .../profile}/v100/entity/display_name.rs | 0 .../profile}/v100/entity/entity_flag.rs | 0 .../profile}/v100/entity/entity_flags.rs | 0 .../src => src/profile}/v100/entity/mod.rs | 0 .../profile}/v100/entity/persona/mod.rs | 0 .../profile}/v100/entity/persona/persona.rs | 0 .../persona/persona_data/entry_kinds/mod.rs | 0 .../persona_data_entry_email_address.rs | 0 .../entry_kinds/persona_data_entry_name.rs | 0 .../persona_data_entry_phone_number.rs | 0 .../v100/entity/persona/persona_data/mod.rs | 0 .../persona/persona_data/persona_data.rs | 0 .../persona_data/persona_data_entry_id.rs | 0 ...ersona_data_identified_collection_types.rs | 0 .../persona_data_identified_entry_types.rs | 0 .../entity_security_state.rs | 0 .../v100/entity_security_state/mod.rs | 0 .../unsecured_entity_control.rs | 0 .../factor_instance/badge_virtual_source.rs | 0 .../factor_instance/factor_instance.rs | 0 .../factor_instance/factor_instance_badge.rs | 0 .../v100/factors/factor_instance/mod.rs | 0 ...rarchical_deterministic_factor_instance.rs | 0 .../profile}/v100/factors/factor_source.rs | 0 .../v100/factors/factor_source_common.rs | 0 .../factor_source_crypto_parameters.rs | 0 .../v100/factors/factor_source_flag.rs | 0 .../profile}/v100/factors/factor_source_id.rs | 0 .../factors/factor_source_id_from_address.rs | 0 .../factors/factor_source_id_from_hash.rs | 0 .../v100/factors/factor_source_kind.rs | 0 .../device_factor_source.rs | 0 .../device_factor_source_hint.rs | 0 .../device_factor_source/mod.rs | 0 .../wallet_client_model.rs | 0 .../factors/factor_sources/factor_sources.rs | 0 .../ledger_hardware_wallet_factor_source.rs | 0 .../ledger_hardware_wallet_hint.rs | 0 .../ledger_hardware_wallet_model.rs | 0 .../mod.rs | 0 .../v100/factors/factor_sources/mod.rs | 0 ...ierarchical_deterministic_factor_source.rs | 0 .../hd_transaction_signing_factor_instance.rs | 0 ...rarchical_deterministic_factor_instance.rs | 0 .../profile}/v100/factors/is_factor_source.rs | 0 .../src => src/profile}/v100/factors/mod.rs | 0 .../profile}/v100/header/content_hint.rs | 0 .../profile}/v100/header/device_info.rs | 0 .../src => src/profile}/v100/header/header.rs | 0 .../src => src/profile}/v100/header/mod.rs | 0 .../profile}/v100/header/profile_id.rs | 0 {sargon/src => src/profile}/v100/mod.rs | 0 .../src => src/profile}/v100/networks/mod.rs | 0 .../v100/networks/network/accounts.rs | 0 .../authorized_dapp/authorized_dapp.rs | 0 .../authorized_persona_simple.rs | 0 .../networks/network/authorized_dapp/mod.rs | 0 .../requested_number_quantifier.rs | 0 .../authorized_dapp/requested_quantity.rs | 0 .../authorized_dapp/shared_persona_data.rs | 0 .../authorized_dapp/shared_with_dapp.rs | 0 .../v100/networks/network/authorized_dapps.rs | 0 .../profile}/v100/networks/network/mod.rs | 0 .../v100/networks/network/network_id.rs | 30 +- .../v100/networks/network/personas.rs | 0 .../v100/networks/network/profile_network.rs | 0 .../v100/networks/profile_networks.rs | 0 {sargon/src => src/profile}/v100/profile.rs | 0 {sargon/src => src}/sargon.udl | 0 {sargon/src => src}/wallet/mod.rs | 0 .../secure_storage/always_fail_storage.rs | 0 .../ephemeral_secure_storage.rs | 0 .../src => src}/wallet/secure_storage/mod.rs | 0 .../wallet/secure_storage/secure_storage.rs | 2 +- .../secure_storage/secure_storage_key.rs | 0 .../secure_storage/wallet_client_storage.rs | 3 +- {sargon/src => src}/wallet/wallet.rs | 1 - {sargon/src => src}/wallet/wallet_accounts.rs | 0 .../src => src}/wallet/wallet_profile_io.rs | 0 .../uniffi/bindings/test_account_address.kts | 0 .../bindings/test_account_address.swift | 0 .../uniffi/bindings/test_app_preferences.kts | 0 .../bindings/test_app_preferences.swift | 0 .../uniffi/bindings/test_bag_of_bytes.kts | 0 .../uniffi/bindings/test_bag_of_bytes.swift | 0 .../uniffi/bindings/test_factor_sources.kts | 0 .../uniffi/bindings/test_factor_sources.swift | 0 .../uniffi/bindings/test_gateways.kts | 0 .../uniffi/bindings/test_gateways.swift | 0 .../uniffi/bindings/test_header.kts | 0 .../uniffi/bindings/test_header.swift | 0 .../uniffi/bindings/test_hex32_bytes.kts | 0 .../uniffi/bindings/test_hex32_bytes.swift | 0 .../uniffi/bindings/test_keys.kts | 0 .../uniffi/bindings/test_keys.swift | 0 .../bindings/test_non_fungible_local_id.kts | 0 .../bindings/test_non_fungible_local_id.swift | 0 .../uniffi/bindings/test_profile.kts | 0 .../uniffi/bindings/test_profile.swift | 0 .../bindings/test_radix_connect_password.kts | 0 .../test_radix_connect_password.swift | 0 .../uniffi/bindings/test_resource_address.kts | 0 .../bindings/test_resource_address.swift | 0 .../uniffi/bindings/test_wallet.kts | 0 .../uniffi/bindings/test_wallet.swift | 0 {sargon/tests => tests}/uniffi/main.rs | 0 .../vectors/fixtures/bip44_secp256k1.json | 0 .../vectors/fixtures/cap26_curve25519.json | 0 .../vectors/fixtures/cap26_secp256k1.json | 0 ...laintext_profile_snapshot_version_100.json | 0 .../vectors/fixtures/slip10_tests_#10.json | 0 .../vectors/fixtures/slip10_tests_#1000.json | 0 {sargon/tests => tests}/vectors/main.rs | 0 uniffi.toml | 53 ++ 229 files changed, 709 insertions(+), 661 deletions(-) delete mode 100644 .github/workflows/rust.yml create mode 100644 .github/workflows/test.yml rename sargon/build.rs => build.rs (100%) delete mode 100644 sargon/Cargo.toml delete mode 100644 sargon/uniffi.toml rename {sargon/src/common => src/core}/assert_json.rs (100%) rename {sargon/src/common => src/core}/error/common_error.rs (100%) rename {sargon/src/common => src/core}/error/mod.rs (100%) rename {sargon/src/common => src/core}/has_placeholder.rs (100%) rename {sargon/src/common => src/core}/hash.rs (100%) rename {sargon/src/common => src/core}/mod.rs (100%) rename {sargon/src/common => src/core}/secure_random_bytes.rs (100%) rename {sargon/src/common => src/core}/types/bag_of_bytes.rs (100%) rename {sargon/src/common => src/core}/types/decimal.rs (83%) rename {sargon/src/common => src/core}/types/entity_kind.rs (100%) rename {sargon/src/common => src/core}/types/hex_32bytes.rs (100%) rename {sargon/src => src/core/types}/identified_vec_via.rs (100%) rename {sargon/src/common => src/core}/types/keys/ed25519/mod.rs (100%) rename {sargon/src/common => src/core}/types/keys/ed25519/private_key.rs (92%) rename {sargon/src/common => src/core}/types/keys/ed25519/public_key.rs (89%) rename {sargon/src/common => src/core}/types/keys/is_private_key.rs (100%) rename {sargon/src/common => src/core}/types/keys/is_public_key.rs (100%) rename {sargon/src/common => src/core}/types/keys/mod.rs (100%) rename {sargon/src/common => src/core}/types/keys/private_key.rs (100%) rename {sargon/src/common => src/core}/types/keys/public_key.rs (95%) rename {sargon/src/common => src/core}/types/keys/secp256k1/mod.rs (100%) rename {sargon/src/common => src/core}/types/keys/secp256k1/private_key.rs (92%) rename {sargon/src/common => src/core}/types/keys/secp256k1/public_key.rs (88%) rename {sargon/src/common => src/core}/types/keys/slip10_curve.rs (100%) rename {sargon/src/common => src/core}/types/logged_result.rs (100%) rename {sargon/src/common => src/core}/types/mod.rs (83%) rename {sargon/src/common => src/core}/types/safe_to_log.rs (100%) rename {sargon/src/common => src/core}/unsafe_id_stepper.rs (100%) rename {sargon/src/common => src/core}/utils/factory.rs (100%) rename {sargon/src/common => src/core}/utils/logged_panic.rs (100%) rename {sargon/src/common => src/core}/utils/mod.rs (100%) rename {sargon/src/common => src/core}/utils/string_utils.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/bip32/hd_path.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/bip32/hd_path_component.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/bip32/mod.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/bip39/bip39_passphrase.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/bip39/bip39_word/bip39_language.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/bip39/bip39_word/bip39_word.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/bip39/bip39_word/mod.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/bip39/bip39_word/u11.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/bip39/bip39_word_count.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/bip39/mnemonic.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/bip39/mod.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/bip44/bip44.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/bip44/bip44_like_path.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/bip44/mod.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/cap26/cap26_entity_kind.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/cap26/cap26_key_kind.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/cap26/cap26_path/cap26_path.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/cap26/cap26_path/mod.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/cap26/cap26_path/paths/account_path.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/cap26/cap26_path/paths/getid_path.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/cap26/cap26_path/paths/identity_path.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/cap26/cap26_path/paths/is_entity_path.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/cap26/cap26_path/paths/mod.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/cap26/entity_cap26_path.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/cap26/mod.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/derivation/derivation.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/derivation/derivation_path.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/derivation/derivation_path_scheme.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/derivation/hierarchical_deterministic_private_key.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/derivation/hierarchical_deterministic_public_key.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/derivation/mnemonic_with_passphrase.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/derivation/mod.rs (100%) rename {sargon/src => src}/hierarchical_deterministic/mod.rs (100%) rename {sargon/src => src}/lib.rs (90%) rename {sargon/src => src/profile}/logic/mod.rs (100%) rename {sargon/src => src/profile}/logic/profile_next_derivation.rs (100%) create mode 100644 src/profile/mod.rs rename {sargon/src => src/profile}/profilesnapshot_version.rs (100%) rename {sargon/src => src/profile}/v100/address/account_address.rs (100%) rename {sargon/src => src/profile}/v100/address/decode_address_helper.rs (88%) rename {sargon/src => src/profile}/v100/address/entity_address.rs (72%) rename {sargon/src => src/profile}/v100/address/identity_address.rs (97%) rename {sargon/src => src/profile}/v100/address/mod.rs (100%) rename {sargon/src => src/profile}/v100/address/non_fungible_global_id.rs (88%) rename {sargon/src => src/profile}/v100/address/non_fungible_local_id.rs (78%) rename {sargon/src => src/profile}/v100/address/resource_address.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/app_display_settings/app_display_fiat_currency.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/app_display_settings/app_display_settings.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/app_display_settings/mod.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/app_preferences.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/gateways/gateway.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/gateways/gateways.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/gateways/mod.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/gateways/network_definition.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/mod.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/p2p_links/mod.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/p2p_links/p2p_link.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/p2p_links/p2p_links.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/p2p_links/radix_connect_password.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/security.rs (100%) rename {sargon/src => src/profile}/v100/app_preferences/transaction_preferences.rs (100%) rename {sargon/src => src/profile}/v100/entity/abstract_entity_type.rs (75%) rename {sargon/src => src/profile}/v100/entity/account/account.rs (97%) rename {sargon/src => src/profile}/v100/entity/account/appearance_id.rs (100%) rename {sargon/src => src/profile}/v100/entity/account/mod.rs (100%) rename {sargon/src => src/profile}/v100/entity/account/on_ledger_settings/mod.rs (100%) rename {sargon/src => src/profile}/v100/entity/account/on_ledger_settings/on_ledger_settings.rs (100%) rename {sargon/src => src/profile}/v100/entity/account/on_ledger_settings/third_party_deposits/asset_exception.rs (100%) rename {sargon/src => src/profile}/v100/entity/account/on_ledger_settings/third_party_deposits/deposit_address_exception_rule.rs (100%) rename {sargon/src => src/profile}/v100/entity/account/on_ledger_settings/third_party_deposits/deposit_rule.rs (100%) rename {sargon/src => src/profile}/v100/entity/account/on_ledger_settings/third_party_deposits/mod.rs (100%) rename {sargon/src => src/profile}/v100/entity/account/on_ledger_settings/third_party_deposits/resource_or_non_fungible.rs (100%) rename {sargon/src => src/profile}/v100/entity/account/on_ledger_settings/third_party_deposits/third_party_deposits.rs (100%) rename {sargon/src => src/profile}/v100/entity/display_name.rs (100%) rename {sargon/src => src/profile}/v100/entity/entity_flag.rs (100%) rename {sargon/src => src/profile}/v100/entity/entity_flags.rs (100%) rename {sargon/src => src/profile}/v100/entity/mod.rs (100%) rename {sargon/src => src/profile}/v100/entity/persona/mod.rs (100%) rename {sargon/src => src/profile}/v100/entity/persona/persona.rs (100%) rename {sargon/src => src/profile}/v100/entity/persona/persona_data/entry_kinds/mod.rs (100%) rename {sargon/src => src/profile}/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_email_address.rs (100%) rename {sargon/src => src/profile}/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_name.rs (100%) rename {sargon/src => src/profile}/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_phone_number.rs (100%) rename {sargon/src => src/profile}/v100/entity/persona/persona_data/mod.rs (100%) rename {sargon/src => src/profile}/v100/entity/persona/persona_data/persona_data.rs (100%) rename {sargon/src => src/profile}/v100/entity/persona/persona_data/persona_data_entry_id.rs (100%) rename {sargon/src => src/profile}/v100/entity/persona/persona_data/persona_data_identified_collection_types.rs (100%) rename {sargon/src => src/profile}/v100/entity/persona/persona_data/persona_data_identified_entry_types.rs (100%) rename {sargon/src => src/profile}/v100/entity_security_state/entity_security_state.rs (100%) rename {sargon/src => src/profile}/v100/entity_security_state/mod.rs (100%) rename {sargon/src => src/profile}/v100/entity_security_state/unsecured_entity_control.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_instance/badge_virtual_source.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_instance/factor_instance.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_instance/factor_instance_badge.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_instance/mod.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_instance/private_hierarchical_deterministic_factor_instance.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_source.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_source_common.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_source_crypto_parameters.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_source_flag.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_source_id.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_source_id_from_address.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_source_id_from_hash.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_source_kind.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_sources/device_factor_source/device_factor_source.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_sources/device_factor_source/device_factor_source_hint.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_sources/device_factor_source/mod.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_sources/device_factor_source/wallet_client_model.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_sources/factor_sources.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_factor_source.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_hint.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_model.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/mod.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_sources/mod.rs (100%) rename {sargon/src => src/profile}/v100/factors/factor_sources/private_hierarchical_deterministic_factor_source.rs (100%) rename {sargon/src => src/profile}/v100/factors/hd_transaction_signing_factor_instance.rs (100%) rename {sargon/src => src/profile}/v100/factors/hierarchical_deterministic_factor_instance.rs (100%) rename {sargon/src => src/profile}/v100/factors/is_factor_source.rs (100%) rename {sargon/src => src/profile}/v100/factors/mod.rs (100%) rename {sargon/src => src/profile}/v100/header/content_hint.rs (100%) rename {sargon/src => src/profile}/v100/header/device_info.rs (100%) rename {sargon/src => src/profile}/v100/header/header.rs (100%) rename {sargon/src => src/profile}/v100/header/mod.rs (100%) rename {sargon/src => src/profile}/v100/header/profile_id.rs (100%) rename {sargon/src => src/profile}/v100/mod.rs (100%) rename {sargon/src => src/profile}/v100/networks/mod.rs (100%) rename {sargon/src => src/profile}/v100/networks/network/accounts.rs (100%) rename {sargon/src => src/profile}/v100/networks/network/authorized_dapp/authorized_dapp.rs (100%) rename {sargon/src => src/profile}/v100/networks/network/authorized_dapp/authorized_persona_simple.rs (100%) rename {sargon/src => src/profile}/v100/networks/network/authorized_dapp/mod.rs (100%) rename {sargon/src => src/profile}/v100/networks/network/authorized_dapp/requested_number_quantifier.rs (100%) rename {sargon/src => src/profile}/v100/networks/network/authorized_dapp/requested_quantity.rs (100%) rename {sargon/src => src/profile}/v100/networks/network/authorized_dapp/shared_persona_data.rs (100%) rename {sargon/src => src/profile}/v100/networks/network/authorized_dapp/shared_with_dapp.rs (100%) rename {sargon/src => src/profile}/v100/networks/network/authorized_dapps.rs (100%) rename {sargon/src => src/profile}/v100/networks/network/mod.rs (100%) rename {sargon/src => src/profile}/v100/networks/network/network_id.rs (87%) rename {sargon/src => src/profile}/v100/networks/network/personas.rs (100%) rename {sargon/src => src/profile}/v100/networks/network/profile_network.rs (100%) rename {sargon/src => src/profile}/v100/networks/profile_networks.rs (100%) rename {sargon/src => src/profile}/v100/profile.rs (100%) rename {sargon/src => src}/sargon.udl (100%) rename {sargon/src => src}/wallet/mod.rs (100%) rename {sargon/src => src}/wallet/secure_storage/always_fail_storage.rs (100%) rename {sargon/src => src}/wallet/secure_storage/ephemeral_secure_storage.rs (100%) rename {sargon/src => src}/wallet/secure_storage/mod.rs (100%) rename {sargon/src => src}/wallet/secure_storage/secure_storage.rs (90%) rename {sargon/src => src}/wallet/secure_storage/secure_storage_key.rs (100%) rename {sargon/src => src}/wallet/secure_storage/wallet_client_storage.rs (99%) rename {sargon/src => src}/wallet/wallet.rs (99%) rename {sargon/src => src}/wallet/wallet_accounts.rs (100%) rename {sargon/src => src}/wallet/wallet_profile_io.rs (100%) rename {sargon/tests => tests}/uniffi/bindings/test_account_address.kts (100%) rename {sargon/tests => tests}/uniffi/bindings/test_account_address.swift (100%) rename {sargon/tests => tests}/uniffi/bindings/test_app_preferences.kts (100%) rename {sargon/tests => tests}/uniffi/bindings/test_app_preferences.swift (100%) rename {sargon/tests => tests}/uniffi/bindings/test_bag_of_bytes.kts (100%) rename {sargon/tests => tests}/uniffi/bindings/test_bag_of_bytes.swift (100%) rename {sargon/tests => tests}/uniffi/bindings/test_factor_sources.kts (100%) rename {sargon/tests => tests}/uniffi/bindings/test_factor_sources.swift (100%) rename {sargon/tests => tests}/uniffi/bindings/test_gateways.kts (100%) rename {sargon/tests => tests}/uniffi/bindings/test_gateways.swift (100%) rename {sargon/tests => tests}/uniffi/bindings/test_header.kts (100%) rename {sargon/tests => tests}/uniffi/bindings/test_header.swift (100%) rename {sargon/tests => tests}/uniffi/bindings/test_hex32_bytes.kts (100%) rename {sargon/tests => tests}/uniffi/bindings/test_hex32_bytes.swift (100%) rename {sargon/tests => tests}/uniffi/bindings/test_keys.kts (100%) rename {sargon/tests => tests}/uniffi/bindings/test_keys.swift (100%) rename {sargon/tests => tests}/uniffi/bindings/test_non_fungible_local_id.kts (100%) rename {sargon/tests => tests}/uniffi/bindings/test_non_fungible_local_id.swift (100%) rename {sargon/tests => tests}/uniffi/bindings/test_profile.kts (100%) rename {sargon/tests => tests}/uniffi/bindings/test_profile.swift (100%) rename {sargon/tests => tests}/uniffi/bindings/test_radix_connect_password.kts (100%) rename {sargon/tests => tests}/uniffi/bindings/test_radix_connect_password.swift (100%) rename {sargon/tests => tests}/uniffi/bindings/test_resource_address.kts (100%) rename {sargon/tests => tests}/uniffi/bindings/test_resource_address.swift (100%) rename {sargon/tests => tests}/uniffi/bindings/test_wallet.kts (100%) rename {sargon/tests => tests}/uniffi/bindings/test_wallet.swift (100%) rename {sargon/tests => tests}/uniffi/main.rs (100%) rename {sargon/tests => tests}/vectors/fixtures/bip44_secp256k1.json (100%) rename {sargon/tests => tests}/vectors/fixtures/cap26_curve25519.json (100%) rename {sargon/tests => tests}/vectors/fixtures/cap26_secp256k1.json (100%) rename {sargon/tests => tests}/vectors/fixtures/only_plaintext_profile_snapshot_version_100.json (100%) rename {sargon/tests => tests}/vectors/fixtures/slip10_tests_#10.json (100%) rename {sargon/tests => tests}/vectors/fixtures/slip10_tests_#1000.json (100%) rename {sargon/tests => tests}/vectors/main.rs (100%) create mode 100644 uniffi.toml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 99e515541..000000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: coverage - -on: [push] -jobs: - test: - name: coverage - runs-on: ubuntu-latest - container: - image: xd009642/tarpaulin:develop-nightly - options: --security-opt seccomp=unconfined - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Generate code coverage - run: | - cargo +nightly tarpaulin - - - name: Upload to codecov.io - uses: codecov/codecov-action@v2 - with: - fail_ci_if_error: true \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..bf47f393a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,77 @@ +# Testing CI - Runs on each PR and Push + +name: Test +on: + pull_request: + push: +env: + CARGO_TERM_COLOR: always +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2023-11-24 + default: true + components: rustfmt, clippy + - name: Install cargo nextest + uses: baptiste0928/cargo-install@v1 + with: + crate: cargo-nextest + locked: true + - name: Install cargo tarpaulin + uses: baptiste0928/cargo-install@v1 + with: + crate: cargo-tarpaulin = "0.27.3" + locked: true + - name: Install JNA + run: wget https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.13.0/jna-5.13.0.jar + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.3 + - name: Run tests + run: CLASSPATH="$PWD/jna-5.13.0.jar" cargo nextest run + env: + # Required env-var to increase the heapsize when using `kotlinc`. + JAVA_OPTS: "-Xmx8g" + # Enable sccache + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" + check-formatting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2023-11-24 + default: true + components: rustfmt + - name: Check formatting + run: cargo fmt --check + cargo-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2023-11-24 + default: true + profile: minimal + - name: Cargo Check + run: cargo check --all + clippy-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2023-11-24 + default: true + components: rustfmt, clippy + - name: Clippy Check + run: cargo clippy --all \ No newline at end of file diff --git a/.tarpaulin.toml b/.tarpaulin.toml index ad4e9a958..f68845a44 100644 --- a/.tarpaulin.toml +++ b/.tarpaulin.toml @@ -1,11 +1,9 @@ [all] exclude-files = [ - "profile/bindings/*", - "profile/tests/test_generated_bindings.rs", + "tests/*", ] verbose = false all-features = true -workspace = true timeout = "1800s" out = ["Xml"] force-clean = false diff --git a/Cargo.lock b/Cargo.lock index 7be61c912..fa325ad0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,11 +4,11 @@ version = 3 [[package]] name = "ahash" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "once_cell", "version_check", ] @@ -39,9 +39,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -53,9 +53,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "askama_derive" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ccf09143e56923c12e027b83a9553210a3c58322ed8419a53461b14a4dccd85" +checksum = "19fe8d6cb13c4714962c072ea496f3392015f0989b1a2847bb4b2d9effd71d83" dependencies = [ "askama_parser", "basic-toml", @@ -125,9 +125,9 @@ checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" [[package]] name = "askama_parser" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "262eb9cf7be51269c5f2951eeda9ccd14d6934e437457f47b4f066bf55a6770d" +checksum = "acb1161c6b64d1c3d83108213c2a2533a342ac225aabd0bda218278c2ddb00c0" dependencies = [ "nom", ] @@ -156,9 +156,9 @@ checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "basic-toml" @@ -227,9 +227,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "blake2" @@ -258,6 +258,18 @@ dependencies = [ "generic-array 0.14.7", ] +[[package]] +name = "blst" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c94087b935a822949d3291a9989ad2b2051ea141eda0fd4e478a75f6aa3e604b" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + [[package]] name = "bnum" version = "0.7.0" @@ -312,9 +324,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" +checksum = "694c8807f2ae16faecc43dc17d74b3eb042482789fd0eb64b39a2e04e087053f" dependencies = [ "serde", ] @@ -358,12 +370,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "9b918671670962b48bc23753aef0c51d072dca6f52f01f800854ada6ddb7f7d3" [[package]] name = "cesu8" @@ -379,9 +388,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", @@ -389,14 +398,14 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] name = "clap" -version = "4.4.14" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e92c5c1a78c62968ec57dbc2440366a2d6e5a23faf829970ff1585dc6b18e2" +checksum = "80c21025abd42669a92efc996ef13cfb2c5c627858421ea58d5c3b331a6c134f" dependencies = [ "clap_builder", "clap_derive", @@ -404,21 +413,21 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.14" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4323769dc8a61e2c39ad7dc26f6f2800524691a44d74fe3d1071a5c24db6370" +checksum = "458bf1f341769dfcf849846f65dffdf9146daa56bcd2a47cb4e1de9915567c99" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.11.0", ] [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck", "proc-macro2", @@ -428,9 +437,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" @@ -469,6 +478,15 @@ name = "const-sha1" version = "0.2.0" source = "git+https://github.com/radixdlt/const-sha1#5e9ae2a99e9c76e85aa67f42e4b62e7f7ce8dad4" +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation-sys" version = "0.8.6" @@ -486,33 +504,27 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.10" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82a9b73a36529d9c47029b9fb3a6f0ea3cc916a261195352ba19e770fc1748b2" +checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.17" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e3681d554572a651dda4186cd47240627c3d0114d45a95f6ad27f2f22e7548d" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.18" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crypto-bigint" @@ -561,9 +573,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.3" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8" dependencies = [ "darling_core", "darling_macro", @@ -571,23 +583,23 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.3" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.10.0", "syn 2.0.48", ] [[package]] name = "darling_macro" -version = "0.20.3" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77" dependencies = [ "darling_core", "quote", @@ -723,9 +735,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "elliptic-curve" @@ -759,18 +771,18 @@ dependencies = [ [[package]] name = "enum-iterator" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7add3873b5dd076766ee79c8e406ad1a472c385476b9e38849f8eec24f1be689" +checksum = "9fd242f399be1da0a5354aa462d57b4ab2b4ee0683cc552f7c007d2d12d36e94" dependencies = [ "enum-iterator-derive", ] [[package]] name = "enum-iterator-derive" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eecf8589574ce9b895052fa12d69af7a233f99e6107f5cb8dd1044f2a17bfdcb" +checksum = "03cdc46ec28bd728e67540c528013c6a10eb69a02eb31078a1bda695438cbfb8" dependencies = [ "proc-macro2", "quote", @@ -857,7 +869,8 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" version = "1.2.1" -source = "git+https://github.com/sajjon/rust-url?branch=uniffi#3b84444c1ac2f57c0a4d836d7667bf7e881535cf" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] @@ -904,9 +917,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -921,9 +934,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "goblin" -version = "0.6.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6b4de4a8eb6c46a8c77e1d3be942cb9a8bf073c22374578e5ba4b08ed0ff68" +checksum = "bb07a4ffed2093b118a525b1d8f5204ae274faed5604537caf7135d0f18d9887" dependencies = [ "log", "plain", @@ -970,9 +983,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" [[package]] name = "hex" @@ -1010,9 +1023,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "iana-time-zone" -version = "0.1.59" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1050,7 +1063,8 @@ dependencies = [ [[package]] name = "idna" version = "0.5.0" -source = "git+https://github.com/sajjon/rust-url?branch=uniffi#3b84444c1ac2f57c0a4d836d7667bf7e881535cf" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1078,9 +1092,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -1095,20 +1109,20 @@ checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" [[package]] name = "is-terminal" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ "hermit-abi", - "rustix", + "libc", "windows-sys 0.52.0", ] [[package]] name = "iso8601-timestamp" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa57edc7ad71119e3d501cec542b6c3552881a421ebd61a78c7bf25ebc2eb73" +checksum = "24d4e5d712dd664b11e778d1cfc06c79ba2700d6bc1771e44fb7b6a4656b487d" dependencies = [ "generic-array 1.0.0", "serde", @@ -1126,9 +1140,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -1163,18 +1177,18 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] [[package]] name = "k256" -version = "0.13.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f01b677d82ef7a676aa37e099defd83a28e15687112cafdd112d60236b6115b" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" dependencies = [ "cfg-if", "ecdsa", @@ -1182,6 +1196,36 @@ dependencies = [ "sha2 0.10.8", ] +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "kinded" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce4bdbb2f423660b19f0e9f7115182214732d8dd5f840cd0a3aee3e22562f34c" +dependencies = [ + "kinded_macros", +] + +[[package]] +name = "kinded_macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13b4ddc5dcb32f45dac3d6f606da2a52fdb9964a18427e63cd5ef6c0d13288d" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -1196,9 +1240,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libm" @@ -1208,9 +1252,9 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -1313,7 +1357,7 @@ dependencies = [ [[package]] name = "native-sdk" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "radix-engine-common", "radix-engine-derive", @@ -1343,21 +1387,26 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -1372,6 +1421,28 @@ dependencies = [ "libc", ] +[[package]] +name = "nutype" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38fd38251d275b6a3cecbf4d2f8ce83b80609f0e33e2508a8bc3a7d94401d007" +dependencies = [ + "nutype_macros", +] + +[[package]] +name = "nutype_macros" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b9dc33172cb6abafee47925b6a188f2d3c3726cb5df12f39132a53df98501d2" +dependencies = [ + "cfg-if", + "kinded", + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "once_cell" version = "1.19.0" @@ -1432,7 +1503,8 @@ dependencies = [ [[package]] name = "percent-encoding" version = "2.3.1" -source = "git+https://github.com/sajjon/rust-url?branch=uniffi#3b84444c1ac2f57c0a4d836d7667bf7e881535cf" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "plain" @@ -1474,20 +1546,20 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.76" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "pulldown-cmark" -version = "0.9.3" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" +checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "memchr", "unicase", ] @@ -1504,7 +1576,7 @@ dependencies = [ [[package]] name = "radix-engine" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "bitflags 1.3.2", "colored", @@ -1534,11 +1606,13 @@ dependencies = [ [[package]] name = "radix-engine-common" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "bech32", "blake2", + "blst", "bnum", + "ed25519-dalek", "hex", "lazy_static", "num-bigint", @@ -1547,7 +1621,9 @@ dependencies = [ "paste", "radix-engine-derive", "sbor", + "secp256k1", "serde", + "sha3", "strum 0.24.1", "utils", ] @@ -1555,7 +1631,7 @@ dependencies = [ [[package]] name = "radix-engine-derive" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "proc-macro2", "quote", @@ -1566,7 +1642,7 @@ dependencies = [ [[package]] name = "radix-engine-interface" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "bitflags 1.3.2", "const-sha1", @@ -1588,7 +1664,7 @@ dependencies = [ [[package]] name = "radix-engine-macros" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "paste", "proc-macro2", @@ -1600,7 +1676,7 @@ dependencies = [ [[package]] name = "radix-engine-profiling" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "fixedstr", ] @@ -1608,7 +1684,7 @@ dependencies = [ [[package]] name = "radix-engine-queries" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "hex", "itertools 0.10.5", @@ -1624,7 +1700,7 @@ dependencies = [ [[package]] name = "radix-engine-store-interface" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "hex", "itertools 0.10.5", @@ -1638,7 +1714,7 @@ dependencies = [ [[package]] name = "radix-engine-stores" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "hex", "itertools 0.10.5", @@ -1651,8 +1727,8 @@ dependencies = [ [[package]] name = "radix-engine-toolkit" -version = "1.0.6" -source = "git+https://github.com/radixdlt/radix-engine-toolkit?rev=e848b6abb9c5e72c695819e4d61a2d0c25f695f5#e848b6abb9c5e72c695819e4d61a2d0c25f695f5" +version = "1.0.10" +source = "git+https://github.com/radixdlt/radix-engine-toolkit?rev=9dc3deeb3299b4f4c255f36bb3d504681379ad5a#9dc3deeb3299b4f4c255f36bb3d504681379ad5a" dependencies = [ "bech32", "cargo_toml", @@ -1674,8 +1750,8 @@ dependencies = [ [[package]] name = "radix-engine-toolkit-json" -version = "1.0.6" -source = "git+https://github.com/radixdlt/radix-engine-toolkit?rev=e848b6abb9c5e72c695819e4d61a2d0c25f695f5#e848b6abb9c5e72c695819e4d61a2d0c25f695f5" +version = "1.0.10" +source = "git+https://github.com/radixdlt/radix-engine-toolkit?rev=9dc3deeb3299b4f4c255f36bb3d504681379ad5a#9dc3deeb3299b4f4c255f36bb3d504681379ad5a" dependencies = [ "bech32", "indexmap 1.9.3", @@ -1756,7 +1832,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", ] [[package]] @@ -1809,7 +1885,7 @@ checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "resources-tracker-macro" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "proc-macro2", "quote", @@ -1847,11 +1923,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", "linux-raw-sys", @@ -1894,9 +1970,10 @@ dependencies = [ "hex", "identified_vec", "iso8601-timestamp", - "itertools 0.12.0", + "itertools 0.12.1", "log", "memoize", + "nutype", "pretty_assertions", "pretty_env_logger", "radix-engine-common", @@ -1914,7 +1991,6 @@ dependencies = [ "strum_macros 0.26.1", "thiserror", "time-util", - "transaction", "uniffi", "url", "uuid", @@ -1923,7 +1999,7 @@ dependencies = [ [[package]] name = "sbor" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "const-sha1", "hex", @@ -1937,7 +2013,7 @@ dependencies = [ [[package]] name = "sbor-derive" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "proc-macro2", "sbor-derive-common", @@ -1946,7 +2022,7 @@ dependencies = [ [[package]] name = "sbor-derive-common" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "const-sha1", "itertools 0.10.5", @@ -1957,8 +2033,8 @@ dependencies = [ [[package]] name = "sbor-json" -version = "1.0.6" -source = "git+https://github.com/radixdlt/radix-engine-toolkit?rev=e848b6abb9c5e72c695819e4d61a2d0c25f695f5#e848b6abb9c5e72c695819e4d61a2d0c25f695f5" +version = "1.0.10" +source = "git+https://github.com/radixdlt/radix-engine-toolkit?rev=9dc3deeb3299b4f4c255f36bb3d504681379ad5a#9dc3deeb3299b4f4c255f36bb3d504681379ad5a" dependencies = [ "bech32", "radix-engine-common", @@ -2012,18 +2088,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scroll" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" +checksum = "6ab8598aa408498679922eff7fa985c25d58a90771bd6be794434c5277eab1a6" dependencies = [ "scroll_derive", ] [[package]] name = "scroll_derive" -version = "0.11.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" +checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" dependencies = [ "proc-macro2", "quote", @@ -2033,7 +2109,7 @@ dependencies = [ [[package]] name = "scrypto" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "bech32", "const-sha1", @@ -2055,7 +2131,7 @@ dependencies = [ [[package]] name = "scrypto-derive" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "proc-macro2", "quote", @@ -2071,7 +2147,7 @@ dependencies = [ [[package]] name = "scrypto-schema" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "bitflags 1.3.2", "radix-engine-common", @@ -2121,18 +2197,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", @@ -2152,11 +2228,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.3", "itoa", "ryu", "serde", @@ -2184,16 +2260,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.4.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" dependencies = [ "base64", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.1.0", + "indexmap 2.2.3", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -2201,9 +2278,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.4.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" +checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d" dependencies = [ "darling", "proc-macro2", @@ -2235,6 +2312,16 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + [[package]] name = "signature" version = "1.6.4" @@ -2285,9 +2372,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smawk" @@ -2313,6 +2400,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strsim" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" + [[package]] name = "strum" version = "0.24.1" @@ -2416,13 +2509,12 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", "rustix", "windows-sys 0.52.0", ] @@ -2449,32 +2541,42 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", "syn 2.0.48", ] +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "time" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -2489,10 +2591,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -2556,7 +2659,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", @@ -2566,17 +2669,14 @@ dependencies = [ [[package]] name = "transaction" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "bech32", - "ed25519-dalek", "hex", "lazy_static", "radix-engine-common", "radix-engine-interface", "sbor", - "secp256k1", - "serde", "strum 0.24.1", "utils", ] @@ -2626,9 +2726,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -2651,6 +2751,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + [[package]] name = "unicode-width" version = "0.1.11" @@ -2665,22 +2771,24 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "uniffi" -version = "0.25.3" -source = "git+https://github.com/mozilla/uniffi-rs?rev=fb8dd5c0f9406ea558d0d9d86804f4688ae95e44#fb8dd5c0f9406ea558d0d9d86804f4688ae95e44" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ad0be8bba6c242d2d16922de4a9c8f167b9491729fda552e70f8626bf7302cb" dependencies = [ "anyhow", "camino", "clap", "uniffi_bindgen", "uniffi_build", - "uniffi_core 0.25.3 (git+https://github.com/mozilla/uniffi-rs?rev=fb8dd5c0f9406ea558d0d9d86804f4688ae95e44)", + "uniffi_core", "uniffi_macros", ] [[package]] name = "uniffi_bindgen" -version = "0.25.3" -source = "git+https://github.com/mozilla/uniffi-rs?rev=fb8dd5c0f9406ea558d0d9d86804f4688ae95e44#fb8dd5c0f9406ea558d0d9d86804f4688ae95e44" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab31006ab9c9c6870739f0e74235729d1478d82e73571b8f53c25aa176d67535" dependencies = [ "anyhow", "askama", @@ -2703,8 +2811,9 @@ dependencies = [ [[package]] name = "uniffi_build" -version = "0.25.3" -source = "git+https://github.com/mozilla/uniffi-rs?rev=fb8dd5c0f9406ea558d0d9d86804f4688ae95e44#fb8dd5c0f9406ea558d0d9d86804f4688ae95e44" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4aa3a7608c6872dc1ce53199d816a24d2e19af952d82ce557ecc8692a4ae9cba" dependencies = [ "anyhow", "camino", @@ -2713,8 +2822,9 @@ dependencies = [ [[package]] name = "uniffi_checksum_derive" -version = "0.25.3" -source = "git+https://github.com/mozilla/uniffi-rs?rev=fb8dd5c0f9406ea558d0d9d86804f4688ae95e44#fb8dd5c0f9406ea558d0d9d86804f4688ae95e44" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72775b3afa6adb30e0c92b3107858d2fcb0ff1a417ac242db1f648b0e2dd0ef2" dependencies = [ "quote", "syn 2.0.48", @@ -2722,24 +2832,9 @@ dependencies = [ [[package]] name = "uniffi_core" -version = "0.25.3" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6121a127a3af1665cd90d12dd2b3683c2643c5103281d0fed5838324ca1fad5b" -dependencies = [ - "anyhow", - "bytes", - "camino", - "log", - "once_cell", - "oneshot-uniffi", - "paste", - "static_assertions", -] - -[[package]] -name = "uniffi_core" -version = "0.25.3" -source = "git+https://github.com/mozilla/uniffi-rs?rev=fb8dd5c0f9406ea558d0d9d86804f4688ae95e44#fb8dd5c0f9406ea558d0d9d86804f4688ae95e44" +checksum = "8d6e8db3f4e558faf0e25ac4b5bd775567973a4e18809f1123e74de52a853692" dependencies = [ "anyhow", "bytes", @@ -2753,8 +2848,9 @@ dependencies = [ [[package]] name = "uniffi_macros" -version = "0.25.3" -source = "git+https://github.com/mozilla/uniffi-rs?rev=fb8dd5c0f9406ea558d0d9d86804f4688ae95e44#fb8dd5c0f9406ea558d0d9d86804f4688ae95e44" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a126650799f97d97d8e38e3f10f15c65f5bc5a76b021bec21823efe9dd831a02" dependencies = [ "bincode", "camino", @@ -2771,8 +2867,9 @@ dependencies = [ [[package]] name = "uniffi_meta" -version = "0.25.3" -source = "git+https://github.com/mozilla/uniffi-rs?rev=fb8dd5c0f9406ea558d0d9d86804f4688ae95e44#fb8dd5c0f9406ea558d0d9d86804f4688ae95e44" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f64a99e905671738d9d293f9cce58708ce1af8e13ea29f9d6b6925114fc2e85" dependencies = [ "anyhow", "bytes", @@ -2782,8 +2879,9 @@ dependencies = [ [[package]] name = "uniffi_testing" -version = "0.25.3" -source = "git+https://github.com/mozilla/uniffi-rs?rev=fb8dd5c0f9406ea558d0d9d86804f4688ae95e44#fb8dd5c0f9406ea558d0d9d86804f4688ae95e44" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdca5719a22edf34c8239cc6ac9e3906d7ebc2a3e8a5e6ece4c3dffc312a4251" dependencies = [ "anyhow", "camino", @@ -2794,8 +2892,9 @@ dependencies = [ [[package]] name = "uniffi_udl" -version = "0.25.3" -source = "git+https://github.com/mozilla/uniffi-rs?rev=fb8dd5c0f9406ea558d0d9d86804f4688ae95e44#fb8dd5c0f9406ea558d0d9d86804f4688ae95e44" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6817c15714acccd0d0459f99b524cabebfdd622376464a2c6466a6485bdb4b" dependencies = [ "anyhow", "textwrap", @@ -2807,13 +2906,13 @@ dependencies = [ [[package]] name = "url" version = "2.5.0" -source = "git+https://github.com/sajjon/rust-url?branch=uniffi#3b84444c1ac2f57c0a4d836d7667bf7e881535cf" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", "percent-encoding", "serde", - "uniffi_core 0.25.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2825,7 +2924,7 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "utils" version = "1.0.2-dev" -source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=038ddee8b0f57aa90e36375c69946c4eb634efeb#038ddee8b0f57aa90e36375c69946c4eb634efeb" +source = "git+https://github.com/radixdlt/radixdlt-scrypto?rev=587d5988cd4ca3c5193ddf37027ff4e4ecd637dc#587d5988cd4ca3c5193ddf37027ff4e4ecd637dc" dependencies = [ "indexmap 2.0.0-pre", "serde", @@ -2833,11 +2932,11 @@ dependencies = [ [[package]] name = "uuid" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "serde", ] @@ -2871,9 +2970,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2881,9 +2980,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", @@ -2896,9 +2995,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2906,9 +3005,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", @@ -2919,9 +3018,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] name = "wasm-encoder" @@ -2983,11 +3082,12 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.118.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ee9723b928e735d53000dec9eae7b07a60e490c85ab54abb66659fc61bfcd9" +checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab" dependencies = [ - "indexmap 2.1.0", + "bitflags 2.4.2", + "indexmap 2.2.3", "semver", ] @@ -3002,18 +3102,19 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.2.75" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d027eb8294904fc715ac0870cebe6b0271e96b90605ee21511e7565c4ce568c" +checksum = "60e73986a6b7fdfedb7c5bf9e7eb71135486507c8fbc4c0c42cffcb6532988b7" dependencies = [ "anyhow", - "wasmparser 0.118.1", + "wasmparser 0.121.2", ] [[package]] name = "weedle2" -version = "4.0.0" -source = "git+https://github.com/mozilla/uniffi-rs?rev=fb8dd5c0f9406ea558d0d9d86804f4688ae95e44#fb8dd5c0f9406ea558d0d9d86804f4688ae95e44" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "998d2c24ec099a87daf9467808859f9d82b61f1d9c9701251aea037f514eae0e" dependencies = [ "nom", ] @@ -3258,9 +3359,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.33" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7520bbdec7211caa7c4e682eb1fbe07abe20cee6756b6e00f537c82c11816aa" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index a5d0219c2..0fcc4d2a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,24 @@ -[workspace] -resolver = "2" -members = ["sargon"] +[package] +name = "sargon" +version = "0.1.0" +edition = "2021" +build = "build.rs" -[workspace.dependencies] +[profile.release] +incremental = false +panic = 'unwind' +codegen-units = 1 + +[[test]] +name = "vectors" + +[[test]] +name = "uniffi" + +[lib] +crate-type = ["staticlib", "cdylib", "lib"] + +[dependencies] log = "0.4.20" pretty_env_logger = "0.5.0" derive_more = { version = "1.0.0-beta.6", features = ["debug", "display"] } @@ -15,33 +31,38 @@ uuid = { version = "1.6.1", features = ["v4", "serde"] } serde_repr = "0.1.17" strum = { version = "0.25.0", features = ["derive"] } strum_macros = { version = "0.26.1" } -radix-engine-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", rev = "038ddee8b0f57aa90e36375c69946c4eb634efeb", features = [ + +# 587d5988cd4ca3c5193ddf37027ff4e4ecd637dc is the Scrypto commit that RET 9dc3deeb3299b4f4c255f36bb3d504681379ad5a uses +radix-engine-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", rev = "587d5988cd4ca3c5193ddf37027ff4e4ecd637dc", features = [ "serde", ] } -radix-engine-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", rev = "038ddee8b0f57aa90e36375c69946c4eb634efeb", features = [ +radix-engine-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", rev = "587d5988cd4ca3c5193ddf37027ff4e4ecd637dc", features = [ "std", ] } -radix-engine-toolkit-json = { git = "https://github.com/radixdlt/radix-engine-toolkit", rev = "e848b6abb9c5e72c695819e4d61a2d0c25f695f5" } -radix-engine-toolkit = { git = "https://github.com/radixdlt/radix-engine-toolkit", rev = "e848b6abb9c5e72c695819e4d61a2d0c25f695f5" } +radix-engine-toolkit-json = { git = "https://github.com/radixdlt/radix-engine-toolkit", rev = "9dc3deeb3299b4f4c255f36bb3d504681379ad5a" } +radix-engine-toolkit = { git = "https://github.com/radixdlt/radix-engine-toolkit", rev = "9dc3deeb3299b4f4c255f36bb3d504681379ad5a" } enum-iterator = "1.4.1" -hex = "0.4.3" -transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", rev = "038ddee8b0f57aa90e36375c69946c4eb634efeb", features = [ - "serde", -] } -bip32 = "0.5.1" # only need Secp256k1, to do validation of PublicKey +bip32 = "0.5.1" # only need Secp256k1, to do validation of PublicKey ed25519-dalek = "1.0.1" rand = "0.8.5" +hex = "0.4.3" delegate = "0.12.0" itertools = { version = "0.12.0" } enum-as-inner = "0.6.0" identified_vec = { version = "0.1.11", features = ["serde", "id_prim"] } nutype = { version = "0.4.0", features = ["serde"] } schemars = { version = "0.8.12", features = ["preserve_order"] } -uniffi = { git = "https://github.com/mozilla/uniffi-rs", rev = "fb8dd5c0f9406ea558d0d9d86804f4688ae95e44", features = [ - "cli", -] } +uniffi = { version = "0.26.0", features = ["cli"] } +pretty_assertions = "1.4.0" +slip10 = "0.4.3" +memoize = "0.4.1" +bip39 = { version = "2.0.0", features = ["serde"] } +time-util = { version = "0.3.4", features = ["chrono"] } +assert-json-diff = "2.0.2" +url = { version = "2.5.0", features = ["serde"] } -[profile.release] -incremental = false -panic = 'unwind' -codegen-units = 1 +[build-dependencies] +uniffi = { version = "0.26.0", features = ["build"] } + +[dev-dependencies] +uniffi = { version = "0.26.0", features = ["bindgen-tests"] } diff --git a/README.md b/README.md index d0355540b..2418ae4b8 100644 --- a/README.md +++ b/README.md @@ -213,5 +213,5 @@ cargo tarpaulin --out Html ## Run Tests ```sh -cargo nextest run --package sargon --test uniffi && cargo nextest run +cargo nextest run ``` \ No newline at end of file diff --git a/_typos.toml b/_typos.toml index de8e32a0e..2d592356d 100644 --- a/_typos.toml +++ b/_typos.toml @@ -1,2 +1,2 @@ [files] -extend-exclude = ["tarpaulin-report.html", "sargon/tests/vectors/fixtures/*.json"] \ No newline at end of file +extend-exclude = ["tarpaulin-report.html", "tests/vectors/fixtures/*.json"] diff --git a/sargon/build.rs b/build.rs similarity index 100% rename from sargon/build.rs rename to build.rs diff --git a/sargon/Cargo.toml b/sargon/Cargo.toml deleted file mode 100644 index 61b36b0df..000000000 --- a/sargon/Cargo.toml +++ /dev/null @@ -1,62 +0,0 @@ -[package] -name = "sargon" -version = "0.1.0" -edition = "2021" -build = "build.rs" - -[dependencies] -serde = { workspace = true } -serde_json = { workspace = true } -serde_with = { workspace = true } -thiserror = { workspace = true } -strum_macros = { workspace = true } -iso8601-timestamp = { workspace = true } -uuid = { workspace = true } -serde_repr = { workspace = true } -strum = { workspace = true } -radix-engine-common = { workspace = true } -radix-engine-toolkit-json = { workspace = true } -radix-engine-toolkit = { workspace = true } -radix-engine-interface = { workspace = true } -enum-iterator = { workspace = true } -hex = { workspace = true } -transaction = { workspace = true } -bip32 = { workspace = true } -ed25519-dalek = { workspace = true } -rand = { workspace = true } -enum-as-inner = { workspace = true } -identified_vec = { workspace = true } -schemars = { workspace = true } -log = { workspace = true } -pretty_env_logger = { workspace = true } -uniffi = { workspace = true, features = ["cli"] } -url = { git = "https://github.com/sajjon/rust-url", branch = "uniffi", features = [ - "serde", - "uniffi", -] } -pretty_assertions = "1.4.0" -slip10 = "0.4.3" -memoize = "0.4.1" -itertools = { version = "0.12.0" } -bip39 = { version = "2.0.0", features = ["serde"] } -time-util = { version = "0.3.4", features = ["chrono"] } -derive_more = { workspace = true } -delegate = { workspace = true } -assert-json-diff = "2.0.2" - -[build-dependencies] -uniffi = { workspace = true, features = ["build"] } - -[dev-dependencies] -uniffi = { workspace = true, features = ["bindgen-tests"] } -serde = { workspace = true } - -[[test]] -name = "vectors" - -[[test]] -name = "uniffi" -test = false - -[lib] -crate-type = ["staticlib", "cdylib", "lib"] diff --git a/sargon/uniffi.toml b/sargon/uniffi.toml deleted file mode 100644 index 61ef7215f..000000000 --- a/sargon/uniffi.toml +++ /dev/null @@ -1,104 +0,0 @@ -[bindings.swift] -# Actually `generate_immutable_records` is `false` by default, but wanted a natural place to document it, our -# clients must be able to pass an updated value, e.g. `update_account(updated_account)` and before have -# mutated the stored properties on account. -generate_immutable_records = false -module_name = "Sargon" - -[bindings.kotlin] -package_name = "sargon" - - -[bindings.swift.custom_types.BagOfBytes] -# Name of the type in the Swift code -type_name = "Data" -# Modules that need to be imported -imports = ["Foundation"] -# Functions to convert between strings and URLs -into_custom = "{ Data({}.map({ i8 in UInt8(bitPattern: i8) })) }()" -from_custom = "{ {}.map({ u8 in Int8(bitPattern: u8) }) }()" - -[bindings.kotlin.custom_types.BagOfBytes] -# Name of the type in the Kotlin code -type_name = "List" -# Classes that need to be imported -imports = [] -# # Functions to convert between strings and URLs -into_custom = "{}.map({ it.toUByte() })" -from_custom = "{}.map({ it.toByte() })" - - -[bindings.swift.custom_types.Uuid] -# Name of the type in the Swift code -type_name = "UUID" -# Modules that need to be imported -imports = ["Foundation"] -# Functions to convert between strings and URLs -into_custom = "UUID(uuidString: {})!" -from_custom = "{}.uuidString" - -[bindings.kotlin.custom_types.Uuid] -# Name of the type in the Kotlin code -type_name = "UUID" -# Classes that need to be imported -imports = ["java.util.UUID"] -# Functions to convert between strings and URLs -into_custom = "UUID.fromString({})" -from_custom = "{}.toString()" - -[bindings.python.custom_types.Uuid] -type_name = "UUID" -# modules to import -imports = ["uuid"] -# Functions to convert between strings and the ParsedUrl class -into_custom = "uuid.UUID({})" -from_custom = "str({})" - - -[bindings.swift.custom_types.Url] -# Name of the type in the Swift code -type_name = "URL" -# Modules that need to be imported -imports = ["Foundation"] -# Functions to convert between strings and URLs -into_custom = "URL(string: {})!" -from_custom = "String(describing: {})" - -[bindings.kotlin.custom_types.Url] -# Name of the type in the Kotlin code -type_name = "URL" -# Classes that need to be imported -imports = ["java.net.URI", "java.net.URL"] -# Functions to convert between strings and URLs -into_custom = "URI({}).toURL()" -from_custom = "{}.toString()" - -[bindings.python.custom_types.Url] -# We're going to be the urllib.parse.ParseResult class, which is the closest -# thing Python has to a Url class. No need to specify `type_name` though, -# since Python is loosely typed. -# modules to import -imports = ["urllib.parse"] -# Functions to convert between strings and the ParsedUrl class -into_custom = "urllib.parse.urlparse({})" -from_custom = "urllib.parse.urlunparse({})" - -[bindings.swift.custom_types.Timestamp] -# Name of the type in the Swift code -type_name = "Date" -# Modules that need to be imported -imports = ["Foundation"] -# Functions to convert between strings and URLs -into_custom = "{let df = DateFormatter();df.dateFormat = \"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ\";return df.date(from: {})!}()" -from_custom = "{let df = DateFormatter();df.dateFormat = \"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ\";return df.string(from: {})}()" - -[bindings.kotlin.custom_types.Timestamp] -type_name = "OffsetDateTime" -imports = ["java.time.OffsetDateTime", "java.time.format.DateTimeFormatter"] -into_custom = "OffsetDateTime.parse({}, DateTimeFormatter.ISO_DATE_TIME)" -from_custom = "{}.format(DateTimeFormatter.ISO_DATE_TIME)" - -[bindings.python.custom_types.Timestamp] -imports = ["datetime"] -into_custom = "{}.isoformat()" -from_custom = "datetime.fromisoformat({})" diff --git a/sargon/src/common/assert_json.rs b/src/core/assert_json.rs similarity index 100% rename from sargon/src/common/assert_json.rs rename to src/core/assert_json.rs diff --git a/sargon/src/common/error/common_error.rs b/src/core/error/common_error.rs similarity index 100% rename from sargon/src/common/error/common_error.rs rename to src/core/error/common_error.rs diff --git a/sargon/src/common/error/mod.rs b/src/core/error/mod.rs similarity index 100% rename from sargon/src/common/error/mod.rs rename to src/core/error/mod.rs diff --git a/sargon/src/common/has_placeholder.rs b/src/core/has_placeholder.rs similarity index 100% rename from sargon/src/common/has_placeholder.rs rename to src/core/has_placeholder.rs diff --git a/sargon/src/common/hash.rs b/src/core/hash.rs similarity index 100% rename from sargon/src/common/hash.rs rename to src/core/hash.rs diff --git a/sargon/src/common/mod.rs b/src/core/mod.rs similarity index 100% rename from sargon/src/common/mod.rs rename to src/core/mod.rs diff --git a/sargon/src/common/secure_random_bytes.rs b/src/core/secure_random_bytes.rs similarity index 100% rename from sargon/src/common/secure_random_bytes.rs rename to src/core/secure_random_bytes.rs diff --git a/sargon/src/common/types/bag_of_bytes.rs b/src/core/types/bag_of_bytes.rs similarity index 100% rename from sargon/src/common/types/bag_of_bytes.rs rename to src/core/types/bag_of_bytes.rs diff --git a/sargon/src/common/types/decimal.rs b/src/core/types/decimal.rs similarity index 83% rename from sargon/src/common/types/decimal.rs rename to src/core/types/decimal.rs index bcca09613..6cd72e596 100644 --- a/sargon/src/common/types/decimal.rs +++ b/src/core/types/decimal.rs @@ -1,9 +1,16 @@ use crate::prelude::*; -use radix_engine_common::math::Decimal as NativeDecimal; -use radix_engine_toolkit_json::models::common::SerializableDecimal; +use radix_engine_common::math::Decimal as ScryptoDecimal; // FIXME: Use RET's type! -#[derive(Clone, Debug, Eq, uniffi::Record, Default)] +#[derive( + Clone, + Debug, + Eq, + Default, + SerializeDisplay, + DeserializeFromStr, + uniffi::Record, +)] pub struct Decimal { base10_string: String, } @@ -38,40 +45,16 @@ impl Ord for Decimal { } } impl Decimal { - fn native(&self) -> NativeDecimal { - NativeDecimal::from_str(&self.base10_string).unwrap() + fn native(&self) -> ScryptoDecimal { + ScryptoDecimal::from_str(&self.base10_string).unwrap() } - fn from_native(decimal: NativeDecimal) -> Self { + fn from_native(decimal: ScryptoDecimal) -> Self { Self { base10_string: decimal.to_string(), } } } -impl Serialize for Decimal { - fn serialize( - &self, - serializer: S, - ) -> Result<::Ok, ::Error> - where - S: Serializer, - { - let dec: SerializableDecimal = self.native().into(); - SerializableDecimal::serialize(&dec, serializer) - } -} - -impl<'de> Deserialize<'de> for Decimal { - #[cfg(not(tarpaulin_include))] // false negative - fn deserialize>(d: D) -> Result { - use std::ops::Deref; - - let s = SerializableDecimal::deserialize(d)?; - let native: NativeDecimal = *s.deref(); - Ok(Self::from_native(native)) - } -} - impl Decimal { pub fn try_from_str(s: &str) -> Result { Self::new(s.to_string()) @@ -84,20 +67,27 @@ impl std::fmt::Display for Decimal { } } -impl Decimal { - pub fn new(value: String) -> Result { - value - .parse::() +impl FromStr for Decimal { + type Err = crate::CommonError; + + fn from_str(s: &str) -> Result { + s.parse::() .map(Self::from_native) .map_err(|_| CommonError::DecimalError) } +} + +impl Decimal { + pub fn new(value: String) -> Result { + value.parse() + } pub fn zero() -> Self { - Self::from_native(NativeDecimal::zero()) + Self::from_native(ScryptoDecimal::zero()) } pub fn one() -> Self { - Self::from_native(NativeDecimal::one()) + Self::from_native(ScryptoDecimal::one()) } pub fn is_zero(&self) -> bool { @@ -125,7 +115,7 @@ impl TryFrom<&[u8]> for Decimal { type Error = crate::CommonError; fn try_from(slice: &[u8]) -> Result { - NativeDecimal::try_from(slice) + ScryptoDecimal::try_from(slice) .map(Self::from_native) .map_err(|_| CommonError::DecimalError) } diff --git a/sargon/src/common/types/entity_kind.rs b/src/core/types/entity_kind.rs similarity index 100% rename from sargon/src/common/types/entity_kind.rs rename to src/core/types/entity_kind.rs diff --git a/sargon/src/common/types/hex_32bytes.rs b/src/core/types/hex_32bytes.rs similarity index 100% rename from sargon/src/common/types/hex_32bytes.rs rename to src/core/types/hex_32bytes.rs diff --git a/sargon/src/identified_vec_via.rs b/src/core/types/identified_vec_via.rs similarity index 100% rename from sargon/src/identified_vec_via.rs rename to src/core/types/identified_vec_via.rs diff --git a/sargon/src/common/types/keys/ed25519/mod.rs b/src/core/types/keys/ed25519/mod.rs similarity index 100% rename from sargon/src/common/types/keys/ed25519/mod.rs rename to src/core/types/keys/ed25519/mod.rs diff --git a/sargon/src/common/types/keys/ed25519/private_key.rs b/src/core/types/keys/ed25519/private_key.rs similarity index 92% rename from sargon/src/common/types/keys/ed25519/private_key.rs rename to src/core/types/keys/ed25519/private_key.rs index 47d5d71fa..98e34bb7c 100644 --- a/sargon/src/common/types/keys/ed25519/private_key.rs +++ b/src/core/types/keys/ed25519/private_key.rs @@ -1,15 +1,15 @@ use crate::prelude::*; -use radix_engine_common::crypto::IsHash; -use transaction::signing::ed25519::{ - Ed25519PrivateKey as EngineEd25519PrivateKey, Ed25519Signature, +use radix_engine_common::crypto::{ + Ed25519PrivateKey as ScryptoEd25519PrivateKey, + Ed25519Signature as ScryptoEd25519Signature, IsHash, }; /// An Ed25519 private key used to create cryptographic signatures, using /// EdDSA scheme. #[derive(derive_more::Debug)] #[debug("{}", self.to_hex())] -pub struct Ed25519PrivateKey(EngineEd25519PrivateKey); +pub struct Ed25519PrivateKey(ScryptoEd25519PrivateKey); impl Ed25519PrivateKey { /// Generates a new `Ed25519PrivateKey` from random bytes @@ -35,7 +35,7 @@ impl IsPrivateKey for Ed25519PrivateKey { SLIP10Curve::Curve25519 } - type Signature = Ed25519Signature; + type Signature = ScryptoEd25519Signature; fn public_key(&self) -> Ed25519PublicKey { self.0.public_key().try_into().expect( @@ -43,13 +43,13 @@ impl IsPrivateKey for Ed25519PrivateKey { ) } - fn sign(&self, msg_hash: &impl IsHash) -> Ed25519Signature { + fn sign(&self, msg_hash: &impl IsHash) -> ScryptoEd25519Signature { self.0.sign(msg_hash) } } impl Ed25519PrivateKey { - pub fn from_engine(engine: EngineEd25519PrivateKey) -> Self { + pub fn from_engine(engine: ScryptoEd25519PrivateKey) -> Self { Self(engine) } @@ -62,7 +62,7 @@ impl Ed25519PrivateKey { } pub fn from_bytes(slice: &[u8]) -> Result { - EngineEd25519PrivateKey::from_bytes(slice) + ScryptoEd25519PrivateKey::from_bytes(slice) .map_err(|_| { CommonError::InvalidEd25519PrivateKeyFromBytes(slice.to_owned()) }) @@ -140,10 +140,9 @@ impl Ed25519PrivateKey { #[cfg(test)] mod tests { + use super::*; use crate::prelude::*; - use transaction::signing::ed25519::Ed25519Signature; - #[test] fn equality() { assert_eq!( @@ -181,7 +180,7 @@ mod tests { pk.to_hex(), "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" ); - let sig = Ed25519Signature::from_str("cf0ca64435609b85ab170da339d415bbac87d678dfd505969be20adc6b5971f4ee4b4620c602bcbc34fd347596546675099d696265f4a42a16df343da1af980e").unwrap(); + let sig = ScryptoEd25519Signature::from_str("cf0ca64435609b85ab170da339d415bbac87d678dfd505969be20adc6b5971f4ee4b4620c602bcbc34fd347596546675099d696265f4a42a16df343da1af980e").unwrap(); assert_eq!(sk.sign(&msg), sig); assert!(pk.is_valid(&sig, &msg)) diff --git a/sargon/src/common/types/keys/ed25519/public_key.rs b/src/core/types/keys/ed25519/public_key.rs similarity index 89% rename from sargon/src/common/types/keys/ed25519/public_key.rs rename to src/core/types/keys/ed25519/public_key.rs index 26ab7b06f..f49360706 100644 --- a/sargon/src/common/types/keys/ed25519/public_key.rs +++ b/src/core/types/keys/ed25519/public_key.rs @@ -1,10 +1,9 @@ use crate::{prelude::*, UniffiCustomTypeConverter}; use radix_engine_common::crypto::{ - Ed25519PublicKey as EngineEd25519PublicKey, IsHash, -}; -use transaction::{ - signing::ed25519::Ed25519Signature, validation::verify_ed25519, + verify_ed25519 as scrypto_verify_ed25519, + Ed25519PublicKey as ScryptoEd25519PublicKey, + Ed25519Signature as ScryptoEd25519Signature, IsHash, }; /// An Ed25519 public key used to verify cryptographic signatures (EdDSA signatures). @@ -16,8 +15,8 @@ use transaction::{ Hash, PartialOrd, Ord, - SerializeDisplay, // yes we could have #[serde(transparent)] since `EngineEd25519PublicKey` is Serialize, but we wanna be in control. - DeserializeFromStr, // yes we could have #[serde(transparent)] since `EngineEd25519PublicKey` is Deserialize, but we wanna be in control. + SerializeDisplay, // yes we could have #[serde(transparent)] since `ScryptoEd25519PublicKey` is Serialize, but we wanna be in control. + DeserializeFromStr, // yes we could have #[serde(transparent)] since `ScryptoEd25519PublicKey` is Deserialize, but we wanna be in control. derive_more::Display, derive_more::Debug, uniffi::Record, @@ -25,11 +24,11 @@ use transaction::{ #[display("{}", self.to_hex())] #[debug("{}", self.to_hex())] pub struct Ed25519PublicKey { - inner: EngineEd25519PublicKey, + inner: ScryptoEd25519PublicKey, } -uniffi::custom_type!(EngineEd25519PublicKey, BagOfBytes); -impl UniffiCustomTypeConverter for EngineEd25519PublicKey { +uniffi::custom_type!(ScryptoEd25519PublicKey, BagOfBytes); +impl UniffiCustomTypeConverter for ScryptoEd25519PublicKey { type Builtin = BagOfBytes; #[cfg(not(tarpaulin_include))] // false negative | tested in bindgen tests @@ -79,19 +78,19 @@ pub fn ed25519_public_key_to_bytes(public_key: &Ed25519PublicKey) -> Vec { public_key.to_bytes() } -impl IsPublicKey for Ed25519PublicKey { +impl IsPublicKey for Ed25519PublicKey { /// Verifies an EdDSA signature over Curve25519. fn is_valid( &self, - signature: &Ed25519Signature, + signature: &ScryptoEd25519Signature, for_hash: &impl IsHash, ) -> bool { - verify_ed25519(for_hash.as_hash(), &self.to_engine(), signature) + scrypto_verify_ed25519(for_hash.as_hash(), &self.to_engine(), signature) } } impl Ed25519PublicKey { - pub(crate) fn to_engine(&self) -> EngineEd25519PublicKey { + pub(crate) fn to_engine(&self) -> ScryptoEd25519PublicKey { self.inner } @@ -104,10 +103,10 @@ impl Ed25519PublicKey { } } -impl TryFrom for Ed25519PublicKey { +impl TryFrom for Ed25519PublicKey { type Error = CommonError; - fn try_from(value: EngineEd25519PublicKey) -> Result { + fn try_from(value: ScryptoEd25519PublicKey) -> Result { ed25519_dalek::PublicKey::from_bytes(value.to_vec().as_slice()) .map_err(|_| CommonError::InvalidEd25519PublicKeyPointNotOnCurve) .map(|_| Self { inner: value }) @@ -126,7 +125,7 @@ impl TryFrom<&[u8]> for Ed25519PublicKey { type Error = crate::CommonError; fn try_from(slice: &[u8]) -> Result { - EngineEd25519PublicKey::try_from(slice) + ScryptoEd25519PublicKey::try_from(slice) .map_err(|_| { CommonError::InvalidEd25519PublicKeyFromBytes(slice.to_vec()) }) @@ -136,7 +135,7 @@ impl TryFrom<&[u8]> for Ed25519PublicKey { impl Ed25519PublicKey { pub fn from_hex(hex: String) -> Result { - // We want to ALWAYS go via `try_from(slice: &[u8])` since validates the EC point (`EngineEd25519PublicKey` doesn't!) + // We want to ALWAYS go via `try_from(slice: &[u8])` since validates the EC point (`ScryptoEd25519PublicKey` doesn't!) Hex32Bytes::from_str(hex.as_str()) .map_err(|_| CommonError::InvalidEd25519PublicKeyFromString(hex)) .and_then(|b| b.to_vec().try_into()) @@ -174,8 +173,8 @@ impl Ed25519PublicKey { #[cfg(test)] mod tests { + use super::*; use crate::prelude::*; - use radix_engine_common::crypto::Ed25519PublicKey as EngineEd25519PublicKey; #[test] fn equality() { @@ -216,7 +215,7 @@ mod tests { #[test] fn from_engine() { - let from_engine: Ed25519PublicKey = EngineEd25519PublicKey::from_str( + let from_engine: Ed25519PublicKey = ScryptoEd25519PublicKey::from_str( "ec172b93ad5e563bf4932c70e1245034c35467ef2efd4d64ebf819683467e2bf", ) .unwrap() diff --git a/sargon/src/common/types/keys/is_private_key.rs b/src/core/types/keys/is_private_key.rs similarity index 100% rename from sargon/src/common/types/keys/is_private_key.rs rename to src/core/types/keys/is_private_key.rs diff --git a/sargon/src/common/types/keys/is_public_key.rs b/src/core/types/keys/is_public_key.rs similarity index 100% rename from sargon/src/common/types/keys/is_public_key.rs rename to src/core/types/keys/is_public_key.rs diff --git a/sargon/src/common/types/keys/mod.rs b/src/core/types/keys/mod.rs similarity index 100% rename from sargon/src/common/types/keys/mod.rs rename to src/core/types/keys/mod.rs diff --git a/sargon/src/common/types/keys/private_key.rs b/src/core/types/keys/private_key.rs similarity index 100% rename from sargon/src/common/types/keys/private_key.rs rename to src/core/types/keys/private_key.rs diff --git a/sargon/src/common/types/keys/public_key.rs b/src/core/types/keys/public_key.rs similarity index 95% rename from sargon/src/common/types/keys/public_key.rs rename to src/core/types/keys/public_key.rs index 6aaae2980..3b0fae984 100644 --- a/sargon/src/common/types/keys/public_key.rs +++ b/src/core/types/keys/public_key.rs @@ -1,6 +1,6 @@ use crate::prelude::*; -use radix_engine_common::crypto::PublicKey as EnginePublicKey; +use radix_engine_common::crypto::PublicKey as ScryptoPublicKey; /// A tagged union of supported public keys on different curves, supported /// curves are `secp256k1` and `Curve25519` @@ -187,7 +187,7 @@ impl Serialize for PublicKey { } } -impl From for EnginePublicKey { +impl From for ScryptoPublicKey { fn from(value: PublicKey) -> Self { match value { PublicKey::Ed25519 { value: key } => key.to_engine().into(), @@ -201,7 +201,7 @@ mod tests { use crate::prelude::*; - use radix_engine_common::crypto::PublicKey as EnginePublicKey; + use radix_engine_common::crypto::PublicKey as ScryptoPublicKey; #[test] fn equality() { @@ -221,13 +221,13 @@ mod tests { fn engine_roundtrip_secp256k1() { let public_key_secp256k1: PublicKey = Secp256k1PublicKey::placeholder().into(); - let engine_key_secp256k1: EnginePublicKey = + let engine_key_secp256k1: ScryptoPublicKey = public_key_secp256k1.clone().into(); match engine_key_secp256k1 { - EnginePublicKey::Secp256k1(k) => { + ScryptoPublicKey::Secp256k1(k) => { assert_eq!(k.to_vec(), public_key_secp256k1.to_bytes()) } - EnginePublicKey::Ed25519(_) => panic!("wrong kind"), + ScryptoPublicKey::Ed25519(_) => panic!("wrong kind"), } } @@ -235,13 +235,13 @@ mod tests { fn engine_roundtrip_ed25519() { let public_key_ed25519: PublicKey = Ed25519PublicKey::placeholder().into(); - let engine_key_ed25519: EnginePublicKey = + let engine_key_ed25519: ScryptoPublicKey = public_key_ed25519.clone().into(); match engine_key_ed25519 { - EnginePublicKey::Ed25519(k) => { + ScryptoPublicKey::Ed25519(k) => { assert_eq!(k.to_vec(), public_key_ed25519.to_bytes()) } - EnginePublicKey::Secp256k1(_) => panic!("wrong kind"), + ScryptoPublicKey::Secp256k1(_) => panic!("wrong kind"), } } diff --git a/sargon/src/common/types/keys/secp256k1/mod.rs b/src/core/types/keys/secp256k1/mod.rs similarity index 100% rename from sargon/src/common/types/keys/secp256k1/mod.rs rename to src/core/types/keys/secp256k1/mod.rs diff --git a/sargon/src/common/types/keys/secp256k1/private_key.rs b/src/core/types/keys/secp256k1/private_key.rs similarity index 92% rename from sargon/src/common/types/keys/secp256k1/private_key.rs rename to src/core/types/keys/secp256k1/private_key.rs index 397fe1fdd..dcb8074a0 100644 --- a/sargon/src/common/types/keys/secp256k1/private_key.rs +++ b/src/core/types/keys/secp256k1/private_key.rs @@ -1,15 +1,15 @@ use crate::prelude::*; -use radix_engine_common::crypto::IsHash; -use transaction::signing::secp256k1::{ - Secp256k1PrivateKey as EngineSecp256k1PrivateKey, Secp256k1Signature, +use radix_engine_common::crypto::{ + IsHash, Secp256k1PrivateKey as ScryptoSecp256k1PrivateKey, + Secp256k1Signature as ScryptoSecp256k1Signature, }; /// A secp256k1 private key used to create cryptographic signatures, more specifically /// ECDSA signatures, that offer recovery of the public key. #[derive(derive_more::Debug)] #[debug("{}", self.to_hex())] -pub struct Secp256k1PrivateKey(EngineSecp256k1PrivateKey); +pub struct Secp256k1PrivateKey(ScryptoSecp256k1PrivateKey); impl Secp256k1PrivateKey { /// Generates a new `Secp256k1PrivateKey` from random bytes @@ -31,7 +31,7 @@ impl PartialEq for Secp256k1PrivateKey { impl Eq for Secp256k1PrivateKey {} impl Secp256k1PrivateKey { - pub fn from_engine(engine: EngineSecp256k1PrivateKey) -> Self { + pub fn from_engine(engine: ScryptoSecp256k1PrivateKey) -> Self { Self(engine) } @@ -44,7 +44,7 @@ impl Secp256k1PrivateKey { } pub fn from_bytes(slice: &[u8]) -> Result { - EngineSecp256k1PrivateKey::from_bytes(slice) + ScryptoSecp256k1PrivateKey::from_bytes(slice) .map_err(|_| { CommonError::InvalidSecp256k1PrivateKeyFromBytes( slice.to_owned(), @@ -87,7 +87,7 @@ impl IsPrivateKey for Secp256k1PrivateKey { SLIP10Curve::Secp256k1 } - type Signature = Secp256k1Signature; + type Signature = ScryptoSecp256k1Signature; fn public_key(&self) -> Secp256k1PublicKey { Secp256k1PublicKey::try_from(self.0.public_key()).expect( @@ -95,7 +95,7 @@ impl IsPrivateKey for Secp256k1PrivateKey { ) } - fn sign(&self, msg_hash: &impl IsHash) -> Secp256k1Signature { + fn sign(&self, msg_hash: &impl IsHash) -> Self::Signature { self.0.sign(msg_hash) } } @@ -144,8 +144,8 @@ impl Secp256k1PrivateKey { #[cfg(test)] mod tests { + use super::*; use crate::prelude::*; - use transaction::signing::secp256k1::Secp256k1Signature; #[test] fn equality() { @@ -184,7 +184,7 @@ mod tests { pk.to_hex(), "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" ); - let sig = Secp256k1Signature::from_str("00eb8dcd5bb841430dd0a6f45565a1b8bdb4a204eb868832cd006f963a89a662813ab844a542fcdbfda4086a83fbbde516214113051b9c8e42a206c98d564d7122").unwrap(); + let sig = ScryptoSecp256k1Signature::from_str("00eb8dcd5bb841430dd0a6f45565a1b8bdb4a204eb868832cd006f963a89a662813ab844a542fcdbfda4086a83fbbde516214113051b9c8e42a206c98d564d7122").unwrap(); assert_eq!(sk.sign(&msg), sig); assert!(pk.is_valid(&sig, &msg)) diff --git a/sargon/src/common/types/keys/secp256k1/public_key.rs b/src/core/types/keys/secp256k1/public_key.rs similarity index 88% rename from sargon/src/common/types/keys/secp256k1/public_key.rs rename to src/core/types/keys/secp256k1/public_key.rs index 8533fb7ad..3c6deb67e 100644 --- a/sargon/src/common/types/keys/secp256k1/public_key.rs +++ b/src/core/types/keys/secp256k1/public_key.rs @@ -1,12 +1,14 @@ use crate::{prelude::*, UniffiCustomTypeConverter}; -use bip32::secp256k1::PublicKey as BIP32Secp256k1PublicKey; +use bip32::secp256k1::PublicKey as BIP32Secp256k1PublicKey; // the bip32 crate actually does validation of the PublicKey whereas `radix_engine_common` does not. use radix_engine_common::crypto::{ - Hash, IsHash, Secp256k1PublicKey as EngineSecp256k1PublicKey, -}; -use transaction::{ - signing::secp256k1::Secp256k1Signature, validation::verify_secp256k1, + verify_secp256k1, Hash, IsHash, + Secp256k1PublicKey as ScryptoSecp256k1PublicKey, + Secp256k1Signature as ScryptoSecp256k1Signature, }; +// use transaction::{ +// signing::secp256k1::Secp256k1Signature, validation::verify_secp256k1, +// }; /// A `secp256k1` public key used to verify cryptographic signatures (ECDSA signatures). #[serde_as] @@ -17,8 +19,8 @@ use transaction::{ Hash, PartialOrd, Ord, - SerializeDisplay, // yes we could have #[serde(transparent)] since `EngineEd25519PublicKey` is Serialize, but we wanna be in control. - DeserializeFromStr, // yes we could have #[serde(transparent)] since `EngineEd25519PublicKey` is Deserialize, but we wanna be in control. + SerializeDisplay, // yes we could have #[serde(transparent)] since `ScryptoEd25519PublicKey` is Serialize, but we wanna be in control. + DeserializeFromStr, // yes we could have #[serde(transparent)] since `ScryptoEd25519PublicKey` is Deserialize, but we wanna be in control. derive_more::Display, derive_more::Debug, uniffi::Record, @@ -26,12 +28,12 @@ use transaction::{ #[display("{}", self.to_hex())] #[debug("{}", self.to_hex())] pub struct Secp256k1PublicKey { - inner: EngineSecp256k1PublicKey, + inner: ScryptoSecp256k1PublicKey, } -uniffi::custom_type!(EngineSecp256k1PublicKey, BagOfBytes); +uniffi::custom_type!(ScryptoSecp256k1PublicKey, BagOfBytes); -impl UniffiCustomTypeConverter for EngineSecp256k1PublicKey { +impl UniffiCustomTypeConverter for ScryptoSecp256k1PublicKey { type Builtin = BagOfBytes; #[cfg(not(tarpaulin_include))] // false negative | tested in bindgen tests @@ -83,11 +85,11 @@ pub fn new_secp256k1_public_key_placeholder_other() -> Secp256k1PublicKey { Secp256k1PublicKey::placeholder_other() } -impl IsPublicKey for Secp256k1PublicKey { +impl IsPublicKey for Secp256k1PublicKey { /// Verifies an ECDSA signature over Secp256k1. fn is_valid( &self, - signature: &Secp256k1Signature, + signature: &ScryptoSecp256k1Signature, for_hash: &impl IsHash, ) -> bool { verify_secp256k1(for_hash.as_hash(), &self.to_engine(), signature) @@ -95,7 +97,7 @@ impl IsPublicKey for Secp256k1PublicKey { } impl Secp256k1PublicKey { - pub(crate) fn to_engine(&self) -> EngineSecp256k1PublicKey { + pub(crate) fn to_engine(&self) -> ScryptoSecp256k1PublicKey { self.inner } @@ -108,10 +110,10 @@ impl Secp256k1PublicKey { } } -impl TryFrom for Secp256k1PublicKey { +impl TryFrom for Secp256k1PublicKey { type Error = CommonError; - fn try_from(value: EngineSecp256k1PublicKey) -> Result { + fn try_from(value: ScryptoSecp256k1PublicKey) -> Result { BIP32Secp256k1PublicKey::from_sec1_bytes(value.to_vec().as_slice()) .map_err(|_| CommonError::InvalidSecp256k1PublicKeyPointNotOnCurve) .map(|_| Self { inner: value }) @@ -130,7 +132,7 @@ impl TryFrom<&[u8]> for Secp256k1PublicKey { type Error = crate::CommonError; fn try_from(slice: &[u8]) -> Result { - EngineSecp256k1PublicKey::try_from(slice) + ScryptoSecp256k1PublicKey::try_from(slice) .map_err(|_| { CommonError::InvalidSecp256k1PublicKeyFromBytes(slice.to_vec()) }) @@ -179,7 +181,7 @@ impl FromStr for Secp256k1PublicKey { mod tests { use crate::prelude::*; - use radix_engine_common::crypto::Secp256k1PublicKey as EngineSecp256k1PublicKey; + use radix_engine_common::crypto::Secp256k1PublicKey as ScryptoSecp256k1PublicKey; #[test] fn equality() { @@ -234,7 +236,7 @@ mod tests { #[test] fn from_engine() { - let from_engine: Secp256k1PublicKey = EngineSecp256k1PublicKey::from_str( + let from_engine: Secp256k1PublicKey = ScryptoSecp256k1PublicKey::from_str( "033083620d1596d3f8988ff3270e42970dd2a031e2b9b6488052a4170ff999f3e8", ) .unwrap() diff --git a/sargon/src/common/types/keys/slip10_curve.rs b/src/core/types/keys/slip10_curve.rs similarity index 100% rename from sargon/src/common/types/keys/slip10_curve.rs rename to src/core/types/keys/slip10_curve.rs diff --git a/sargon/src/common/types/logged_result.rs b/src/core/types/logged_result.rs similarity index 100% rename from sargon/src/common/types/logged_result.rs rename to src/core/types/logged_result.rs diff --git a/sargon/src/common/types/mod.rs b/src/core/types/mod.rs similarity index 83% rename from sargon/src/common/types/mod.rs rename to src/core/types/mod.rs index 929fc4f3d..ce1042b89 100644 --- a/sargon/src/common/types/mod.rs +++ b/src/core/types/mod.rs @@ -2,6 +2,7 @@ mod bag_of_bytes; mod decimal; mod entity_kind; mod hex_32bytes; +mod identified_vec_via; mod keys; mod logged_result; mod safe_to_log; @@ -10,6 +11,7 @@ pub use bag_of_bytes::*; pub use decimal::*; pub use entity_kind::*; pub use hex_32bytes::*; +pub use identified_vec_via::*; pub use keys::*; pub use logged_result::*; pub use safe_to_log::*; diff --git a/sargon/src/common/types/safe_to_log.rs b/src/core/types/safe_to_log.rs similarity index 100% rename from sargon/src/common/types/safe_to_log.rs rename to src/core/types/safe_to_log.rs diff --git a/sargon/src/common/unsafe_id_stepper.rs b/src/core/unsafe_id_stepper.rs similarity index 100% rename from sargon/src/common/unsafe_id_stepper.rs rename to src/core/unsafe_id_stepper.rs diff --git a/sargon/src/common/utils/factory.rs b/src/core/utils/factory.rs similarity index 100% rename from sargon/src/common/utils/factory.rs rename to src/core/utils/factory.rs diff --git a/sargon/src/common/utils/logged_panic.rs b/src/core/utils/logged_panic.rs similarity index 100% rename from sargon/src/common/utils/logged_panic.rs rename to src/core/utils/logged_panic.rs diff --git a/sargon/src/common/utils/mod.rs b/src/core/utils/mod.rs similarity index 100% rename from sargon/src/common/utils/mod.rs rename to src/core/utils/mod.rs diff --git a/sargon/src/common/utils/string_utils.rs b/src/core/utils/string_utils.rs similarity index 100% rename from sargon/src/common/utils/string_utils.rs rename to src/core/utils/string_utils.rs diff --git a/sargon/src/hierarchical_deterministic/bip32/hd_path.rs b/src/hierarchical_deterministic/bip32/hd_path.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/bip32/hd_path.rs rename to src/hierarchical_deterministic/bip32/hd_path.rs diff --git a/sargon/src/hierarchical_deterministic/bip32/hd_path_component.rs b/src/hierarchical_deterministic/bip32/hd_path_component.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/bip32/hd_path_component.rs rename to src/hierarchical_deterministic/bip32/hd_path_component.rs diff --git a/sargon/src/hierarchical_deterministic/bip32/mod.rs b/src/hierarchical_deterministic/bip32/mod.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/bip32/mod.rs rename to src/hierarchical_deterministic/bip32/mod.rs diff --git a/sargon/src/hierarchical_deterministic/bip39/bip39_passphrase.rs b/src/hierarchical_deterministic/bip39/bip39_passphrase.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/bip39/bip39_passphrase.rs rename to src/hierarchical_deterministic/bip39/bip39_passphrase.rs diff --git a/sargon/src/hierarchical_deterministic/bip39/bip39_word/bip39_language.rs b/src/hierarchical_deterministic/bip39/bip39_word/bip39_language.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/bip39/bip39_word/bip39_language.rs rename to src/hierarchical_deterministic/bip39/bip39_word/bip39_language.rs diff --git a/sargon/src/hierarchical_deterministic/bip39/bip39_word/bip39_word.rs b/src/hierarchical_deterministic/bip39/bip39_word/bip39_word.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/bip39/bip39_word/bip39_word.rs rename to src/hierarchical_deterministic/bip39/bip39_word/bip39_word.rs diff --git a/sargon/src/hierarchical_deterministic/bip39/bip39_word/mod.rs b/src/hierarchical_deterministic/bip39/bip39_word/mod.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/bip39/bip39_word/mod.rs rename to src/hierarchical_deterministic/bip39/bip39_word/mod.rs diff --git a/sargon/src/hierarchical_deterministic/bip39/bip39_word/u11.rs b/src/hierarchical_deterministic/bip39/bip39_word/u11.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/bip39/bip39_word/u11.rs rename to src/hierarchical_deterministic/bip39/bip39_word/u11.rs diff --git a/sargon/src/hierarchical_deterministic/bip39/bip39_word_count.rs b/src/hierarchical_deterministic/bip39/bip39_word_count.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/bip39/bip39_word_count.rs rename to src/hierarchical_deterministic/bip39/bip39_word_count.rs diff --git a/sargon/src/hierarchical_deterministic/bip39/mnemonic.rs b/src/hierarchical_deterministic/bip39/mnemonic.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/bip39/mnemonic.rs rename to src/hierarchical_deterministic/bip39/mnemonic.rs diff --git a/sargon/src/hierarchical_deterministic/bip39/mod.rs b/src/hierarchical_deterministic/bip39/mod.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/bip39/mod.rs rename to src/hierarchical_deterministic/bip39/mod.rs diff --git a/sargon/src/hierarchical_deterministic/bip44/bip44.rs b/src/hierarchical_deterministic/bip44/bip44.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/bip44/bip44.rs rename to src/hierarchical_deterministic/bip44/bip44.rs diff --git a/sargon/src/hierarchical_deterministic/bip44/bip44_like_path.rs b/src/hierarchical_deterministic/bip44/bip44_like_path.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/bip44/bip44_like_path.rs rename to src/hierarchical_deterministic/bip44/bip44_like_path.rs diff --git a/sargon/src/hierarchical_deterministic/bip44/mod.rs b/src/hierarchical_deterministic/bip44/mod.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/bip44/mod.rs rename to src/hierarchical_deterministic/bip44/mod.rs diff --git a/sargon/src/hierarchical_deterministic/cap26/cap26_entity_kind.rs b/src/hierarchical_deterministic/cap26/cap26_entity_kind.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/cap26/cap26_entity_kind.rs rename to src/hierarchical_deterministic/cap26/cap26_entity_kind.rs diff --git a/sargon/src/hierarchical_deterministic/cap26/cap26_key_kind.rs b/src/hierarchical_deterministic/cap26/cap26_key_kind.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/cap26/cap26_key_kind.rs rename to src/hierarchical_deterministic/cap26/cap26_key_kind.rs diff --git a/sargon/src/hierarchical_deterministic/cap26/cap26_path/cap26_path.rs b/src/hierarchical_deterministic/cap26/cap26_path/cap26_path.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/cap26/cap26_path/cap26_path.rs rename to src/hierarchical_deterministic/cap26/cap26_path/cap26_path.rs diff --git a/sargon/src/hierarchical_deterministic/cap26/cap26_path/mod.rs b/src/hierarchical_deterministic/cap26/cap26_path/mod.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/cap26/cap26_path/mod.rs rename to src/hierarchical_deterministic/cap26/cap26_path/mod.rs diff --git a/sargon/src/hierarchical_deterministic/cap26/cap26_path/paths/account_path.rs b/src/hierarchical_deterministic/cap26/cap26_path/paths/account_path.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/cap26/cap26_path/paths/account_path.rs rename to src/hierarchical_deterministic/cap26/cap26_path/paths/account_path.rs diff --git a/sargon/src/hierarchical_deterministic/cap26/cap26_path/paths/getid_path.rs b/src/hierarchical_deterministic/cap26/cap26_path/paths/getid_path.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/cap26/cap26_path/paths/getid_path.rs rename to src/hierarchical_deterministic/cap26/cap26_path/paths/getid_path.rs diff --git a/sargon/src/hierarchical_deterministic/cap26/cap26_path/paths/identity_path.rs b/src/hierarchical_deterministic/cap26/cap26_path/paths/identity_path.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/cap26/cap26_path/paths/identity_path.rs rename to src/hierarchical_deterministic/cap26/cap26_path/paths/identity_path.rs diff --git a/sargon/src/hierarchical_deterministic/cap26/cap26_path/paths/is_entity_path.rs b/src/hierarchical_deterministic/cap26/cap26_path/paths/is_entity_path.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/cap26/cap26_path/paths/is_entity_path.rs rename to src/hierarchical_deterministic/cap26/cap26_path/paths/is_entity_path.rs diff --git a/sargon/src/hierarchical_deterministic/cap26/cap26_path/paths/mod.rs b/src/hierarchical_deterministic/cap26/cap26_path/paths/mod.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/cap26/cap26_path/paths/mod.rs rename to src/hierarchical_deterministic/cap26/cap26_path/paths/mod.rs diff --git a/sargon/src/hierarchical_deterministic/cap26/entity_cap26_path.rs b/src/hierarchical_deterministic/cap26/entity_cap26_path.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/cap26/entity_cap26_path.rs rename to src/hierarchical_deterministic/cap26/entity_cap26_path.rs diff --git a/sargon/src/hierarchical_deterministic/cap26/mod.rs b/src/hierarchical_deterministic/cap26/mod.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/cap26/mod.rs rename to src/hierarchical_deterministic/cap26/mod.rs diff --git a/sargon/src/hierarchical_deterministic/derivation/derivation.rs b/src/hierarchical_deterministic/derivation/derivation.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/derivation/derivation.rs rename to src/hierarchical_deterministic/derivation/derivation.rs diff --git a/sargon/src/hierarchical_deterministic/derivation/derivation_path.rs b/src/hierarchical_deterministic/derivation/derivation_path.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/derivation/derivation_path.rs rename to src/hierarchical_deterministic/derivation/derivation_path.rs diff --git a/sargon/src/hierarchical_deterministic/derivation/derivation_path_scheme.rs b/src/hierarchical_deterministic/derivation/derivation_path_scheme.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/derivation/derivation_path_scheme.rs rename to src/hierarchical_deterministic/derivation/derivation_path_scheme.rs diff --git a/sargon/src/hierarchical_deterministic/derivation/hierarchical_deterministic_private_key.rs b/src/hierarchical_deterministic/derivation/hierarchical_deterministic_private_key.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/derivation/hierarchical_deterministic_private_key.rs rename to src/hierarchical_deterministic/derivation/hierarchical_deterministic_private_key.rs diff --git a/sargon/src/hierarchical_deterministic/derivation/hierarchical_deterministic_public_key.rs b/src/hierarchical_deterministic/derivation/hierarchical_deterministic_public_key.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/derivation/hierarchical_deterministic_public_key.rs rename to src/hierarchical_deterministic/derivation/hierarchical_deterministic_public_key.rs diff --git a/sargon/src/hierarchical_deterministic/derivation/mnemonic_with_passphrase.rs b/src/hierarchical_deterministic/derivation/mnemonic_with_passphrase.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/derivation/mnemonic_with_passphrase.rs rename to src/hierarchical_deterministic/derivation/mnemonic_with_passphrase.rs diff --git a/sargon/src/hierarchical_deterministic/derivation/mod.rs b/src/hierarchical_deterministic/derivation/mod.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/derivation/mod.rs rename to src/hierarchical_deterministic/derivation/mod.rs diff --git a/sargon/src/hierarchical_deterministic/mod.rs b/src/hierarchical_deterministic/mod.rs similarity index 100% rename from sargon/src/hierarchical_deterministic/mod.rs rename to src/hierarchical_deterministic/mod.rs diff --git a/sargon/src/lib.rs b/src/lib.rs similarity index 90% rename from sargon/src/lib.rs rename to src/lib.rs index 4eb8d2b5d..1d7f38695 100644 --- a/sargon/src/lib.rs +++ b/src/lib.rs @@ -1,21 +1,15 @@ #![allow(unused_imports)] -mod common; +mod core; mod hierarchical_deterministic; -mod identified_vec_via; -mod logic; -mod profilesnapshot_version; -mod v100; +mod profile; mod wallet; pub mod prelude { - pub use crate::common::*; + pub use crate::core::*; pub use crate::hierarchical_deterministic::*; - pub use crate::identified_vec_via::*; - pub use crate::logic::*; - pub use crate::profilesnapshot_version::*; - pub use crate::v100::*; + pub use crate::profile::*; pub use crate::wallet::*; pub(crate) use std::collections::{BTreeSet, HashMap, HashSet}; diff --git a/sargon/src/logic/mod.rs b/src/profile/logic/mod.rs similarity index 100% rename from sargon/src/logic/mod.rs rename to src/profile/logic/mod.rs diff --git a/sargon/src/logic/profile_next_derivation.rs b/src/profile/logic/profile_next_derivation.rs similarity index 100% rename from sargon/src/logic/profile_next_derivation.rs rename to src/profile/logic/profile_next_derivation.rs diff --git a/src/profile/mod.rs b/src/profile/mod.rs new file mode 100644 index 000000000..96a005eed --- /dev/null +++ b/src/profile/mod.rs @@ -0,0 +1,7 @@ +mod logic; +mod profilesnapshot_version; +mod v100; + +pub use logic::*; +pub use profilesnapshot_version::*; +pub use v100::*; diff --git a/sargon/src/profilesnapshot_version.rs b/src/profile/profilesnapshot_version.rs similarity index 100% rename from sargon/src/profilesnapshot_version.rs rename to src/profile/profilesnapshot_version.rs diff --git a/sargon/src/v100/address/account_address.rs b/src/profile/v100/address/account_address.rs similarity index 100% rename from sargon/src/v100/address/account_address.rs rename to src/profile/v100/address/account_address.rs diff --git a/sargon/src/v100/address/decode_address_helper.rs b/src/profile/v100/address/decode_address_helper.rs similarity index 88% rename from sargon/src/v100/address/decode_address_helper.rs rename to src/profile/v100/address/decode_address_helper.rs index 2f7f125d7..7d6e36099 100644 --- a/sargon/src/v100/address/decode_address_helper.rs +++ b/src/profile/v100/address/decode_address_helper.rs @@ -1,8 +1,8 @@ -use radix_engine_common::types::EntityType as EngineEntityType; +use radix_engine_common::types::EntityType as ScryptoEntityType; use radix_engine_toolkit::functions::address::decode; use crate::prelude::*; -type EngineDecodeAddressOutput = (u8, EngineEntityType, String, [u8; 30]); +type EngineDecodeAddressOutput = (u8, ScryptoEntityType, String, [u8; 30]); pub type DecodeAddressOutput = (NetworkID, AbstractEntityType, String, [u8; 30]); diff --git a/sargon/src/v100/address/entity_address.rs b/src/profile/v100/address/entity_address.rs similarity index 72% rename from sargon/src/v100/address/entity_address.rs rename to src/profile/v100/address/entity_address.rs index 2e1ec9598..381618deb 100644 --- a/sargon/src/v100/address/entity_address.rs +++ b/src/profile/v100/address/entity_address.rs @@ -1,11 +1,12 @@ use crate::prelude::*; -use radix_engine_common::crypto::PublicKey as EnginePublicKey; -use radix_engine_common::types::NodeId; +use radix_engine_common::{ + address::AddressBech32Encoder, crypto::PublicKey as ScryptoPublicKey, + types::NodeId as ScryptoNodeId, +}; use radix_engine_toolkit::functions::derive::{ - virtual_account_address_from_public_key, - virtual_identity_address_from_public_key, + virtual_account_address_from_public_key as RET_new_account_address, + virtual_identity_address_from_public_key as RET_new_identity_address, }; -use radix_engine_toolkit_json::models::scrypto::node_id::SerializableNodeIdInternal; /// An address of an entity, provides default implementation of `try_from_bech32` /// to decode a bech32 encoded address string into Self. @@ -20,13 +21,15 @@ pub trait EntityAddress: Sized { network_id: NetworkID, ) -> Self; - fn address_from_node_id(node_id: NodeId, network_id_value: u8) -> String { - let node = SerializableNodeIdInternal { - network_id: network_id_value, - node_id, - }; - - format!("{node}") + fn address_from_node_id( + node_id: ScryptoNodeId, + network_id: NetworkID, + ) -> String { + let bech32_encoder = + AddressBech32Encoder::new(&network_id.network_definition()); + bech32_encoder + .encode(node_id.as_bytes()) + .expect("Should always be able to format address") } /// Creates a new address from `public_key` and `network_id` by bech32 encoding @@ -34,22 +37,18 @@ pub trait EntityAddress: Sized { #[cfg(not(tarpaulin_include))] // false negative fn from_public_key

(public_key: P, network_id: NetworkID) -> Self where - P: Into + Clone, + P: Into + Clone, { let component = match Self::entity_type() { - AbstractEntityType::Account => { - virtual_account_address_from_public_key(&public_key) - } + AbstractEntityType::Account => RET_new_account_address(&public_key), AbstractEntityType::Identity => { - virtual_identity_address_from_public_key(&public_key) + RET_new_identity_address(&public_key) } AbstractEntityType::Resource => panic!("resource"), }; - let address = Self::address_from_node_id( - component.into_node_id(), - network_id.discriminant(), - ); + let address = + Self::address_from_node_id(component.into_node_id(), network_id); Self::__with_address_and_network_id(&address, network_id) } diff --git a/sargon/src/v100/address/identity_address.rs b/src/profile/v100/address/identity_address.rs similarity index 97% rename from sargon/src/v100/address/identity_address.rs rename to src/profile/v100/address/identity_address.rs index 12c28feef..643cbcb2e 100644 --- a/sargon/src/v100/address/identity_address.rs +++ b/src/profile/v100/address/identity_address.rs @@ -110,8 +110,8 @@ impl FromStr for IdentityAddress { mod tests { use crate::prelude::*; use radix_engine_common::crypto::{ - Ed25519PublicKey as EngineEd25519PublicKey, - PublicKey as EnginePublicKey, + Ed25519PublicKey as ScryptoEd25519PublicKey, + PublicKey as ScryptoPublicKey, }; #[test] @@ -145,13 +145,13 @@ mod tests { #[test] fn from_public_key_bytes_and_network_id() { - let public_key = EngineEd25519PublicKey::from_str( + let public_key = ScryptoEd25519PublicKey::from_str( "6c28952be5cdade99c7dd5d003b6b692714b6b74c5fdb5fdc9a8e4ee1d297838", ) .unwrap(); assert_eq!( IdentityAddress::from_public_key( - EnginePublicKey::Ed25519(public_key), + ScryptoPublicKey::Ed25519(public_key), NetworkID::Mainnet ) .address, diff --git a/sargon/src/v100/address/mod.rs b/src/profile/v100/address/mod.rs similarity index 100% rename from sargon/src/v100/address/mod.rs rename to src/profile/v100/address/mod.rs diff --git a/sargon/src/v100/address/non_fungible_global_id.rs b/src/profile/v100/address/non_fungible_global_id.rs similarity index 88% rename from sargon/src/v100/address/non_fungible_global_id.rs rename to src/profile/v100/address/non_fungible_global_id.rs index 9d7d211fb..72ec270dd 100644 --- a/sargon/src/v100/address/non_fungible_global_id.rs +++ b/src/profile/v100/address/non_fungible_global_id.rs @@ -1,13 +1,13 @@ use crate::prelude::*; use radix_engine_common::address::AddressBech32Decoder; +use radix_engine_interface::blueprints::resource::NonFungibleGlobalId as ScryptoNonFungibleGlobalId; + use radix_engine_toolkit_json::models::scrypto::non_fungible_global_id::{ - SerializableNonFungibleGlobalId as EngineSerializableNonFungibleGlobalId, - SerializableNonFungibleGlobalIdInternal as EngineSerializableNonFungibleGlobalIdInternal, + SerializableNonFungibleGlobalId as RETNonFungibleGlobalId, + SerializableNonFungibleGlobalIdInternal as RETNonFungibleGlobalIdInternal, }; -use transaction::prelude::NonFungibleGlobalId as EngineNonFungibleGlobalId; - #[derive( Clone, Debug, @@ -35,15 +35,17 @@ impl From for radix_engine_common::types::ResourceAddress { } impl NonFungibleGlobalId { - fn from_internal_engine( - internal: EngineSerializableNonFungibleGlobalIdInternal, - ) -> Self { + fn from_internal_engine(internal: RETNonFungibleGlobalIdInternal) -> Self { let (engine_resource_address, engine_local_id) = internal.non_fungible_global_id.into_parts(); + let network_id: NetworkID = internal + .network_id + .try_into() + .expect("should be able to know network"); let resource_address_bech32 = ResourceAddress::address_from_node_id( engine_resource_address.into_node_id(), - internal.network_id, + network_id, ); let non_fungible_local_id: NonFungibleLocalId = engine_local_id.into(); @@ -56,20 +58,20 @@ impl NonFungibleGlobalId { } } - fn engine_global_id(&self) -> EngineNonFungibleGlobalId { - EngineNonFungibleGlobalId::new( - self.resource_address.clone().into(), - self.non_fungible_local_id.clone().try_into().unwrap(), - ) - } - fn network_id(&self) -> NetworkID { self.resource_address.network_id } - fn engine(&self) -> EngineSerializableNonFungibleGlobalId { - EngineSerializableNonFungibleGlobalId::new( - self.engine_global_id(), + fn engine(&self) -> RETNonFungibleGlobalId { + let scrypto_global_id = ScryptoNonFungibleGlobalId::new( + self.resource_address.clone().into(), + self.non_fungible_local_id + .clone() + .try_into() + .expect("Should always be able to convert into Engine"), + ); + RETNonFungibleGlobalId::new( + scrypto_global_id, self.network_id().discriminant(), ) } @@ -97,7 +99,7 @@ impl FromStr for NonFungibleGlobalId { type Err = CommonError; fn from_str(s: &str) -> Result { - EngineSerializableNonFungibleGlobalIdInternal::from_str(s) + RETNonFungibleGlobalIdInternal::from_str(s) .map(Self::from_internal_engine) .map_err(|_| CommonError::InvalidNonFungibleGlobalID(s.to_owned())) } diff --git a/sargon/src/v100/address/non_fungible_local_id.rs b/src/profile/v100/address/non_fungible_local_id.rs similarity index 78% rename from sargon/src/v100/address/non_fungible_local_id.rs rename to src/profile/v100/address/non_fungible_local_id.rs index 16edcaee4..1741c5323 100644 --- a/sargon/src/v100/address/non_fungible_local_id.rs +++ b/src/profile/v100/address/non_fungible_local_id.rs @@ -1,6 +1,6 @@ use crate::prelude::*; -use radix_engine_common::data::scrypto::model::NonFungibleLocalId as NativeNonFungibleLocalId; +use radix_engine_common::prelude::NonFungibleLocalId as ScryptoNonFungibleLocalId; #[derive(Clone, Debug, Hash, PartialEq, Eq, uniffi::Enum)] pub enum NonFungibleLocalId { @@ -16,8 +16,8 @@ pub fn non_fungible_local_id_to_string(id: NonFungibleLocalId) -> String { } impl NonFungibleLocalId { - fn native(&self) -> NativeNonFungibleLocalId { - NativeNonFungibleLocalId::try_from(self.clone()).unwrap() + fn native(&self) -> ScryptoNonFungibleLocalId { + ScryptoNonFungibleLocalId::try_from(self.clone()).unwrap() } } @@ -27,26 +27,26 @@ impl std::fmt::Display for NonFungibleLocalId { } } -impl From for NonFungibleLocalId { - fn from(value: NativeNonFungibleLocalId) -> Self { +impl From for NonFungibleLocalId { + fn from(value: ScryptoNonFungibleLocalId) -> Self { match value { - NativeNonFungibleLocalId::String(value) => Self::Str { + ScryptoNonFungibleLocalId::String(value) => Self::Str { value: value.value().to_owned(), }, - NativeNonFungibleLocalId::Integer(value) => Self::Integer { + ScryptoNonFungibleLocalId::Integer(value) => Self::Integer { value: value.value(), }, - NativeNonFungibleLocalId::Bytes(value) => Self::Bytes { + ScryptoNonFungibleLocalId::Bytes(value) => Self::Bytes { value: value.value().to_vec().into(), }, - NativeNonFungibleLocalId::RUID(value) => Self::Ruid { + ScryptoNonFungibleLocalId::RUID(value) => Self::Ruid { value: value.value().to_vec().into(), }, } } } -impl TryFrom for NativeNonFungibleLocalId { +impl TryFrom for ScryptoNonFungibleLocalId { type Error = crate::CommonError; fn try_from(value: NonFungibleLocalId) -> Result { @@ -69,11 +69,11 @@ impl TryFrom for NativeNonFungibleLocalId { } } -impl std::str::FromStr for NonFungibleLocalId { - type Err = ::Err; +impl FromStr for NonFungibleLocalId { + type Err = ::Err; fn from_str(s: &str) -> std::result::Result { - NativeNonFungibleLocalId::from_str(s).map(Into::into) + ScryptoNonFungibleLocalId::from_str(s).map(Into::into) } } @@ -82,11 +82,14 @@ mod tests { use crate::prelude::*; use radix_engine_common::data::scrypto::model::{ - BytesNonFungibleLocalId, IntegerNonFungibleLocalId, - NonFungibleLocalId as NativeNonFungibleLocalId, RUIDNonFungibleLocalId, - StringNonFungibleLocalId, + BytesNonFungibleLocalId as ScryptoBytesNonFungibleLocalId, + IntegerNonFungibleLocalId as ScryptoIntegerNonFungibleLocalId, + RUIDNonFungibleLocalId as ScryptoRUIDNonFungibleLocalId, + StringNonFungibleLocalId as ScryptoStringNonFungibleLocalId, }; + use super::*; + #[test] fn from_str_ok() { assert_eq!( @@ -156,7 +159,7 @@ mod tests { value: "".to_string() } .try_into(), - Err::( + Err::( CommonError::InvalidNonFungibleLocalIDString ) ); @@ -169,7 +172,7 @@ mod tests { value: BagOfBytes::new() } .try_into(), - Err::( + Err::( CommonError::InvalidNonFungibleLocalIDBytes ) ); @@ -181,8 +184,9 @@ mod tests { let non_native = NonFungibleLocalId::Ruid { value: bytes.clone().to_vec().into(), }; - let native = - NativeNonFungibleLocalId::RUID(RUIDNonFungibleLocalId::new(bytes)); + let native = ScryptoNonFungibleLocalId::RUID( + ScryptoRUIDNonFungibleLocalId::new(bytes), + ); assert_eq!(non_native.clone(), native.clone().into()); assert_eq!(non_native.clone().try_into(), Ok(native.clone())); assert_eq!( @@ -199,8 +203,9 @@ mod tests { let non_native = NonFungibleLocalId::Bytes { value: bytes.clone().to_vec().into(), }; - let native = NativeNonFungibleLocalId::Bytes( - BytesNonFungibleLocalId::new(bytes.clone().to_vec()).unwrap(), + let native = ScryptoNonFungibleLocalId::Bytes( + ScryptoBytesNonFungibleLocalId::new(bytes.clone().to_vec()) + .unwrap(), ); assert_eq!(non_native.clone(), native.clone().into()); assert_eq!(non_native.clone().try_into(), Ok(native.clone())); @@ -217,8 +222,8 @@ mod tests { let non_native = NonFungibleLocalId::Str { value: "test".to_string(), }; - let native = NativeNonFungibleLocalId::String( - StringNonFungibleLocalId::new("test").unwrap(), + let native = ScryptoNonFungibleLocalId::String( + ScryptoStringNonFungibleLocalId::new("test").unwrap(), ); assert_eq!(non_native.clone(), native.clone().into()); assert_eq!(non_native.clone().try_into(), Ok(native.clone())); @@ -233,8 +238,8 @@ mod tests { #[test] fn from_native_integer() { let non_native = NonFungibleLocalId::Integer { value: 1234 }; - let native = NativeNonFungibleLocalId::Integer( - IntegerNonFungibleLocalId::new(1234), + let native = ScryptoNonFungibleLocalId::Integer( + ScryptoIntegerNonFungibleLocalId::new(1234), ); assert_eq!(non_native.clone(), native.clone().into()); assert_eq!(non_native.clone().try_into(), Ok(native.clone())); @@ -252,7 +257,7 @@ mod tests { value: BagOfBytes::new(), }; assert_eq!( - NativeNonFungibleLocalId::try_from(invalid), + ScryptoNonFungibleLocalId::try_from(invalid), Err(CommonError::InvalidLength { expected: 32, found: 0, diff --git a/sargon/src/v100/address/resource_address.rs b/src/profile/v100/address/resource_address.rs similarity index 100% rename from sargon/src/v100/address/resource_address.rs rename to src/profile/v100/address/resource_address.rs diff --git a/sargon/src/v100/app_preferences/app_display_settings/app_display_fiat_currency.rs b/src/profile/v100/app_preferences/app_display_settings/app_display_fiat_currency.rs similarity index 100% rename from sargon/src/v100/app_preferences/app_display_settings/app_display_fiat_currency.rs rename to src/profile/v100/app_preferences/app_display_settings/app_display_fiat_currency.rs diff --git a/sargon/src/v100/app_preferences/app_display_settings/app_display_settings.rs b/src/profile/v100/app_preferences/app_display_settings/app_display_settings.rs similarity index 100% rename from sargon/src/v100/app_preferences/app_display_settings/app_display_settings.rs rename to src/profile/v100/app_preferences/app_display_settings/app_display_settings.rs diff --git a/sargon/src/v100/app_preferences/app_display_settings/mod.rs b/src/profile/v100/app_preferences/app_display_settings/mod.rs similarity index 100% rename from sargon/src/v100/app_preferences/app_display_settings/mod.rs rename to src/profile/v100/app_preferences/app_display_settings/mod.rs diff --git a/sargon/src/v100/app_preferences/app_preferences.rs b/src/profile/v100/app_preferences/app_preferences.rs similarity index 100% rename from sargon/src/v100/app_preferences/app_preferences.rs rename to src/profile/v100/app_preferences/app_preferences.rs diff --git a/sargon/src/v100/app_preferences/gateways/gateway.rs b/src/profile/v100/app_preferences/gateways/gateway.rs similarity index 100% rename from sargon/src/v100/app_preferences/gateways/gateway.rs rename to src/profile/v100/app_preferences/gateways/gateway.rs diff --git a/sargon/src/v100/app_preferences/gateways/gateways.rs b/src/profile/v100/app_preferences/gateways/gateways.rs similarity index 100% rename from sargon/src/v100/app_preferences/gateways/gateways.rs rename to src/profile/v100/app_preferences/gateways/gateways.rs diff --git a/sargon/src/v100/app_preferences/gateways/mod.rs b/src/profile/v100/app_preferences/gateways/mod.rs similarity index 100% rename from sargon/src/v100/app_preferences/gateways/mod.rs rename to src/profile/v100/app_preferences/gateways/mod.rs diff --git a/sargon/src/v100/app_preferences/gateways/network_definition.rs b/src/profile/v100/app_preferences/gateways/network_definition.rs similarity index 100% rename from sargon/src/v100/app_preferences/gateways/network_definition.rs rename to src/profile/v100/app_preferences/gateways/network_definition.rs diff --git a/sargon/src/v100/app_preferences/mod.rs b/src/profile/v100/app_preferences/mod.rs similarity index 100% rename from sargon/src/v100/app_preferences/mod.rs rename to src/profile/v100/app_preferences/mod.rs diff --git a/sargon/src/v100/app_preferences/p2p_links/mod.rs b/src/profile/v100/app_preferences/p2p_links/mod.rs similarity index 100% rename from sargon/src/v100/app_preferences/p2p_links/mod.rs rename to src/profile/v100/app_preferences/p2p_links/mod.rs diff --git a/sargon/src/v100/app_preferences/p2p_links/p2p_link.rs b/src/profile/v100/app_preferences/p2p_links/p2p_link.rs similarity index 100% rename from sargon/src/v100/app_preferences/p2p_links/p2p_link.rs rename to src/profile/v100/app_preferences/p2p_links/p2p_link.rs diff --git a/sargon/src/v100/app_preferences/p2p_links/p2p_links.rs b/src/profile/v100/app_preferences/p2p_links/p2p_links.rs similarity index 100% rename from sargon/src/v100/app_preferences/p2p_links/p2p_links.rs rename to src/profile/v100/app_preferences/p2p_links/p2p_links.rs diff --git a/sargon/src/v100/app_preferences/p2p_links/radix_connect_password.rs b/src/profile/v100/app_preferences/p2p_links/radix_connect_password.rs similarity index 100% rename from sargon/src/v100/app_preferences/p2p_links/radix_connect_password.rs rename to src/profile/v100/app_preferences/p2p_links/radix_connect_password.rs diff --git a/sargon/src/v100/app_preferences/security.rs b/src/profile/v100/app_preferences/security.rs similarity index 100% rename from sargon/src/v100/app_preferences/security.rs rename to src/profile/v100/app_preferences/security.rs diff --git a/sargon/src/v100/app_preferences/transaction_preferences.rs b/src/profile/v100/app_preferences/transaction_preferences.rs similarity index 100% rename from sargon/src/v100/app_preferences/transaction_preferences.rs rename to src/profile/v100/app_preferences/transaction_preferences.rs diff --git a/sargon/src/v100/entity/abstract_entity_type.rs b/src/profile/v100/entity/abstract_entity_type.rs similarity index 75% rename from sargon/src/v100/entity/abstract_entity_type.rs rename to src/profile/v100/entity/abstract_entity_type.rs index b9c5d2c31..9b27cc8c0 100644 --- a/sargon/src/v100/entity/abstract_entity_type.rs +++ b/src/profile/v100/entity/abstract_entity_type.rs @@ -1,5 +1,5 @@ use crate::prelude::*; -use radix_engine_common::types::EntityType as EngineEntityType; +use radix_engine_common::types::EntityType as ScryptoEntityType; /// Type of a wallet Radix Entity - Account or Identity (used by Personas). /// @@ -28,16 +28,16 @@ pub enum AbstractEntityType { } impl AbstractEntityType { /// Conversion of the Radix Engines type for EntityType to Self. - pub fn try_from(value: EngineEntityType) -> Result { + pub fn try_from(value: ScryptoEntityType) -> Result { match value { - EngineEntityType::GlobalVirtualEd25519Account => Ok(Self::Account), - EngineEntityType::GlobalVirtualSecp256k1Account => { + ScryptoEntityType::GlobalVirtualEd25519Account => Ok(Self::Account), + ScryptoEntityType::GlobalVirtualSecp256k1Account => { Ok(Self::Account) } - EngineEntityType::GlobalVirtualEd25519Identity => { + ScryptoEntityType::GlobalVirtualEd25519Identity => { Ok(Self::Identity) } - EngineEntityType::GlobalFungibleResourceManager => { + ScryptoEntityType::GlobalFungibleResourceManager => { Ok(Self::Resource) } _ => Err(CommonError::UnsupportedEntityType), diff --git a/sargon/src/v100/entity/account/account.rs b/src/profile/v100/entity/account/account.rs similarity index 97% rename from sargon/src/v100/entity/account/account.rs rename to src/profile/v100/entity/account/account.rs index 415017a6d..8804cddfd 100644 --- a/sargon/src/v100/entity/account/account.rs +++ b/src/profile/v100/entity/account/account.rs @@ -299,20 +299,7 @@ impl Account { #[cfg(test)] mod tests { - use std::str::FromStr; - - use crate::{ - assert_eq_after_json_roundtrip, AssetException, - DepositAddressExceptionRule, DepositRule, EntityFlag, EntityFlags, - HasPlaceholder, OnLedgerSettings, ResourceOrNonFungible, - ThirdPartyDeposits, - }; - use identified_vec::IsIdentifiedVec; - use radix_engine_common::prelude::HashSet; - - use crate::v100::{AccountAddress, AppearanceID, DisplayName}; - - use super::Account; + use crate::prelude::*; #[test] fn equality() { @@ -695,7 +682,7 @@ mod tests { #[test] fn hash() { assert_eq!( - HashSet::from_iter([ + HashSet::::from_iter([ Account::placeholder(), Account::placeholder_stokenet(), Account::placeholder_nebunet(), diff --git a/sargon/src/v100/entity/account/appearance_id.rs b/src/profile/v100/entity/account/appearance_id.rs similarity index 100% rename from sargon/src/v100/entity/account/appearance_id.rs rename to src/profile/v100/entity/account/appearance_id.rs diff --git a/sargon/src/v100/entity/account/mod.rs b/src/profile/v100/entity/account/mod.rs similarity index 100% rename from sargon/src/v100/entity/account/mod.rs rename to src/profile/v100/entity/account/mod.rs diff --git a/sargon/src/v100/entity/account/on_ledger_settings/mod.rs b/src/profile/v100/entity/account/on_ledger_settings/mod.rs similarity index 100% rename from sargon/src/v100/entity/account/on_ledger_settings/mod.rs rename to src/profile/v100/entity/account/on_ledger_settings/mod.rs diff --git a/sargon/src/v100/entity/account/on_ledger_settings/on_ledger_settings.rs b/src/profile/v100/entity/account/on_ledger_settings/on_ledger_settings.rs similarity index 100% rename from sargon/src/v100/entity/account/on_ledger_settings/on_ledger_settings.rs rename to src/profile/v100/entity/account/on_ledger_settings/on_ledger_settings.rs diff --git a/sargon/src/v100/entity/account/on_ledger_settings/third_party_deposits/asset_exception.rs b/src/profile/v100/entity/account/on_ledger_settings/third_party_deposits/asset_exception.rs similarity index 100% rename from sargon/src/v100/entity/account/on_ledger_settings/third_party_deposits/asset_exception.rs rename to src/profile/v100/entity/account/on_ledger_settings/third_party_deposits/asset_exception.rs diff --git a/sargon/src/v100/entity/account/on_ledger_settings/third_party_deposits/deposit_address_exception_rule.rs b/src/profile/v100/entity/account/on_ledger_settings/third_party_deposits/deposit_address_exception_rule.rs similarity index 100% rename from sargon/src/v100/entity/account/on_ledger_settings/third_party_deposits/deposit_address_exception_rule.rs rename to src/profile/v100/entity/account/on_ledger_settings/third_party_deposits/deposit_address_exception_rule.rs diff --git a/sargon/src/v100/entity/account/on_ledger_settings/third_party_deposits/deposit_rule.rs b/src/profile/v100/entity/account/on_ledger_settings/third_party_deposits/deposit_rule.rs similarity index 100% rename from sargon/src/v100/entity/account/on_ledger_settings/third_party_deposits/deposit_rule.rs rename to src/profile/v100/entity/account/on_ledger_settings/third_party_deposits/deposit_rule.rs diff --git a/sargon/src/v100/entity/account/on_ledger_settings/third_party_deposits/mod.rs b/src/profile/v100/entity/account/on_ledger_settings/third_party_deposits/mod.rs similarity index 100% rename from sargon/src/v100/entity/account/on_ledger_settings/third_party_deposits/mod.rs rename to src/profile/v100/entity/account/on_ledger_settings/third_party_deposits/mod.rs diff --git a/sargon/src/v100/entity/account/on_ledger_settings/third_party_deposits/resource_or_non_fungible.rs b/src/profile/v100/entity/account/on_ledger_settings/third_party_deposits/resource_or_non_fungible.rs similarity index 100% rename from sargon/src/v100/entity/account/on_ledger_settings/third_party_deposits/resource_or_non_fungible.rs rename to src/profile/v100/entity/account/on_ledger_settings/third_party_deposits/resource_or_non_fungible.rs diff --git a/sargon/src/v100/entity/account/on_ledger_settings/third_party_deposits/third_party_deposits.rs b/src/profile/v100/entity/account/on_ledger_settings/third_party_deposits/third_party_deposits.rs similarity index 100% rename from sargon/src/v100/entity/account/on_ledger_settings/third_party_deposits/third_party_deposits.rs rename to src/profile/v100/entity/account/on_ledger_settings/third_party_deposits/third_party_deposits.rs diff --git a/sargon/src/v100/entity/display_name.rs b/src/profile/v100/entity/display_name.rs similarity index 100% rename from sargon/src/v100/entity/display_name.rs rename to src/profile/v100/entity/display_name.rs diff --git a/sargon/src/v100/entity/entity_flag.rs b/src/profile/v100/entity/entity_flag.rs similarity index 100% rename from sargon/src/v100/entity/entity_flag.rs rename to src/profile/v100/entity/entity_flag.rs diff --git a/sargon/src/v100/entity/entity_flags.rs b/src/profile/v100/entity/entity_flags.rs similarity index 100% rename from sargon/src/v100/entity/entity_flags.rs rename to src/profile/v100/entity/entity_flags.rs diff --git a/sargon/src/v100/entity/mod.rs b/src/profile/v100/entity/mod.rs similarity index 100% rename from sargon/src/v100/entity/mod.rs rename to src/profile/v100/entity/mod.rs diff --git a/sargon/src/v100/entity/persona/mod.rs b/src/profile/v100/entity/persona/mod.rs similarity index 100% rename from sargon/src/v100/entity/persona/mod.rs rename to src/profile/v100/entity/persona/mod.rs diff --git a/sargon/src/v100/entity/persona/persona.rs b/src/profile/v100/entity/persona/persona.rs similarity index 100% rename from sargon/src/v100/entity/persona/persona.rs rename to src/profile/v100/entity/persona/persona.rs diff --git a/sargon/src/v100/entity/persona/persona_data/entry_kinds/mod.rs b/src/profile/v100/entity/persona/persona_data/entry_kinds/mod.rs similarity index 100% rename from sargon/src/v100/entity/persona/persona_data/entry_kinds/mod.rs rename to src/profile/v100/entity/persona/persona_data/entry_kinds/mod.rs diff --git a/sargon/src/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_email_address.rs b/src/profile/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_email_address.rs similarity index 100% rename from sargon/src/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_email_address.rs rename to src/profile/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_email_address.rs diff --git a/sargon/src/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_name.rs b/src/profile/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_name.rs similarity index 100% rename from sargon/src/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_name.rs rename to src/profile/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_name.rs diff --git a/sargon/src/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_phone_number.rs b/src/profile/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_phone_number.rs similarity index 100% rename from sargon/src/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_phone_number.rs rename to src/profile/v100/entity/persona/persona_data/entry_kinds/persona_data_entry_phone_number.rs diff --git a/sargon/src/v100/entity/persona/persona_data/mod.rs b/src/profile/v100/entity/persona/persona_data/mod.rs similarity index 100% rename from sargon/src/v100/entity/persona/persona_data/mod.rs rename to src/profile/v100/entity/persona/persona_data/mod.rs diff --git a/sargon/src/v100/entity/persona/persona_data/persona_data.rs b/src/profile/v100/entity/persona/persona_data/persona_data.rs similarity index 100% rename from sargon/src/v100/entity/persona/persona_data/persona_data.rs rename to src/profile/v100/entity/persona/persona_data/persona_data.rs diff --git a/sargon/src/v100/entity/persona/persona_data/persona_data_entry_id.rs b/src/profile/v100/entity/persona/persona_data/persona_data_entry_id.rs similarity index 100% rename from sargon/src/v100/entity/persona/persona_data/persona_data_entry_id.rs rename to src/profile/v100/entity/persona/persona_data/persona_data_entry_id.rs diff --git a/sargon/src/v100/entity/persona/persona_data/persona_data_identified_collection_types.rs b/src/profile/v100/entity/persona/persona_data/persona_data_identified_collection_types.rs similarity index 100% rename from sargon/src/v100/entity/persona/persona_data/persona_data_identified_collection_types.rs rename to src/profile/v100/entity/persona/persona_data/persona_data_identified_collection_types.rs diff --git a/sargon/src/v100/entity/persona/persona_data/persona_data_identified_entry_types.rs b/src/profile/v100/entity/persona/persona_data/persona_data_identified_entry_types.rs similarity index 100% rename from sargon/src/v100/entity/persona/persona_data/persona_data_identified_entry_types.rs rename to src/profile/v100/entity/persona/persona_data/persona_data_identified_entry_types.rs diff --git a/sargon/src/v100/entity_security_state/entity_security_state.rs b/src/profile/v100/entity_security_state/entity_security_state.rs similarity index 100% rename from sargon/src/v100/entity_security_state/entity_security_state.rs rename to src/profile/v100/entity_security_state/entity_security_state.rs diff --git a/sargon/src/v100/entity_security_state/mod.rs b/src/profile/v100/entity_security_state/mod.rs similarity index 100% rename from sargon/src/v100/entity_security_state/mod.rs rename to src/profile/v100/entity_security_state/mod.rs diff --git a/sargon/src/v100/entity_security_state/unsecured_entity_control.rs b/src/profile/v100/entity_security_state/unsecured_entity_control.rs similarity index 100% rename from sargon/src/v100/entity_security_state/unsecured_entity_control.rs rename to src/profile/v100/entity_security_state/unsecured_entity_control.rs diff --git a/sargon/src/v100/factors/factor_instance/badge_virtual_source.rs b/src/profile/v100/factors/factor_instance/badge_virtual_source.rs similarity index 100% rename from sargon/src/v100/factors/factor_instance/badge_virtual_source.rs rename to src/profile/v100/factors/factor_instance/badge_virtual_source.rs diff --git a/sargon/src/v100/factors/factor_instance/factor_instance.rs b/src/profile/v100/factors/factor_instance/factor_instance.rs similarity index 100% rename from sargon/src/v100/factors/factor_instance/factor_instance.rs rename to src/profile/v100/factors/factor_instance/factor_instance.rs diff --git a/sargon/src/v100/factors/factor_instance/factor_instance_badge.rs b/src/profile/v100/factors/factor_instance/factor_instance_badge.rs similarity index 100% rename from sargon/src/v100/factors/factor_instance/factor_instance_badge.rs rename to src/profile/v100/factors/factor_instance/factor_instance_badge.rs diff --git a/sargon/src/v100/factors/factor_instance/mod.rs b/src/profile/v100/factors/factor_instance/mod.rs similarity index 100% rename from sargon/src/v100/factors/factor_instance/mod.rs rename to src/profile/v100/factors/factor_instance/mod.rs diff --git a/sargon/src/v100/factors/factor_instance/private_hierarchical_deterministic_factor_instance.rs b/src/profile/v100/factors/factor_instance/private_hierarchical_deterministic_factor_instance.rs similarity index 100% rename from sargon/src/v100/factors/factor_instance/private_hierarchical_deterministic_factor_instance.rs rename to src/profile/v100/factors/factor_instance/private_hierarchical_deterministic_factor_instance.rs diff --git a/sargon/src/v100/factors/factor_source.rs b/src/profile/v100/factors/factor_source.rs similarity index 100% rename from sargon/src/v100/factors/factor_source.rs rename to src/profile/v100/factors/factor_source.rs diff --git a/sargon/src/v100/factors/factor_source_common.rs b/src/profile/v100/factors/factor_source_common.rs similarity index 100% rename from sargon/src/v100/factors/factor_source_common.rs rename to src/profile/v100/factors/factor_source_common.rs diff --git a/sargon/src/v100/factors/factor_source_crypto_parameters.rs b/src/profile/v100/factors/factor_source_crypto_parameters.rs similarity index 100% rename from sargon/src/v100/factors/factor_source_crypto_parameters.rs rename to src/profile/v100/factors/factor_source_crypto_parameters.rs diff --git a/sargon/src/v100/factors/factor_source_flag.rs b/src/profile/v100/factors/factor_source_flag.rs similarity index 100% rename from sargon/src/v100/factors/factor_source_flag.rs rename to src/profile/v100/factors/factor_source_flag.rs diff --git a/sargon/src/v100/factors/factor_source_id.rs b/src/profile/v100/factors/factor_source_id.rs similarity index 100% rename from sargon/src/v100/factors/factor_source_id.rs rename to src/profile/v100/factors/factor_source_id.rs diff --git a/sargon/src/v100/factors/factor_source_id_from_address.rs b/src/profile/v100/factors/factor_source_id_from_address.rs similarity index 100% rename from sargon/src/v100/factors/factor_source_id_from_address.rs rename to src/profile/v100/factors/factor_source_id_from_address.rs diff --git a/sargon/src/v100/factors/factor_source_id_from_hash.rs b/src/profile/v100/factors/factor_source_id_from_hash.rs similarity index 100% rename from sargon/src/v100/factors/factor_source_id_from_hash.rs rename to src/profile/v100/factors/factor_source_id_from_hash.rs diff --git a/sargon/src/v100/factors/factor_source_kind.rs b/src/profile/v100/factors/factor_source_kind.rs similarity index 100% rename from sargon/src/v100/factors/factor_source_kind.rs rename to src/profile/v100/factors/factor_source_kind.rs diff --git a/sargon/src/v100/factors/factor_sources/device_factor_source/device_factor_source.rs b/src/profile/v100/factors/factor_sources/device_factor_source/device_factor_source.rs similarity index 100% rename from sargon/src/v100/factors/factor_sources/device_factor_source/device_factor_source.rs rename to src/profile/v100/factors/factor_sources/device_factor_source/device_factor_source.rs diff --git a/sargon/src/v100/factors/factor_sources/device_factor_source/device_factor_source_hint.rs b/src/profile/v100/factors/factor_sources/device_factor_source/device_factor_source_hint.rs similarity index 100% rename from sargon/src/v100/factors/factor_sources/device_factor_source/device_factor_source_hint.rs rename to src/profile/v100/factors/factor_sources/device_factor_source/device_factor_source_hint.rs diff --git a/sargon/src/v100/factors/factor_sources/device_factor_source/mod.rs b/src/profile/v100/factors/factor_sources/device_factor_source/mod.rs similarity index 100% rename from sargon/src/v100/factors/factor_sources/device_factor_source/mod.rs rename to src/profile/v100/factors/factor_sources/device_factor_source/mod.rs diff --git a/sargon/src/v100/factors/factor_sources/device_factor_source/wallet_client_model.rs b/src/profile/v100/factors/factor_sources/device_factor_source/wallet_client_model.rs similarity index 100% rename from sargon/src/v100/factors/factor_sources/device_factor_source/wallet_client_model.rs rename to src/profile/v100/factors/factor_sources/device_factor_source/wallet_client_model.rs diff --git a/sargon/src/v100/factors/factor_sources/factor_sources.rs b/src/profile/v100/factors/factor_sources/factor_sources.rs similarity index 100% rename from sargon/src/v100/factors/factor_sources/factor_sources.rs rename to src/profile/v100/factors/factor_sources/factor_sources.rs diff --git a/sargon/src/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_factor_source.rs b/src/profile/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_factor_source.rs similarity index 100% rename from sargon/src/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_factor_source.rs rename to src/profile/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_factor_source.rs diff --git a/sargon/src/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_hint.rs b/src/profile/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_hint.rs similarity index 100% rename from sargon/src/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_hint.rs rename to src/profile/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_hint.rs diff --git a/sargon/src/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_model.rs b/src/profile/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_model.rs similarity index 100% rename from sargon/src/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_model.rs rename to src/profile/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/ledger_hardware_wallet_model.rs diff --git a/sargon/src/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/mod.rs b/src/profile/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/mod.rs similarity index 100% rename from sargon/src/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/mod.rs rename to src/profile/v100/factors/factor_sources/ledger_hardware_wallet_factor_source/mod.rs diff --git a/sargon/src/v100/factors/factor_sources/mod.rs b/src/profile/v100/factors/factor_sources/mod.rs similarity index 100% rename from sargon/src/v100/factors/factor_sources/mod.rs rename to src/profile/v100/factors/factor_sources/mod.rs diff --git a/sargon/src/v100/factors/factor_sources/private_hierarchical_deterministic_factor_source.rs b/src/profile/v100/factors/factor_sources/private_hierarchical_deterministic_factor_source.rs similarity index 100% rename from sargon/src/v100/factors/factor_sources/private_hierarchical_deterministic_factor_source.rs rename to src/profile/v100/factors/factor_sources/private_hierarchical_deterministic_factor_source.rs diff --git a/sargon/src/v100/factors/hd_transaction_signing_factor_instance.rs b/src/profile/v100/factors/hd_transaction_signing_factor_instance.rs similarity index 100% rename from sargon/src/v100/factors/hd_transaction_signing_factor_instance.rs rename to src/profile/v100/factors/hd_transaction_signing_factor_instance.rs diff --git a/sargon/src/v100/factors/hierarchical_deterministic_factor_instance.rs b/src/profile/v100/factors/hierarchical_deterministic_factor_instance.rs similarity index 100% rename from sargon/src/v100/factors/hierarchical_deterministic_factor_instance.rs rename to src/profile/v100/factors/hierarchical_deterministic_factor_instance.rs diff --git a/sargon/src/v100/factors/is_factor_source.rs b/src/profile/v100/factors/is_factor_source.rs similarity index 100% rename from sargon/src/v100/factors/is_factor_source.rs rename to src/profile/v100/factors/is_factor_source.rs diff --git a/sargon/src/v100/factors/mod.rs b/src/profile/v100/factors/mod.rs similarity index 100% rename from sargon/src/v100/factors/mod.rs rename to src/profile/v100/factors/mod.rs diff --git a/sargon/src/v100/header/content_hint.rs b/src/profile/v100/header/content_hint.rs similarity index 100% rename from sargon/src/v100/header/content_hint.rs rename to src/profile/v100/header/content_hint.rs diff --git a/sargon/src/v100/header/device_info.rs b/src/profile/v100/header/device_info.rs similarity index 100% rename from sargon/src/v100/header/device_info.rs rename to src/profile/v100/header/device_info.rs diff --git a/sargon/src/v100/header/header.rs b/src/profile/v100/header/header.rs similarity index 100% rename from sargon/src/v100/header/header.rs rename to src/profile/v100/header/header.rs diff --git a/sargon/src/v100/header/mod.rs b/src/profile/v100/header/mod.rs similarity index 100% rename from sargon/src/v100/header/mod.rs rename to src/profile/v100/header/mod.rs diff --git a/sargon/src/v100/header/profile_id.rs b/src/profile/v100/header/profile_id.rs similarity index 100% rename from sargon/src/v100/header/profile_id.rs rename to src/profile/v100/header/profile_id.rs diff --git a/sargon/src/v100/mod.rs b/src/profile/v100/mod.rs similarity index 100% rename from sargon/src/v100/mod.rs rename to src/profile/v100/mod.rs diff --git a/sargon/src/v100/networks/mod.rs b/src/profile/v100/networks/mod.rs similarity index 100% rename from sargon/src/v100/networks/mod.rs rename to src/profile/v100/networks/mod.rs diff --git a/sargon/src/v100/networks/network/accounts.rs b/src/profile/v100/networks/network/accounts.rs similarity index 100% rename from sargon/src/v100/networks/network/accounts.rs rename to src/profile/v100/networks/network/accounts.rs diff --git a/sargon/src/v100/networks/network/authorized_dapp/authorized_dapp.rs b/src/profile/v100/networks/network/authorized_dapp/authorized_dapp.rs similarity index 100% rename from sargon/src/v100/networks/network/authorized_dapp/authorized_dapp.rs rename to src/profile/v100/networks/network/authorized_dapp/authorized_dapp.rs diff --git a/sargon/src/v100/networks/network/authorized_dapp/authorized_persona_simple.rs b/src/profile/v100/networks/network/authorized_dapp/authorized_persona_simple.rs similarity index 100% rename from sargon/src/v100/networks/network/authorized_dapp/authorized_persona_simple.rs rename to src/profile/v100/networks/network/authorized_dapp/authorized_persona_simple.rs diff --git a/sargon/src/v100/networks/network/authorized_dapp/mod.rs b/src/profile/v100/networks/network/authorized_dapp/mod.rs similarity index 100% rename from sargon/src/v100/networks/network/authorized_dapp/mod.rs rename to src/profile/v100/networks/network/authorized_dapp/mod.rs diff --git a/sargon/src/v100/networks/network/authorized_dapp/requested_number_quantifier.rs b/src/profile/v100/networks/network/authorized_dapp/requested_number_quantifier.rs similarity index 100% rename from sargon/src/v100/networks/network/authorized_dapp/requested_number_quantifier.rs rename to src/profile/v100/networks/network/authorized_dapp/requested_number_quantifier.rs diff --git a/sargon/src/v100/networks/network/authorized_dapp/requested_quantity.rs b/src/profile/v100/networks/network/authorized_dapp/requested_quantity.rs similarity index 100% rename from sargon/src/v100/networks/network/authorized_dapp/requested_quantity.rs rename to src/profile/v100/networks/network/authorized_dapp/requested_quantity.rs diff --git a/sargon/src/v100/networks/network/authorized_dapp/shared_persona_data.rs b/src/profile/v100/networks/network/authorized_dapp/shared_persona_data.rs similarity index 100% rename from sargon/src/v100/networks/network/authorized_dapp/shared_persona_data.rs rename to src/profile/v100/networks/network/authorized_dapp/shared_persona_data.rs diff --git a/sargon/src/v100/networks/network/authorized_dapp/shared_with_dapp.rs b/src/profile/v100/networks/network/authorized_dapp/shared_with_dapp.rs similarity index 100% rename from sargon/src/v100/networks/network/authorized_dapp/shared_with_dapp.rs rename to src/profile/v100/networks/network/authorized_dapp/shared_with_dapp.rs diff --git a/sargon/src/v100/networks/network/authorized_dapps.rs b/src/profile/v100/networks/network/authorized_dapps.rs similarity index 100% rename from sargon/src/v100/networks/network/authorized_dapps.rs rename to src/profile/v100/networks/network/authorized_dapps.rs diff --git a/sargon/src/v100/networks/network/mod.rs b/src/profile/v100/networks/network/mod.rs similarity index 100% rename from sargon/src/v100/networks/network/mod.rs rename to src/profile/v100/networks/network/mod.rs diff --git a/sargon/src/v100/networks/network/network_id.rs b/src/profile/v100/networks/network/network_id.rs similarity index 87% rename from sargon/src/v100/networks/network/network_id.rs rename to src/profile/v100/networks/network/network_id.rs index cf445a4ff..7d974f2df 100644 --- a/sargon/src/v100/networks/network/network_id.rs +++ b/src/profile/v100/networks/network/network_id.rs @@ -1,5 +1,5 @@ use crate::prelude::*; -use radix_engine_common::network::NetworkDefinition as NativeNetworkDefinition; +use radix_engine_common::network::NetworkDefinition as ScryptoNetworkDefinition; #[derive( Serialize_repr, @@ -114,40 +114,40 @@ impl std::fmt::Display for NetworkID { } impl NetworkID { - /// Looks up a `NativeNetworkDefinition` in lookup table, + /// Looks up a `ScryptoNetworkDefinition` in lookup table, /// this is used internally for radix_engine_common::address::AddressBech32Decoder, /// and to read out the canonical name (logical name) for a network. - pub(crate) fn network_definition(&self) -> NativeNetworkDefinition { + pub(crate) fn network_definition(&self) -> ScryptoNetworkDefinition { use NetworkID::*; match self { - Mainnet => NativeNetworkDefinition::mainnet(), - Stokenet => NativeNetworkDefinition::stokenet(), - Adapanet => NativeNetworkDefinition::adapanet(), - Nebunet => NativeNetworkDefinition::nebunet(), - Kisharnet => NativeNetworkDefinition::kisharnet(), - Ansharnet => NativeNetworkDefinition::ansharnet(), - Zabanet => NativeNetworkDefinition::zabanet(), - Enkinet => NativeNetworkDefinition { + Mainnet => ScryptoNetworkDefinition::mainnet(), + Stokenet => ScryptoNetworkDefinition::stokenet(), + Adapanet => ScryptoNetworkDefinition::adapanet(), + Nebunet => ScryptoNetworkDefinition::nebunet(), + Kisharnet => ScryptoNetworkDefinition::kisharnet(), + Ansharnet => ScryptoNetworkDefinition::ansharnet(), + Zabanet => ScryptoNetworkDefinition::zabanet(), + Enkinet => ScryptoNetworkDefinition { id: Enkinet.discriminant(), logical_name: String::from("enkinet"), hrp_suffix: String::from("tdx_21_"), }, - Hammunet => NativeNetworkDefinition { + Hammunet => ScryptoNetworkDefinition { id: Hammunet.discriminant(), logical_name: String::from("hammunet"), hrp_suffix: String::from("tdx_22_"), }, - Nergalnet => NativeNetworkDefinition { + Nergalnet => ScryptoNetworkDefinition { id: Nebunet.discriminant(), logical_name: String::from("nergalnet"), hrp_suffix: String::from("tdx_24_"), }, - Mardunet => NativeNetworkDefinition { + Mardunet => ScryptoNetworkDefinition { id: Mardunet.discriminant(), logical_name: String::from("mardunet"), hrp_suffix: String::from("tdx_24_"), }, - NetworkID::Simulator => NativeNetworkDefinition::simulator(), + NetworkID::Simulator => ScryptoNetworkDefinition::simulator(), } } } diff --git a/sargon/src/v100/networks/network/personas.rs b/src/profile/v100/networks/network/personas.rs similarity index 100% rename from sargon/src/v100/networks/network/personas.rs rename to src/profile/v100/networks/network/personas.rs diff --git a/sargon/src/v100/networks/network/profile_network.rs b/src/profile/v100/networks/network/profile_network.rs similarity index 100% rename from sargon/src/v100/networks/network/profile_network.rs rename to src/profile/v100/networks/network/profile_network.rs diff --git a/sargon/src/v100/networks/profile_networks.rs b/src/profile/v100/networks/profile_networks.rs similarity index 100% rename from sargon/src/v100/networks/profile_networks.rs rename to src/profile/v100/networks/profile_networks.rs diff --git a/sargon/src/v100/profile.rs b/src/profile/v100/profile.rs similarity index 100% rename from sargon/src/v100/profile.rs rename to src/profile/v100/profile.rs diff --git a/sargon/src/sargon.udl b/src/sargon.udl similarity index 100% rename from sargon/src/sargon.udl rename to src/sargon.udl diff --git a/sargon/src/wallet/mod.rs b/src/wallet/mod.rs similarity index 100% rename from sargon/src/wallet/mod.rs rename to src/wallet/mod.rs diff --git a/sargon/src/wallet/secure_storage/always_fail_storage.rs b/src/wallet/secure_storage/always_fail_storage.rs similarity index 100% rename from sargon/src/wallet/secure_storage/always_fail_storage.rs rename to src/wallet/secure_storage/always_fail_storage.rs diff --git a/sargon/src/wallet/secure_storage/ephemeral_secure_storage.rs b/src/wallet/secure_storage/ephemeral_secure_storage.rs similarity index 100% rename from sargon/src/wallet/secure_storage/ephemeral_secure_storage.rs rename to src/wallet/secure_storage/ephemeral_secure_storage.rs diff --git a/sargon/src/wallet/secure_storage/mod.rs b/src/wallet/secure_storage/mod.rs similarity index 100% rename from sargon/src/wallet/secure_storage/mod.rs rename to src/wallet/secure_storage/mod.rs diff --git a/sargon/src/wallet/secure_storage/secure_storage.rs b/src/wallet/secure_storage/secure_storage.rs similarity index 90% rename from sargon/src/wallet/secure_storage/secure_storage.rs rename to src/wallet/secure_storage/secure_storage.rs index 8a275095c..983cc3fc9 100644 --- a/sargon/src/wallet/secure_storage/secure_storage.rs +++ b/src/wallet/secure_storage/secure_storage.rs @@ -1,6 +1,6 @@ use crate::prelude::*; -#[uniffi::export] +#[uniffi::export(with_foreign)] pub trait SecureStorage: Send + Sync + std::fmt::Debug { fn load_data(&self, key: SecureStorageKey) -> Result>>; fn save_data(&self, key: SecureStorageKey, data: Vec) -> Result<()>; diff --git a/sargon/src/wallet/secure_storage/secure_storage_key.rs b/src/wallet/secure_storage/secure_storage_key.rs similarity index 100% rename from sargon/src/wallet/secure_storage/secure_storage_key.rs rename to src/wallet/secure_storage/secure_storage_key.rs diff --git a/sargon/src/wallet/secure_storage/wallet_client_storage.rs b/src/wallet/secure_storage/wallet_client_storage.rs similarity index 99% rename from sargon/src/wallet/secure_storage/wallet_client_storage.rs rename to src/wallet/secure_storage/wallet_client_storage.rs index 320734101..4fc696540 100644 --- a/sargon/src/wallet/secure_storage/wallet_client_storage.rs +++ b/src/wallet/secure_storage/wallet_client_storage.rs @@ -188,7 +188,8 @@ mod tests { sut.load::(SecureStorageKey::ActiveProfileID), Err(CommonError::FailedToDeserializeJSONToValue { json_byte_count: 1, - type_name: "sargon::v100::profile::Profile".to_string() + type_name: "sargon::profile::v100::profile::Profile" + .to_string() }) ); } diff --git a/sargon/src/wallet/wallet.rs b/src/wallet/wallet.rs similarity index 99% rename from sargon/src/wallet/wallet.rs rename to src/wallet/wallet.rs index 1a4cfcedd..4599a37fb 100644 --- a/sargon/src/wallet/wallet.rs +++ b/src/wallet/wallet.rs @@ -254,7 +254,6 @@ impl Wallet { #[cfg(test)] mod tests { - use radix_engine_toolkit_json::models::transaction::header; use crate::prelude::*; #[test] diff --git a/sargon/src/wallet/wallet_accounts.rs b/src/wallet/wallet_accounts.rs similarity index 100% rename from sargon/src/wallet/wallet_accounts.rs rename to src/wallet/wallet_accounts.rs diff --git a/sargon/src/wallet/wallet_profile_io.rs b/src/wallet/wallet_profile_io.rs similarity index 100% rename from sargon/src/wallet/wallet_profile_io.rs rename to src/wallet/wallet_profile_io.rs diff --git a/sargon/tests/uniffi/bindings/test_account_address.kts b/tests/uniffi/bindings/test_account_address.kts similarity index 100% rename from sargon/tests/uniffi/bindings/test_account_address.kts rename to tests/uniffi/bindings/test_account_address.kts diff --git a/sargon/tests/uniffi/bindings/test_account_address.swift b/tests/uniffi/bindings/test_account_address.swift similarity index 100% rename from sargon/tests/uniffi/bindings/test_account_address.swift rename to tests/uniffi/bindings/test_account_address.swift diff --git a/sargon/tests/uniffi/bindings/test_app_preferences.kts b/tests/uniffi/bindings/test_app_preferences.kts similarity index 100% rename from sargon/tests/uniffi/bindings/test_app_preferences.kts rename to tests/uniffi/bindings/test_app_preferences.kts diff --git a/sargon/tests/uniffi/bindings/test_app_preferences.swift b/tests/uniffi/bindings/test_app_preferences.swift similarity index 100% rename from sargon/tests/uniffi/bindings/test_app_preferences.swift rename to tests/uniffi/bindings/test_app_preferences.swift diff --git a/sargon/tests/uniffi/bindings/test_bag_of_bytes.kts b/tests/uniffi/bindings/test_bag_of_bytes.kts similarity index 100% rename from sargon/tests/uniffi/bindings/test_bag_of_bytes.kts rename to tests/uniffi/bindings/test_bag_of_bytes.kts diff --git a/sargon/tests/uniffi/bindings/test_bag_of_bytes.swift b/tests/uniffi/bindings/test_bag_of_bytes.swift similarity index 100% rename from sargon/tests/uniffi/bindings/test_bag_of_bytes.swift rename to tests/uniffi/bindings/test_bag_of_bytes.swift diff --git a/sargon/tests/uniffi/bindings/test_factor_sources.kts b/tests/uniffi/bindings/test_factor_sources.kts similarity index 100% rename from sargon/tests/uniffi/bindings/test_factor_sources.kts rename to tests/uniffi/bindings/test_factor_sources.kts diff --git a/sargon/tests/uniffi/bindings/test_factor_sources.swift b/tests/uniffi/bindings/test_factor_sources.swift similarity index 100% rename from sargon/tests/uniffi/bindings/test_factor_sources.swift rename to tests/uniffi/bindings/test_factor_sources.swift diff --git a/sargon/tests/uniffi/bindings/test_gateways.kts b/tests/uniffi/bindings/test_gateways.kts similarity index 100% rename from sargon/tests/uniffi/bindings/test_gateways.kts rename to tests/uniffi/bindings/test_gateways.kts diff --git a/sargon/tests/uniffi/bindings/test_gateways.swift b/tests/uniffi/bindings/test_gateways.swift similarity index 100% rename from sargon/tests/uniffi/bindings/test_gateways.swift rename to tests/uniffi/bindings/test_gateways.swift diff --git a/sargon/tests/uniffi/bindings/test_header.kts b/tests/uniffi/bindings/test_header.kts similarity index 100% rename from sargon/tests/uniffi/bindings/test_header.kts rename to tests/uniffi/bindings/test_header.kts diff --git a/sargon/tests/uniffi/bindings/test_header.swift b/tests/uniffi/bindings/test_header.swift similarity index 100% rename from sargon/tests/uniffi/bindings/test_header.swift rename to tests/uniffi/bindings/test_header.swift diff --git a/sargon/tests/uniffi/bindings/test_hex32_bytes.kts b/tests/uniffi/bindings/test_hex32_bytes.kts similarity index 100% rename from sargon/tests/uniffi/bindings/test_hex32_bytes.kts rename to tests/uniffi/bindings/test_hex32_bytes.kts diff --git a/sargon/tests/uniffi/bindings/test_hex32_bytes.swift b/tests/uniffi/bindings/test_hex32_bytes.swift similarity index 100% rename from sargon/tests/uniffi/bindings/test_hex32_bytes.swift rename to tests/uniffi/bindings/test_hex32_bytes.swift diff --git a/sargon/tests/uniffi/bindings/test_keys.kts b/tests/uniffi/bindings/test_keys.kts similarity index 100% rename from sargon/tests/uniffi/bindings/test_keys.kts rename to tests/uniffi/bindings/test_keys.kts diff --git a/sargon/tests/uniffi/bindings/test_keys.swift b/tests/uniffi/bindings/test_keys.swift similarity index 100% rename from sargon/tests/uniffi/bindings/test_keys.swift rename to tests/uniffi/bindings/test_keys.swift diff --git a/sargon/tests/uniffi/bindings/test_non_fungible_local_id.kts b/tests/uniffi/bindings/test_non_fungible_local_id.kts similarity index 100% rename from sargon/tests/uniffi/bindings/test_non_fungible_local_id.kts rename to tests/uniffi/bindings/test_non_fungible_local_id.kts diff --git a/sargon/tests/uniffi/bindings/test_non_fungible_local_id.swift b/tests/uniffi/bindings/test_non_fungible_local_id.swift similarity index 100% rename from sargon/tests/uniffi/bindings/test_non_fungible_local_id.swift rename to tests/uniffi/bindings/test_non_fungible_local_id.swift diff --git a/sargon/tests/uniffi/bindings/test_profile.kts b/tests/uniffi/bindings/test_profile.kts similarity index 100% rename from sargon/tests/uniffi/bindings/test_profile.kts rename to tests/uniffi/bindings/test_profile.kts diff --git a/sargon/tests/uniffi/bindings/test_profile.swift b/tests/uniffi/bindings/test_profile.swift similarity index 100% rename from sargon/tests/uniffi/bindings/test_profile.swift rename to tests/uniffi/bindings/test_profile.swift diff --git a/sargon/tests/uniffi/bindings/test_radix_connect_password.kts b/tests/uniffi/bindings/test_radix_connect_password.kts similarity index 100% rename from sargon/tests/uniffi/bindings/test_radix_connect_password.kts rename to tests/uniffi/bindings/test_radix_connect_password.kts diff --git a/sargon/tests/uniffi/bindings/test_radix_connect_password.swift b/tests/uniffi/bindings/test_radix_connect_password.swift similarity index 100% rename from sargon/tests/uniffi/bindings/test_radix_connect_password.swift rename to tests/uniffi/bindings/test_radix_connect_password.swift diff --git a/sargon/tests/uniffi/bindings/test_resource_address.kts b/tests/uniffi/bindings/test_resource_address.kts similarity index 100% rename from sargon/tests/uniffi/bindings/test_resource_address.kts rename to tests/uniffi/bindings/test_resource_address.kts diff --git a/sargon/tests/uniffi/bindings/test_resource_address.swift b/tests/uniffi/bindings/test_resource_address.swift similarity index 100% rename from sargon/tests/uniffi/bindings/test_resource_address.swift rename to tests/uniffi/bindings/test_resource_address.swift diff --git a/sargon/tests/uniffi/bindings/test_wallet.kts b/tests/uniffi/bindings/test_wallet.kts similarity index 100% rename from sargon/tests/uniffi/bindings/test_wallet.kts rename to tests/uniffi/bindings/test_wallet.kts diff --git a/sargon/tests/uniffi/bindings/test_wallet.swift b/tests/uniffi/bindings/test_wallet.swift similarity index 100% rename from sargon/tests/uniffi/bindings/test_wallet.swift rename to tests/uniffi/bindings/test_wallet.swift diff --git a/sargon/tests/uniffi/main.rs b/tests/uniffi/main.rs similarity index 100% rename from sargon/tests/uniffi/main.rs rename to tests/uniffi/main.rs diff --git a/sargon/tests/vectors/fixtures/bip44_secp256k1.json b/tests/vectors/fixtures/bip44_secp256k1.json similarity index 100% rename from sargon/tests/vectors/fixtures/bip44_secp256k1.json rename to tests/vectors/fixtures/bip44_secp256k1.json diff --git a/sargon/tests/vectors/fixtures/cap26_curve25519.json b/tests/vectors/fixtures/cap26_curve25519.json similarity index 100% rename from sargon/tests/vectors/fixtures/cap26_curve25519.json rename to tests/vectors/fixtures/cap26_curve25519.json diff --git a/sargon/tests/vectors/fixtures/cap26_secp256k1.json b/tests/vectors/fixtures/cap26_secp256k1.json similarity index 100% rename from sargon/tests/vectors/fixtures/cap26_secp256k1.json rename to tests/vectors/fixtures/cap26_secp256k1.json diff --git a/sargon/tests/vectors/fixtures/only_plaintext_profile_snapshot_version_100.json b/tests/vectors/fixtures/only_plaintext_profile_snapshot_version_100.json similarity index 100% rename from sargon/tests/vectors/fixtures/only_plaintext_profile_snapshot_version_100.json rename to tests/vectors/fixtures/only_plaintext_profile_snapshot_version_100.json diff --git a/sargon/tests/vectors/fixtures/slip10_tests_#10.json b/tests/vectors/fixtures/slip10_tests_#10.json similarity index 100% rename from sargon/tests/vectors/fixtures/slip10_tests_#10.json rename to tests/vectors/fixtures/slip10_tests_#10.json diff --git a/sargon/tests/vectors/fixtures/slip10_tests_#1000.json b/tests/vectors/fixtures/slip10_tests_#1000.json similarity index 100% rename from sargon/tests/vectors/fixtures/slip10_tests_#1000.json rename to tests/vectors/fixtures/slip10_tests_#1000.json diff --git a/sargon/tests/vectors/main.rs b/tests/vectors/main.rs similarity index 100% rename from sargon/tests/vectors/main.rs rename to tests/vectors/main.rs diff --git a/uniffi.toml b/uniffi.toml new file mode 100644 index 000000000..2d520d75b --- /dev/null +++ b/uniffi.toml @@ -0,0 +1,53 @@ +[bindings.swift] +module_name = "Sargon" + +[bindings.kotlin] +package_name = "sargon" + +[bindings.swift.custom_types.BagOfBytes] +type_name = "Data" +imports = ["Foundation"] +into_custom = "{ Data({}.map({ i8 in UInt8(bitPattern: i8) })) }()" +from_custom = "{ {}.map({ u8 in Int8(bitPattern: u8) }) }()" + +[bindings.kotlin.custom_types.BagOfBytes] +type_name = "List" +imports = [] +into_custom = "{}.map({ it.toUByte() })" +from_custom = "{}.map({ it.toByte() })" + +[bindings.swift.custom_types.Uuid] +type_name = "UUID" +imports = ["Foundation"] +into_custom = "UUID(uuidString: {})!" +from_custom = "{}.uuidString" + +[bindings.kotlin.custom_types.Uuid] +type_name = "UUID" +imports = ["java.util.UUID"] +into_custom = "UUID.fromString({})" +from_custom = "{}.toString()" + +[bindings.swift.custom_types.Url] +type_name = "URL" +imports = ["Foundation"] +into_custom = "URL(string: {})!" +from_custom = "String(describing: {})" + +[bindings.kotlin.custom_types.Url] +type_name = "URL" +imports = ["java.net.URI", "java.net.URL"] +into_custom = "URI({}).toURL()" +from_custom = "{}.toString()" + +[bindings.swift.custom_types.Timestamp] +type_name = "Date" +imports = ["Foundation"] +into_custom = "{let df = DateFormatter();df.dateFormat = \"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ\";return df.date(from: {})!}()" +from_custom = "{let df = DateFormatter();df.dateFormat = \"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ\";return df.string(from: {})}()" + +[bindings.kotlin.custom_types.Timestamp] +type_name = "OffsetDateTime" +imports = ["java.time.OffsetDateTime", "java.time.format.DateTimeFormatter"] +into_custom = "OffsetDateTime.parse({}, DateTimeFormatter.ISO_DATE_TIME)" +from_custom = "{}.format(DateTimeFormatter.ISO_DATE_TIME)" From 2781e36785d57fb59ad88912957342ae0aa59207 Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Tue, 13 Feb 2024 12:31:00 +0100 Subject: [PATCH 02/13] bump rust version in GH actions --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf47f393a..46fa1ec02 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: - name: Install Rust Toolchain uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2023-11-24 + toolchain: nightly-2024-01-11 default: true components: rustfmt, clippy - name: Install cargo nextest @@ -46,7 +46,7 @@ jobs: - name: Install Rust Toolchain uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2023-11-24 + toolchain: nightly-2024-01-11 default: true components: rustfmt - name: Check formatting @@ -58,7 +58,7 @@ jobs: - name: Install Rust Toolchain uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2023-11-24 + toolchain: nightly-2024-01-11 default: true profile: minimal - name: Cargo Check @@ -70,7 +70,7 @@ jobs: - name: Install Rust Toolchain uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2023-11-24 + toolchain: nightly-2024-01-11 default: true components: rustfmt, clippy - name: Clippy Check From de790065e73b694a61a60f82f9c9079a33fb1509 Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Tue, 13 Feb 2024 12:35:55 +0100 Subject: [PATCH 03/13] Add generate code coverage step to test.yml --- .github/workflows/test.yml | 134 +++++++++++++++++++++---------------- 1 file changed, 75 insertions(+), 59 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 46fa1ec02..75298f340 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,71 +7,87 @@ on: env: CARGO_TERM_COLOR: always jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly-2024-01-11 - default: true - components: rustfmt, clippy - - name: Install cargo nextest - uses: baptiste0928/cargo-install@v1 - with: - crate: cargo-nextest - locked: true - - name: Install cargo tarpaulin - uses: baptiste0928/cargo-install@v1 - with: - crate: cargo-tarpaulin = "0.27.3" - locked: true - - name: Install JNA - run: wget https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.13.0/jna-5.13.0.jar - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.3 - - name: Run tests - run: CLASSPATH="$PWD/jna-5.13.0.jar" cargo nextest run - env: - # Required env-var to increase the heapsize when using `kotlinc`. - JAVA_OPTS: "-Xmx8g" - # Enable sccache - SCCACHE_GHA_ENABLED: "true" - RUSTC_WRAPPER: "sccache" check-formatting: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly-2024-01-11 - default: true - components: rustfmt - - name: Check formatting - run: cargo fmt --check + - uses: actions/checkout@v4 + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2024-01-11 + default: true + components: rustfmt + - name: Check formatting + run: cargo fmt --check cargo-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly-2024-01-11 - default: true - profile: minimal - - name: Cargo Check - run: cargo check --all + - uses: actions/checkout@v4 + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2024-01-11 + default: true + profile: minimal + - name: Cargo Check + run: cargo check --all clippy-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly-2024-01-11 - default: true - components: rustfmt, clippy - - name: Clippy Check - run: cargo clippy --all \ No newline at end of file + - uses: actions/checkout@v4 + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2024-01-11 + default: true + components: rustfmt, clippy + - name: Clippy Check + run: cargo clippy --all + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2024-01-11 + default: true + components: rustfmt, clippy + - name: Install cargo nextest + uses: baptiste0928/cargo-install@v1 + with: + crate: cargo-nextest + locked: true + - name: Install JNA + run: wget https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.13.0/jna-5.13.0.jar + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.3 + - name: Run tests + run: CLASSPATH="$PWD/jna-5.13.0.jar" cargo nextest run + env: + # Required env-var to increase the heapsize when using `kotlinc`. + JAVA_OPTS: "-Xmx8g" + # Enable sccache + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" + codecoverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly-2024-01-11 + default: true + - name: Install cargo tarpaulin + uses: baptiste0928/cargo-install@v1 + with: + crate: cargo-tarpaulin = "0.27.3" + locked: true + - name: Generate code coverage + run: cargo +nightly tarpaulin + + - name: Upload to codecov.io + uses: codecov/codecov-action@v2 + with: + fail_ci_if_error: true From 1924ac897143f1726bfa858bb274b93fd3ca883b Mon Sep 17 00:00:00 2001 From: Marek Karwacki Date: Wed, 14 Feb 2024 08:25:14 +0100 Subject: [PATCH 04/13] ci: use forked github actions --- .github/workflows/test.yml | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 75298f340..7516e0387 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,9 +10,9 @@ jobs: check-formatting: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: RDXWorks-actions/checkout - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 + uses: RDXWorks-actions/toolchain@master with: toolchain: nightly-2024-01-11 default: true @@ -22,9 +22,9 @@ jobs: cargo-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: RDXWorks-actions/checkout - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 + uses: RDXWorks-actions/toolchain@master with: toolchain: nightly-2024-01-11 default: true @@ -34,9 +34,9 @@ jobs: clippy-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: RDXWorks-actions/checkout - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 + uses: RDXWorks-actions/toolchain@master with: toolchain: nightly-2024-01-11 default: true @@ -46,22 +46,22 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: RDXWorks-actions/checkout - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 + uses: RDXWorks-actions/toolchain@master with: toolchain: nightly-2024-01-11 default: true components: rustfmt, clippy - name: Install cargo nextest - uses: baptiste0928/cargo-install@v1 + uses: RDXWorks-actions/cargo-install@main with: crate: cargo-nextest locked: true - name: Install JNA run: wget https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.13.0/jna-5.13.0.jar - name: Run sccache-cache - uses: mozilla-actions/sccache-action@v0.0.3 + uses: RDXWorks-actions/sccache-action@main - name: Run tests run: CLASSPATH="$PWD/jna-5.13.0.jar" cargo nextest run env: @@ -73,21 +73,29 @@ jobs: codecoverage: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: RDXWorks-actions/checkout - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 + uses: RDXWorks-actions/toolchain@master with: toolchain: nightly-2024-01-11 default: true - name: Install cargo tarpaulin - uses: baptiste0928/cargo-install@v1 + uses: RDXWorks-actions/cargo-install@main with: crate: cargo-tarpaulin = "0.27.3" locked: true + - uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main + with: + role_name: ${{ secrets.AWS_ROLE_NAME_SECRET }} + app_name: 'sargon' + step_name: 'codecoverage' + secret_prefix: 'CODECOV' + secret_name: ${{ secrets.AWS_SECRET_NAME_CODECOV }} + parse_json: true - name: Generate code coverage run: cargo +nightly tarpaulin - name: Upload to codecov.io - uses: codecov/codecov-action@v2 + uses: RDXWorks-actions/codecov-action@main with: fail_ci_if_error: true From 021e388b729139eb3da7d18629367100e885ead5 Mon Sep 17 00:00:00 2001 From: Marek Karwacki Date: Wed, 14 Feb 2024 08:27:14 +0100 Subject: [PATCH 05/13] ci: use forked github actions --- .github/workflows/test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7516e0387..4865162cd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: check-formatting: runs-on: ubuntu-latest steps: - - uses: RDXWorks-actions/checkout + - uses: RDXWorks-actions/checkout@main - name: Install Rust Toolchain uses: RDXWorks-actions/toolchain@master with: @@ -22,7 +22,7 @@ jobs: cargo-check: runs-on: ubuntu-latest steps: - - uses: RDXWorks-actions/checkout + - uses: RDXWorks-actions/checkout@main - name: Install Rust Toolchain uses: RDXWorks-actions/toolchain@master with: @@ -34,7 +34,7 @@ jobs: clippy-check: runs-on: ubuntu-latest steps: - - uses: RDXWorks-actions/checkout + - uses: RDXWorks-actions/checkout@main - name: Install Rust Toolchain uses: RDXWorks-actions/toolchain@master with: @@ -46,7 +46,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: RDXWorks-actions/checkout + - uses: RDXWorks-actions/checkout@main@main - name: Install Rust Toolchain uses: RDXWorks-actions/toolchain@master with: @@ -73,7 +73,7 @@ jobs: codecoverage: runs-on: ubuntu-latest steps: - - uses: RDXWorks-actions/checkout + - uses: RDXWorks-actions/checkout@main - name: Install Rust Toolchain uses: RDXWorks-actions/toolchain@master with: From 953681a6d831aeca68b7f7381e3994972520dcf4 Mon Sep 17 00:00:00 2001 From: Marek Karwacki Date: Wed, 14 Feb 2024 08:50:49 +0100 Subject: [PATCH 06/13] ci: use forked github actions --- .github/workflows/test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4865162cd..59968b3d6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,10 @@ name: Test on: pull_request: push: +permissions: + id-token: write + pull-requests: read + contents: read env: CARGO_TERM_COLOR: always jobs: @@ -46,7 +50,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: RDXWorks-actions/checkout@main@main + - uses: RDXWorks-actions/checkout@main - name: Install Rust Toolchain uses: RDXWorks-actions/toolchain@master with: From 567e830b6ba430a050193cc5a5a48de0af7754ac Mon Sep 17 00:00:00 2001 From: Marek Karwacki Date: Wed, 14 Feb 2024 08:52:43 +0100 Subject: [PATCH 07/13] ci: use cargo-install v1 --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 59968b3d6..d57a4f805 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,7 +58,7 @@ jobs: default: true components: rustfmt, clippy - name: Install cargo nextest - uses: RDXWorks-actions/cargo-install@main + uses: RDXWorks-actions/cargo-install@v1 with: crate: cargo-nextest locked: true @@ -84,7 +84,7 @@ jobs: toolchain: nightly-2024-01-11 default: true - name: Install cargo tarpaulin - uses: RDXWorks-actions/cargo-install@main + uses: RDXWorks-actions/cargo-install@v1 with: crate: cargo-tarpaulin = "0.27.3" locked: true From 00cee0e597591494b30614142b87c1ae0248fa86 Mon Sep 17 00:00:00 2001 From: Marek Karwacki Date: Wed, 14 Feb 2024 08:55:43 +0100 Subject: [PATCH 08/13] ci: fix cargo-tarpaulin --- .github/workflows/test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d57a4f805..abfde64a9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,7 +58,7 @@ jobs: default: true components: rustfmt, clippy - name: Install cargo nextest - uses: RDXWorks-actions/cargo-install@v1 + uses: RDXWorks-actions/cargo-install@main with: crate: cargo-nextest locked: true @@ -84,9 +84,10 @@ jobs: toolchain: nightly-2024-01-11 default: true - name: Install cargo tarpaulin - uses: RDXWorks-actions/cargo-install@v1 + uses: RDXWorks-actions/cargo-install@main with: - crate: cargo-tarpaulin = "0.27.3" + crate: cargo-tarpaulin + tag: 0.27.3 locked: true - uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main with: From 031a6f20a8d2e4041afd3a0aed7ea77e35f9491c Mon Sep 17 00:00:00 2001 From: Marek Karwacki Date: Wed, 14 Feb 2024 09:09:36 +0100 Subject: [PATCH 09/13] ci: extend permissions --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index abfde64a9..c5ceaa466 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,6 +8,7 @@ permissions: id-token: write pull-requests: read contents: read + deployments: write env: CARGO_TERM_COLOR: always jobs: From 8a592cfcdbc85c865dc0d9fde6ac895571d3cbcf Mon Sep 17 00:00:00 2001 From: Marek Karwacki Date: Wed, 14 Feb 2024 09:21:42 +0100 Subject: [PATCH 10/13] ci: adjust permissions --- .github/workflows/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c5ceaa466..ebf697a8f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,9 +6,7 @@ on: push: permissions: id-token: write - pull-requests: read contents: read - deployments: write env: CARGO_TERM_COLOR: always jobs: @@ -100,7 +98,6 @@ jobs: parse_json: true - name: Generate code coverage run: cargo +nightly tarpaulin - - name: Upload to codecov.io uses: RDXWorks-actions/codecov-action@main with: From f16d45172834f5e231d74ce4719f7e5151aa5c4a Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Wed, 14 Feb 2024 09:43:06 +0100 Subject: [PATCH 11/13] Remove macOS specific random bytes impl, with one that might work on Linux --- tests/uniffi/bindings/test_bag_of_bytes.swift | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/uniffi/bindings/test_bag_of_bytes.swift b/tests/uniffi/bindings/test_bag_of_bytes.swift index 204471867..57da5418e 100644 --- a/tests/uniffi/bindings/test_bag_of_bytes.swift +++ b/tests/uniffi/bindings/test_bag_of_bytes.swift @@ -62,15 +62,18 @@ extension Data { } } +func randomByteArray(byteCount count: Int) throws -> [UInt8] { + #if canImport(Darwin) || os(Linux) || os(Android) || os(Windows) + var rng = SystemRandomNumberGenerator() + return (0.. Self { - var bytes = [UInt8](repeating: 0, count: byteCount) - let status = SecRandomCopyBytes(kSecRandomDefault, byteCount, &bytes) - if status == errSecSuccess { - return Self(bytes) - } - struct UnableToGenerateBytes: Swift.Error {} - throw UnableToGenerateBytes() + Data(randomBytesArray(byteCount: byteCount)) } } From 850c5b2b58f30d90ee4f11c2103d439de56f8da6 Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Wed, 14 Feb 2024 09:57:29 +0100 Subject: [PATCH 12/13] Remove ALL keychain random bytes refs, update CI, try running tarpaulin without nightly. --- .github/workflows/test.yml | 8 ++++---- tests/uniffi/bindings/test_bag_of_bytes.swift | 8 ++++---- tests/uniffi/bindings/test_hex32_bytes.swift | 20 +++++++++++-------- .../test_radix_connect_password.swift | 20 +++++++++++-------- tests/uniffi/bindings/test_wallet.swift | 20 +++++++++++-------- 5 files changed, 44 insertions(+), 32 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ebf697a8f..e04debf96 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -91,13 +91,13 @@ jobs: - uses: radixdlt/public-iac-resuable-artifacts/fetch-secrets@main with: role_name: ${{ secrets.AWS_ROLE_NAME_SECRET }} - app_name: 'sargon' - step_name: 'codecoverage' - secret_prefix: 'CODECOV' + app_name: "sargon" + step_name: "codecoverage" + secret_prefix: "CODECOV" secret_name: ${{ secrets.AWS_SECRET_NAME_CODECOV }} parse_json: true - name: Generate code coverage - run: cargo +nightly tarpaulin + run: cargo tarpaulin - name: Upload to codecov.io uses: RDXWorks-actions/codecov-action@main with: diff --git a/tests/uniffi/bindings/test_bag_of_bytes.swift b/tests/uniffi/bindings/test_bag_of_bytes.swift index 57da5418e..422814557 100644 --- a/tests/uniffi/bindings/test_bag_of_bytes.swift +++ b/tests/uniffi/bindings/test_bag_of_bytes.swift @@ -62,7 +62,7 @@ extension Data { } } -func randomByteArray(byteCount count: Int) throws -> [UInt8] { +func randomByteArray(byteCount count: Int) -> [UInt8] { #if canImport(Darwin) || os(Linux) || os(Android) || os(Windows) var rng = SystemRandomNumberGenerator() return (0.. [UInt8] { } extension Data { - public static func random(byteCount: Int) throws -> Self { - Data(randomBytesArray(byteCount: byteCount)) + public static func random(byteCount: Int) -> Self { + Data(randomByteArray(byteCount: byteCount)) } } @@ -160,7 +160,7 @@ func test() throws { let s = Set( (0.. [UInt8] { + #if canImport(Darwin) || os(Linux) || os(Android) || os(Windows) + var rng = SystemRandomNumberGenerator() + return (0.. Self { - var bytes = [UInt8](repeating: 0, count: byteCount) - let status = SecRandomCopyBytes(kSecRandomDefault, byteCount, &bytes) - if status == errSecSuccess { - return Self(bytes) - } - struct UnableToGenerateBytes: Swift.Error {} - throw UnableToGenerateBytes() + public static func random(byteCount: Int) -> Self { + Data(randomByteArray(byteCount: byteCount)) } } + extension Hex32Bytes { init(data: Data) throws { self = try newHex32BytesFrom(bytes: data) diff --git a/tests/uniffi/bindings/test_radix_connect_password.swift b/tests/uniffi/bindings/test_radix_connect_password.swift index 403b27189..73133162f 100644 --- a/tests/uniffi/bindings/test_radix_connect_password.swift +++ b/tests/uniffi/bindings/test_radix_connect_password.swift @@ -1,17 +1,21 @@ import Sargon import Foundation +func randomByteArray(byteCount count: Int) -> [UInt8] { + #if canImport(Darwin) || os(Linux) || os(Android) || os(Windows) + var rng = SystemRandomNumberGenerator() + return (0.. Self { - var bytes = [UInt8](repeating: 0, count: byteCount) - let status = SecRandomCopyBytes(kSecRandomDefault, byteCount, &bytes) - if status == errSecSuccess { - return Self(bytes) - } - struct UnableToGenerateBytes: Swift.Error {} - throw UnableToGenerateBytes() + public static func random(byteCount: Int) -> Self { + Data(randomByteArray(byteCount: byteCount)) } } + extension RadixConnectPassword { init(bytes: Hex32Bytes) { self = newRadixConnectPassword(bytes: bytes) diff --git a/tests/uniffi/bindings/test_wallet.swift b/tests/uniffi/bindings/test_wallet.swift index d89baac00..617e52f4d 100644 --- a/tests/uniffi/bindings/test_wallet.swift +++ b/tests/uniffi/bindings/test_wallet.swift @@ -139,18 +139,22 @@ extension AppearanceID { static let placeholder: Self = newAppearanceIdPlaceholder() static let placeholderOther: Self = newAppearanceIdPlaceholderOther() } +func randomByteArray(byteCount count: Int) -> [UInt8] { + #if canImport(Darwin) || os(Linux) || os(Android) || os(Windows) + var rng = SystemRandomNumberGenerator() + return (0.. Self { - var bytes = [UInt8](repeating: 0, count: byteCount) - let status = SecRandomCopyBytes(kSecRandomDefault, byteCount, &bytes) - if status == errSecSuccess { - return Self(bytes) - } - struct UnableToGenerateBytes: Swift.Error {} - throw UnableToGenerateBytes() + public static func random(byteCount: Int) -> Self { + Data(randomByteArray(byteCount: byteCount)) } } + extension Wallet { public static let defaultIphoneName: String = "iPhone" From 90a2fef131c2a581a2c3ea3d37ab59f1f6b8fa7d Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Wed, 14 Feb 2024 10:38:15 +0100 Subject: [PATCH 13/13] run only library unit tests with tarpaulin --- .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 e04debf96..9541b1b6a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -97,7 +97,7 @@ jobs: secret_name: ${{ secrets.AWS_SECRET_NAME_CODECOV }} parse_json: true - name: Generate code coverage - run: cargo tarpaulin + run: cargo tarpaulin --lib - name: Upload to codecov.io uses: RDXWorks-actions/codecov-action@main with: