import type { IPowProvider } from "@iota/iota.js" ; import os from "os" ; import module from "../native/" ; /**
 * Neon POW Provider.
 */ export class NeonPowProvider implements IPowProvider { internal private readonly _numCpus : number ; param numCpus constructor ( numCpus ? ) { this . _numCpus = numCpus ?? os . cpus ( ) . length ; } param message param targetScore returns public async pow ( message , targetScore ) { const powRelevantData = message . slice ( 0 , - 8 ) ; const nonceArr = module . doPow ( powRelevantData . buffer , targetScore , this . _numCpus ) ; return ( BigInt ( nonceArr [ 0 ] ) | ( BigInt ( nonceArr [ 1 ] ) << BigInt ( 32 ) ) ) . toString ( ) ; } }