Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split out Profile, Gateway, FIP, Drivers, Clients, Manifest building and TX models #326

Merged
merged 23 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
718 changes: 677 additions & 41 deletions Cargo.lock

Large diffs are not rendered by default.

139 changes: 100 additions & 39 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,25 @@ members = [
"crates/sargon-core",
"crates/sargon-hierarchical-deterministic",
"crates/sargon-factors",
"crates/sargon-factors-supporting-types",
"crates/sargon-addresses",
"crates/sargon-keys-collector",
"crates/sargon-transaction-models",
"crates/sargon-manifests",
"crates/sargon-profile-supporting-types",
"crates/sargon-drivers",
"crates/http-client",
"crates/sargon-clients",
"crates/sargon-profile-gateway",
"crates/sargon-profile",
"crates/sargon-profile-app-preferences",
"crates/sargon-profile-security-structures",
"crates/sargon-profile-logic",
"crates/sargon-factor-instances-provider",
"crates/next-derivation-index-ephemeral",

"crates/gateway-models",
"crates/gateway-client-and-api",

"crates/sargon", # to be split

Expand All @@ -36,31 +53,62 @@ radix-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v1
"serde",
"secp256k1_sign_and_validate",
] }
radix-common-derive = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v1.3.0" }
radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v1.3.0" }
radix-engine-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v1.3.0" }
radix-engine-toolkit = { git = "https://github.com/radixdlt/radix-engine-toolkit", rev = "2ab5b35a6cb96c9faeb98ed8df67b870336e6873" }
radix-engine-toolkit-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v1.3.0" }
radix-rust = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v1.3.0", features = [
"serde",
] }
radix-transactions = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v1.3.0" }
radix-engine-toolkit = { git = "https://github.com/radixdlt/radix-engine-toolkit", rev = "2ab5b35a6cb96c9faeb98ed8df67b870336e6873" }
sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v1.3.0" }

# ===== EXTERNAL DEPENDENCIES ========

# actix-rt = "3.3.0"
actix-rt = { git = "https://github.com/actix/actix-net", rev = "57fd6ea8098d1f2d281c305fc331216c4fe1992e" }

# aes-gcm = "10.3"
aes-gcm = { git = "https://github.com/RustCrypto/AEADs", rev = "7e82b01cd4901f6a35b5153536f11b87f5e4e622", default-features = false, features = [
"aes",
"alloc",
"getrandom",
"zeroize",
] }

arraystring = { git = "https://github.com/paulocsanz/arraystring", rev = "ebd7d8ba94fa0d5068fe048d5445f6b1af56035d", features = [
"serde-traits",
] }

# actix-rt = "3.3.0"
actix-rt = { git = "https://github.com/actix/actix-net", rev = "57fd6ea8098d1f2d281c305fc331216c4fe1992e" }
async-std = "1.13.0"

async-trait = { git = "https://github.com/dtolnay/async-trait", rev = "1eb21ed8bd87029bf4dcbea41ff309f2b2220c43" }

# hkdf = "0.12.4"
hkdf = { git = "https://github.com/RustCrypto/KDFs/", rev = "1ac16e8b9d4ee7a67613c9396c6cc1327652eaba" }
# thiserror = "1.0.50"
thiserror = { git = "https://github.com/dtolnay/thiserror/", rev = "a7d220d7915fb888413aa7978efd70f7006bda9d" }
# assert-json-diff = "2.0.2"
assert-json-diff = { git = "https://github.com/davidpdrsn/assert-json-diff/", rev = "bca0d2c590808274298d939e0533da79cd09076d" }

base64 = { git = "https://github.com/marshallpierce/rust-base64.git", rev = "e14400697453bcc85997119b874bc03d9601d0af" }

# bip39 = "2.0.0"
bip39 = { git = "https://github.com/rust-bitcoin/rust-bip39", rev = "a30760beac21d595b2bda376df4f4e6bf029bcc5", features = [
"serde",
"zeroize",
"french",
] }

# camino = "1.0.8"
camino = { git = "https://github.com/camino-rs/camino/", rev = "afa51b1b4c684b7e6698a6717ccda3affd0abd42" }

# cargo_toml = "0.15.3"
cargo_toml = { git = "https://gitlab.com/lib.rs/cargo_toml", rev = "e498c94fc42a660c1ca1a28999ce1d757cfe77fe" }

# clap = "4.5.1"
clap = { git = "https://github.com/clap-rs/clap/", rev = "8a7a13a5618cfdc4ff328624a5266e7b4d88649a", default-features = false, features = [
"std",
"derive",
] }

# derive_more = "1.0.0"
derive_more = { git = "https://github.com/JelteF/derive_more", rev = "d7f5b9e94d024790682f6fc4dcca13941cce64c8", features = [
"add",
Expand All @@ -80,21 +128,16 @@ enum-as-inner = { git = "https://github.com/bluejekyll/enum-as-inner/", rev = "c
# enum-iterator = "1.4.1"
enum-iterator = { git = "https://github.com/stephaneyfx/enum-iterator/", rev = "9d472a1237cfd03b1c7657fdcba74c8070bfb4ea" }


# aes-gcm = "10.3"
aes-gcm = { git = "https://github.com/RustCrypto/AEADs", rev = "7e82b01cd4901f6a35b5153536f11b87f5e4e622", default-features = false, features = [
"aes",
"alloc",
"getrandom",
"zeroize",
] }

# delegate = "0.12.0"
delegate = { git = "https://github.com/Kobzol/rust-delegate/", rev = "ac852be64f3e4b5f9b58be910d09921488d2845d" }

futures = "0.3.31"

# hex = "0.4.3"
hex = { git = "https://github.com/KokaKiwi/rust-hex/", rev = "b2b4370b5bf021b98ee7adc92233e8de3f2de792" }

# hkdf = "0.12.4"
hkdf = { git = "https://github.com/RustCrypto/KDFs/", rev = "1ac16e8b9d4ee7a67613c9396c6cc1327652eaba" }

# SLIP10 implementation
# iota_crypto = "0.23.2"
Expand All @@ -104,26 +147,51 @@ iota-crypto = { git = "https://github.com/iotaledger/crypto.rs", rev = "8c131255
"secp256k1",
"x25519",
] }

# iso8601-timestamp = "0.2.16"
iso8601-timestamp = { git = "https://github.com/Lantern-chat/iso8601-timestamp/", rev = "e5a3f2a5911759bc6b0d8100b032a6b4dd6e12c1", features = [
"serde",
"std",
] }

# itertools = "0.12.0"
itertools = { git = "https://github.com/rust-itertools/itertools/", rev = "98ecabb47d7147dae06fc3fa400ec758947194f3" }

# Transitive dependency of iota_crypto - used to construct PubKey from uncompressed bytes.
# k256 = "0.13.3"
k256 = { git = "https://github.com/RustCrypto/elliptic-curves", rev = "e158ce5cf0e9acee2fd76aff2a628334f5c771e5" }

log = "0.4.20"

# once_cell = "1.19.0"
once_cell = { git = "https://github.com/matklad/once_cell/", rev = "c48d3c2c01de926228aea2ac1d03672b4ce160c1" }

# paste = "1.0.14"
paste = { git = "https://github.com/dtolnay/paste", rev = "1e0cc1025af5388397c67fa4389ad7ad24814df8" }

# preinterpret = "0.2.0"
preinterpret = { git = "https://github.com/dhedey/preinterpret", rev = "6754b92bdead0ddd6f69fbee7d782180d6351605" }

# pretty_assertions = "1.4.0"
pretty_assertions = { git = "https://github.com/rust-pretty-assertions/rust-pretty-assertions", rev = "3f1ebc0cac5f88e875f036bf16636e15fa935c8d" }

# pretty_env_logger = "0.5.0"
pretty_env_logger = { git = "https://github.com/seanmonstar/pretty-env-logger/", rev = "0e238400e18649415dc710c025e99c009a1bb744" }

# rand = "0.8.5"
rand = { git = "https://github.com/rust-random/rand/", rev = "937320cbfeebd4352a23086d9c6e68f067f74644" }

# regex = "1.9.3"
regex = { git = "https://github.com/rust-lang/regex/", rev = "72f889ef3cca59ebac6a026f3646e8d92f056d88" }

# serde_with = "3.4.0"
serde_with = { git = "https://github.com/jonasbb/serde_with/", rev = "1e8e4e75398c6a9de29386473ae7c3157be031c2" }

# reqwest = "0.12.3"
reqwest = { git = "https://github.com/seanmonstar/reqwest", rev = "0720159f6369f54e045a1fd315e0f24b7a0b4a39", default-features = false, features = [
"native-tls-vendored",
] }

# paste = "1.0.14"
paste = { git = "https://github.com/dtolnay/paste", rev = "1e0cc1025af5388397c67fa4389ad7ad24814df8" }

# pretty_assertions = "1.4.0"
pretty_assertions = { git = "https://github.com/rust-pretty-assertions/rust-pretty-assertions", rev = "3f1ebc0cac5f88e875f036bf16636e15fa935c8d" }
# serde_with = "3.4.0"
serde_with = { git = "https://github.com/jonasbb/serde_with/", rev = "1e8e4e75398c6a9de29386473ae7c3157be031c2" }

serde = { version = "1.0.193", features = ["derive", "rc", "std"] }

Expand All @@ -132,28 +200,24 @@ serde_json = { git = "https://github.com/serde-rs/json/", rev = "4bc1eaa03a61605
"preserve_order",
] }


# serde_repr = "0.1.17"
serde_repr = { git = "https://github.com/dtolnay/serde-repr/", rev = "94cce18a51bc169869f2cdcea6549b3ed81b3b2e" }

# iso8601-timestamp = "0.2.16"
iso8601-timestamp = { git = "https://github.com/Lantern-chat/iso8601-timestamp/", rev = "e5a3f2a5911759bc6b0d8100b032a6b4dd6e12c1", features = [
"serde",
"std",
] }
# itertools = "0.12.0"
itertools = { git = "https://github.com/rust-itertools/itertools/", rev = "98ecabb47d7147dae06fc3fa400ec758947194f3" }

# once_cell = "1.19.0"
once_cell = { git = "https://github.com/matklad/once_cell/", rev = "c48d3c2c01de926228aea2ac1d03672b4ce160c1" }


# strum = "0.26.1"
strum = { git = "https://github.com/Peternator7/strum/", rev = "f746c3699acf150112e26c00e6c8ca666d8d068d", features = [
"derive",
] }

# thiserror = "1.0.50"
thiserror = { git = "https://github.com/dtolnay/thiserror/", rev = "a7d220d7915fb888413aa7978efd70f7006bda9d" }

url = { version = "2.5.0", features = ["serde"] }

# uniffi = "0.28.3"
uniffi = { git = "https://github.com/mozilla/uniffi-rs/", rev = "9127d4d9cfb8ff8372e70f2e4e0eb36bc06f146d", features = [
"cli",
] }

# uuid = "1.6.1"
uuid = { git = "https://github.com/uuid-rs/uuid/", rev = "c8891073248ddc7faa8c53ac9ceb629a341c7b9b", features = [
"v4",
Expand All @@ -165,6 +229,3 @@ zeroize = { git = "https://github.com/RustCrypto/utils", rev = "df6d2f48a5e8afe8
"zeroize_derive",
"derive",
] }

# cargo_toml = "0.15.3"
cargo_toml = { git = "https://gitlab.com/lib.rs/cargo_toml", rev = "e498c94fc42a660c1ca1a28999ce1d757cfe77fe" }
12 changes: 6 additions & 6 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb",
"version" : "1.1.0"
"revision" : "671108c96644956dddcd89dd59c203dcdb36cec7",
"version" : "1.1.4"
}
},
{
"identity" : "swift-custom-dump",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "f01efb26f3a192a0e88dcdb7c3c391ec2fc25d9c",
"version" : "1.3.0"
"revision" : "82645ec760917961cfa08c9c0c7104a57a0fa4b1",
"version" : "1.3.3"
}
},
{
Expand All @@ -41,8 +41,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "6f30bdba373bbd7fbfe241dddd732651f2fbd1e2",
"version" : "1.1.2"
"revision" : "a3f634d1a409c7979cabc0a71b3f26ffa9fc8af1",
"version" : "1.4.3"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion _typos.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[files]
extend-exclude = [
"crates/sargon/fixtures/**",
"crates/**/fixtures/**/**",
"scripts/**",
"apple/Sources/UniFFI/Sargon.swift",
"examples/iOS/Backend/Sources/Planbok/Features/DebugProfileFeature.swift",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SargonUniFFI

extension AccountOrAddressOf {
extension OwnedOrThirdPartyAccountAddress {
public var accountAddress: AccountAddress {
accountOrAddressOfAccountAddress(recipient: self)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SargonUniFFI

#if DEBUG
extension AccountOrAddressOf {
extension OwnedOrThirdPartyAccountAddress {
public static let sample: Self = newAccountOrAddressOfSample()
public static let sampleOther: Self = newAccountOrAddressOfSampleOther()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import SargonUniFFI

// MARK: - AccountOrAddressOf + SargonModel
extension AccountOrAddressOf: SargonModel {}
// MARK: - OwnedOrThirdPartyAccountAddress + SargonModel
extension OwnedOrThirdPartyAccountAddress: SargonModel {}

// MARK: - AccountOrAddressOf + CustomStringConvertible
extension AccountOrAddressOf: CustomStringConvertible {
// MARK: - OwnedOrThirdPartyAccountAddress + CustomStringConvertible
extension OwnedOrThirdPartyAccountAddress: CustomStringConvertible {
public var description: String {
accountAddress.address
}
}

// MARK: - AccountOrAddressOf + Identifiable
extension AccountOrAddressOf: Identifiable {
// MARK: - OwnedOrThirdPartyAccountAddress + Identifiable
extension OwnedOrThirdPartyAccountAddress: Identifiable {
public typealias ID = AccountAddress
public var id: ID {
accountAddress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,11 @@ extension TestCase {
return try XCTUnwrap(String(data: utf8, encoding: .utf8))
}

func rtm(_ rtmFile: String) throws -> TransactionManifest {
let data = try openTransactionFile(rtmFile, extension: "rtm")
func rtm(
_ rtmFile: String,
in crate: String = "sargon-transaction-models"
) throws -> TransactionManifest {
let data = try openTransactionFile(rtmFile, extension: "rtm", in: crate)
let instructionsString = try XCTUnwrap(String(data: data, encoding: .utf8))

return try TransactionManifest(
Expand All @@ -241,7 +244,11 @@ extension TestCase {
)
}

private func openTransactionFile(_ fileName: String, extension fileExtension: String) throws -> Data {
try openFile(subPath: "transaction", fileName, extension: fileExtension)
private func openTransactionFile(
_ fileName: String,
extension fileExtension: String,
in crate: String = "sargon-transaction-models"
) throws -> Data {
try openFile(subPath: "transaction", fileName, extension: fileExtension, in: crate)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import XCTest

final class WalletToDappInteractionResponseTests: Test<WalletToDappInteractionResponse> {
func test_codable() throws {
let json = try openFile(subPath: "vector", "wallet_interactions_wallet_to_dapp", extension: "json")
let json = try openFile(
subPath: "vector",
"wallet_interactions_wallet_to_dapp",
extension: "json",
in: "sargon"
)
let sut = try JSONDecoder().decode([SUT].self, from: json)
let encoded = try JSONEncoder().encode(sut)
try XCTAssertEqual(JSONDecoder().decode([SUT].self, from: encoded), sut)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Sargon
import SargonUniFFI
import XCTest

final class AccountOrAddressOfTests: Test<AccountOrAddressOf> {
final class AccountOrAddressOfTests: Test<OwnedOrThirdPartyAccountAddress> {
func test_id_is_account_address() {
XCTAssertEqual(SUT.sample.id, SUT.sample.accountAddress)
}
Expand Down
5 changes: 3 additions & 2 deletions apple/Tests/Utils/Test.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ class TestCase: XCTestCase {
func openFile(
subPath: String,
_ fileName: String,
extension fileExtension: String
extension fileExtension: String,
in crate: String = "sargon-profile"
) throws -> Data {
let testsDirectory: String = URL(fileURLWithPath: "\(#file)").pathComponents.dropLast(4).joined(separator: "/")

let fileURL = try XCTUnwrap(URL(fileURLWithPath: "\(testsDirectory)/crates/sargon/fixtures/\(subPath)/\(fileName).\(fileExtension)"))
let fileURL = try XCTUnwrap(URL(fileURLWithPath: "\(testsDirectory)/crates/\(crate)/fixtures/\(subPath)/\(fileName).\(fileExtension)"))

return try Data(contentsOf: fileURL)
}
Expand Down
22 changes: 0 additions & 22 deletions codecov.yml

This file was deleted.

Binary file removed crates/.DS_Store
Binary file not shown.
Loading
Loading