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

error integrating on-demand's randomness feature #1

Open
0xMukesh opened this issue Jul 22, 2024 · 0 comments
Open

error integrating on-demand's randomness feature #1

0xMukesh opened this issue Jul 22, 2024 · 0 comments

Comments

@0xMukesh
Copy link

0xMukesh commented Jul 22, 2024

hey there! i'm trying to integrate switchboard on-demand's randomness feature into my program. however, i'm encountering a strange error while running tests using the SDK, and i'm unsure how to resolve it.

the error message is as follows:

SyntaxError: Named export 'BN' not found. The requested module '@coral-xyz/anchor-30' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@coral-xyz/anchor-30';
const { BN, BorshAccountsCoder, utils } = pkg;

 ❯ tests/blet.test.ts:2:31
      1| import * as anchor from "@coral-xyz/anchor";
      2| import { AnchorUtils, Randomness, Queue } from "@switchboard-xyz/on-demand";
       |                               ^
      3| import { AnchorError, Program } from "@coral-xyz/anchor";
      4| import {

environment

  1. testing framework - vitest
  2. tsconfig - tsconfig.json
  3. version of @switchboard-xyz/on-demand - v1.1.39 (latest)
  4. node.js version - v22.3.0
  5. package manager - pnpm v9.4.0

additional context

i think it's an issue related to how the package is bundled for CJS and ESM versions. any suggestions on how to resolve this would be greatly appreciated. thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant