fix(@wallet): pre-populate token details

fixes #5024
This commit is contained in:
Anthony Laibe 2022-03-11 15:05:36 +01:00 committed by Anthony Laibe
parent 0908b13ad5
commit d1d56c9ea8
2 changed files with 4 additions and 3 deletions

View File

@ -23,7 +23,7 @@ const getTokenDetailsTask*: Task = proc(argEncoded: string) {.gcsafe, nimcall.}
"address": arg.address, "address": arg.address,
"name": tkn.tokenName(), "name": tkn.tokenName(),
"symbol": tkn.tokenSymbol(), "symbol": tkn.tokenSymbol(),
"decimals": (if decimals == 0: "" else: $decimals) "decimals": $decimals
} }
arg.finish(output) arg.finish(output)
except Exception as e: except Exception as e:

View File

@ -17,6 +17,7 @@ StatusModal {
property int marginBetweenInputs: 35 property int marginBetweenInputs: 35
property string validationError: "" property string validationError: ""
property WalletStore walletStore property WalletStore walletStore
property int mainnetChainID: 1
header.title: editable ? header.title: editable ?
//% "Add custom token" //% "Add custom token"
@ -41,7 +42,7 @@ StatusModal {
open(); open();
} }
function openWithData(address, name, symbol, decimals){ function openWithData(chainId, address, name, symbol, decimals){
addressInput.text = address; addressInput.text = address;
nameInput.text = name; nameInput.text = name;
symbolInput.text = symbol; symbolInput.text = symbol;
@ -60,7 +61,7 @@ StatusModal {
} }
property var getTokenDetails: Backpressure.debounce(popup, 500, function (tokenAddress){ property var getTokenDetails: Backpressure.debounce(popup, 500, function (tokenAddress){
popup.walletStore.walletTokensModule.getTokenDetails(tokenAddress) popup.walletStore.walletTokensModule.getTokenDetails(mainnetChainID, tokenAddress)
}); });
function onKeyReleased(){ function onKeyReleased(){