-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a new function to filter hidden assets and uses it for issued as…
…sets
- Loading branch information
Showing
2 changed files
with
22 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1,9 +1,25 @@ | ||
import { Asset } from 'stellar-base'; | ||
|
||
const MYKOBO_EURC = new Asset('EURC', 'GAQRF3UGHBT6JYQZ7YSUYCIYWAF4T2SAA5237Q5LIQYJOHHFAWDXZ7NM'); | ||
const HIDDEN_SPACEWALK_ASSETS = [MYKOBO_EURC]; | ||
|
||
export function prioritizeXLMAsset(assets?: Asset[]): Asset[] { | ||
if (!assets) { | ||
return []; | ||
} | ||
|
||
return assets.sort((a, b) => (a.code === 'XLM' ? -1 : b.code === 'XLM' ? 1 : 0)); | ||
} | ||
|
||
// Filter out hardcoded hidden assets | ||
export function filterHiddenAssets(assets?: Asset[]): Asset[] { | ||
if (!assets) { | ||
return []; | ||
} | ||
|
||
return assets.filter((asset) => { | ||
const isHidden = Boolean(HIDDEN_SPACEWALK_ASSETS.find((hidden) => hidden.equals(asset))); | ||
console.log('isHidden', isHidden, 'asset', asset); | ||
return !isHidden; | ||
}); | ||
} |