|
68 | 68 | <Button v-tooltip="`Copy public key`" icon="fal fa-copy" @click.native="copyPublicKey(key)" /> |
69 | 69 | <Button v-if="!key.external" v-tooltip="`Convert blockchains`" icon="fal fa-link" @click.native="convertKeypair(key)" /> |
70 | 70 | <Button v-if="detachedKey(key)" icon="fal fa-ban" v-tooltip="`Remove key`" @click.native="removeKey(key)" /> |
| 71 | + <Button v-if="canManuallyLink(key)" icon="fal fa-user" v-tooltip="`Manually link account`" @click.native="manuallyLinkAccount(key)" /> |
71 | 72 | <Button primary="1" v-if="!key.external" text="Export" icon="fal fa-key" @click.native="exportKey(key)" /> |
72 | 73 | </section> |
73 | 74 |
|
|
264 | 265 | if(converted) PopupService.push(Popups.snackbar("Conversion successful. Check the network for the corresponding blockchain.")) |
265 | 266 | })); |
266 | 267 | }, |
| 268 | + canManuallyLink(keypair){ |
| 269 | + return keypair.blockchains[0] === 'eos'; |
| 270 | + }, |
| 271 | + async manuallyLinkAccount(keypair){ |
| 272 | + const blockchain = keypair.blockchains[0]; |
| 273 | + const networks = this.scatter.settings.networks.filter(x => x.blockchain === blockchain); |
| 274 | + PopupService.push(Popups.selectList('Select a <span>Network</span>', 'Select the type of blockchain you want to either create or import a key for.', networks, x => { |
| 275 | + return x.name; |
| 276 | + }, async network => { |
| 277 | + if(!network) return; |
| 278 | + PopupService.push(Popups.getInput('Manually Link Account', 'If you link an account that does not actually belong to this key, you will not be able to sign anything.', 'account name', 'What is the account name?', async name => { |
| 279 | + if(!name || !name.length) return; |
| 280 | + let [account_name, permission] = name.split('@'); |
| 281 | + if(!permission || !permission.length) permission = 'active'; |
| 282 | +
|
| 283 | + const account = Account.fromJson({ |
| 284 | + keypairUnique: keypair.unique(), |
| 285 | + networkUnique: network.unique(), |
| 286 | + name:account_name, |
| 287 | + authority:permission, |
| 288 | + publicKey: keypair.publicKeys.find(x => x.blockchain === blockchain).key |
| 289 | + }); |
| 290 | +
|
| 291 | + await AccountService.addAccount(account); |
| 292 | + SingularAccounts.setPredefinedAccount(network, account); |
| 293 | + BalanceService.loadBalancesFor(account); |
| 294 | + await SingularAccounts.refreshAccounts([network], [keypair]); |
| 295 | + this.closer(true); |
| 296 | + })) |
| 297 | + })); |
| 298 | +
|
| 299 | + }, |
267 | 300 | ...mapActions([ |
268 | 301 | Actions.SET_BALANCES, |
269 | 302 | Actions.REMOVE_BALANCES, |
|
0 commit comments