Skip to content

Commit

Permalink
Don't need to be quite so greedy with adding keys to the EOSManager's…
Browse files Browse the repository at this point in the history
… signature provider. It's entirely possible that we'll spin up a contract on an account we don't have keys for, and we don't need to blow up if this happens, we just need to provide an error when actually trying to execute the action and signing with that account.
  • Loading branch information
thekevinbrown committed May 21, 2019
1 parent 6fa65f4 commit 15adf32
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/eosManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,12 @@ export class EOSManager {
* @param account Account to be unioned into the signature list.
*/
static addSigningAccountIfMissing = (account: Account) => {
if (!account.publicKey || !account.privateKey) {
throw new Error(
`Provided account ${account.name} is missing a key and cannot be used for signing.`
);
}

// If the signature provider doesn't have it
if (!EOSManager.signatureProvider.keys.get(account.publicKey)) {
// If there are keys and signature provider doesn't have it, add it on in.
if (
account.publicKey &&
account.privateKey &&
!EOSManager.signatureProvider.keys.get(account.publicKey)
) {
const nonLegacyPublicKey = convertLegacyPublicKey(account.publicKey);
EOSManager.signatureProvider.keys.set(nonLegacyPublicKey, account.privateKey);
EOSManager.signatureProvider.availableKeys.push(nonLegacyPublicKey);
Expand Down

0 comments on commit 15adf32

Please sign in to comment.