Skip to content

meta.costUnits -- Expected a number, but received: null #3756

@MaximusMcCann

Description

@MaximusMcCann

Overview

v1.98.4

connection.getTransaction throwing errors b/c Helius RPC returns a "null" for costUnits: optional(number()),

Steps to reproduce

Description of bug

connection.getTransaction throwing errors b/c Helius RPC returns a "null" for costUnits instead of a number.

Would expect to allow anull for this field:

Presuming the fix is:


1097:   costUnits?: number | null;

1130:   costUnits?: number | null;

2376:   costUnits: optional(nullable((number())),

2402:   costUnits: optional(nullable(number())),

Thrown error

 error: StructError: At path: meta.costUnits -- Expected a number, but received: null
          at validate (..../node_modules/superstruct/src/struct.ts:198:19)
          at Object.create (..../node_modules/superstruct/src/struct.ts:144:18)
          at ..../node_modules/@solana/web3.js/src/connection.ts:437:17
          at Struct.coercer (..../node_modules/superstruct/src/structs/coercions.ts:25:26)
          at run (..../node_modules/superstruct/src/utils.ts:145:20)
          at run.next (<anonymous>)
          at shiftIterator (..../node_modules/superstruct/src/utils.ts:59:33)
          at validate (..../node_modules/superstruct/src/struct.ts:195:17)
          at Object.create (..../node_modules/superstruct/src/struct.ts:144:18)
          at Connection.getTransaction (..../node_modules/@solana/web3.js/src/connection.ts:5075:17)
          at processTicksAndRejections (node:internal/process/task_queues:105:5)
          at async fetchTransactionWithRetry (..../src/utils/solanaServerHelpers.ts:77:19)
          at async getSolanaTrxInfo (..../src/utils/solanaServerHelpers.ts:137:19)
          at async Object.<anonymous> (..../src/utils/solanaServerHelpers.test.ts:57:7) {
        value: null,
        type: 'number',
        refinement: undefined,
        key: 'costUnits',
        path: [ 'meta', 'costUnits' ],
        branch: [ [Object], [Object], null ],
        failures: [Function (anonymous)]
      }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions