alpha-wallet-ios
alpha-wallet-ios copied to clipboard
Add guidelines as how to add custom locked token to the app
Hi,
I hope you guys are doing well. I wanted to get information on how to add a locked token on the home screen in the iOS app. I was able find the criteria of the android version on GitHub but no references as to how to do it in the iOS version. Your help is appreciated.
Thanks in advance.
@iamsaad333 Hi! Do you mean add it so the token appears in the Wallet tab by default? If so, you can add it to the list at https://github.com/AlphaWallet/alpha-wallet-ios/blob/master/AlphaWallet/Core/TokensAutodetector/ImportToken.swift#L14.
There's a better place to add it in TokensAutodetector.swift, but unfortunately that needs a bit cleaning up, so ImportToken.swift is the place to be now.
Allow me to demonstrate. I want to add a custom token to the app which will show along the Etherem token by default as shown in the attached screenshot. I was able to achieve this in the Android app by following the guide lines for AlphaWallet Android(Screenshot attached).

Ah, right yes, the instruction in https://github.com/AlphaWallet/alpha-wallet-ios/issues/4988#issuecomment-1185177462 works for what you want with a caveat, it will display the token only if the balance is non-zero.
Thanks for pointing out the concerned class but the question remains that what will be the Syntax to achieve the desired outcome. Like in this case of the Android App it is clearly written that if I add
private static final List<TokenInfo> lockedTokens = Arrays.asList( // new TokenInfo(String TokenAddress, String TokenName, String TokenSymbol, int TokenDecimals, boolean isEnabled, long ChainId) new TokenInfo("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "USD Coin", "USDC", 6, true, EthereumNetworkBase.MAINNET_ID) );
In the class CustomViewSettings then my Token will appear on the screen. In the same manner what code should I add into the class ImportToken.swift to achieve this??
Just to be clear, you want the token to appear in the Wallet tab automatically, right?
If so, this describes how to do it (but the token would only appear if there's a non-zero balance for that wallet): https://github.com/AlphaWallet/alpha-wallet-ios/issues/4988#issuecomment-1185177462
Sure, I get your point that the token will only show if there's a non zero balance but I still need the chunk of code that will make this happen. Only telling me the class name doesn't help.
No, I'm referring to this:
Hi! Do you mean add it so the token appears in the Wallet tab by default? If so, you can add it to the list at https://github.com/AlphaWallet/alpha-wallet-ios/blob/master/AlphaWallet/Core/TokensAutodetector/ImportToken.swift#L14