2014-11-20 07:52:32 -08:00
|
|
|
'use strict';
|
|
|
|
|
2014-11-21 07:54:56 -08:00
|
|
|
var BufferReader = require('./encoding/bufferreader');
|
|
|
|
var BufferWriter = require('./encoding/bufferwriter');
|
2014-09-01 15:45:03 -07:00
|
|
|
var Opcode = require('./opcode');
|
|
|
|
|
2014-11-27 12:10:35 -08:00
|
|
|
var Script = function Script(from) {
|
|
|
|
if (!(this instanceof Script)) {
|
|
|
|
return new Script(from);
|
|
|
|
}
|
|
|
|
|
2014-09-01 15:45:03 -07:00
|
|
|
this.chunks = [];
|
|
|
|
|
2014-11-27 12:10:35 -08:00
|
|
|
if (Buffer.isBuffer(from)) {
|
2014-11-27 13:30:16 -08:00
|
|
|
return Script.fromBuffer(from);
|
2014-11-27 12:10:35 -08:00
|
|
|
} else if (typeof from === 'string') {
|
2014-11-27 13:30:16 -08:00
|
|
|
return Script.fromString(from);
|
2014-11-27 12:10:35 -08:00
|
|
|
} else if (typeof from !== 'undefined') {
|
|
|
|
this.set(from);
|
2014-09-01 15:45:03 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Script.prototype.set = function(obj) {
|
|
|
|
this.chunks = obj.chunks || this.chunks;
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
2014-11-27 12:10:35 -08:00
|
|
|
Script.fromBuffer = function(buffer) {
|
|
|
|
var script = new Script();
|
|
|
|
script.chunks = [];
|
2014-09-18 17:52:02 -07:00
|
|
|
|
2014-11-27 12:10:35 -08:00
|
|
|
var br = new BufferReader(buffer);
|
2014-09-01 16:41:07 -07:00
|
|
|
while (!br.eof()) {
|
preserve claimed length and op code
When parsing OP_PUSHDATAX commands, the the length of data might not require
the size integer of OP_PUSHDATAX. For instance, you might write 1 byte, and yet
use OP_PUSHDATA4. We need to record which OP_PUSHDATAX was used so that when we
write the buffer back out, we can write the same one. Also, the claimed length
may be different. For instance, we may OP_PUSHDATA of length 100 to the stack,
but there may only be 50 bytes left in the script. In that case, buf.length and
chunk.len will be different. I'm not sure if that would be considered a valid
script, but in any case, for script analysis, we need both values.
2014-09-01 17:27:39 -07:00
|
|
|
var opcodenum = br.readUInt8();
|
2014-09-01 16:41:07 -07:00
|
|
|
|
preserve claimed length and op code
When parsing OP_PUSHDATAX commands, the the length of data might not require
the size integer of OP_PUSHDATAX. For instance, you might write 1 byte, and yet
use OP_PUSHDATA4. We need to record which OP_PUSHDATAX was used so that when we
write the buffer back out, we can write the same one. Also, the claimed length
may be different. For instance, we may OP_PUSHDATA of length 100 to the stack,
but there may only be 50 bytes left in the script. In that case, buf.length and
chunk.len will be different. I'm not sure if that would be considered a valid
script, but in any case, for script analysis, we need both values.
2014-09-01 17:27:39 -07:00
|
|
|
var len, buf;
|
|
|
|
if (opcodenum > 0 && opcodenum < Opcode.map.OP_PUSHDATA1) {
|
|
|
|
len = opcodenum;
|
2014-11-27 12:10:35 -08:00
|
|
|
script.chunks.push({
|
2014-09-17 15:49:45 -07:00
|
|
|
buf: br.read(len),
|
preserve claimed length and op code
When parsing OP_PUSHDATAX commands, the the length of data might not require
the size integer of OP_PUSHDATAX. For instance, you might write 1 byte, and yet
use OP_PUSHDATA4. We need to record which OP_PUSHDATAX was used so that when we
write the buffer back out, we can write the same one. Also, the claimed length
may be different. For instance, we may OP_PUSHDATA of length 100 to the stack,
but there may only be 50 bytes left in the script. In that case, buf.length and
chunk.len will be different. I'm not sure if that would be considered a valid
script, but in any case, for script analysis, we need both values.
2014-09-01 17:27:39 -07:00
|
|
|
len: len,
|
|
|
|
opcodenum: opcodenum
|
|
|
|
});
|
|
|
|
} else if (opcodenum === Opcode.map.OP_PUSHDATA1) {
|
2014-09-01 16:41:07 -07:00
|
|
|
len = br.readUInt8();
|
2014-11-27 12:10:35 -08:00
|
|
|
buf = br.read(len);
|
|
|
|
script.chunks.push({
|
preserve claimed length and op code
When parsing OP_PUSHDATAX commands, the the length of data might not require
the size integer of OP_PUSHDATAX. For instance, you might write 1 byte, and yet
use OP_PUSHDATA4. We need to record which OP_PUSHDATAX was used so that when we
write the buffer back out, we can write the same one. Also, the claimed length
may be different. For instance, we may OP_PUSHDATA of length 100 to the stack,
but there may only be 50 bytes left in the script. In that case, buf.length and
chunk.len will be different. I'm not sure if that would be considered a valid
script, but in any case, for script analysis, we need both values.
2014-09-01 17:27:39 -07:00
|
|
|
buf: buf,
|
|
|
|
len: len,
|
|
|
|
opcodenum: opcodenum
|
|
|
|
});
|
|
|
|
} else if (opcodenum === Opcode.map.OP_PUSHDATA2) {
|
2014-09-01 16:41:07 -07:00
|
|
|
len = br.readUInt16LE();
|
2014-09-17 15:49:45 -07:00
|
|
|
buf = br.read(len);
|
2014-11-27 12:10:35 -08:00
|
|
|
script.chunks.push({
|
preserve claimed length and op code
When parsing OP_PUSHDATAX commands, the the length of data might not require
the size integer of OP_PUSHDATAX. For instance, you might write 1 byte, and yet
use OP_PUSHDATA4. We need to record which OP_PUSHDATAX was used so that when we
write the buffer back out, we can write the same one. Also, the claimed length
may be different. For instance, we may OP_PUSHDATA of length 100 to the stack,
but there may only be 50 bytes left in the script. In that case, buf.length and
chunk.len will be different. I'm not sure if that would be considered a valid
script, but in any case, for script analysis, we need both values.
2014-09-01 17:27:39 -07:00
|
|
|
buf: buf,
|
|
|
|
len: len,
|
|
|
|
opcodenum: opcodenum
|
|
|
|
});
|
|
|
|
} else if (opcodenum === Opcode.map.OP_PUSHDATA4) {
|
2014-09-01 16:41:07 -07:00
|
|
|
len = br.readUInt32LE();
|
2014-09-17 15:49:45 -07:00
|
|
|
buf = br.read(len);
|
2014-11-27 12:10:35 -08:00
|
|
|
script.chunks.push({
|
preserve claimed length and op code
When parsing OP_PUSHDATAX commands, the the length of data might not require
the size integer of OP_PUSHDATAX. For instance, you might write 1 byte, and yet
use OP_PUSHDATA4. We need to record which OP_PUSHDATAX was used so that when we
write the buffer back out, we can write the same one. Also, the claimed length
may be different. For instance, we may OP_PUSHDATA of length 100 to the stack,
but there may only be 50 bytes left in the script. In that case, buf.length and
chunk.len will be different. I'm not sure if that would be considered a valid
script, but in any case, for script analysis, we need both values.
2014-09-01 17:27:39 -07:00
|
|
|
buf: buf,
|
|
|
|
len: len,
|
|
|
|
opcodenum: opcodenum
|
|
|
|
});
|
2014-09-01 16:41:07 -07:00
|
|
|
} else {
|
2014-11-27 12:10:35 -08:00
|
|
|
script.chunks.push(opcodenum);
|
2014-09-01 16:41:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-27 12:10:35 -08:00
|
|
|
return script;
|
2014-09-01 16:41:07 -07:00
|
|
|
};
|
|
|
|
|
preserve claimed length and op code
When parsing OP_PUSHDATAX commands, the the length of data might not require
the size integer of OP_PUSHDATAX. For instance, you might write 1 byte, and yet
use OP_PUSHDATA4. We need to record which OP_PUSHDATAX was used so that when we
write the buffer back out, we can write the same one. Also, the claimed length
may be different. For instance, we may OP_PUSHDATA of length 100 to the stack,
but there may only be 50 bytes left in the script. In that case, buf.length and
chunk.len will be different. I'm not sure if that would be considered a valid
script, but in any case, for script analysis, we need both values.
2014-09-01 17:27:39 -07:00
|
|
|
Script.prototype.toBuffer = function() {
|
|
|
|
var bw = new BufferWriter();
|
|
|
|
|
2014-09-01 18:01:17 -07:00
|
|
|
for (var i = 0; i < this.chunks.length; i++) {
|
|
|
|
var chunk = this.chunks[i];
|
2014-11-27 12:10:35 -08:00
|
|
|
var opcodenum;
|
2014-09-01 18:01:17 -07:00
|
|
|
if (typeof chunk === 'number') {
|
2014-11-27 12:10:35 -08:00
|
|
|
opcodenum = chunk;
|
2014-09-01 18:01:17 -07:00
|
|
|
bw.writeUInt8(opcodenum);
|
|
|
|
} else {
|
2014-11-27 12:10:35 -08:00
|
|
|
opcodenum = chunk.opcodenum;
|
2014-09-01 18:01:17 -07:00
|
|
|
bw.writeUInt8(chunk.opcodenum);
|
|
|
|
if (opcodenum < Opcode.map.OP_PUSHDATA1) {
|
|
|
|
bw.write(chunk.buf);
|
2014-11-27 12:10:35 -08:00
|
|
|
} else if (opcodenum === Opcode.map.OP_PUSHDATA1) {
|
2014-09-01 18:01:17 -07:00
|
|
|
bw.writeUInt8(chunk.len);
|
|
|
|
bw.write(chunk.buf);
|
2014-11-27 12:10:35 -08:00
|
|
|
} else if (opcodenum === Opcode.map.OP_PUSHDATA2) {
|
2014-09-01 18:01:17 -07:00
|
|
|
bw.writeUInt16LE(chunk.len);
|
|
|
|
bw.write(chunk.buf);
|
2014-11-27 12:10:35 -08:00
|
|
|
} else if (opcodenum === Opcode.map.OP_PUSHDATA4) {
|
2014-09-01 18:01:17 -07:00
|
|
|
bw.writeUInt32LE(chunk.len);
|
|
|
|
bw.write(chunk.buf);
|
preserve claimed length and op code
When parsing OP_PUSHDATAX commands, the the length of data might not require
the size integer of OP_PUSHDATAX. For instance, you might write 1 byte, and yet
use OP_PUSHDATA4. We need to record which OP_PUSHDATAX was used so that when we
write the buffer back out, we can write the same one. Also, the claimed length
may be different. For instance, we may OP_PUSHDATA of length 100 to the stack,
but there may only be 50 bytes left in the script. In that case, buf.length and
chunk.len will be different. I'm not sure if that would be considered a valid
script, but in any case, for script analysis, we need both values.
2014-09-01 17:27:39 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-01 18:01:17 -07:00
|
|
|
|
|
|
|
return bw.concat();
|
preserve claimed length and op code
When parsing OP_PUSHDATAX commands, the the length of data might not require
the size integer of OP_PUSHDATAX. For instance, you might write 1 byte, and yet
use OP_PUSHDATA4. We need to record which OP_PUSHDATAX was used so that when we
write the buffer back out, we can write the same one. Also, the claimed length
may be different. For instance, we may OP_PUSHDATA of length 100 to the stack,
but there may only be 50 bytes left in the script. In that case, buf.length and
chunk.len will be different. I'm not sure if that would be considered a valid
script, but in any case, for script analysis, we need both values.
2014-09-01 17:27:39 -07:00
|
|
|
};
|
|
|
|
|
2014-11-27 13:30:16 -08:00
|
|
|
Script.fromString = function(str) {
|
|
|
|
var script = new Script();
|
|
|
|
script.chunks = [];
|
2014-09-01 19:42:20 -07:00
|
|
|
|
|
|
|
var tokens = str.split(' ');
|
|
|
|
var i = 0;
|
|
|
|
while (i < tokens.length) {
|
|
|
|
var token = tokens[i];
|
|
|
|
var opcode = Opcode(token);
|
|
|
|
var opcodenum = opcode.toNumber();
|
|
|
|
|
|
|
|
if (typeof opcodenum === 'undefined') {
|
|
|
|
opcodenum = parseInt(token);
|
|
|
|
if (opcodenum > 0 && opcodenum < Opcode.map.OP_PUSHDATA1) {
|
2014-11-27 13:30:16 -08:00
|
|
|
script.chunks.push({
|
2014-09-01 19:42:20 -07:00
|
|
|
buf: new Buffer(tokens[i + 1].slice(2), 'hex'),
|
|
|
|
len: opcodenum,
|
|
|
|
opcodenum: opcodenum
|
|
|
|
});
|
|
|
|
i = i + 2;
|
2014-11-27 12:10:35 -08:00
|
|
|
} else {
|
2014-09-01 19:42:20 -07:00
|
|
|
throw new Error('Invalid script');
|
|
|
|
}
|
2014-11-28 06:48:06 -08:00
|
|
|
} else if (opcodenum === Opcode.map.OP_PUSHDATA1 ||
|
|
|
|
opcodenum === Opcode.map.OP_PUSHDATA2 ||
|
|
|
|
opcodenum === Opcode.map.OP_PUSHDATA4) {
|
2014-11-27 12:10:35 -08:00
|
|
|
if (tokens[i + 2].slice(0, 2) !== '0x') {
|
2014-09-19 21:59:19 -07:00
|
|
|
throw new Error('Pushdata data must start with 0x');
|
2014-11-27 12:10:35 -08:00
|
|
|
}
|
2014-11-27 13:30:16 -08:00
|
|
|
script.chunks.push({
|
2014-09-01 19:42:20 -07:00
|
|
|
buf: new Buffer(tokens[i + 2].slice(2), 'hex'),
|
|
|
|
len: parseInt(tokens[i + 1]),
|
|
|
|
opcodenum: opcodenum
|
|
|
|
});
|
|
|
|
i = i + 3;
|
|
|
|
} else {
|
2014-11-27 13:30:16 -08:00
|
|
|
script.chunks.push(opcodenum);
|
2014-09-01 19:42:20 -07:00
|
|
|
i = i + 1;
|
|
|
|
}
|
|
|
|
}
|
2014-11-27 13:30:16 -08:00
|
|
|
return script;
|
2014-09-01 19:42:20 -07:00
|
|
|
};
|
|
|
|
|
2014-09-01 18:31:02 -07:00
|
|
|
Script.prototype.toString = function() {
|
2014-11-27 12:10:35 -08:00
|
|
|
var str = '';
|
2014-09-01 18:31:02 -07:00
|
|
|
|
|
|
|
for (var i = 0; i < this.chunks.length; i++) {
|
|
|
|
var chunk = this.chunks[i];
|
2014-11-27 12:10:35 -08:00
|
|
|
var opcodenum;
|
2014-09-01 18:31:02 -07:00
|
|
|
if (typeof chunk === 'number') {
|
2014-11-27 12:10:35 -08:00
|
|
|
opcodenum = chunk;
|
|
|
|
str = str + Opcode(opcodenum).toString() + ' ';
|
2014-09-01 18:31:02 -07:00
|
|
|
} else {
|
2014-11-27 12:10:35 -08:00
|
|
|
opcodenum = chunk.opcodenum;
|
|
|
|
if (opcodenum === Opcode.map.OP_PUSHDATA1 ||
|
|
|
|
opcodenum === Opcode.map.OP_PUSHDATA2 ||
|
|
|
|
opcodenum === Opcode.map.OP_PUSHDATA4) {
|
|
|
|
str = str + Opcode(opcodenum).toString() + ' ';
|
|
|
|
}
|
|
|
|
str = str + chunk.len + ' ';
|
|
|
|
str = str + '0x' + chunk.buf.toString('hex') + ' ';
|
2014-09-01 18:31:02 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return str.substr(0, str.length - 1);
|
|
|
|
};
|
|
|
|
|
2014-09-19 21:59:19 -07:00
|
|
|
Script.prototype.isOpReturn = function() {
|
2014-11-28 06:45:42 -08:00
|
|
|
return (this.chunks[0] === Opcode('OP_RETURN').toNumber() &&
|
2014-11-27 12:10:35 -08:00
|
|
|
(this.chunks.length === 1 ||
|
2014-11-28 06:08:33 -08:00
|
|
|
(this.chunks.length === 2 &&
|
|
|
|
this.chunks[1].buf &&
|
|
|
|
this.chunks[1].buf.length <= 40 &&
|
2014-11-28 06:45:42 -08:00
|
|
|
this.chunks[1].length === this.chunks.len)));
|
2014-09-19 21:59:19 -07:00
|
|
|
};
|
|
|
|
|
2014-11-25 10:21:53 -08:00
|
|
|
Script.prototype.isPublicKeyHashOut = function() {
|
2014-11-28 06:45:42 -08:00
|
|
|
return this.chunks[0] === Opcode('OP_DUP').toNumber() &&
|
2014-11-28 06:08:33 -08:00
|
|
|
this.chunks[1] === Opcode('OP_HASH160').toNumber() &&
|
|
|
|
this.chunks[2].buf &&
|
|
|
|
this.chunks[3] === Opcode('OP_EQUALVERIFY').toNumber() &&
|
2014-11-28 06:45:42 -08:00
|
|
|
this.chunks[4] === Opcode('OP_CHECKSIG').toNumber();
|
2014-09-22 16:04:06 -07:00
|
|
|
};
|
|
|
|
|
2014-11-25 10:21:53 -08:00
|
|
|
Script.prototype.isPublicKeyHashIn = function() {
|
2014-11-28 06:45:42 -08:00
|
|
|
return !!(this.chunks.length === 2 &&
|
2014-11-28 06:08:33 -08:00
|
|
|
this.chunks[0].buf &&
|
2014-11-28 06:45:42 -08:00
|
|
|
this.chunks[1].buf);
|
2014-09-22 16:04:06 -07:00
|
|
|
};
|
|
|
|
|
2014-11-25 10:21:53 -08:00
|
|
|
Script.prototype.isScriptHashOut = function() {
|
2014-11-28 06:45:42 -08:00
|
|
|
return this.chunks.length === 3 &&
|
2014-11-28 06:08:33 -08:00
|
|
|
this.chunks[0] === Opcode('OP_HASH160').toNumber() &&
|
|
|
|
this.chunks[1].buf &&
|
|
|
|
this.chunks[1].buf.length === 20 &&
|
2014-11-28 06:45:42 -08:00
|
|
|
this.chunks[2] === Opcode('OP_EQUAL').toNumber();
|
2014-09-22 16:04:06 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
//note that these are frequently indistinguishable from pubkeyhashin
|
2014-11-25 10:21:53 -08:00
|
|
|
Script.prototype.isScriptHashIn = function() {
|
2014-11-28 06:45:42 -08:00
|
|
|
return this.chunks.every(function(chunk) {
|
2014-09-22 16:04:06 -07:00
|
|
|
return Buffer.isBuffer(chunk.buf);
|
|
|
|
});
|
|
|
|
};
|
2014-09-22 14:56:07 -07:00
|
|
|
|
2014-11-28 07:57:19 -08:00
|
|
|
/**
|
|
|
|
* Adds a script element at the start of the script.
|
|
|
|
* @param {*} obj a string, number, Opcode, Bufer, or object to add
|
|
|
|
* @returns {Script} this script instance
|
|
|
|
*/
|
|
|
|
Script.prototype.prepend = function(obj) {
|
|
|
|
this._addByType(obj, true);
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a script element to the end of the script.
|
|
|
|
*
|
|
|
|
* @param {*} obj a string, number, Opcode, Bufer, or object to add
|
|
|
|
* @returns {Script} this script instance
|
|
|
|
*
|
|
|
|
*/
|
2014-11-27 12:10:35 -08:00
|
|
|
Script.prototype.add = function(obj) {
|
2014-11-28 07:57:19 -08:00
|
|
|
this._addByType(obj, false);
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
|
|
|
Script.prototype._addByType = function(obj, prepend) {
|
2014-11-27 12:10:35 -08:00
|
|
|
if (typeof obj === 'string') {
|
2014-11-28 07:57:19 -08:00
|
|
|
this._addOpcode(obj, prepend);
|
2014-11-27 12:10:35 -08:00
|
|
|
} else if (typeof obj === 'number') {
|
2014-11-28 07:57:19 -08:00
|
|
|
this._addOpcode(obj, prepend);
|
2014-11-27 12:10:35 -08:00
|
|
|
} else if (obj.constructor && obj.constructor.name && obj.constructor.name === 'Opcode') {
|
2014-11-28 07:57:19 -08:00
|
|
|
this._addOpcode(obj, prepend);
|
2014-11-27 12:10:35 -08:00
|
|
|
} else if (Buffer.isBuffer(obj)) {
|
2014-11-28 07:57:19 -08:00
|
|
|
this._addBuffer(obj, prepend);
|
2014-11-27 12:10:35 -08:00
|
|
|
} else if (typeof obj === 'object') {
|
2014-11-28 07:57:19 -08:00
|
|
|
this._insertAtPosition(obj, prepend);
|
2014-11-27 12:10:35 -08:00
|
|
|
} else {
|
2014-09-23 21:28:03 -07:00
|
|
|
throw new Error('Invalid script chunk');
|
2014-11-27 12:10:35 -08:00
|
|
|
}
|
2014-09-23 21:28:03 -07:00
|
|
|
};
|
|
|
|
|
2014-11-28 07:57:19 -08:00
|
|
|
Script.prototype._insertAtPosition = function(op, prepend) {
|
|
|
|
if (prepend) {
|
|
|
|
this.chunks.unshift(op);
|
|
|
|
} else {
|
|
|
|
this.chunks.push(op);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Script.prototype._addOpcode = function(opcode, prepend) {
|
|
|
|
var op;
|
2014-11-27 12:10:35 -08:00
|
|
|
if (typeof opcode === 'number') {
|
2014-11-28 07:57:19 -08:00
|
|
|
op = opcode;
|
2014-11-27 12:10:35 -08:00
|
|
|
} else if (opcode.constructor && opcode.constructor.name && opcode.constructor.name === 'Opcode') {
|
2014-11-28 07:57:19 -08:00
|
|
|
op = opcode.toNumber();
|
2014-11-27 12:10:35 -08:00
|
|
|
} else {
|
2014-11-28 07:57:19 -08:00
|
|
|
op = Opcode(opcode).toNumber();
|
2014-11-27 12:10:35 -08:00
|
|
|
}
|
2014-11-28 07:57:19 -08:00
|
|
|
this._insertAtPosition(op, prepend);
|
2014-09-23 21:28:03 -07:00
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
2014-11-28 07:57:19 -08:00
|
|
|
Script.prototype._addBuffer = function(buf, prepend) {
|
2014-09-23 21:28:03 -07:00
|
|
|
var opcodenum;
|
|
|
|
var len = buf.length;
|
|
|
|
if (buf.length > 0 && buf.length < Opcode.map.OP_PUSHDATA1) {
|
|
|
|
opcodenum = buf.length;
|
|
|
|
} else if (buf.length < Math.pow(2, 8)) {
|
|
|
|
opcodenum = Opcode.map.OP_PUSHDATA1;
|
|
|
|
} else if (buf.length < Math.pow(2, 16)) {
|
|
|
|
opcodenum = Opcode.map.OP_PUSHDATA2;
|
|
|
|
} else if (buf.length < Math.pow(2, 32)) {
|
|
|
|
opcodenum = Opcode.map.OP_PUSHDATA4;
|
2014-09-23 21:37:18 -07:00
|
|
|
} else {
|
2014-11-27 12:10:35 -08:00
|
|
|
throw new Error('You can\'t push that much data');
|
2014-09-23 21:28:03 -07:00
|
|
|
}
|
2014-11-28 07:57:19 -08:00
|
|
|
this._insertAtPosition({
|
2014-09-23 21:28:03 -07:00
|
|
|
buf: buf,
|
|
|
|
len: len,
|
|
|
|
opcodenum: opcodenum
|
2014-11-28 07:57:19 -08:00
|
|
|
}, prepend);
|
2014-09-23 21:28:03 -07:00
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
2014-09-01 15:45:03 -07:00
|
|
|
module.exports = Script;
|