Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

sample usage assertion error #12

Description

@dev-dantealighieri

hi, getSampledUsage function was working normally, but nowadays i only get assertion error from it.

What might be the reason, is there way that i can solve this? if not, what default values that i can use for Uint128 cpu and net values that returns from sample usage method that is used for cpu and net price calculations.

if none of these works, is there any other way that i can get cpuPrice, netPrice of the current state?

    const eosResources = new Resources({
      api: apiClient,
    });

    const powerup = await eosResources.v1.powerup.get_state();

    let sampleUsage: SampleUsage;
    try {
      sampleUsage = await eosResources.getSampledUsage();
    } catch (error) {
      sampleUsage = defaultSampleUsage();
    }
error: Assertion failed
stack: 'Error: Assertion failed\n    at assert (/Users/dante/Documents/Codes/eos/node_modules/bn.js/lib/bn.js:6:21)\n    at BN.divmod (/Users/dante/Documents/Codes/eos/node_modules/bn.js/lib/bn.js:2342:5)\n    at BN.div (/Users/dante/Documents/Codes/eos/node_modules/bn.js/lib/bn.js:2438:17)\n    at divCeil (/Users/dante/Documents/Codes/eos/node_modules/@wharfkit/resources/src/index.ts:80:21)\n    at Resources.<anonymous> (/Users/dante/Documents/Codes/eos/node_modules/@wharfkit/resources/src/index.ts:73:18)\n    at Generator.next (<anonymous>)\n    at fulfilled (/Users/dante/Documents/Codes/eos/node_modules/@wharfkit/resources/node_modules/tslib/tslib.js:166:62)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)'

thanks, dante

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions