getStarknetAccount static method

Future<Account> getStarknetAccount({
  1. required SecureStore secureStore,
  2. required Account account,
  3. required String walletId,
})

Implementation

static Future<s.Account> getStarknetAccount({
  required SecureStore secureStore,
  required Account account,
  required String walletId,
}) async {
  final privateKey =
      await secureStore.getSecret(key: privateKeyKey(walletId, account.id));
  if (privateKey == null) {
    throw Exception("Private key not found");
  }
  return s.Account(
    accountAddress: s.Felt.fromHexString(account.address),
    chainId: WalletKit().chainId,
    provider: WalletKit().provider,
    signer: s.StarkAccountSigner(
      signer: s.StarkSigner(
        privateKey: s.Felt.fromHexString(privateKey),
      ),
    ),
    supportedTxVersion: s.AccountSupportedTxVersion.v1,
  );
}