Skip to content

Commit

Permalink
Merge pull request #360 from algorandfoundation/fix-account-type
Browse files Browse the repository at this point in the history
fix: correct the account type
  • Loading branch information
neilcampbell authored Dec 18, 2024
2 parents 0611b81 + fa9382f commit 98f91c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/code/modules/types_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Account information at a given round.
| `appsTotalExtraPages?` | `number` | The sum of all extra application program pages for this account. |
| `appsTotalSchema?` | `ApplicationStateSchema` | (tsch) stores the sum of all of the local schemas and global schemas in this account. Note: the raw account uses `StateSchema` for this type. |
| `assets?` | `AssetHolding`[] | Assets held by this account. |
| `authAddress?` | `Address` | The address against which signing should be checked. If empty, the address of the current account is used. This field can be updated in any transaction by setting the `RekeyTo` field. |
| `authAddr?` | `Address` | The address against which signing should be checked. If empty, the address of the current account is used. This field can be updated in any transaction by setting the `RekeyTo` field. |
| `balance` | [`AlgoAmount`](../classes/types_amount.AlgoAmount.md) | The balance of Algo currently held by the account. |
| `createdApps?` | `Application`[] | Parameters of applications created by this account including app global data. |
| `createdAssets?` | `Asset`[] | (apar) parameters of assets created by this account. Note: the raw account uses `map[int] -> Asset` for this type. |
Expand Down
14 changes: 14 additions & 0 deletions src/types/account-manager.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import algosdk from 'algosdk'
import { v4 as uuid } from 'uuid'
import { beforeEach, describe, expect, test } from 'vitest'
import { algo } from '../amount'
import { algorandFixture } from '../testing'

describe('AccountManager', () => {
Expand Down Expand Up @@ -42,4 +43,17 @@ describe('AccountManager', () => {
expect(account.addr).toEqual(account2.addr)
expect(account.account.sk).toEqual(account2.account.sk)
}, 10e6)

test('Rekeyed account is retrievable', async () => {
const { algorand, generateAccount } = localnet.context

const rekeyed = await generateAccount({ initialFunds: algo(1) })
const rekeyTo = await generateAccount({ initialFunds: algo(0.1) })

await algorand.account.rekeyAccount(rekeyed.addr, rekeyTo)

const accountInfo = await algorand.account.getInformation(rekeyed.addr)
expect(accountInfo.address.toString()).toBe(rekeyed.addr.toString())
expect(accountInfo.authAddr!.toString()).toBe(rekeyTo.addr.toString())
}, 10e6)
})
2 changes: 1 addition & 1 deletion src/types/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export type AccountInformation = {
* address of the current account is used. This field can be updated in any
* transaction by setting the `RekeyTo` field.
*/
authAddress?: Address
authAddr?: Address

/**
* Parameters of applications created by this account including app global data.
Expand Down

0 comments on commit 98f91c6

Please sign in to comment.