From fb628cd0f380ba95cb51ae69acbf8fbbe359820c Mon Sep 17 00:00:00 2001 From: Cristian Lungu Date: Tue, 20 Aug 2024 16:41:35 +0300 Subject: [PATCH] fix: send collectible token-id hex conversion --- src/status_im/contexts/wallet/send/events.cljs | 4 ++-- src/utils/hex.cljs | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/status_im/contexts/wallet/send/events.cljs b/src/status_im/contexts/wallet/send/events.cljs index 1c8c28de29..eaf4f24032 100644 --- a/src/status_im/contexts/wallet/send/events.cljs +++ b/src/status_im/contexts/wallet/send/events.cljs @@ -731,8 +731,8 @@ :route route :token-address token-address :token-id (if collectible - (money/to-hex - (js/parseInt token-id)) + (utils.hex/number-to-hex + token-id) token-id) :data data :eth-transfer? eth-transfer?})] diff --git a/src/utils/hex.cljs b/src/utils/hex.cljs index 6892f35d28..649ca121e9 100644 --- a/src/utils/hex.cljs +++ b/src/utils/hex.cljs @@ -1,6 +1,7 @@ (ns utils.hex (:require [clojure.string :as string] + [native-module.core :as native-module] [schema.core :as schema])) (defn normalize-hex @@ -25,3 +26,14 @@ [:=> [:cat :string] :string]) + +(defn number-to-hex + [value] + (->> value + native-module/number-to-hex + prefix-hex)) + +(schema/=> number-to-hex + [:=> + [:cat [:or :string :int]] + :string])