requestAirdrop throws a StructError from superstruct
d-reader-josip opened this issue · 3 comments
d-reader-josip commented
Steps to reproduce
const endpoint = "https://rpc-devnet.helius.xyz/?api-key=<API_KEY>" // insert API key
const connection = new Connection(endpoint, 'confirmed');
const signature = await connection.requestAirdrop(
new PublicKey('<WALLET_ADDRESS>'), // insert some wallet address
1000000000, // 1 Solana
);
// Things broke down at this point but in case they start working it's nice to wait for transaction confirmation
const blockhashWithExpiryBlockHeight = await connection.getLatestBlockhash();
await connection.confirmTransaction(
{
signature: sign,
...blockhashWithExpiryBlockHeight,
},
'confirmed',
);
Issue happens in the create
and validate
functions from the superstruct
package
/**
* Create a value with the coercion logic of struct and validate it.
*/
export function create<T, S>(
value: unknown,
struct: Struct<T, S>,
message?: string
): T {
const result = validate(value, struct, { coerce: true, message })
if (result[0]) {
throw result[0]
} else {
return result[1]
}
}
d-reader-josip commented
Any updates on this issue? Haven't checked if it's still existing or not. Maybe with the node version downgrade things got fixed?