From ca4fbe760dde7da59d61ff605bb8a3bf67abd7a8 Mon Sep 17 00:00:00 2001 From: mpsc0x Date: Mon, 14 Oct 2024 18:14:29 +0300 Subject: [PATCH] feat: added getter for Ed25519Account --- src/clients/aptosProvider.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/clients/aptosProvider.ts b/src/clients/aptosProvider.ts index df154eb..00b0bd8 100644 --- a/src/clients/aptosProvider.ts +++ b/src/clients/aptosProvider.ts @@ -5,6 +5,7 @@ import { AccountAddress, Ed25519PrivateKey, Account, + Ed25519Account, } from "@aptos-labs/ts-sdk"; import { PathLike } from "fs"; import fs from "fs"; @@ -180,11 +181,20 @@ export class AptosProvider { return this.aptos; } - /** Returns the profile account by name if found. */ - public getProfileAccountByName(profileName: string): Ed25519PrivateKey { + /** Returns the profile private key by name if found. */ + public getProfileAccountPrivateKeyByName( + profileName: string, + ): Ed25519PrivateKey { return this.profileAccountMap.get(profileName); } + /** Returns the profile private key by name if found. */ + public getProfileAccountByName(profileName: string): Ed25519Account { + return Account.fromPrivateKey({ + privateKey: this.getProfileAccountPrivateKeyByName(profileName), + }); + } + /** Returns the profile address by name if found. */ public getProfileAddressByName(profileName: string): AccountAddress { return this.profileAddressMap.get(profileName);