helius-labs / helius-sdk

138 stars 40 forks source link

requestAirdrop throws a StructError from superstruct #17

Closed d-reader-josip closed 2 months ago

d-reader-josip commented 1 year ago

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',
);

image

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 1 year ago

Any updates on this issue? Haven't checked if it's still existing or not. Maybe with the node version downgrade things got fixed?

0xIchigo commented 2 months ago

gm @d-reader-josip! Just going through and cleaning up the issues here. Are you still encountering this issue? I'm not able to reproduce

d-reader-josip commented 2 months ago

I have no idea and at this point I'll get PTSD if I run my 15 months old code.

How about we turn a blind eye and pretend the issue doesn't exist until someone reopens it?