-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathutils.ts
More file actions
30 lines (25 loc) · 757 Bytes
/
utils.ts
File metadata and controls
30 lines (25 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { calculateDepositByDataSize } from "@wpdas/naxios";
import { Big } from "big.js";
import { ONE_HUNDREDTH_NEAR } from "@/common/constants";
import { parseNearAmount } from "@/common/lib";
import type { IndivisibleUnits } from "@/common/types";
import type { ApplyArgs } from "./client";
type CallDepositParams =
| { functionName: "apply"; args: ApplyArgs }
| { functionName: string; args: {} };
export const calculateCallDeposit = ({
functionName,
args,
}: CallDepositParams): IndivisibleUnits => {
switch (functionName) {
case "apply": {
return (
parseNearAmount(Big(0.01).times(calculateDepositByDataSize(args)).toString()) ??
ONE_HUNDREDTH_NEAR
);
}
default: {
return "0";
}
}
};