hedera-sdk-rust icon indicating copy to clipboard operation
hedera-sdk-rust copied to clipboard

Streamline key and alias specifications for AccountCreateTransaction

Open RickyLB opened this issue 11 months ago • 0 comments

Description

New methods need to be added to the SDK in order to streamline account key specifications with considerations for alias.

The following APIs need to be added in AccountCreateTransaction:

  • key_with_alias(ECDSAKey) - Sets ECDSA private key, derives and sets it's EVM address in the background. Essentially combines the methods key(Key) + alias(Alias)
  • key_with_alias(Key, ECDSAKey) - Allows for setting the account key and a separate key that the EVM address should be derived from. A user must sign the transaction with both keys for this flow to be successful.
  • key_without_alias(Key) - Explicitly calls out that the alias is not set.

The following APIs need to be deprecated in AccountCreateTransaction:

  • key(Key) - set the key for the AccountCreateTransaction

Test plan

  1. When an account is created with an ECDSA key with key_with_alias , then the created account has the ECDSA key as its key and the ECDSA key as its alias.
  2. When an account is created with a Key and an ECDSA key with key_with_alias, then the created account has the Key as its key and the ECDSA key as its alias.
  3. When an account is created with a Key with key_without_alias, then the created account has the Key as its key and no alias.

Example

  1. Create an account with an ECDSA key using key_with_alias.
  2. Query the account and verify its key and alias match the ECDSA key.
  3. Create another account with a Key and an ECDSA key using key_with_alias.
  4. Query the account and verify its key matches the Key and its alias matched the ECDSA key.
  5. Create another account with a Key using key_without_alias.
  6. Query the account and verify its key matches the Key and it has no alias.

RickyLB avatar Jan 17 '25 20:01 RickyLB