I want to enter a Vec as input But i can't do that i don't know what is wrong !
1 Answer
Normally you would pass a JS array of strings that represent valid pubkeys, like:
["HXia2kfw8codMQTgDRCqMaDmVpY76aJqwzmGLFsFRfsW", "BMAJg8NEpetxXAihDXMXqxpYcU7Pn6g2rLh9uCfJHsvs"]
And this works fine if you change the type in the instruction from vector
to array
. So I tend to think that it not accepting the same for Vec<Pubkey>
might be a bug in the Solana Playground.
If you're running the local version of the playground, if you modify this line to this.parse(el, innerType as IdlType, idl)
it will accept an array of pubkeys as string as you would normally expect.
-
but we must use "Vec<publicKey>" due to security reasons! Commented Sep 3, 2023 at 12:14
-
Not suggesting you shouldn't use "Vec<publicKey>". There are a lot of ways you can test the instruction that will work with "Vec<publicKey>"– SerbanCommented Sep 3, 2023 at 12:24
-
yes you are right i am newbie to solana (i was evm developer) i should try an other way thx. Commented Sep 4, 2023 at 7:35