Skip to content

Commit

Permalink
Merge pull request #88 from valory-xyz/tanya/launch-fix
Browse files Browse the repository at this point in the history
(launch) fix: allow empty agentIds
  • Loading branch information
DavidMinarsch authored Aug 28, 2024
2 parents d7fe4d9 + c8336ed commit 25a7559
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 19 deletions.
2 changes: 1 addition & 1 deletion apps/launch/common-util/functions/stakingContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const getStakingContractInitPayload = ({
livenessPeriod,
timeForEmissions,
numAgentInstances,
agentIds: agentIds.split(/,\s?/).map((agentId) => Number(agentId)),
agentIds: agentIds ? agentIds.split(/,\s?/).map((agentId) => Number(agentId)) : [],
threshold,
configHash,
activityChecker,
Expand Down
16 changes: 0 additions & 16 deletions apps/launch/components/MyStakingContracts/Create/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,22 +203,6 @@ describe('<CreateStakingContract />', () => {
expect(numAgentInstancesInput).toHaveValue('1'); // default value
});

// Agent IDs
it('should display `Agent IDs` field as required and able to fill the field', async () => {
render(<CreateStakingContract />);

const agentIdsInput = screen.getByLabelText('Agent IDs');
expect(agentIdsInput).toBeRequired();

await userEvent.clear(agentIdsInput);
await userEvent.type(agentIdsInput, '1,2, ');

await clickCreateContractButton();
expect(
screen.getByText('Please input a valid list of numbers separated by commas.'),
).toBeInTheDocument();
});

// Multisig threshold
it('should display `Multisig threshold` field as required and able to fill the field', async () => {
render(<CreateStakingContract />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export const useFieldRules = (): StakingDepositRules => {
numAgentInstances: { rules: getGenericFieldRules(FieldConfig.numAgentInstances.name) },
agentIds: {
rules: [
...getGenericFieldRules(FieldConfig.agentIds.name),
{ ...FORM_VALIDATION.validateCommaSeparatedList },
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ const AgentIds: FC<{ address: Address }> = ({ address }) => {
return data.map((id) => (
<a
key={id}
href={`${REGISTRY_URL}${networkName}/services/${id}`}
href={`${REGISTRY_URL}ethereum/agents/${id}`}
className="mr-8"
target="_blank"
rel="noreferrer"
>
Expand Down

0 comments on commit 25a7559

Please sign in to comment.