]> git.codecow.com Git - libnemo.git/commitdiff
Deprecate multiple Account load signatures.
authorChris Duncan <chris@zoso.dev>
Thu, 16 Oct 2025 02:43:06 +0000 (19:43 -0700)
committerChris Duncan <chris@zoso.dev>
Thu, 16 Oct 2025 02:43:06 +0000 (19:43 -0700)
src/lib/account/index.ts

index 6b6d88a0684180b1a607dc0de9dbd23525eebbc1..4d90b65bb1f237301725ef96b2cdbe8aa0905ab5 100644 (file)
@@ -172,20 +172,14 @@ export class Account {
        }\r
 \r
        /**\r
-       * Instantiates an Account object from its Nano address.\r
+       * Instantiates an Account object from its Nano address. It is unable to sign\r
+       * blocks or messages since it has no private key.\r
        *\r
        * @param {string} address - Address of the account\r
        * @returns {Account} A new Account object\r
        */\r
        static load (address: string): Account\r
        /**\r
-       * Instantiates Account objects from their Nano addresses.\r
-       *\r
-       * @param {string[]} addresses - Addresses of the accounts\r
-       * @returns {Account[]} Array of new Account objects\r
-       */\r
-       static load (addresses: string[]): Account[]\r
-       /**\r
        * Instantiates an Account object from its public key. It is unable to sign\r
        * blocks or messages since it has no private key.\r
        *\r
@@ -194,14 +188,6 @@ export class Account {
        */\r
        static load (publicKey: string | Uint8Array<ArrayBuffer>): Account\r
        /**\r
-       * Instantiates Account objects from their public keys. They are unable to sign\r
-       * blocks or messages since they have no private key.\r
-       *\r
-       * @param {string | Uint8Array<ArrayBuffer>[]} publicKeys - Public keys of the accounts\r
-       * @returns {Account[]} Array of new Account objects\r
-       */\r
-       static load (publicKeys: string | Uint8Array<ArrayBuffer>[]): Account[]\r
-       /**\r
        * Instantiates an Account object from its public key. It is unable to sign\r
        * blocks or messages since it has no private key.\r
        *\r
@@ -210,49 +196,20 @@ export class Account {
        */\r
        static load (keypair: KeyPair): Account\r
        /**\r
-       * Instantiates Account objects from their public keys. They are unable to sign\r
-       * blocks or messages since they have no private key.\r
-       *\r
-       * @param {KeyPair[]} keypairs - Indexes and keys of the accounts\r
-       * @returns {Account[]} Array of new Account objects\r
-       */\r
-       static load (keypairs: KeyPair[]): Account[]\r
-       /**\r
        * Instantiates an Account object from its private key which is used to derive\r
        * a public key and then discarded.\r
        *\r
        * @param {KeyPair} keypair - Index and key of the account\r
        * @param {string} type - Indicates a private key\r
-       * @returns {Promise<Account>} Promise for a new Account object\r
-       */\r
-       static async load (keypair: KeyPair, type: 'private'): Promise<Account>\r
-       /**\r
-       * Instantiates Account objects from their private keys which are used to\r
-       * derive public keys and then discarded.\r
-       *\r
-       * @param {KeyPair[]} keypairs - Indexes and keys of the accounts\r
-       * @param {string} type - Indicates private keys\r
-       * @returns {Promise<Account[]>} Promise for array of new Account objects\r
-       */\r
-       static async load (keypairs: KeyPair[], type: 'private'): Promise<Account[]>\r
-       /**\r
-       * Instantiates Account objects from their private keys which are used to\r
-       * derive public keys and then discarded.\r
-       *\r
-       * @param {(string | Uint8Array<ArrayBuffer> | KeyPair | (string | Uint8Array<ArrayBuffer> | KeyPair)[])} input - Indexes and keys of the accounts\r
-       * @param {'private'} [type] - Indicates private keys\r
-       * @returns {(Account | Account[] | Promise<Account | Account[]>)} Promise for array of new Account objects\r
+       * @returns {Account} A new Account object\r
        */\r
-       static load (input: string | Uint8Array<ArrayBuffer> | KeyPair | (string | Uint8Array<ArrayBuffer> | KeyPair)[], type?: 'private'): Account | Account[] | Promise<Account | Account[]> {\r
-               const isInputArray = Array.isArray(input)\r
-               const inputs = isInputArray ? input : [input]\r
+       static load (keypair: KeyPair, type: 'private'): Account\r
+       static load (input: string | Uint8Array<ArrayBuffer> | KeyPair, type?: 'private'): Account {\r
+               const { address, publicKey, index } = _load(input, type)\r
                this.#isInternal = true\r
-               const accounts = inputs.map((input) => {\r
-                       const { address, publicKey, index } = _load(input, type)\r
-                       return new this(address, publicKey, index)\r
-               })\r
+               const self = new this(address, publicKey, index)\r
                this.#isInternal = false\r
-               return isInputArray ? accounts : accounts[0]\r
+               return self\r
        }\r
 \r
        /**\r