Skip to content

Commit

Permalink
fix(schema): specify HandlerNames instead of Handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
atticusofsparta committed Oct 14, 2024
1 parent 367537a commit 44cc472
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/types/ant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
import { z } from 'zod';

import { Logger } from '../common/logger.js';
import { ARWEAVE_TX_REGEX } from '../constants.js';
import { AoMessageResult, WalletAddress, WriteOptions } from './common.js';

Expand Down Expand Up @@ -93,7 +92,6 @@ export const AntStateSchema = z.object({
['Source-Code-TX-ID']: ArweaveTxIdSchema.describe(
'Transaction ID of the Source Code for the ANT.',
),
Handlers: z.array(z.string()),
});

export type AoANTState = z.infer<typeof AntStateSchema>;
Expand All @@ -112,6 +110,9 @@ export const AntInfoSchema = z.object({
Denomination: IntegerStringSchema.describe(
'The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers.',
),
HandlerNames: z
.array(z.string({ description: 'Handler Name' }))
.describe('List of handlers for the ANT.'),
});

export type AoANTInfo = z.infer<typeof AntInfoSchema>;
Expand Down
1 change: 0 additions & 1 deletion src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
spawn,
unmonitor,
} from '@permaweb/aoconnect';
import { z } from 'zod';

import { AoSigner } from './token.js';

Expand Down
15 changes: 15 additions & 0 deletions src/utils/schema.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/**
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { z } from 'zod';

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/esm/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ describe('ANTRegistry', async () => {
});

describe('ANT', async () => {
const processId = 'aWI_dq1JH7facsulLuas1X3l5dkKuWtixcZDYMw9mpg';
const processId = 'YcxE5IbqZYK72H64ELoysxiJ-0wb36deYPv55wgl8xo';
const ant = ANT.init({
processId,
});
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/ant.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ describe('ANT Schemas', () => {
['Total-Supply']: '1',
Logo: stub_address,
Denomination: '0',
HandlerNames: ['handler1', 'handler2'],
};
const invalidInfo = {
Name: 'TestToken',
Expand All @@ -75,6 +76,7 @@ describe('ANT Schemas', () => {
['Total-Supply']: 1000,
Logo: stub_address,
Denomination: '1',
HandlerNames: ['handler1', 'handler2'],
};

assert.doesNotThrow(() => AntInfoSchema.parse(validInfo));
Expand Down

0 comments on commit 44cc472

Please sign in to comment.