-
-
Notifications
You must be signed in to change notification settings - Fork 268
feat: update asset endpoints to include RWA data #7548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
031892f
feat: use rwa data in asset endpoints
oscarwroche bc5b11e
fix: remove null coalescing
oscarwroche ce035c1
chore: remove comment
oscarwroche 9be0dfe
refactor: put headers directly inside object
oscarwroche e0b237b
chore: update changelog
oscarwroche 160f440
fix: remove dead code
oscarwroche 3891eeb
Merge branch 'main' into feat/ondo-rwa-data
oscarwroche File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -457,6 +457,7 @@ export class TokensController extends BaseController< | |
| isERC721, | ||
| aggregators: formatAggregatorNames(tokenMetadata?.aggregators || []), | ||
| name, | ||
| ...(tokenMetadata?.rwaData && { rwaData: tokenMetadata.rwaData }), | ||
| }; | ||
| const previousIndex = newTokens.findIndex( | ||
| (token) => token.address.toLowerCase() === address.toLowerCase(), | ||
|
|
@@ -525,7 +526,7 @@ export class TokensController extends BaseController< | |
| }, {}); | ||
| try { | ||
| tokensToImport.forEach((tokenToAdd) => { | ||
| const { address, symbol, decimals, image, aggregators, name } = | ||
| const { address, symbol, decimals, image, aggregators, name, rwaData } = | ||
| tokenToAdd; | ||
| const checksumAddress = toChecksumHexAddress(address); | ||
| const formattedToken: Token = { | ||
|
|
@@ -535,6 +536,7 @@ export class TokensController extends BaseController< | |
| image, | ||
| aggregators, | ||
| name, | ||
| ...(rwaData && { rwaData }), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm okay so rwaData is also needed on the TokensController? Nice. |
||
| }; | ||
| newTokensMap[checksumAddress] = formattedToken; | ||
| importedTokensMap[address.toLowerCase()] = true; | ||
|
|
@@ -664,6 +666,7 @@ export class TokensController extends BaseController< | |
| aggregators, | ||
| isERC721, | ||
| name, | ||
| rwaData, | ||
| } = tokenToAdd; | ||
| const checksumAddress = toChecksumHexAddress(address); | ||
| const newEntry: Token = { | ||
|
|
@@ -674,6 +677,7 @@ export class TokensController extends BaseController< | |
| isERC721, | ||
| aggregators, | ||
| name, | ||
| ...(rwaData && { rwaData }), | ||
| }; | ||
|
|
||
| const previousImportedIndex = newTokens.findIndex( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ import type { NetworkState } from '@metamask/network-controller'; | |
| import { hexToBigInt, parseCaipAssetType } from '@metamask/utils'; | ||
| import type { Hex } from '@metamask/utils'; | ||
| import { createSelector, weakMapMemoize } from 'reselect'; | ||
| import { TokenRwaData } from 'src/token-service'; | ||
|
|
||
| import { | ||
| parseBalanceWithDecimals, | ||
|
|
@@ -84,6 +85,7 @@ export type Asset = ( | |
| conversionRate: number; | ||
| } | ||
| | undefined; | ||
| rwaData?: TokenRwaData; | ||
dawnseeker8 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
|
|
||
| export type AssetListState = { | ||
|
|
@@ -325,6 +327,7 @@ const selectAllEvmAssets = createAssetListSelector( | |
| } | ||
| : undefined, | ||
| chainId, | ||
| ...(token.rwaData && { rwaData: token.rwaData }), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay fair. |
||
| }); | ||
| } | ||
| } | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change will fix the lint complaining about
--prune-suppressionsparatmeter, but when we put that parameter to runyarn lintit still complain. the only way is to change the count here to pass the error, if your guys know some better way to fix this issue, i am happy to change it back here.