Skip to content

Commit

Permalink
adds multisigAccount boolean to account status
Browse files Browse the repository at this point in the history
signifies to the user that the account is a multisig account. This will
be helpful in many usecases in the CLI and Node App.
  • Loading branch information
patnir committed Oct 30, 2024
1 parent fd381cf commit 9d05f64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ironfish/src/rpc/routes/wallet/serializers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from '../../../wallet/exporter/multisig'
import { AssetValue } from '../../../wallet/walletdb/assetValue'
import { DecryptedNoteValue } from '../../../wallet/walletdb/decryptedNoteValue'
import { isSignerMultisig } from '../../../wallet/walletdb/multisigKeys'
import { TransactionValue } from '../../../wallet/walletdb/transactionValue'
import {
RpcAccountAssetBalanceDelta,
Expand Down Expand Up @@ -157,6 +158,9 @@ export async function serializeRpcAccountStatus(
account: Account,
): Promise<RpcAccountStatus> {
const head = await account.getHead()
const isMultisigAccount = account.multisigKeys
? isSignerMultisig(account.multisigKeys)
: false

return {
name: account.name,
Expand All @@ -171,5 +175,6 @@ export async function serializeRpcAccountStatus(
scanningEnabled: account.scanningEnabled,
viewOnly: !account.isSpendingAccount(),
default: wallet.getDefaultAccount()?.id === account.id,
multisigAccount: isMultisigAccount,
}
}
2 changes: 2 additions & 0 deletions ironfish/src/rpc/routes/wallet/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export type RpcAccountStatus = {
scanningEnabled: boolean
viewOnly: boolean
default: boolean
multisigAccount: boolean
}

export const RpcAccountStatusSchema: yup.ObjectSchema<RpcAccountStatus> = yup
Expand All @@ -190,5 +191,6 @@ export const RpcAccountStatusSchema: yup.ObjectSchema<RpcAccountStatus> = yup
scanningEnabled: yup.boolean().defined(),
viewOnly: yup.boolean().defined(),
default: yup.boolean().defined(),
multisigAccount: yup.boolean().defined(),
})
.defined()

0 comments on commit 9d05f64

Please sign in to comment.