Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions key-wallet-ffi/include/key_wallet_ffi.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,22 @@ typedef enum {
Asset lock shielded address top-up funding (subfeature 5)
*/
ASSET_LOCK_SHIELDED_ADDRESS_TOP_UP = 15,
/*
Blockchain identity ECDSA keys (DIP-9) - Path: m/9'/coinType'/5'/0'
*/
BLOCKCHAIN_IDENTITIES_ECDSA = 16,
/*
Blockchain identity ECDSA Hash160 keys (DIP-9) - Path: m/9'/coinType'/5'/1'
*/
BLOCKCHAIN_IDENTITIES_ECDSA_HASH160 = 17,
/*
Blockchain identity BLS keys (DIP-9) - Path: m/9'/coinType'/5'/2'
*/
BLOCKCHAIN_IDENTITIES_BLS = 18,
/*
Blockchain identity BLS Hash160 keys (DIP-9) - Path: m/9'/coinType'/5'/3'
*/
BLOCKCHAIN_IDENTITIES_BLS_HASH160 = 19,
} FFIAccountType;

/*
Expand Down
44 changes: 44 additions & 0 deletions key-wallet-ffi/src/address_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ fn get_managed_account_by_type<'a>(
AccountType::AssetLockShieldedAddressTopUp => {
collection.asset_lock_shielded_address_topup.as_ref()
}
AccountType::BlockchainIdentitiesECDSA => collection.blockchain_identities_ecdsa.as_ref(),
AccountType::BlockchainIdentitiesECDSAHash160 => {
collection.blockchain_identities_ecdsa_hash160.as_ref()
}
AccountType::BlockchainIdentitiesBLS => collection.blockchain_identities_bls.as_ref(),
AccountType::BlockchainIdentitiesBLSHash160 => {
collection.blockchain_identities_bls_hash160.as_ref()
}
AccountType::ProviderVotingKeys => collection.provider_voting_keys.as_ref(),
AccountType::ProviderOwnerKeys => collection.provider_owner_keys.as_ref(),
AccountType::ProviderOperatorKeys => collection.provider_operator_keys.as_ref(),
Expand Down Expand Up @@ -102,6 +110,14 @@ fn get_managed_account_by_type_mut<'a>(
AccountType::AssetLockShieldedAddressTopUp => {
collection.asset_lock_shielded_address_topup.as_mut()
}
AccountType::BlockchainIdentitiesECDSA => collection.blockchain_identities_ecdsa.as_mut(),
AccountType::BlockchainIdentitiesECDSAHash160 => {
collection.blockchain_identities_ecdsa_hash160.as_mut()
}
AccountType::BlockchainIdentitiesBLS => collection.blockchain_identities_bls.as_mut(),
AccountType::BlockchainIdentitiesBLSHash160 => {
collection.blockchain_identities_bls_hash160.as_mut()
}
AccountType::ProviderVotingKeys => collection.provider_voting_keys.as_mut(),
AccountType::ProviderOwnerKeys => collection.provider_owner_keys.as_mut(),
AccountType::ProviderOperatorKeys => collection.provider_operator_keys.as_mut(),
Expand Down Expand Up @@ -788,6 +804,34 @@ pub unsafe extern "C" fn managed_wallet_mark_address_used(
}
}
}
if !found {
if let Some(account) = &mut collection.blockchain_identities_ecdsa {
if account.mark_address_used(&address) {
found = true;
}
}
}
if !found {
if let Some(account) = &mut collection.blockchain_identities_ecdsa_hash160 {
if account.mark_address_used(&address) {
found = true;
}
}
}
if !found {
if let Some(account) = &mut collection.blockchain_identities_bls {
if account.mark_address_used(&address) {
found = true;
}
}
}
if !found {
if let Some(account) = &mut collection.blockchain_identities_bls_hash160 {
if account.mark_address_used(&address) {
found = true;
}
}
}
if !found {
for account in collection.dashpay_receival_accounts.values_mut() {
if account.mark_address_used(&address) {
Expand Down
32 changes: 32 additions & 0 deletions key-wallet-ffi/src/managed_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,18 @@ pub unsafe extern "C" fn managed_wallet_get_account(
AccountType::AssetLockShieldedAddressTopUp => {
managed_collection.asset_lock_shielded_address_topup.as_ref()
}
AccountType::BlockchainIdentitiesECDSA => {
managed_collection.blockchain_identities_ecdsa.as_ref()
}
AccountType::BlockchainIdentitiesECDSAHash160 => {
managed_collection.blockchain_identities_ecdsa_hash160.as_ref()
}
AccountType::BlockchainIdentitiesBLS => {
managed_collection.blockchain_identities_bls.as_ref()
}
AccountType::BlockchainIdentitiesBLSHash160 => {
managed_collection.blockchain_identities_bls_hash160.as_ref()
}
AccountType::ProviderVotingKeys => managed_collection.provider_voting_keys.as_ref(),
AccountType::ProviderOwnerKeys => managed_collection.provider_owner_keys.as_ref(),
AccountType::ProviderOperatorKeys => managed_collection.provider_operator_keys.as_ref(),
Expand Down Expand Up @@ -563,6 +575,14 @@ pub unsafe extern "C" fn managed_core_account_get_account_type(
AccountType::IdentityInvitation => FFIAccountType::IdentityInvitation,
AccountType::AssetLockAddressTopUp => FFIAccountType::AssetLockAddressTopUp,
AccountType::AssetLockShieldedAddressTopUp => FFIAccountType::AssetLockShieldedAddressTopUp,
AccountType::BlockchainIdentitiesECDSA => FFIAccountType::BlockchainIdentitiesECDSA,
AccountType::BlockchainIdentitiesECDSAHash160 => {
FFIAccountType::BlockchainIdentitiesECDSAHash160
}
AccountType::BlockchainIdentitiesBLS => FFIAccountType::BlockchainIdentitiesBLS,
AccountType::BlockchainIdentitiesBLSHash160 => {
FFIAccountType::BlockchainIdentitiesBLSHash160
}
AccountType::ProviderVotingKeys => FFIAccountType::ProviderVotingKeys,
AccountType::ProviderOwnerKeys => FFIAccountType::ProviderOwnerKeys,
AccountType::ProviderOperatorKeys => FFIAccountType::ProviderOperatorKeys,
Expand Down Expand Up @@ -1039,6 +1059,18 @@ pub unsafe extern "C" fn managed_core_account_get_address_pool(
ManagedAccountType::AssetLockShieldedAddressTopUp {
addresses,
} => addresses,
ManagedAccountType::BlockchainIdentitiesECDSA {
addresses,
} => addresses,
ManagedAccountType::BlockchainIdentitiesECDSAHash160 {
addresses,
} => addresses,
ManagedAccountType::BlockchainIdentitiesBLS {
addresses,
} => addresses,
ManagedAccountType::BlockchainIdentitiesBLSHash160 {
addresses,
} => addresses,
ManagedAccountType::ProviderVotingKeys {
addresses,
} => addresses,
Expand Down
68 changes: 68 additions & 0 deletions key-wallet-ffi/src/transaction_checking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,74 @@ pub unsafe extern "C" fn managed_wallet_check_transaction(
ffi_accounts.push(ffi_match);
continue;
}
CoreAccountTypeMatch::BlockchainIdentitiesECDSA {
involved_addresses,
} => {
let ffi_match = FFIAccountMatch {
account_type: 16, // BlockchainIdentitiesECDSA
account_index: 0,
registration_index: 0,
received: account_match.received,
sent: account_match.sent,
external_addresses_count: involved_addresses.len() as c_uint,
internal_addresses_count: 0,
has_external_addresses: !involved_addresses.is_empty(),
has_internal_addresses: false,
};
ffi_accounts.push(ffi_match);
continue;
}
CoreAccountTypeMatch::BlockchainIdentitiesECDSAHash160 {
involved_addresses,
} => {
let ffi_match = FFIAccountMatch {
account_type: 17, // BlockchainIdentitiesECDSAHash160
account_index: 0,
registration_index: 0,
received: account_match.received,
sent: account_match.sent,
external_addresses_count: involved_addresses.len() as c_uint,
internal_addresses_count: 0,
has_external_addresses: !involved_addresses.is_empty(),
has_internal_addresses: false,
};
ffi_accounts.push(ffi_match);
continue;
}
CoreAccountTypeMatch::BlockchainIdentitiesBLS {
involved_addresses,
} => {
let ffi_match = FFIAccountMatch {
account_type: 18, // BlockchainIdentitiesBLS
account_index: 0,
registration_index: 0,
received: account_match.received,
sent: account_match.sent,
external_addresses_count: involved_addresses.len() as c_uint,
internal_addresses_count: 0,
has_external_addresses: !involved_addresses.is_empty(),
has_internal_addresses: false,
};
ffi_accounts.push(ffi_match);
continue;
}
CoreAccountTypeMatch::BlockchainIdentitiesBLSHash160 {
involved_addresses,
} => {
let ffi_match = FFIAccountMatch {
account_type: 19, // BlockchainIdentitiesBLSHash160
account_index: 0,
registration_index: 0,
received: account_match.received,
sent: account_match.sent,
external_addresses_count: involved_addresses.len() as c_uint,
internal_addresses_count: 0,
has_external_addresses: !involved_addresses.is_empty(),
has_internal_addresses: false,
};
ffi_accounts.push(ffi_match);
continue;
}
CoreAccountTypeMatch::ProviderVotingKeys {
involved_addresses,
} => {
Expand Down
32 changes: 32 additions & 0 deletions key-wallet-ffi/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ pub enum FFIAccountType {
AssetLockAddressTopUp = 14,
/// Asset lock shielded address top-up funding (subfeature 5)
AssetLockShieldedAddressTopUp = 15,
/// Blockchain identity ECDSA keys (DIP-9) - Path: m/9'/coinType'/5'/0'
BlockchainIdentitiesECDSA = 16,
/// Blockchain identity ECDSA Hash160 keys (DIP-9) - Path: m/9'/coinType'/5'/1'
BlockchainIdentitiesECDSAHash160 = 17,
/// Blockchain identity BLS keys (DIP-9) - Path: m/9'/coinType'/5'/2'
BlockchainIdentitiesBLS = 18,
/// Blockchain identity BLS Hash160 keys (DIP-9) - Path: m/9'/coinType'/5'/3'
BlockchainIdentitiesBLSHash160 = 19,
}

impl FFIAccountType {
Expand Down Expand Up @@ -229,6 +237,18 @@ impl FFIAccountType {
FFIAccountType::AssetLockShieldedAddressTopUp => {
key_wallet::AccountType::AssetLockShieldedAddressTopUp
}
FFIAccountType::BlockchainIdentitiesECDSA => {
key_wallet::AccountType::BlockchainIdentitiesECDSA
}
FFIAccountType::BlockchainIdentitiesECDSAHash160 => {
key_wallet::AccountType::BlockchainIdentitiesECDSAHash160
}
FFIAccountType::BlockchainIdentitiesBLS => {
key_wallet::AccountType::BlockchainIdentitiesBLS
}
FFIAccountType::BlockchainIdentitiesBLSHash160 => {
key_wallet::AccountType::BlockchainIdentitiesBLSHash160
}
FFIAccountType::ProviderVotingKeys => key_wallet::AccountType::ProviderVotingKeys,
FFIAccountType::ProviderOwnerKeys => key_wallet::AccountType::ProviderOwnerKeys,
FFIAccountType::ProviderOperatorKeys => key_wallet::AccountType::ProviderOperatorKeys,
Expand Down Expand Up @@ -314,6 +334,18 @@ impl FFIAccountType {
key_wallet::AccountType::AssetLockShieldedAddressTopUp => {
(FFIAccountType::AssetLockShieldedAddressTopUp, 0, None)
}
key_wallet::AccountType::BlockchainIdentitiesECDSA => {
(FFIAccountType::BlockchainIdentitiesECDSA, 0, None)
}
key_wallet::AccountType::BlockchainIdentitiesECDSAHash160 => {
(FFIAccountType::BlockchainIdentitiesECDSAHash160, 0, None)
}
key_wallet::AccountType::BlockchainIdentitiesBLS => {
(FFIAccountType::BlockchainIdentitiesBLS, 0, None)
}
key_wallet::AccountType::BlockchainIdentitiesBLSHash160 => {
(FFIAccountType::BlockchainIdentitiesBLSHash160, 0, None)
}
key_wallet::AccountType::ProviderVotingKeys => {
(FFIAccountType::ProviderVotingKeys, 0, None)
}
Expand Down
Loading
Loading