Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bankSend assumes the validator account is only possible sender #187

Open
anilhelvaci opened this issue Oct 30, 2024 · 0 comments · May be fixed by #189
Open

bankSend assumes the validator account is only possible sender #187

anilhelvaci opened this issue Oct 30, 2024 · 0 comments · May be fixed by #189

Comments

@anilhelvaci
Copy link
Contributor

Problem Definition

Current bankSend only uses the validator account as its from account. There might be situations where an account other than the validator is needed to be the sender.

export const bankSend = (addr: string, wanted: string) => {
const chain = ['--chain-id', CHAINID];
const from = ['--from', VALIDATORADDR];
const testKeyring = ['--keyring-backend', 'test'];
const noise = [...from, ...chain, ...testKeyring, '--yes'];
return agd.tx('bank', 'send', VALIDATORADDR, addr, wanted, ...noise);
};

Solution

In order not to break any existing code, I suggest an implementation like below:

export const bankSend = (addr, wanted, from = VALIDATORADDR) => {
  const chain = ['--chain-id', CHAINID];
  const fromArg = ['--from', from];
  const testKeyring = ['--keyring-backend', 'test'];
  const noise = [...fromArg, ...chain, ...testKeyring, '--yes'];

  return agd.tx('bank', 'send', from, addr, wanted, ...noise);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant