@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
@@ -42,7 +42,7 @@ export default function AccountOtherAssets(props: AccountOtherAssetsProps) {
42
42
  }
43
43
 
44
44
  const otherAssets = Object.values(tokensBalancesData)
45
- .filter((asset) => !["BTC", "MUSD"].includes(asset.symbol))
45
+ .filter((asset) => !["BTC", "MUSD", "MEZO"].includes(asset.symbol))
46
46
  .filter((asset) => asset.value > 0n)
47
47
 
48
48
  const assetsCount = otherAssets.length
@@ -15,6 +15,7 @@ import AccountAddressActions from "./AccountAddressActions"
15
15
  import AccountOtherAssets from "./AccountOtherAssets"
16
16
  import AccountBtcListing from "./AccountBtcListing"
17
17
  import AccountMusdListing from "./AccountMusdListing"
18
+ import AccountMezoListing from "./AccountMezoListing"
18
19
  import useDropdownStore, { DropdownView } from "../../../stores/dropdownStore"
19
20
 
20
21
  type RootProps = {
@@ -69,6 +70,8 @@ export default function Root(props: RootProps) {
69
70
 
70
71
  <AccountMusdListing />
71
72
 
73
+ <AccountMezoListing />
74
+
72
75
  <AccountOtherAssets
73
76
  onClick={onOtherAssetsClick}
74
77
  overrides={overridesWithDivider}
@@ -18,6 +18,7 @@ import {
18
18
  getAsset,
19
19
  isBitcoinLikeCryptoAsset,
20
20
  isTTokenCryptoAsset,
21
+ isMezoCryptoAsset,
21
22
  } from "../utils/assets"
22
23
  import { convertToUsd } from "../utils/currency"
23
24
  import { CHAIN_ID, mezoMainnet, mezoTestnet } from "../constants"
@@ -54,6 +55,8 @@ export const BALANCE_OF_ABI = [
54
55
  ] as const satisfies Abi
55
56
 
56
57
  const BALANCE_TOKENS: MezoChainToken[] = [
58
+ "MEZO",
59
+ "MUSD",
57
60
  "mcbBTC",
58
61
  "mDAI",
59
62
  "mFBTC",
@@ -64,7 +67,6 @@ const BALANCE_TOKENS: MezoChainToken[] = [
64
67
  "mUSDe",
65
68
  "mUSDT",
66
69
  "mxSolvBTC",
67
- "MUSD",
68
70
  ]
69
71
 
70
72
  type UseMezoChainTokensBalancesOptions<T extends MezoChainToken[]> = {
@@ -219,6 +221,13 @@ export function useTokensBalances<T extends MezoChainToken[]>(
219
221
  conversion.decimals,
220
222
  )
221
223
  }
224
+ // TODO: Provide MEZO oracle to get accurate token price
225
+ if (isMezoCryptoAsset(tokenBalance.symbol)) {
226
+ usd = {
227
+ value: 0n,
228
+ formatted: "0",
229
+ }
230
+ }
222
231
 
223
232
  return { ...tokenBalance, usd }
224
233
  })
@@ -69,6 +69,7 @@ function useWatchTransferEventsForAllTokens() {
69
69
  useWatchTransferEvents("mUSDT")
70
70
  useWatchTransferEvents("mxSolvBTC")
71
71
  useWatchTransferEvents("MUSD")
72
+ useWatchTransferEvents("MEZO")
72
73
  }
73
74
 
74
75
  export { useWatchTransferEvents, useWatchTransferEventsForAllTokens }
@@ -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
+ }
@@ -29,6 +29,7 @@ import priceFeed from "@mezo-org/musd-contracts/deployments/mainnet/PriceFeed.js
29
29
  import priceFeedTestnet from "@mezo-org/musd-contracts/deployments/matsnet/PriceFeed.json"
30
30
 
31
31
  import { Abi, Address } from "viem"
32
+ import mezoArtifact from "./artifacts/MEZO.json"
32
33
 
33
34
  export type MezoChainToken =
34
35
  | "mcbBTC"
@@ -42,6 +43,7 @@ export type MezoChainToken =
42
43
  | "mUSDT"
43
44
  | "mxSolvBTC"
44
45
  | "MUSD"
46
+ | "MEZO"
45
47
 
46
48
  export type MezoBorrowContract =
47
49
  | "TroveManager"
@@ -68,6 +70,7 @@ export const testnetTokenContracts = {
68
70
  mUSDT: usdtTestnet,
69
71
  mxSolvBTC: xsolvbtcTestnet,
70
72
  MUSD: musdTestnet,
73
+ MEZO: mezoArtifact,
71
74
  } as unknown as ContractsMap<MezoChainToken>
72
75
 
73
76
  export const mainnetTokenContracts = {
@@ -82,6 +85,7 @@ export const mainnetTokenContracts = {
82
85
  mUSDT: usdtMainnet,
83
86
  mxSolvBTC: xsolvbtcMainnet,
84
87
  MUSD: musdMainnet,
88
+ MEZO: mezoArtifact,
85
89
  } as unknown as ContractsMap<MezoChainToken>
86
90
 
87
91
  export const mainnetBorrowContracts = {
@@ -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
  /**
@@ -101,3 +106,12 @@ export function isUsdLikeCryptoAsset(key: string) {
101
106
  export function isTTokenCryptoAsset(key: string) {
102
107
  return /^(mt|t)$/i.test(key)
103
108
  }
109
+
110
+ /**
111
+ * Checks if given crypto asset is MEZO token
112
+ * @param key The key of crypto asset
113
+ * @returns True if crypto asset is MEZO token
114
+ */
115
+ export function isMezoCryptoAsset(key: string) {
116
+ return /^mezo$/i.test(key)
117
+ }