Closed bitcoinwarrior1 closed 3 weeks ago
function writeInt64(buffer, offset, value, littleEndian) {
if (offset + 8 > buffer.length) {
throw new Error("Offset is outside the bounds of Uint8Array");
}
if (value > 0x7fffffffffffffffn || value < -0x8000000000000000n) {
throw new Error(`The value of "value" is out of range. It must be >= ${-0x8000000000000000n} and <= ${0x7fffffffffffffffn}. Received ${value}`);
}
littleEndian = littleEndian.toUpperCase();
const buf = Buffer.alloc(8);
if (littleEndian === "LE") {
buf.writeBigInt64LE(value, 0);
}
else {
buf.writeBigInt64BE(value, 0);
}
buffer.set(Uint8Array.from(buf), offset);
return offset + 8;
}
it seems there's an error here. Can i have your detialed information about running environment?
Your node version or bundler is very old.
uint8array-tools has an explicitly designated browser version that your bundler is ignoring, instead it is trying to use the NodeJS version and transpile it into the browser.
if you can create a dummy repository with a minimal example using a modern bundler on its latest version we can try to fix it. (It might be a bug in the bundler)
if you are using an old version of an old bundler, try updating to the latest version
Thank you, @junderw & @jasonandjay, for your replies. I tried the script in node.js, and it works. It looks like the bundler was the issue.
Hi guys, thank you so much for creating this library!
I am trying to create a taproot script that allows a user to spend funds by providing a message and signature.
After generating the taproot address and sending funds, I tried to spend the input by providing the
tapLeafScript
using thehashLockScript
variable from above.The
hashLockScript
variable causes the error. The error does not occur if I use theoutput
variable. Both areUint8Array
sSince the code runs on the client side, I imported the buffer module to resolve the issue, but it persists.
const Buffer = require('buffer/').Buffer;
Any idea what I could be doing wrong? Thank you for your time.