Skip to content
This repository was archived by the owner on Dec 23, 2025. It is now read-only.

Commit eb98022

Browse files
committed
fix: parse decimal amount
1 parent 30b8065 commit eb98022

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@reservoir0x/relay-protocol-sdk",
3-
"version": "0.0.53",
3+
"version": "0.0.54",
44
"description": "Relay protocol SDK",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/messages/v2.1/depository-withdrawal.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
hashStruct,
1414
Hex,
1515
parseAbiParameters,
16+
parseUnits,
1617
} from "viem";
1718

1819
import {
@@ -854,7 +855,13 @@ export const getDecodedWithdrawalAmount = (
854855
}
855856

856857
case "hyperliquid-vm": {
857-
return decodedWithdrawal.withdrawal.parameters.amount;
858+
// The assumption here is that the amount is always encoded with the full decimals of the currency
859+
const decimals =
860+
decodedWithdrawal.withdrawal.parameters.amount.split(".")[1].length;
861+
return parseUnits(
862+
decodedWithdrawal.withdrawal.parameters.amount,
863+
decimals
864+
).toString();
858865
}
859866

860867
default:

0 commit comments

Comments
 (0)