Skip to content

Project 9 - TypeError: Cannot read properties of null (reading 'gatewayUri') #43

@tuncatunc

Description

@tuncatunc

Hi All Solana Bootcamp 2024 participants.

I made to Project 9 and it's complex and there are much reward for those who're patient.

when building sb commit ix, it throws gatewayUri error.

Anyone has this problem?

Thank you!

PS: run setup and start validator script a few minutes ago.

    let sbCommitIx = await randomness.commitIx(queue); <----- TypeError: Cannot read properties of null (reading 'gatewayUri')
it('Committing, Revealing and winner', async () => {

    const queue = new anchor.web3.PublicKey("A43DyUGA7s8eXPxqEjJY6EBu1KKbNgfxF8h17VAHn13w")
    console.log(`Queue account`, queue.toBase58());

    const queueAccount = new sb.Queue(switchBoardProgram, queue);
    console.log(`Queue account`, queueAccount.pubkey.toBase58());

    try {
      console.log(`Loading queue account`);
      await queueAccount.loadData();
      console.log(`Queue account loaded
      Queue account: ${queueAccount.pubkey.toBase58()}
      Queue account data: ${queueAccount.program}
      `);
    } catch (error) {
      console.log(`Switchboard queue load error`, error);
      process.exit(1);
    }

    const [randomness, createRandomnessIx] = await sb.Randomness.create(switchBoardProgram, rndKp, queue);
    console.log("Created a randomness account!")
    console.log(`Randomness account`, randomness.pubkey.toBase58());
    console.log(`Randomness Keypair`, rndKp.publicKey.toBase58());

    const createRandomnessTx = await sb.asV0Tx({
      connection: provider.connection,
      ixs: [createRandomnessIx],
      payer: payer.publicKey,
      signers: [rndKp, payer.payer],
      computeUnitPrice: 75_000,
      computeUnitLimitMultiple: 1.3,
    })

    const blockhashContext = await provider.connection.getLatestBlockhash();

    const createRandomnessSignature = await provider.connection.sendTransaction(createRandomnessTx);

    await provider.connection.confirmTransaction({
      signature: createRandomnessSignature,
      blockhash: blockhashContext.blockhash,
      lastValidBlockHeight: blockhashContext.lastValidBlockHeight,
    })

    console.log(
      "Transaction Signature for randomness account creation: ",
      createRandomnessSignature
    );

    console.log(`SB Commit Instruction build...`);
    let sbCommitIx = await randomness.commitIx(queue); <----- TypeError: Cannot read properties of null (reading 'gatewayUri')
    console.log(`...built`);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions