-
Notifications
You must be signed in to change notification settings - Fork 1
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
Wrap SOME of Radix Engine Toolkit types, first of MANY PRs. #3
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #3 +/- ##
===========================================
- Coverage 99.13% 99.06% -0.08%
===========================================
Files 120 128 +8
Lines 2663 2891 +228
===========================================
+ Hits 2640 2864 +224
- Misses 23 27 +4 ☔ View full report in Codecov by Sentry. |
…requires more fixed size BagOfBytes, introducing: Hex64Bytes, Hex65Bytes, Hex33Bytes, generated with macro.
…Key, and same for Secp256k1.
…ove sccache ref in direnv, it did not speed up things.
… in Package.swift, also required for when making releses.
@@ -10,4 +10,7 @@ typedef string Timestamp; | |||
[Custom] | |||
typedef sequence<i8> BagOfBytes; | |||
|
|||
[Custom] | |||
typedef string InnerDecimal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the trick, we vendor Decimal192
as a struct with one single stored property (field) __inner: InnerDecimal
which in the land of Swift and Kotlin will be __inner: String
. It is given that name to hide it as much as possible. It is, in fact, NOT a String but the rust type InnerDecimal
which in Rust land holds a ScryptoDecimal192.
This is the best compromise, it allwos for usage of a real decimal in Rust land - the ScryptoDecimal192 - and it allows for its OWN type in Swift/Kotlin, and NOT a silly error prone typealias Decimal192 = String
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To Be Written in coming PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stubbing out the API as per radixdlt/babylon-wallet-ios#1032
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stubbing out the API as per radixdlt/babylon-wallet-ios#1032
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stubbing out the API as per radixdlt/babylon-wallet-ios#1032
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stubbing out the API as per radixdlt/babylon-wallet-ios#1032
blobs()
method will probably be turned into just field usage.
src/core/types/decimal192.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost ALL methods inits of Decimal as per radixdlt/babylon-wallet-ios#1032 has been implemented, formatting remains.
.pre-commit-config.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@micbakos-rdx please re-install the precommit hook
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, looks promising!
Waiting to see how stuff around TransactionManifest and building will look like 🚀.
// use radix_engine_common::crypto::Ed25519Signature as ScryptoEd25519Signature; | ||
// use radix_engine_common::crypto::Secp256k1Signature as ScryptoSecp256k1Signature; | ||
|
||
// /// Represents any natively supported signature, including public key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To implement later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Third party deposits more tests
LOC Delta
Fear not the LOC delta, it is the huge generated Swift file mostly.
Introduction
This PR primary solves the so far unsolved challenge of how to implement and vendor
Decimal
, renamed toDecimal192
as to not collide with Swift FoundationsDecimal
. 192 comes from the fact that it is powered by a 192 bit integer inside of Scrypto repo (radix_engine_common
crate).I've solved it by ensuring that
Decimal192
is a struct/data class in Swift and Kotlin, and NOT a typealias, which HAS a__inner: String
which is named like that so to scare Swift/Kotlin devs to not touch it, while keeping it as a thing which has a thing which has a ScryptoDecimal192. This actives the best of two worlds:The goal of this PR is to progress the wrapping of RET inside of Sargon, fulfilling the defined "API" by PR: radixdlt/babylon-wallet-ios#1032
This PR also implements, and stubs out some other RET types, and introduces fundamental building blocks such as
Secp256k1Signature
- UniFFI exposed! andEd25519Signature
also UniFFI exposed, needed bySignedIntent
and other RET types.This PR also contains improvements to the iOS example app
Changes
Changes in Rust land
mnemonic_with_passphrase_of_device_factor_source_by_id
which is used by Example wallet to load the mnemonicChanges in Sargon Swift SPM Package
sargon
mostly wrapping freestanding global functions in methods by use of extensions.Changes in Example wallet iOS
Future
Many more PRs to come, all focused on vendoring RET through Sargon..