How to use `eosjs` with multiple dynamic keys provider
My case, when an account call my action in my contract they will provide keyProvider then I must re-create eosjs with new keyProvider.
Do we have another way to solve it ? 🙇
Pass a function: keyProvider = () => dynamicKeys
@jcalfee same problem for me, would you please tell how to do that? or is there an example available? thanks so much!
See configuration keyProvider..
If a function is provided, this function is called for each transaction.
let userProvidedKey = null
eos = Eos({keyProvider: ()=> userProviderKey})
// set the key
userProvidedKey=privateKey1
await eos.someAction('user' ..)
// change the key
userProvidedKey=privateKey2
await eos.someAction('user2' ..)
I could add a feature and accept the keyProvider here too:
// proposed, does not work
await eos.someAction('user2' .., {keyProvider: privateKey2})
The proposed change does not leave the variable userProvidedKey layout around..
@jcalfee great job, I'am so appreciate that and will follow this guide. thank you very much!
@jcalfee so appreciate! but maybe there is a spell mistake in 'userProviderKey/userProvidedKey'
Where is the spelling mistake?
Pass a function:
keyProvider = () => dynamicKeys
How can I do it in eosjs@beta ?
Scatter use new Proxy class for inject custom keyprovider.
Also you can use iteratible object with multiple keys for JsSignatureProvider