(Fix) Wrong owners name assignment on Safe Load (#2020)

* pad with zeroes so sorting works properly

* fix @ts-eslint warnings
This commit is contained in:
Fernando 2021-03-16 07:24:31 -03:00 committed by GitHub
parent 34a8bcc259
commit 188175d690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -1,13 +1,16 @@
import { LoadFormValues } from 'src/routes/load/container/Load'
import { CreateSafeValues } from 'src/routes/open/utils/safeDataExtractor'
export const FIELD_NAME = 'name'
export const FIELD_CONFIRMATIONS = 'confirmations'
export const FIELD_OWNERS = 'owners'
export const FIELD_SAFE_NAME = 'safeName'
export const FIELD_CREATION_PROXY_SALT = 'safeCreationSalt'
export const getOwnerNameBy = (index: number): string => `owner${index}Name`
export const getOwnerAddressBy = (index: number): string => `owner${index}Address`
export const getOwnerNameBy = (index: number): string => `owner${index.toString().padStart(4, '0')}Name`
export const getOwnerAddressBy = (index: number): string => `owner${index.toString().padStart(4, '0')}Address`
export const getNumOwnersFrom = (values) => {
export const getNumOwnersFrom = (values: CreateSafeValues | LoadFormValues): number => {
const accounts = Object.keys(values)
.sort()
.filter((key) => {