@mezo-org/passport 0.16.1 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/src/components/Dropdown/ListingItem.d.ts +4 -2
  2. package/dist/src/components/Dropdown/ListingItem.d.ts.map +1 -1
  3. package/dist/src/components/Dropdown/ListingItem.js +7 -4
  4. package/dist/src/components/Dropdown/ListingItem.js.map +1 -1
  5. package/dist/src/components/Dropdown/Root/AccountMezoListing.d.ts +4 -0
  6. package/dist/src/components/Dropdown/Root/AccountMezoListing.d.ts.map +1 -0
  7. package/dist/src/components/Dropdown/Root/AccountMezoListing.js +30 -0
  8. package/dist/src/components/Dropdown/Root/AccountMezoListing.js.map +1 -0
  9. package/dist/src/components/Dropdown/Root/AccountOtherAssets.js +1 -1
  10. package/dist/src/components/Dropdown/Root/AccountOtherAssets.js.map +1 -1
  11. package/dist/src/components/Dropdown/Root/Root.d.ts.map +1 -1
  12. package/dist/src/components/Dropdown/Root/Root.js +2 -0
  13. package/dist/src/components/Dropdown/Root/Root.js.map +1 -1
  14. package/dist/src/hooks/useTokensBalances.d.ts.map +1 -1
  15. package/dist/src/hooks/useTokensBalances.js +10 -2
  16. package/dist/src/hooks/useTokensBalances.js.map +1 -1
  17. package/dist/src/hooks/useWatchTransferEvents.d.ts.map +1 -1
  18. package/dist/src/hooks/useWatchTransferEvents.js +1 -0
  19. package/dist/src/hooks/useWatchTransferEvents.js.map +1 -1
  20. package/dist/src/lib/contracts/artifacts/MEZO.json +428 -0
  21. package/dist/src/lib/contracts/index.d.ts +1 -1
  22. package/dist/src/lib/contracts/index.d.ts.map +1 -1
  23. package/dist/src/lib/contracts/index.js +3 -0
  24. package/dist/src/lib/contracts/index.js.map +1 -1
  25. package/dist/src/utils/assets.d.ts +15 -0
  26. package/dist/src/utils/assets.d.ts.map +1 -1
  27. package/dist/src/utils/assets.js +13 -0
  28. package/dist/src/utils/assets.js.map +1 -1
  29. package/package.json +1 -1
  30. package/src/components/Dropdown/ListingItem.tsx +23 -4
  31. package/src/components/Dropdown/Root/AccountMezoListing.tsx +55 -0
  32. package/src/components/Dropdown/Root/AccountOtherAssets.tsx +1 -1
  33. package/src/components/Dropdown/Root/Root.tsx +3 -0
  34. package/src/hooks/useTokensBalances.ts +10 -1
  35. package/src/hooks/useWatchTransferEvents.ts +1 -0
  36. package/src/lib/contracts/artifacts/MEZO.json +428 -0
  37. package/src/lib/contracts/index.ts +4 -0
  38. package/src/utils/assets.ts +14 -0
@@ -0,0 +1,428 @@
1
+ {
2
+ "address": "0x7B7c000000000000000000000000000000000001",
3
+ "abi": [
4
+ {
5
+ "anonymous": false,
6
+ "inputs": [
7
+ {
8
+ "indexed": true,
9
+ "internalType": "address",
10
+ "name": "owner",
11
+ "type": "address"
12
+ },
13
+ {
14
+ "indexed": true,
15
+ "internalType": "address",
16
+ "name": "spender",
17
+ "type": "address"
18
+ },
19
+ {
20
+ "indexed": false,
21
+ "internalType": "uint256",
22
+ "name": "value",
23
+ "type": "uint256"
24
+ }
25
+ ],
26
+ "name": "Approval",
27
+ "type": "event"
28
+ },
29
+ {
30
+ "anonymous": false,
31
+ "inputs": [
32
+ {
33
+ "indexed": true,
34
+ "internalType": "address",
35
+ "name": "to",
36
+ "type": "address"
37
+ },
38
+ {
39
+ "indexed": false,
40
+ "internalType": "uint256",
41
+ "name": "amount",
42
+ "type": "uint256"
43
+ }
44
+ ],
45
+ "name": "Minted",
46
+ "type": "event"
47
+ },
48
+ {
49
+ "anonymous": false,
50
+ "inputs": [
51
+ {
52
+ "indexed": true,
53
+ "internalType": "address",
54
+ "name": "minter",
55
+ "type": "address"
56
+ }
57
+ ],
58
+ "name": "MinterSet",
59
+ "type": "event"
60
+ },
61
+ {
62
+ "anonymous": false,
63
+ "inputs": [
64
+ {
65
+ "indexed": true,
66
+ "internalType": "address",
67
+ "name": "from",
68
+ "type": "address"
69
+ },
70
+ {
71
+ "indexed": true,
72
+ "internalType": "address",
73
+ "name": "to",
74
+ "type": "address"
75
+ },
76
+ {
77
+ "indexed": false,
78
+ "internalType": "uint256",
79
+ "name": "value",
80
+ "type": "uint256"
81
+ }
82
+ ],
83
+ "name": "Transfer",
84
+ "type": "event"
85
+ },
86
+ {
87
+ "inputs": [],
88
+ "name": "DOMAIN_SEPARATOR",
89
+ "outputs": [
90
+ {
91
+ "internalType": "bytes32",
92
+ "name": "",
93
+ "type": "bytes32"
94
+ }
95
+ ],
96
+ "stateMutability": "view",
97
+ "type": "function"
98
+ },
99
+ {
100
+ "inputs": [],
101
+ "name": "PERMIT_TYPEHASH",
102
+ "outputs": [
103
+ {
104
+ "internalType": "bytes32",
105
+ "name": "",
106
+ "type": "bytes32"
107
+ }
108
+ ],
109
+ "stateMutability": "pure",
110
+ "type": "function"
111
+ },
112
+ {
113
+ "inputs": [
114
+ {
115
+ "internalType": "address",
116
+ "name": "owner",
117
+ "type": "address"
118
+ },
119
+ {
120
+ "internalType": "address",
121
+ "name": "spender",
122
+ "type": "address"
123
+ }
124
+ ],
125
+ "name": "allowance",
126
+ "outputs": [
127
+ {
128
+ "internalType": "uint256",
129
+ "name": "",
130
+ "type": "uint256"
131
+ }
132
+ ],
133
+ "stateMutability": "view",
134
+ "type": "function"
135
+ },
136
+ {
137
+ "inputs": [
138
+ {
139
+ "internalType": "address",
140
+ "name": "spender",
141
+ "type": "address"
142
+ },
143
+ {
144
+ "internalType": "uint256",
145
+ "name": "value",
146
+ "type": "uint256"
147
+ }
148
+ ],
149
+ "name": "approve",
150
+ "outputs": [
151
+ {
152
+ "internalType": "bool",
153
+ "name": "",
154
+ "type": "bool"
155
+ }
156
+ ],
157
+ "stateMutability": "nonpayable",
158
+ "type": "function"
159
+ },
160
+ {
161
+ "inputs": [
162
+ {
163
+ "internalType": "address",
164
+ "name": "account",
165
+ "type": "address"
166
+ }
167
+ ],
168
+ "name": "balanceOf",
169
+ "outputs": [
170
+ {
171
+ "internalType": "uint256",
172
+ "name": "",
173
+ "type": "uint256"
174
+ }
175
+ ],
176
+ "stateMutability": "view",
177
+ "type": "function"
178
+ },
179
+ {
180
+ "inputs": [],
181
+ "name": "decimals",
182
+ "outputs": [
183
+ {
184
+ "internalType": "uint8",
185
+ "name": "",
186
+ "type": "uint8"
187
+ }
188
+ ],
189
+ "stateMutability": "view",
190
+ "type": "function"
191
+ },
192
+ {
193
+ "inputs": [],
194
+ "name": "getMinter",
195
+ "outputs": [
196
+ {
197
+ "internalType": "address",
198
+ "name": "",
199
+ "type": "address"
200
+ }
201
+ ],
202
+ "stateMutability": "view",
203
+ "type": "function"
204
+ },
205
+ {
206
+ "inputs": [
207
+ {
208
+ "internalType": "address",
209
+ "name": "to",
210
+ "type": "address"
211
+ },
212
+ {
213
+ "internalType": "uint256",
214
+ "name": "amount",
215
+ "type": "uint256"
216
+ }
217
+ ],
218
+ "name": "mint",
219
+ "outputs": [
220
+ {
221
+ "internalType": "bool",
222
+ "name": "",
223
+ "type": "bool"
224
+ }
225
+ ],
226
+ "stateMutability": "nonpayable",
227
+ "type": "function"
228
+ },
229
+ {
230
+ "inputs": [],
231
+ "name": "name",
232
+ "outputs": [
233
+ {
234
+ "internalType": "string",
235
+ "name": "",
236
+ "type": "string"
237
+ }
238
+ ],
239
+ "stateMutability": "view",
240
+ "type": "function"
241
+ },
242
+ {
243
+ "inputs": [
244
+ {
245
+ "internalType": "address",
246
+ "name": "owner",
247
+ "type": "address"
248
+ }
249
+ ],
250
+ "name": "nonce",
251
+ "outputs": [
252
+ {
253
+ "internalType": "uint256",
254
+ "name": "",
255
+ "type": "uint256"
256
+ }
257
+ ],
258
+ "stateMutability": "view",
259
+ "type": "function"
260
+ },
261
+ {
262
+ "inputs": [
263
+ {
264
+ "internalType": "address",
265
+ "name": "owner",
266
+ "type": "address"
267
+ }
268
+ ],
269
+ "name": "nonces",
270
+ "outputs": [
271
+ {
272
+ "internalType": "uint256",
273
+ "name": "",
274
+ "type": "uint256"
275
+ }
276
+ ],
277
+ "stateMutability": "view",
278
+ "type": "function"
279
+ },
280
+ {
281
+ "inputs": [
282
+ {
283
+ "internalType": "address",
284
+ "name": "owner",
285
+ "type": "address"
286
+ },
287
+ {
288
+ "internalType": "address",
289
+ "name": "spender",
290
+ "type": "address"
291
+ },
292
+ {
293
+ "internalType": "uint256",
294
+ "name": "amount",
295
+ "type": "uint256"
296
+ },
297
+ {
298
+ "internalType": "uint256",
299
+ "name": "deadline",
300
+ "type": "uint256"
301
+ },
302
+ {
303
+ "internalType": "uint8",
304
+ "name": "v",
305
+ "type": "uint8"
306
+ },
307
+ {
308
+ "internalType": "bytes32",
309
+ "name": "r",
310
+ "type": "bytes32"
311
+ },
312
+ {
313
+ "internalType": "bytes32",
314
+ "name": "s",
315
+ "type": "bytes32"
316
+ }
317
+ ],
318
+ "name": "permit",
319
+ "outputs": [
320
+ {
321
+ "internalType": "bool",
322
+ "name": "",
323
+ "type": "bool"
324
+ }
325
+ ],
326
+ "stateMutability": "nonpayable",
327
+ "type": "function"
328
+ },
329
+ {
330
+ "inputs": [
331
+ {
332
+ "internalType": "address",
333
+ "name": "minter",
334
+ "type": "address"
335
+ }
336
+ ],
337
+ "name": "setMinter",
338
+ "outputs": [
339
+ {
340
+ "internalType": "bool",
341
+ "name": "",
342
+ "type": "bool"
343
+ }
344
+ ],
345
+ "stateMutability": "nonpayable",
346
+ "type": "function"
347
+ },
348
+ {
349
+ "inputs": [],
350
+ "name": "symbol",
351
+ "outputs": [
352
+ {
353
+ "internalType": "string",
354
+ "name": "",
355
+ "type": "string"
356
+ }
357
+ ],
358
+ "stateMutability": "view",
359
+ "type": "function"
360
+ },
361
+ {
362
+ "inputs": [],
363
+ "name": "totalSupply",
364
+ "outputs": [
365
+ {
366
+ "internalType": "uint256",
367
+ "name": "",
368
+ "type": "uint256"
369
+ }
370
+ ],
371
+ "stateMutability": "view",
372
+ "type": "function"
373
+ },
374
+ {
375
+ "inputs": [
376
+ {
377
+ "internalType": "address",
378
+ "name": "to",
379
+ "type": "address"
380
+ },
381
+ {
382
+ "internalType": "uint256",
383
+ "name": "value",
384
+ "type": "uint256"
385
+ }
386
+ ],
387
+ "name": "transfer",
388
+ "outputs": [
389
+ {
390
+ "internalType": "bool",
391
+ "name": "",
392
+ "type": "bool"
393
+ }
394
+ ],
395
+ "stateMutability": "nonpayable",
396
+ "type": "function"
397
+ },
398
+ {
399
+ "inputs": [
400
+ {
401
+ "internalType": "address",
402
+ "name": "from",
403
+ "type": "address"
404
+ },
405
+ {
406
+ "internalType": "address",
407
+ "name": "to",
408
+ "type": "address"
409
+ },
410
+ {
411
+ "internalType": "uint256",
412
+ "name": "value",
413
+ "type": "uint256"
414
+ }
415
+ ],
416
+ "name": "transferFrom",
417
+ "outputs": [
418
+ {
419
+ "internalType": "bool",
420
+ "name": "",
421
+ "type": "bool"
422
+ }
423
+ ],
424
+ "stateMutability": "nonpayable",
425
+ "type": "function"
426
+ }
427
+ ]
428
+ }
@@ -1,5 +1,5 @@
1
1
  import { Abi, Address } from "viem";
2
- export type MezoChainToken = "mcbBTC" | "mDAI" | "mFBTC" | "mSolvBTC" | "mswBTC" | "mT" | "mUSDC" | "mUSDe" | "mUSDT" | "mxSolvBTC" | "MUSD";
2
+ export type MezoChainToken = "mcbBTC" | "mDAI" | "mFBTC" | "mSolvBTC" | "mswBTC" | "mT" | "mUSDC" | "mUSDe" | "mUSDT" | "mxSolvBTC" | "MUSD" | "MEZO";
3
3
  export type MezoBorrowContract = "TroveManager" | "BorrowerOperations" | "PriceFeed";
4
4
  type ContractsMap<K extends string> = Record<K, {
5
5
  address: Address;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/contracts/index.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,MAAM,GACN,OAAO,GACP,UAAU,GACV,QAAQ,GACR,IAAI,GACJ,OAAO,GACP,OA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AA;AAEhD,eAAO,MAAM,sBAAsB,EAInB,YAAY,CAAC,kBAAkB,CAAC,CAAA"}
@@ -26,6 +26,7 @@ import troveManagerTestnet from "@mezo-org/musd-contracts/deployments/matsnet/Tr
26
26
  import borrowerOperationsTestnet from "@mezo-org/musd-contracts/deployments/matsnet/BorrowerOperations.json";
27
27
  import priceFeed from "@mezo-org/musd-contracts/deployments/mainnet/PriceFeed.json";
28
28
  import priceFeedTestnet from "@mezo-org/musd-contracts/deployments/matsnet/PriceFeed.json";
29
+ import mezoArtifact from "./artifacts/MEZO.json";
29
30
  export const testnetTokenContracts = {
30
31
  mcbBTC: cbbtcTestnet,
31
32
  mDAI: daiTestnet,
@@ -38,6 +39,7 @@ export const testnetTokenContracts = {
38
39
  mUSDT: usdtTestnet,
39
40
  mxSolvBTC: xsolvbtcTestnet,
40
41
  MUSD: musdTestnet,
42
+ MEZO: mezoArtifact,
41
43
  };
42
44
  export const mainnetTokenContracts = {
43
45
  mcbBTC: cbbtcMainnet,
@@ -51,6 +53,7 @@ export const mainnetTokenContracts = {
51
53
  mUSDT: usdtMainnet,
52
54
  mxSolvBTC: xsolvbtcMainnet,
53
55
  MUSD: musdMainnet,
56
+ MEZO: mezoArtifact,
54
57
  };
55
58
  export const mainnetBorrowContracts = {
56
59
  TroveManager: troveManagerMainnet,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/contracts/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,2DAA2D,CAAA;AACpF,OAAO,UAAU,MAAM,yDAAyD,CAAA;AAChF,OAAO,WAAW,MAAM,0DAA0D,CAAA;AAClF,OAAO,cAAc,MAAM,6DAA6D,CAAA;AACxF,OAAO,YAAY,MAAM,2DAA2D,CAAA;AACpF,OAAO,QAAQ,MAAM,uDAAuD,CAAA;AAC5E,OAAO,WAAW,MAAM,0DAA0D,CAAA;AAClF,OAAO,WAAW,MAAM,0DAA0D,CAAA;AAClF,OAAO,WAA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EAAE,SAAS;CAC0B,CAAA;AAEhD,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,YAAY,EAAE,mBAAmB;IACjC,kBAAkB,EAAE,yBAAyB;IAC7C,SAAS,EAAE,gBAAgB;CACmB,CAAA"}
@@ -64,6 +64,11 @@ declare const ASSETS: {
64
64
  symbol: string;
65
65
  decimals: number;
66
66
  };
67
+ MEZO: {
68
+ name: string;
69
+ symbol: string;
70
+ decimals: number;
71
+ };
67
72
  };
68
73
  /**
69
74
  * Gets details of given crypto asset
@@ -122,6 +127,10 @@ export declare function getAsset(key: keyof typeof ASSETS): {
122
127
  name: string;
123
128
  symbol: string;
124
129
  decimals: number;
130
+ } | {
131
+ name: string;
132
+ symbol: string;
133
+ decimals: number;
125
134
  };
126
135
  /**
127
136
  * Checks if given crypto asset is Bitcoin-like
@@ -141,5 +150,11 @@ export declare function isUsdLikeCryptoAsset(key: string): boolean;
141
150
  * @returns True if crypto asset is T token
142
151
  */
143
152
  export declare function isTTokenCryptoAsset(key: string): boolean;
153
+ /**
154
+ * Checks if given crypto asset is MEZO token
155
+ * @param key The key of crypto asset
156
+ * @returns True if crypto asset is MEZO token
157
+ */
158
+ export declare function isMezoCryptoAsset(key: string): boolean;
144
159
  export {};
145
160
  //# sourceMappingURL=assets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../src/utils/assets.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkEX,CAAA;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,OAAO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEhD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,WAEnD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,WAE/C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,WAE9C"}
1
+ {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../src/utils/assets.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuEX,CAAA;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,OAAO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEhD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,WAEnD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,WAE/C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,WAE9C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,WAE5C"}
@@ -64,6 +64,11 @@ const ASSETS = {
64
64
  symbol: "mxSolvBTC",
65
65
  decimals: 18,
66
66
  },
67
+ MEZO: {
68
+ name: "MEZO",
69
+ symbol: "MEZO",
70
+ decimals: 18,
71
+ },
67
72
  };
68
73
  /**
69
74
  * Gets details of given crypto asset
@@ -97,4 +102,12 @@ export function isUsdLikeCryptoAsset(key) {
97
102
  export function isTTokenCryptoAsset(key) {
98
103
  return /^(mt|t)$/i.test(key);
99
104
  }
105
+ /**
106
+ * Checks if given crypto asset is MEZO token
107
+ * @param key The key of crypto asset
108
+ * @returns True if crypto asset is MEZO token
109
+ */
110
+ export function isMezoCryptoAsset(key) {
111
+ return /^mezo$/i.test(key);
112
+ }
100
113
  //# sourceMappingURL=assets.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"assets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AAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,OAAO,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC5B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mezo-org/passport",
3
- "version": "0.16.1",
3
+ "version": "0.17.0",
4
4
  "main": "dist/src/index.js",
5
5
  "license": "GPL-3.0-only",
6
6
  "scripts": {
@@ -67,19 +67,28 @@ type ListingItemProps = {
67
67
  icon?: ReactNode
68
68
  label?: string
69
69
  subLabel?: string
70
- value?: number
71
- subValue?: number
70
+ value?: number | string
71
+ valueFormatter?: (value: number | string) => string
72
+ subValue?: number | string
73
+ subValueFormatter?: (value: number | string) => string
72
74
  overrides?: BlockProps["overrides"]
73
75
  isLoading?: boolean
74
76
  }
75
77
 
78
+ const defaultValueFormatter = (value: number | string): string => {
79
+ if (typeof value === "string") return value
80
+ return formatUsd(value)
81
+ }
82
+
76
83
  export default function ListingItem(props: ListingItemProps) {
77
84
  const {
78
85
  icon,
79
86
  label,
80
87
  subLabel,
81
88
  value,
89
+ valueFormatter = defaultValueFormatter,
82
90
  subValue,
91
+ subValueFormatter = defaultValueFormatter,
83
92
  overrides,
84
93
  isLoading = false,
85
94
  } = props
@@ -155,7 +164,11 @@ export default function ListingItem(props: ListingItemProps) {
155
164
  value={
156
165
  value !== undefined && (
157
166
  <LabelMedium>
158
- <SlotNumber formatFunction={formatUsd}>{value}</SlotNumber>
167
+ {typeof value === "number" ? (
168
+ <SlotNumber formatFunction={valueFormatter}>{value}</SlotNumber>
169
+ ) : (
170
+ valueFormatter(value)
171
+ )}
159
172
  </LabelMedium>
160
173
  )
161
174
  }
@@ -166,7 +179,13 @@ export default function ListingItem(props: ListingItemProps) {
166
179
  as="div"
167
180
  color={theme.colors.contentSecondary}
168
181
  >
169
- <SlotNumber formatFunction={formatUsd}>{subValue}</SlotNumber>
182
+ {typeof subValue === "number" ? (
183
+ <SlotNumber formatFunction={subValueFormatter}>
184
+ {subValue}
185
+ </SlotNumber>
186
+ ) : (
187
+ subValueFormatter(subValue)
188
+ )}
170
189
  </ParagraphSmall>
171
190
  )
172
191
  }
@@ -0,0 +1,55 @@
1
+ import React from "react"
2
+ import { BlockProps, MezoCircle, useStyletron } from "@mezo-org/mezo-clay"
3
+ import ListingItem from "../ListingItem"
4
+ import { getAsset } from "../../../utils/assets"
5
+ import { useTokensBalances } from "../../../hooks/useTokensBalances"
6
+ import { formatNumberToCompactString } from "../../../utils/numbers"
7
+
8
+ export default function AccountMezoListing(
9
+ props: Omit<BlockProps, "children">,
10
+ ) {
11
+ const [, theme] = useStyletron()
12
+ const {
13
+ data: tokensBalancesData,
14
+ isError: isTokensBalancesError,
15
+ isPending: isTokensBalancesPending,
16
+ } = useTokensBalances()
17
+
18
+ if (isTokensBalancesPending) {
19
+ return <ListingItem isLoading />
20
+ }
21
+
22
+ if (isTokensBalancesError) {
23
+ // TODO: allow to display error state for MEZO balance after MEZO asset is public
24
+ return null // <AccountError topic="MEZO balance" />
25
+ }
26
+
27
+ const mezoBalance = Number(tokensBalancesData.MEZO.formatted)
28
+
29
+ if (mezoBalance === 0) {
30
+ return null
31
+ }
32
+
33
+ return (
34
+ <ListingItem
35
+ icon={
36
+ <MezoCircle
37
+ color={theme.colors.accent}
38
+ symbolColor={theme.colors.white}
39
+ />
40
+ }
41
+ label={getAsset("MEZO").name}
42
+ // TODO: example MEZO asset item - update after MEZO asset has price oracle
43
+ // value="N/A"
44
+ // valueFormatter={() => "N/A"}
45
+ // subLabel="Balance"
46
+ // subValue={mezoBalance}
47
+ // subValueFormatter={() => formatNumberToCompactString(mezoBalance)}
48
+ value={mezoBalance}
49
+ valueFormatter={(value: number | string) =>
50
+ formatNumberToCompactString(Number(value))
51
+ }
52
+ {...props}
53
+ />
54
+ )
55
+ }