From 188175d69037c5e8ae4f94e66f3141072b9a119f Mon Sep 17 00:00:00 2001 From: Fernando Date: Tue, 16 Mar 2021 07:24:31 -0300 Subject: [PATCH] (Fix) Wrong owners name assignment on Safe Load (#2020) * pad with zeroes so sorting works properly * fix @ts-eslint warnings --- src/routes/open/components/fields.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/routes/open/components/fields.ts b/src/routes/open/components/fields.ts index 87d0f0b7..eb9cba20 100644 --- a/src/routes/open/components/fields.ts +++ b/src/routes/open/components/fields.ts @@ -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) => {