@@ -2,15 +2,6 @@ import { Asset } from "@/data/facades/chain/types";
2
2
import { IRON_ASSET_ID_HEX } from "../data/constants" ;
3
3
import { CurrencyUtils } from "@ironfish/sdk" ;
4
4
5
- type AmountValidationResult = [ bigint , null ] | [ null , Error ] ;
6
-
7
- interface AssetWithVerification extends Asset {
8
- verification : {
9
- status : "verified" | "unverified" | "unknown" ;
10
- decimals ?: number ;
11
- } ;
12
- }
13
-
14
5
export const isValidBigInt = ( num : string ) => {
15
6
if ( num . length === 0 ) return false ;
16
7
try {
@@ -22,7 +13,7 @@ export const isValidBigInt = (num: string) => {
22
13
} ;
23
14
24
15
export const getAssetDecimals = (
25
- asset : AssetWithVerification | undefined ,
16
+ asset : Asset | undefined ,
26
17
) : number | undefined => {
27
18
if ( ! asset ) return undefined ;
28
19
try {
@@ -37,8 +28,8 @@ export const getAssetDecimals = (
37
28
export const convertAmountToMinor = (
38
29
amount : string ,
39
30
assetId : string ,
40
- assetMap : Map < string , AssetWithVerification > ,
41
- ) : AmountValidationResult => {
31
+ assetMap : Map < string , Asset > ,
32
+ ) => {
42
33
const asset =
43
34
assetId === IRON_ASSET_ID_HEX ? undefined : assetMap . get ( assetId ) ;
44
35
return CurrencyUtils . tryMajorToMinor ( amount , assetId , {
@@ -49,7 +40,7 @@ export const convertAmountToMinor = (
49
40
export const isValidAmount = (
50
41
value : string ,
51
42
assetId : string ,
52
- assetMap : Map < string , AssetWithVerification > ,
43
+ assetMap : Map < string , Asset > ,
53
44
) => {
54
45
if ( value . length === 0 ) return true ;
55
46
@@ -68,7 +59,7 @@ export const isValidAmount = (
68
59
export const enforceDecimals = (
69
60
value : string ,
70
61
assetId : string ,
71
- assetMap : Map < string , AssetWithVerification > ,
62
+ assetMap : Map < string , Asset > ,
72
63
) : string => {
73
64
if ( value . length === 0 ) return value ;
74
65
0 commit comments