From 19b8db46080ebcb118fb426095f2830a7a9fb018 Mon Sep 17 00:00:00 2001 From: Chqrles Date: Wed, 3 Jul 2024 13:19:30 +0200 Subject: [PATCH] [Backend] minor fixes (#100) * add address padding on tx hash * allow smaller public keys * improve public key regex pattern --- backend/src/routes/executeFromOutside.ts | 4 ++-- backend/src/routes/verifyOtp.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/routes/executeFromOutside.ts b/backend/src/routes/executeFromOutside.ts index d093353a..b25d59f7 100644 --- a/backend/src/routes/executeFromOutside.ts +++ b/backend/src/routes/executeFromOutside.ts @@ -1,5 +1,5 @@ import type { FastifyInstance } from 'fastify' -import { type Account } from 'starknet' +import { type Account, addAddressPadding } from 'starknet' import { Entrypoint } from '@/constants/contracts' @@ -54,7 +54,7 @@ export function getExecuteFromOutsideRoute(fastify: FastifyInstance, deployer: A } return reply.code(200).send({ - transaction_hash, + transaction_hash: addAddressPadding(transaction_hash), }) } catch (error) { fastify.log.error(error) diff --git a/backend/src/routes/verifyOtp.ts b/backend/src/routes/verifyOtp.ts index 02b7adb8..e04aa75d 100644 --- a/backend/src/routes/verifyOtp.ts +++ b/backend/src/routes/verifyOtp.ts @@ -33,8 +33,8 @@ export function verifyOtp( properties: { phone_number: { type: 'string', pattern: '^\\+[1-9]\\d{1,14}$' }, sent_otp: { type: 'string', pattern: '^[0-9]{6}$' }, - public_key_x: { type: 'string', pattern: '^0x[0-9a-fA-F]{64}$' }, - public_key_y: { type: 'string', pattern: '^0x[0-9a-fA-F]{64}$' }, + public_key_x: { type: 'string', pattern: '^0x[0-9a-fA-F]+$' }, + public_key_y: { type: 'string', pattern: '^0x[0-9a-fA-F]+$' }, }, }, },