|
46 | 46 | import PasswordHelpers from "../../services/utility/PasswordHelpers"; |
47 | 47 | import RecipientField from '../reusable/RecipientField'; |
48 | 48 | import BalanceHelpers from "../../services/utility/BalanceHelpers"; |
| 49 | + import SingularAccounts from "../../services/utility/SingularAccounts"; |
49 | 50 |
|
50 | 51 | const STATES = { |
51 | 52 | TEXT:'text', |
|
114 | 115 | }, |
115 | 116 | hasMemo(){ |
116 | 117 | return this.token.blockchain === Blockchains.EOSIO; |
| 118 | + }, |
| 119 | + fioAccount(){ |
| 120 | + return this.scatter.keychain.accounts.find(x => x.network().blockchain === Blockchains.FIO); |
117 | 121 | } |
118 | 122 | }, |
119 | 123 | methods:{ |
|
140 | 144 |
|
141 | 145 | let recipient = this.contact ? this.contact.recipient : this.recipient; |
142 | 146 |
|
143 | | - if(recipient.indexOf('@') > -1){ |
| 147 | + if(this.fioAccount && recipient.indexOf('@') > -1){ |
144 | 148 | // FIO name |
145 | 149 | const fioPlugin = PluginRepository.plugin(Blockchains.FIO); |
146 | 150 | if(!fioPlugin.isValidRecipient(recipient)) |
|
152 | 156 |
|
153 | 157 | if (!this.featureFlags.fioResolutions) return PopupService.push(Popups.snackbar("FIO resolutions are currently disabled, please use an address directly.")); |
154 | 158 |
|
155 | | - const fioRecipient = await fioPlugin.recipientToSendable(this.token.network(), recipient, this.token.blockchain, this.token.symbol, address => { |
156 | | - if (address === 0) return null; |
157 | | - // Maybe some wallets do `account@permission`, just in case |
158 | | - if (address.indexOf('@')) return address.split('@')[0]; |
159 | | - return address; |
160 | | - }).catch(() => null); |
| 159 | + const getFioRecipient = (symbol) => { |
| 160 | + return fioPlugin.recipientToSendable(this.fioAccount.network(), recipient, this.token.blockchain, symbol, address => { |
| 161 | + if (address === 0) return null; |
| 162 | + // Maybe some wallets do `account@permission`, just in case |
| 163 | + if (address.indexOf('@')) return address.split('@')[0]; |
| 164 | + return address; |
| 165 | + }).catch(() => null) |
| 166 | + } |
| 167 | +
|
| 168 | + const fioRecipient = (await getFioRecipient(this.token.symbol) || await getFioRecipient(this.token.network().systemToken().symbol)); |
161 | 169 |
|
162 | 170 | if (!fioRecipient) return PopupService.push(Popups.snackbar(`The identity you entered does not exist, or does not accept these tokens.`)); |
163 | 171 | recipient = fioRecipient; |
|
0 commit comments