-
Notifications
You must be signed in to change notification settings - Fork 13
feat: new managed platform account to track platform balances #368
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
Changes from 9 commits
41763cc
0cba282
2c9b1ee
ef94446
dc19c0d
9727358
21ea4b8
69fc930
a52f947
f8c1574
1fcff26
0c8aa23
e0dbb8f
9c50241
3202614
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3820,6 +3820,13 @@ FFIWallet *wallet_create_random_with_options(FFINetwork network, | |
| The caller must ensure that: | ||
| - The wallet pointer is either null or points to a valid FFIWallet | ||
| - The FFIWallet remains valid for the duration of this call | ||
|
|
||
| # Note | ||
|
|
||
| This function does NOT support the following account types: | ||
| - `PlatformPayment`: Use `wallet_add_platform_payment_account()` instead | ||
| - `DashpayReceivingFunds`: Use `wallet_add_dashpay_receiving_account()` instead | ||
| - `DashpayExternalAccount`: Use `wallet_add_dashpay_external_account_with_xpub_bytes()` instead | ||
| */ | ||
|
|
||
| FFIAccountResult wallet_add_account(FFIWallet *wallet, | ||
|
|
@@ -3867,6 +3874,13 @@ FFIAccountResult wallet_add_dashpay_external_account_with_xpub_bytes(FFIWallet * | |
| - The wallet pointer is either null or points to a valid FFIWallet | ||
| - The xpub_bytes pointer is either null or points to at least xpub_len bytes | ||
| - The FFIWallet remains valid for the duration of this call | ||
|
|
||
| # Note | ||
|
|
||
| This function does NOT support the following account types: | ||
| - `PlatformPayment`: Use `wallet_add_platform_payment_account()` instead | ||
| - `DashpayReceivingFunds`: Use `wallet_add_dashpay_receiving_account()` instead | ||
| - `DashpayExternalAccount`: Use `wallet_add_dashpay_external_account_with_xpub_bytes()` instead | ||
| */ | ||
|
|
||
| FFIAccountResult wallet_add_account_with_xpub_bytes(FFIWallet *wallet, | ||
|
|
@@ -3886,6 +3900,13 @@ FFIAccountResult wallet_add_account_with_xpub_bytes(FFIWallet *wallet, | |
| - The wallet pointer is either null or points to a valid FFIWallet | ||
| - The xpub_string pointer is either null or points to a valid null-terminated C string | ||
| - The FFIWallet remains valid for the duration of this call | ||
|
|
||
| # Note | ||
|
|
||
| This function does NOT support the following account types: | ||
| - `PlatformPayment`: Use `wallet_add_platform_payment_account()` instead | ||
| - `DashpayReceivingFunds`: Use `wallet_add_dashpay_receiving_account()` instead | ||
| - `DashpayExternalAccount`: Use `wallet_add_dashpay_external_account_with_xpub_bytes()` instead | ||
| */ | ||
|
|
||
| FFIAccountResult wallet_add_account_with_string_xpub(FFIWallet *wallet, | ||
|
|
@@ -3894,6 +3915,30 @@ FFIAccountResult wallet_add_account_with_string_xpub(FFIWallet *wallet, | |
| const char *xpub_string) | ||
| ; | ||
|
|
||
| /* | ||
| Add a Platform Payment account (DIP-17) to the wallet | ||
|
|
||
| Platform Payment accounts use the derivation path: | ||
| `m/9'/coin_type'/17'/account'/key_class'/index` | ||
|
|
||
| # Arguments | ||
| * `wallet` - Pointer to the wallet | ||
| * `account_index` - The account index (hardened) in the derivation path | ||
| * `key_class` - The key class (hardened) - typically 0' for main addresses | ||
|
|
||
| # Safety | ||
|
|
||
| This function dereferences a raw pointer to FFIWallet. | ||
| The caller must ensure that: | ||
| - The wallet pointer is either null or points to a valid FFIWallet | ||
| - The FFIWallet remains valid for the duration of this call | ||
| */ | ||
|
|
||
| FFIAccountResult wallet_add_platform_payment_account(FFIWallet *wallet, | ||
| unsigned int account_index, | ||
| unsigned int key_class) | ||
| ; | ||
|
Comment on lines
+4190
to
+4212
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# First, find the Rust implementation of wallet_add_platform_payment_account
rg -n "wallet_add_platform_payment_account" -g '*.rs' -A 20Repository: dashpay/rust-dashcore Length of output: 10569 🏁 Script executed: #!/bin/bash
# Find AccountType definition and PlatformPayment variant
rg -n "enum AccountType|impl.*AccountType" -g '*.rs' -A 30 | head -100Repository: dashpay/rust-dashcore Length of output: 9121 🏁 Script executed: #!/bin/bash
# Find AccountType enum definition with PlatformPayment
rg -n "pub enum AccountType" -g '*.rs' -A 50 | grep -A 50 "key-wallet/src/account"Repository: dashpay/rust-dashcore Length of output: 8910 🏁 Script executed: #!/bin/bash
# Search for PlatformPayment in account type file
rg -n "PlatformPayment" key-wallet/src/account/account_type.rs -B 2 -A 5Repository: dashpay/rust-dashcore Length of output: 1858 🏁 Script executed: #!/bin/bash
# Find the derivation path implementation for PlatformPayment
rg -n "DIP-17: m/9'" -B 5 -A 20 key-wallet/src/account/account_type.rsRepository: dashpay/rust-dashcore Length of output: 1264 🏁 Script executed: #!/bin/bash
# Check the bip32 library usage - from_hardened_idx converts raw to hardened
# Let's search for how ChildNumber is used in the codebase
rg -n "from_hardened_idx" -B 2 -A 2 key-wallet/src/ | head -40Repository: dashpay/rust-dashcore Length of output: 3599 Clarify that The Rust implementation applies hardening internally via 🤖 Prompt for AI Agents |
||
|
|
||
| /* | ||
| Describe the wallet manager for a given network and return a newly | ||
| allocated C 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.
Use the C enum identifiers in these notes to avoid FFI confusion.
The notes currently list Rust variant names, but C callers see
FFIAccountTypeconstants. Using the C identifiers makes the guidance unambiguous for FFI consumers.📝 Suggested wording updates (apply to all three note blocks)
Also applies to: 3877-3883, 3903-3909
🤖 Prompt for AI Agents