Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #59 from ar-io/remove-state-field-regex
Browse files Browse the repository at this point in the history
fix(regex): remove field regex for contract fields
  • Loading branch information
dtfiedler authored Nov 20, 2023
2 parents b263600 + 784e623 commit e528ccc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import { EvaluationOptions } from 'warp-contracts';

export const ARNS_CONTRACT_ID_REGEX = '([a-zA-Z0-9-_s+]{43})';
export const ARNS_CONTRACT_FIELD_REGEX =
'(balances|fees|ticker|owner|name|controller|auctions|settings|reserved|gateways|version|lastTickedState|demandFactoring)';
export const ARNS_NAME_REGEX = '([a-zA-Z0-9-s+]{1,51})';
export const EVALUATION_TIMEOUT_MS = 10_000; // 10 sec state timeout
export const allowedContractTypes = ['ant'] as const;
Expand Down
8 changes: 2 additions & 6 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import Router from '@koa/router';
import {
ARNS_CONTRACT_FIELD_REGEX,
ARNS_CONTRACT_ID_REGEX,
ARNS_NAME_REGEX,
} from './constants';
import { ARNS_CONTRACT_ID_REGEX, ARNS_NAME_REGEX } from './constants';
import {
contractBalanceHandler,
contractFieldHandler,
Expand Down Expand Up @@ -104,7 +100,7 @@ router.get(
);
// fallback for any other contract fields that don't include additional logic (i.e. this just returns partial contract state)
router.get(
`/v1/contract/:contractTxId${ARNS_CONTRACT_ID_REGEX}/:field${ARNS_CONTRACT_FIELD_REGEX}`,
`/v1/contract/:contractTxId${ARNS_CONTRACT_ID_REGEX}/:field`,
contractFieldHandler,
);
router.get(
Expand Down

0 comments on commit e528ccc

Please sign in to comment.