]> git.codecow.com Git - libnemo.git/commitdiff
Alphabetize function declaration order.
authorChris Duncan <chris@zoso.dev>
Mon, 7 Jul 2025 13:14:47 +0000 (06:14 -0700)
committerChris Duncan <chris@zoso.dev>
Mon, 7 Jul 2025 13:14:47 +0000 (06:14 -0700)
src/lib/account.ts

index e23548119762f13c61ef15b8aa95aeda5a5fbc09..c3045351cca57c5cf489ada59f719f037c2065e2 100644 (file)
@@ -186,6 +186,38 @@ export class Account {
                return true\r
        }\r
 \r
+       /**\r
+       * Refreshes the account from its current state on the network.\r
+       *\r
+       * A successful response sets the balance, frontier, and representative\r
+       * properties.\r
+       *\r
+       * @param {Rpc|string|URL} rpc - RPC node information required to call `account_info`\r
+       */\r
+       async refresh (rpc: Rpc | string | URL): Promise<void> {\r
+               if (typeof rpc === 'string' || rpc.constructor === URL) {\r
+                       rpc = new Rpc(rpc)\r
+               }\r
+               if (rpc.constructor !== Rpc) {\r
+                       throw new TypeError('RPC must be a valid node')\r
+               }\r
+               const data = {\r
+                       account: this.address,\r
+                       receivable: true,\r
+                       representative: true,\r
+                       weight: true\r
+               }\r
+               const { balance, frontier, receivable, representative, weight } = await rpc.call('account_info', data)\r
+               if (frontier == null) {\r
+                       throw new Error('Account not found')\r
+               }\r
+               this.#balance = BigInt(balance)\r
+               this.#frontier = frontier\r
+               this.#receivable = BigInt(receivable)\r
+               this.#representative = Account.fromAddress(representative)\r
+               this.#weight = BigInt(weight)\r
+       }\r
+\r
        /**\r
        * Unlocks the account using the same password as used prior to lock it.\r
        *\r
@@ -249,38 +281,6 @@ export class Account {
                }\r
        }\r
 \r
-       /**\r
-       * Refreshes the account from its current state on the network.\r
-       *\r
-       * A successful response sets the balance, frontier, and representative\r
-       * properties.\r
-       *\r
-       * @param {Rpc|string|URL} rpc - RPC node information required to call `account_info`\r
-       */\r
-       async refresh (rpc: Rpc | string | URL): Promise<void> {\r
-               if (typeof rpc === 'string' || rpc.constructor === URL) {\r
-                       rpc = new Rpc(rpc)\r
-               }\r
-               if (rpc.constructor !== Rpc) {\r
-                       throw new TypeError('RPC must be a valid node')\r
-               }\r
-               const data = {\r
-                       account: this.address,\r
-                       receivable: true,\r
-                       representative: true,\r
-                       weight: true\r
-               }\r
-               const { balance, frontier, receivable, representative, weight } = await rpc.call('account_info', data)\r
-               if (frontier == null) {\r
-                       throw new Error('Account not found')\r
-               }\r
-               this.#balance = BigInt(balance)\r
-               this.#frontier = frontier\r
-               this.#receivable = BigInt(receivable)\r
-               this.#representative = Account.fromAddress(representative)\r
-               this.#weight = BigInt(weight)\r
-       }\r
-\r
        static #addressToKey (v: string): string {\r
                const publicKeyBytes = base32.toBytes(v.slice(-60, -8))\r
                const checksumBytes = base32.toBytes(v.slice(-8))\r