From 74be99954aed3401957ce4a0355175ff485cbc26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20=27birdy=27=20Danjou?= Date: Thu, 27 Jun 2024 21:12:10 +0200 Subject: [PATCH] fix: fix types --- src/sdk/reencrypt.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/sdk/reencrypt.ts b/src/sdk/reencrypt.ts index 2088a8c..a8c94fe 100644 --- a/src/sdk/reencrypt.ts +++ b/src/sdk/reencrypt.ts @@ -1,4 +1,9 @@ -import { bytesToBigInt, fromHexString } from '../utils'; +import { + bytesToBigInt, + bigIntToBytes, + toHexString, + fromHexString, +} from '../utils'; import { u8vec_to_cryptobox_pk, default_client_for_centralized_kms, @@ -18,11 +23,11 @@ export const reencryptRequest = ) => { if (!gatewayUrl) throw new Error('You must provide a reencryption URL.'); - const payload: { [key: string]: string } = { - signature, - user_address: userAddress, - enc_key: publicKey, - ciphertext_handle: handle.toString(), + const payload = { + signature: signature.replace(/^(0x)/, ''), + user_address: userAddress.replace(/^(0x)/, ''), + enc_key: publicKey.replace(/^(0x)/, ''), + ciphertext_handle: toHexString(bigIntToBytes(handle)), eip712_verifying_contract: contractAddress, }; const options = {