Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
edisontim committed Sep 27, 2024
1 parent c61a90d commit 18e4097
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 1 addition & 2 deletions client/src/ui/elements/NumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export const NumberInput = ({
value={displayValue}
onChange={(e) => {
if (allowDecimals) {
console.log("heyyyy");
setDisplayValue(e.target.value.match(/[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)/)?.[0] ?? min.toString());
onChange(parseFloat(e.target.value.match(/[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)/)?.[0] ?? min.toString()));
} else {
Expand All @@ -69,7 +68,7 @@ export const NumberInput = ({
playClick();
}}
>
{arrows && <ArrowRight className="fill-gold" width={"6px"} height={"8px"} />}
<ArrowRight className="fill-gold" width={"6px"} height={"8px"} />
</div>
)}
</div>
Expand Down
13 changes: 8 additions & 5 deletions client/src/ui/modules/chat/InputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { toHexString, toValidAscii } from "@/ui/utils/utils";
import { ContractAddress } from "@bibliothecadao/eternum";
import { getComponentValue, Has, HasValue, runQuery } from "@dojoengine/recs";
import { useCallback, useMemo, useRef } from "react";
import { TypedData } from "starknet";
import { Signature, TypedData, WeierstrassSignatureType } from "starknet";
import { GLOBAL_CHANNEL } from "./Chat";
import { Tab } from "./ChatTab";

Expand All @@ -16,8 +16,8 @@ export const InputField = ({
salt,
}: {
currentTab: Tab;
addNewTab: any;
setCurrentTab: any;
addNewTab: (newTab: Tab) => void;
setCurrentTab: (tab: Tab) => void;
salt: bigint;
}) => {
const {
Expand Down Expand Up @@ -83,9 +83,12 @@ export const InputField = ({
const messageInValidAscii = toValidAscii(message);
const data = generateMessageTypedData(account.address, channel, messageInValidAscii, toHexString(salt));

const signature: any = await account.signMessage(data as TypedData);
const signature: Signature = await account.signMessage(data as TypedData);

await toriiClient.publishMessage(JSON.stringify(data), [toHexString(signature.r), toHexString(signature.s)]);
await toriiClient.publishMessage(JSON.stringify(data), [
toHexString((signature as WeierstrassSignatureType).r),
toHexString((signature as WeierstrassSignatureType).s),
]);
},
[account, salt, toriiClient, currentTab.address],
);
Expand Down

0 comments on commit 18e4097

Please sign in to comment.