Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@neo-one/client-common

Package Overview
Dependencies
Maintainers
2
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@neo-one/client-common - npm Package Compare versions

Comparing version 3.2.0-preview5 to 3.3.1-rc1

dist/cjs/Instruction.d.ts

17

CHANGELOG.json

@@ -5,2 +5,19 @@ {

{
"version": "3.3.0",
"tag": "@neo-one/client-common_v3.3.0",
"date": "Wed, 05 May 2021 03:33:54 GMT",
"comments": {
"minor": [
{
"comment": "Updates for Preview5"
}
],
"dependency": [
{
"comment": "Updating dependency \"@neo-one/utils\" from `^3.1.0` to `^3.2.0`"
}
]
}
},
{
"version": "3.1.0",

@@ -7,0 +24,0 @@ "tag": "@neo-one/client-common_v3.1.0",

9

CHANGELOG.md
# Change Log - @neo-one/client-common
This log was last generated on Mon, 08 Feb 2021 21:00:42 GMT and should not be manually modified.
This log was last generated on Wed, 05 May 2021 03:33:54 GMT and should not be manually modified.
## 3.3.0
Wed, 05 May 2021 03:33:54 GMT
### Minor changes
- Updates for Preview5
## 3.1.0

@@ -6,0 +13,0 @@ Mon, 08 Feb 2021 21:00:42 GMT

@@ -61,2 +61,3 @@ /// <reference types="node" />

ONE_HUNDRED_MILLION_FIXED8: BN;
MAP_STACK_ITEM_MAX_KEY_SIZE: number;
uInt160ToBuffer: (value: UInt160 | UInt160Hex) => Buffer;

@@ -89,3 +90,5 @@ add0x: (value: string) => string;

hexToECPoint: (value: ECPoint | ECPointHex) => ECPoint;
base64ToECPoint: (value: ECPoint | ECPointHex) => ECPoint;
ecPointToString: (value: ECPoint | ECPointHex) => string;
ecPointToBase64: (value: ECPoint | ECPointHex) => ECPointHex;
ecPointCompare: (a: ECPoint | ECPointHex, b: ECPoint | ECPointHex) => 0 | 1 | -1;

@@ -111,2 +114,4 @@ stringToECPoint: (value: ECPoint | ECPointHex) => ECPoint;

ContractManagement: string;
StdLib: string;
CryptoLib: string;
Ledger: string;

@@ -122,2 +127,4 @@ NEO: string;

ContractManagement: UInt160;
StdLib: UInt160;
CryptoLib: UInt160;
Ledger: UInt160;

@@ -124,0 +131,0 @@ NEO: UInt160;

26

dist/cjs/common.js

@@ -64,2 +64,4 @@ "use strict";

const bufferToECPoint = asECPoint;
const ecPointToBase64 = (value) => typeof value === 'string' ? value : value.toString('base64');
const base64ToECPoint = (value) => bufferToECPoint(typeof value === 'string' ? Buffer.from(value, 'base64') : value);
const ecPointToHex = (value) => typeof value === 'string' ? value : value.toString('hex');

@@ -128,13 +130,17 @@ const hexToECPoint = (value) => bufferToECPoint(typeof value === 'string' ? Buffer.from(value, 'hex') : value);

const nativeScriptHashes = {
ContractManagement: '0xa501d7d7d10983673b61b7a2d3a813b36f9f0e43',
Ledger: '0x971d69c6dd10ce88e7dfffec1dc603c6125a8764',
NEO: '0xf61eebf573ea36593fd43aa150c055ad7906ab83',
GAS: '0x70e2301955bf1e74cbb31d18c2f96972abadb328',
Policy: '0x79bcd398505eb779df6e67e4be6c14cded08e2f2',
RoleManagement: '0x597b1471bbce497b7809e2c8f10db67050008b02',
Oracle: '0x8dc0e742cbdfdeda51ff8a8b78d46829144c80ee',
NameService: '0xa2b524b68dfe43a9d56af84f443c6b9843b8028c',
ContractManagement: '0xfffdc93764dbaddd97c48f252a53ea4643faa3fd',
StdLib: '0xacce6fd80d44e1796aa0c2c625e9e4e0ce39efc0',
CryptoLib: '0x726cb6e0cd8628a1350a611384688911ab75f51b',
Ledger: '0xda65b600f7124ce6c79950c1772a36403104f2be',
NEO: '0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5',
GAS: '0xd2a4cff31913016155e38e474a2c06d08be276cf',
Policy: '0xcc5e4edd9f5f8dba8bb65734541df7a1c081c67b',
RoleManagement: '0x49cf4e5378ffcd4dec034fd98a174c5491e395e2',
Oracle: '0xfe924b7cfe89ddd271abaf7210a80a7e11178758',
NameService: '0x7a8fcf0392cd625647907afa8e45cc66872b596b',
};
const nativeHashes = {
ContractManagement: hexToUInt160(nativeScriptHashes.ContractManagement),
StdLib: hexToUInt160(nativeScriptHashes.StdLib),
CryptoLib: hexToUInt160(nativeScriptHashes.CryptoLib),
Ledger: hexToUInt160(nativeScriptHashes.Ledger),

@@ -148,2 +154,3 @@ NEO: hexToUInt160(nativeScriptHashes.NEO),

};
const MAP_STACK_ITEM_MAX_KEY_SIZE = 64;
exports.common = {

@@ -175,2 +182,3 @@ D8,

ONE_HUNDRED_MILLION_FIXED8,
MAP_STACK_ITEM_MAX_KEY_SIZE,
uInt160ToBuffer,

@@ -203,3 +211,5 @@ add0x,

hexToECPoint,
base64ToECPoint,
ecPointToString,
ecPointToBase64,
ecPointCompare,

@@ -206,0 +216,0 @@ stringToECPoint,

@@ -26,2 +26,3 @@ "use strict";

case 'Hash160':
case 'Address':
value = common_1.common.uInt160ToBuffer(crypto_1.crypto.addressToScriptHash({

@@ -28,0 +29,0 @@ addressVersion: common_1.common.NEO_ADDRESS_VERSION,

@@ -29,2 +29,3 @@ /// <reference types="node" />

hash256: (value: Buffer) => UInt256;
calculateHash: (value: Buffer) => UInt256;
sign: ({ message, privateKey }: {

@@ -89,3 +90,2 @@ readonly message: Buffer;

createPrivateKey: () => PrivateKey;
isMultiSigContract: (script: Buffer) => boolean;
isMultiSigContractWithResult: (script: Buffer) => MultiSigResult;

@@ -92,0 +92,0 @@ isSignatureContract: (script: Buffer) => boolean;

@@ -33,2 +33,3 @@ "use strict";

const hash256 = (value) => common_1.common.bufferToUInt256(sha256(sha256(value)));
const calculateHash = (value) => common_1.common.bufferToUInt256(sha256(value));
const hmacSha512 = (key, data) => crypto_1.createHmac('sha512', key).update(data).digest();

@@ -172,4 +173,3 @@ const sign = ({ message, privateKey }) => {

builder.emitPushECPoint(publicKey);
builder.emitOp('PUSHNULL');
builder.emitSysCall('Neo.Crypto.VerifyWithECDsaSecp256r1');
builder.emitSysCall('Neo.Crypto.CheckSig');
return builder.build();

@@ -185,4 +185,3 @@ };

builder.emitPushECPoint(publicKey);
builder.emitOp('PUSHNULL');
builder.emitSysCall('Neo.Crypto.VerifyWithECDsaSecp256r1');
builder.emitSysCall('Neo.Crypto.CheckSig');
return builder.build();

@@ -220,4 +219,3 @@ };

builder.emitPushInt(publicKeysSorted.length);
builder.emitOp('PUSHNULL');
builder.emitSysCall('Neo.Crypto.CheckMultisigWithECDsaSecp256r1');
builder.emitSysCall('Neo.Crypto.CheckMultisig');
return builder.build();

@@ -259,4 +257,3 @@ };

builder.emitPushInt(publicKeysSorted.length);
builder.emitOp('PUSHNULL');
builder.emitSysCall('Neo.Crypto.CheckMultisigWithECDsaSecp256r1');
builder.emitSysCall('Neo.Crypto.CheckMultisig');
return builder.build();

@@ -356,75 +353,4 @@ };

};
const checkMultisigWithECDsaSecp256r1 = Buffer.from('138defaf', 'hex');
const verifyECDsaSecp256r1 = Buffer.from('95440d78', 'hex');
const isMultiSigContract = (script) => {
let m = 0;
let n = 0;
let i = 0;
if (script.length < 43)
return false;
if (script[i] > models_1.Op.PUSH16)
return false;
if (script[i] < models_1.Op.PUSH1 && script[i] !== 1 && script[i] !== 2)
return false;
switch (script[i]) {
case models_1.Op.PUSHINT8:
m = script[++i];
++i;
break;
case models_1.Op.PUSHINT16:
m = script.readUInt16LE(++i);
i += 2;
break;
default:
const b = script[i];
if (b >= models_1.Op.PUSH1 && b <= models_1.Op.PUSH16) {
m = b - models_1.Op.PUSH0;
++i;
break;
}
return false;
}
if (m < 1 || m > 1024)
return false;
while (script[i] == models_1.Op.PUSHDATA1) {
if (script.length <= i + 35)
return false;
if (script[++i] !== 33)
return false;
i += 34;
++n;
}
if (n < m || n > 1024)
return false;
switch (script[i]) {
case models_1.Op.PUSHINT8:
if (n != script[++i])
return false;
++i;
break;
case models_1.Op.PUSHINT16:
if (script.length < i + 3 || n != script.readUInt16LE(++i))
return false;
i += 2;
break;
default:
const b = script[i];
if (b >= models_1.Op.PUSH1 && b <= models_1.Op.PUSH16) {
if (n !== b - models_1.Op.PUSH0)
return false;
++i;
break;
}
return false;
}
if (script[i++] !== models_1.Op.PUSHNULL)
return false;
if (script[i++] !== models_1.Op.SYSCALL)
return false;
if (script.length !== i + 4)
return false;
if (!script.slice(i).equals(checkMultisigWithECDsaSecp256r1))
return false;
return true;
};
const checkMultisig = Buffer.from('7bce6ca5', 'hex');
const checkSig = Buffer.from('747476aa', 'hex');
const isMultiSigContractWithResult = (script) => {

@@ -435,3 +361,3 @@ let m = 0;

let points = [];
if (script.length < 43)
if (script.length < 42)
return { result: false };

@@ -494,19 +420,16 @@ if (script[i] > models_1.Op.PUSH16)

}
if (script[i++] !== models_1.Op.PUSHNULL)
if (script.length !== i + 5)
return { result: false };
if (script[i++] !== models_1.Op.SYSCALL)
return { result: false };
if (script.length !== i + 4)
if (!script.slice(i).equals(checkMultisig))
return { result: false };
if (!script.slice(i).equals(checkMultisigWithECDsaSecp256r1))
return { result: false };
return { result: true, m, n, points };
};
const isSignatureContract = (script) => script.length === 41 &&
const isSignatureContract = (script) => script.length === 40 &&
script[0] === models_1.Op.PUSHDATA1 &&
script[1] === 33 &&
script[35] === models_1.Op.PUSHNULL &&
script[36] === models_1.Op.SYSCALL &&
script.slice(37).equals(verifyECDsaSecp256r1);
const isStandardContract = (script) => isSignatureContract(script) || isMultiSigContract(script);
script[35] === models_1.Op.SYSCALL &&
script.slice(36).equals(checkSig);
const isStandardContract = (script) => isSignatureContract(script) || isMultiSigContractWithResult(script).result;
const HARDENED_KEY_OFFSET = 0x80000000;

@@ -655,2 +578,3 @@ const EXTENDED_KEY_BYTES = 78;

hash256,
calculateHash,
sign,

@@ -686,3 +610,2 @@ verify,

createPrivateKey,
isMultiSigContract,
isMultiSigContractWithResult,

@@ -689,0 +612,0 @@ isSignatureContract,

@@ -379,3 +379,3 @@ /// <reference types="node" />

export declare const InvalidJumpError: {
new (op: "PUSHINT8" | "PUSHINT16" | "PUSHINT32" | "PUSHINT64" | "PUSHINT128" | "PUSHINT256" | "PUSHA" | "PUSHNULL" | "PUSHDATA1" | "PUSHDATA2" | "PUSHDATA4" | "PUSHM1" | "PUSH0" | "PUSH1" | "PUSH2" | "PUSH3" | "PUSH4" | "PUSH5" | "PUSH6" | "PUSH7" | "PUSH8" | "PUSH9" | "PUSH10" | "PUSH11" | "PUSH12" | "PUSH13" | "PUSH14" | "PUSH15" | "PUSH16" | "NOP" | "JMP" | "JMP_L" | "JMPIF" | "JMPIF_L" | "JMPIFNOT" | "JMPIFNOT_L" | "JMPEQ" | "JMPEQ_L" | "JMPNE" | "JMPNE_L" | "JMPGT" | "JMPGT_L" | "JMPGE" | "JMPGE_L" | "JMPLT" | "JMPLT_L" | "JMPLE" | "JMPLE_L" | "CALL" | "CALL_L" | "CALLA" | "CALLT" | "ABORT" | "ASSERT" | "THROW" | "TRY" | "TRY_L" | "ENDTRY" | "ENDTRY_L" | "ENDFINALLY" | "RET" | "SYSCALL" | "DEPTH" | "DROP" | "NIP" | "XDROP" | "CLEAR" | "DUP" | "OVER" | "PICK" | "TUCK" | "SWAP" | "ROT" | "ROLL" | "REVERSE3" | "REVERSE4" | "REVERSEN" | "INITSSLOT" | "INITSLOT" | "LDSFLD0" | "LDSFLD1" | "LDSFLD2" | "LDSFLD3" | "LDSFLD4" | "LDSFLD5" | "LDSFLD6" | "LDSFLD" | "STSFLD0" | "STSFLD1" | "STSFLD2" | "STSFLD3" | "STSFLD4" | "STSFLD5" | "STSFLD6" | "STSFLD" | "LDLOC0" | "LDLOC1" | "LDLOC2" | "LDLOC3" | "LDLOC4" | "LDLOC5" | "LDLOC6" | "LDLOC" | "STLOC0" | "STLOC1" | "STLOC2" | "STLOC3" | "STLOC4" | "STLOC5" | "STLOC6" | "STLOC" | "LDARG0" | "LDARG1" | "LDARG2" | "LDARG3" | "LDARG4" | "LDARG5" | "LDARG6" | "LDARG" | "STARG0" | "STARG1" | "STARG2" | "STARG3" | "STARG4" | "STARG5" | "STARG6" | "STARG" | "NEWBUFFER" | "MEMCPY" | "CAT" | "SUBSTR" | "LEFT" | "RIGHT" | "INVERT" | "AND" | "OR" | "XOR" | "EQUAL" | "NOTEQUAL" | "SIGN" | "ABS" | "NEGATE" | "INC" | "DEC" | "ADD" | "SUB" | "MUL" | "DIV" | "MOD" | "SHL" | "SHR" | "NOT" | "BOOLAND" | "BOOLOR" | "NZ" | "NUMEQUAL" | "NUMNOTEQUAL" | "LT" | "LE" | "GT" | "GE" | "MIN" | "MAX" | "WITHIN" | "PACK" | "UNPACK" | "NEWARRAY0" | "NEWARRAY" | "NEWARRAY_T" | "NEWSTRUCT0" | "NEWSTRUCT" | "NEWMAP" | "SIZE" | "HASKEY" | "KEYS" | "VALUES" | "PICKITEM" | "APPEND" | "SETITEM" | "REVERSEITEMS" | "REMOVE" | "CLEARITEMS" | "POPITEM" | "ISNULL" | "ISTYPE" | "CONVERT"): {
new (op: "PUSHINT8" | "PUSHINT16" | "PUSHINT32" | "PUSHINT64" | "PUSHINT128" | "PUSHINT256" | "PUSHA" | "PUSHNULL" | "PUSHDATA1" | "PUSHDATA2" | "PUSHDATA4" | "PUSHM1" | "PUSH0" | "PUSH1" | "PUSH2" | "PUSH3" | "PUSH4" | "PUSH5" | "PUSH6" | "PUSH7" | "PUSH8" | "PUSH9" | "PUSH10" | "PUSH11" | "PUSH12" | "PUSH13" | "PUSH14" | "PUSH15" | "PUSH16" | "NOP" | "JMP" | "JMP_L" | "JMPIF" | "JMPIF_L" | "JMPIFNOT" | "JMPIFNOT_L" | "JMPEQ" | "JMPEQ_L" | "JMPNE" | "JMPNE_L" | "JMPGT" | "JMPGT_L" | "JMPGE" | "JMPGE_L" | "JMPLT" | "JMPLT_L" | "JMPLE" | "JMPLE_L" | "CALL" | "CALL_L" | "CALLA" | "CALLT" | "ABORT" | "ASSERT" | "THROW" | "TRY" | "TRY_L" | "ENDTRY" | "ENDTRY_L" | "ENDFINALLY" | "RET" | "SYSCALL" | "DEPTH" | "DROP" | "NIP" | "XDROP" | "CLEAR" | "DUP" | "OVER" | "PICK" | "TUCK" | "SWAP" | "ROT" | "ROLL" | "REVERSE3" | "REVERSE4" | "REVERSEN" | "INITSSLOT" | "INITSLOT" | "LDSFLD0" | "LDSFLD1" | "LDSFLD2" | "LDSFLD3" | "LDSFLD4" | "LDSFLD5" | "LDSFLD6" | "LDSFLD" | "STSFLD0" | "STSFLD1" | "STSFLD2" | "STSFLD3" | "STSFLD4" | "STSFLD5" | "STSFLD6" | "STSFLD" | "LDLOC0" | "LDLOC1" | "LDLOC2" | "LDLOC3" | "LDLOC4" | "LDLOC5" | "LDLOC6" | "LDLOC" | "STLOC0" | "STLOC1" | "STLOC2" | "STLOC3" | "STLOC4" | "STLOC5" | "STLOC6" | "STLOC" | "LDARG0" | "LDARG1" | "LDARG2" | "LDARG3" | "LDARG4" | "LDARG5" | "LDARG6" | "LDARG" | "STARG0" | "STARG1" | "STARG2" | "STARG3" | "STARG4" | "STARG5" | "STARG6" | "STARG" | "NEWBUFFER" | "MEMCPY" | "CAT" | "SUBSTR" | "LEFT" | "RIGHT" | "INVERT" | "AND" | "OR" | "XOR" | "EQUAL" | "NOTEQUAL" | "SIGN" | "ABS" | "NEGATE" | "INC" | "DEC" | "ADD" | "SUB" | "MUL" | "DIV" | "MOD" | "POW" | "SQRT" | "SHL" | "SHR" | "NOT" | "BOOLAND" | "BOOLOR" | "NZ" | "NUMEQUAL" | "NUMNOTEQUAL" | "LT" | "LE" | "GT" | "GE" | "MIN" | "MAX" | "WITHIN" | "PACK" | "UNPACK" | "NEWARRAY0" | "NEWARRAY" | "NEWARRAY_T" | "NEWSTRUCT0" | "NEWSTRUCT" | "NEWMAP" | "SIZE" | "HASKEY" | "KEYS" | "VALUES" | "PICKITEM" | "APPEND" | "SETITEM" | "REVERSEITEMS" | "REMOVE" | "CLEARITEMS" | "POPITEM" | "ISNULL" | "ISTYPE" | "CONVERT" | "PRINT"): {
readonly name: string;

@@ -391,3 +391,3 @@ readonly code: string;

export declare const InvalidScriptError: {
new (op: "PUSHINT8" | "PUSHINT16" | "PUSHINT32" | "PUSHINT64" | "PUSHINT128" | "PUSHINT256" | "PUSHA" | "PUSHNULL" | "PUSHDATA1" | "PUSHDATA2" | "PUSHDATA4" | "PUSHM1" | "PUSH0" | "PUSH1" | "PUSH2" | "PUSH3" | "PUSH4" | "PUSH5" | "PUSH6" | "PUSH7" | "PUSH8" | "PUSH9" | "PUSH10" | "PUSH11" | "PUSH12" | "PUSH13" | "PUSH14" | "PUSH15" | "PUSH16" | "NOP" | "JMP" | "JMP_L" | "JMPIF" | "JMPIF_L" | "JMPIFNOT" | "JMPIFNOT_L" | "JMPEQ" | "JMPEQ_L" | "JMPNE" | "JMPNE_L" | "JMPGT" | "JMPGT_L" | "JMPGE" | "JMPGE_L" | "JMPLT" | "JMPLT_L" | "JMPLE" | "JMPLE_L" | "CALL" | "CALL_L" | "CALLA" | "CALLT" | "ABORT" | "ASSERT" | "THROW" | "TRY" | "TRY_L" | "ENDTRY" | "ENDTRY_L" | "ENDFINALLY" | "RET" | "SYSCALL" | "DEPTH" | "DROP" | "NIP" | "XDROP" | "CLEAR" | "DUP" | "OVER" | "PICK" | "TUCK" | "SWAP" | "ROT" | "ROLL" | "REVERSE3" | "REVERSE4" | "REVERSEN" | "INITSSLOT" | "INITSLOT" | "LDSFLD0" | "LDSFLD1" | "LDSFLD2" | "LDSFLD3" | "LDSFLD4" | "LDSFLD5" | "LDSFLD6" | "LDSFLD" | "STSFLD0" | "STSFLD1" | "STSFLD2" | "STSFLD3" | "STSFLD4" | "STSFLD5" | "STSFLD6" | "STSFLD" | "LDLOC0" | "LDLOC1" | "LDLOC2" | "LDLOC3" | "LDLOC4" | "LDLOC5" | "LDLOC6" | "LDLOC" | "STLOC0" | "STLOC1" | "STLOC2" | "STLOC3" | "STLOC4" | "STLOC5" | "STLOC6" | "STLOC" | "LDARG0" | "LDARG1" | "LDARG2" | "LDARG3" | "LDARG4" | "LDARG5" | "LDARG6" | "LDARG" | "STARG0" | "STARG1" | "STARG2" | "STARG3" | "STARG4" | "STARG5" | "STARG6" | "STARG" | "NEWBUFFER" | "MEMCPY" | "CAT" | "SUBSTR" | "LEFT" | "RIGHT" | "INVERT" | "AND" | "OR" | "XOR" | "EQUAL" | "NOTEQUAL" | "SIGN" | "ABS" | "NEGATE" | "INC" | "DEC" | "ADD" | "SUB" | "MUL" | "DIV" | "MOD" | "SHL" | "SHR" | "NOT" | "BOOLAND" | "BOOLOR" | "NZ" | "NUMEQUAL" | "NUMNOTEQUAL" | "LT" | "LE" | "GT" | "GE" | "MIN" | "MAX" | "WITHIN" | "PACK" | "UNPACK" | "NEWARRAY0" | "NEWARRAY" | "NEWARRAY_T" | "NEWSTRUCT0" | "NEWSTRUCT" | "NEWMAP" | "SIZE" | "HASKEY" | "KEYS" | "VALUES" | "PICKITEM" | "APPEND" | "SETITEM" | "REVERSEITEMS" | "REMOVE" | "CLEARITEMS" | "POPITEM" | "ISNULL" | "ISTYPE" | "CONVERT", ip: number): {
new (op: "PUSHINT8" | "PUSHINT16" | "PUSHINT32" | "PUSHINT64" | "PUSHINT128" | "PUSHINT256" | "PUSHA" | "PUSHNULL" | "PUSHDATA1" | "PUSHDATA2" | "PUSHDATA4" | "PUSHM1" | "PUSH0" | "PUSH1" | "PUSH2" | "PUSH3" | "PUSH4" | "PUSH5" | "PUSH6" | "PUSH7" | "PUSH8" | "PUSH9" | "PUSH10" | "PUSH11" | "PUSH12" | "PUSH13" | "PUSH14" | "PUSH15" | "PUSH16" | "NOP" | "JMP" | "JMP_L" | "JMPIF" | "JMPIF_L" | "JMPIFNOT" | "JMPIFNOT_L" | "JMPEQ" | "JMPEQ_L" | "JMPNE" | "JMPNE_L" | "JMPGT" | "JMPGT_L" | "JMPGE" | "JMPGE_L" | "JMPLT" | "JMPLT_L" | "JMPLE" | "JMPLE_L" | "CALL" | "CALL_L" | "CALLA" | "CALLT" | "ABORT" | "ASSERT" | "THROW" | "TRY" | "TRY_L" | "ENDTRY" | "ENDTRY_L" | "ENDFINALLY" | "RET" | "SYSCALL" | "DEPTH" | "DROP" | "NIP" | "XDROP" | "CLEAR" | "DUP" | "OVER" | "PICK" | "TUCK" | "SWAP" | "ROT" | "ROLL" | "REVERSE3" | "REVERSE4" | "REVERSEN" | "INITSSLOT" | "INITSLOT" | "LDSFLD0" | "LDSFLD1" | "LDSFLD2" | "LDSFLD3" | "LDSFLD4" | "LDSFLD5" | "LDSFLD6" | "LDSFLD" | "STSFLD0" | "STSFLD1" | "STSFLD2" | "STSFLD3" | "STSFLD4" | "STSFLD5" | "STSFLD6" | "STSFLD" | "LDLOC0" | "LDLOC1" | "LDLOC2" | "LDLOC3" | "LDLOC4" | "LDLOC5" | "LDLOC6" | "LDLOC" | "STLOC0" | "STLOC1" | "STLOC2" | "STLOC3" | "STLOC4" | "STLOC5" | "STLOC6" | "STLOC" | "LDARG0" | "LDARG1" | "LDARG2" | "LDARG3" | "LDARG4" | "LDARG5" | "LDARG6" | "LDARG" | "STARG0" | "STARG1" | "STARG2" | "STARG3" | "STARG4" | "STARG5" | "STARG6" | "STARG" | "NEWBUFFER" | "MEMCPY" | "CAT" | "SUBSTR" | "LEFT" | "RIGHT" | "INVERT" | "AND" | "OR" | "XOR" | "EQUAL" | "NOTEQUAL" | "SIGN" | "ABS" | "NEGATE" | "INC" | "DEC" | "ADD" | "SUB" | "MUL" | "DIV" | "MOD" | "POW" | "SQRT" | "SHL" | "SHR" | "NOT" | "BOOLAND" | "BOOLOR" | "NZ" | "NUMEQUAL" | "NUMNOTEQUAL" | "LT" | "LE" | "GT" | "GE" | "MIN" | "MAX" | "WITHIN" | "PACK" | "UNPACK" | "NEWARRAY0" | "NEWARRAY" | "NEWARRAY_T" | "NEWSTRUCT0" | "NEWSTRUCT" | "NEWMAP" | "SIZE" | "HASKEY" | "KEYS" | "VALUES" | "PICKITEM" | "APPEND" | "SETITEM" | "REVERSEITEMS" | "REMOVE" | "CLEARITEMS" | "POPITEM" | "ISNULL" | "ISTYPE" | "CONVERT" | "PRINT", ip: number): {
readonly name: string;

@@ -394,0 +394,0 @@ readonly code: string;

@@ -19,2 +19,3 @@ export * from './BinaryWriter';

export * from './disassembleByteCode';
export * from './script';
export * from './Script';
export * from './Instruction';

@@ -22,4 +22,5 @@ "use strict";

tslib_1.__exportStar(require("./disassembleByteCode"), exports);
tslib_1.__exportStar(require("./script"), exports);
tslib_1.__exportStar(require("./Script"), exports);
tslib_1.__exportStar(require("./Instruction"), exports);
//# sourceMappingURL=index.js.map

@@ -11,1 +11,7 @@ export declare enum CallFlags {

}
export declare const isCallFlag: (value: number) => value is CallFlags;
export declare const assertCallFlags: (value: number) => CallFlags;
export declare type CallFlagsJSON = keyof typeof CallFlags;
export declare const isCallFlagsJSON: (type: string) => type is "None" | "All" | "ReadStates" | "WriteStates" | "AllowCall" | "AllowNotify" | "States" | "ReadOnly";
export declare const assertCallFlagsJSON: (type: string) => CallFlagsJSON;
export declare const toCallFlagsJSON: (type: CallFlags) => "None" | "All" | "ReadStates" | "WriteStates" | "AllowCall" | "AllowNotify" | "States" | "ReadOnly";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CallFlags = void 0;
exports.toCallFlagsJSON = exports.assertCallFlagsJSON = exports.isCallFlagsJSON = exports.assertCallFlags = exports.isCallFlag = exports.CallFlags = void 0;
const common_1 = require("../common");
var CallFlags;

@@ -15,3 +16,18 @@ (function (CallFlags) {

})(CallFlags = exports.CallFlags || (exports.CallFlags = {}));
exports.isCallFlag = (value) => CallFlags[value] !== undefined;
exports.assertCallFlags = (value) => {
if (exports.isCallFlag(value)) {
return value;
}
throw new common_1.InvalidFormatError(`Expected StackItemType, found: ${value}`);
};
exports.isCallFlagsJSON = (type) => CallFlags[type] !== undefined;
exports.assertCallFlagsJSON = (type) => {
if (exports.isCallFlagsJSON(type)) {
return type;
}
throw new common_1.InvalidFormatError();
};
exports.toCallFlagsJSON = (type) => exports.assertCallFlagsJSON(CallFlags[type]);
//# sourceMappingURL=CallFlags.js.map

@@ -6,3 +6,2 @@ export * from './AccountContract';

export * from './Serializable';
export * from './StorageFlagsModel';
export * from './WitnessModel';

@@ -9,0 +8,0 @@ export * from './WitnessScopeModel';

@@ -9,3 +9,2 @@ "use strict";

tslib_1.__exportStar(require("./Serializable"), exports);
tslib_1.__exportStar(require("./StorageFlagsModel"), exports);
tslib_1.__exportStar(require("./WitnessModel"), exports);

@@ -12,0 +11,0 @@ tslib_1.__exportStar(require("./WitnessScopeModel"), exports);

@@ -25,5 +25,5 @@ /// <reference types="node" />

serializeHeader(writer: BinaryWriter): void;
serializeBeforeChecksumBase(writer: BinaryWriter): void;
serializeForChecksumBase(writer: BinaryWriter): void;
serializeWireBase(writer: BinaryWriter): void;
serializeJSON(): NefFileJSON;
}

@@ -12,3 +12,3 @@ "use strict";

this.serializeWire = Serializable_1.createSerializeWire(this.serializeWireBase.bind(this));
this.serializeForChecksum = Serializable_1.createSerializeWire(this.serializeBeforeChecksumBase.bind(this));
this.serializeForChecksum = Serializable_1.createSerializeWire(this.serializeForChecksumBase.bind(this));
this.headerSize = utils_1.utils.lazy(() => IOHelper_1.IOHelper.sizeOfUInt32LE + IOHelper_1.IOHelper.sizeOfFixedString(64));

@@ -24,3 +24,3 @@ this.sizeInternal = utils_1.utils.lazy(() => this.headerSize() +

this.script = script;
this.checkSum = checkSum !== null && checkSum !== void 0 ? checkSum : crypto_1.crypto.sha256(this.serializeForChecksum()).readUInt32LE(0);
this.checkSum = checkSum !== null && checkSum !== void 0 ? checkSum : crypto_1.crypto.hash256(this.serializeForChecksum()).readUInt32LE(0);
}

@@ -34,3 +34,3 @@ get size() {

}
serializeBeforeChecksumBase(writer) {
serializeForChecksumBase(writer) {
var _a;

@@ -44,3 +44,3 @@ this.serializeHeader(writer);

serializeWireBase(writer) {
this.serializeBeforeChecksumBase(writer);
this.serializeForChecksumBase(writer);
writer.writeUInt32LE(this.checkSum);

@@ -47,0 +47,0 @@ }

/// <reference types="node" />
import { BinaryWriter } from '../BinaryWriter';
import { UInt256 } from '../common';
export declare type SerializeWire = () => Buffer;

@@ -12,2 +13,2 @@ export interface SerializableWire {

}
export declare const getHashData: (wire: Buffer, magic: number) => Buffer;
export declare const getSignData: (hash: UInt256, magic: number) => Buffer;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getHashData = exports.createSerializeWire = void 0;
exports.getSignData = exports.createSerializeWire = void 0;
const BinaryWriter_1 = require("../BinaryWriter");

@@ -10,6 +10,6 @@ exports.createSerializeWire = (serializeWireBase) => () => {

};
exports.getHashData = (wire, magic) => {
exports.getSignData = (hash, magic) => {
const writer = new BinaryWriter_1.BinaryWriter();
writer.writeUInt32LE(magic);
writer.writeBytes(wire);
writer.writeUInt256(hash);
return writer.toBuffer();

@@ -16,0 +16,0 @@ };

@@ -55,5 +55,5 @@ /// <reference types="node" />

constructor({ version, nonce, attributes, witnesses, signers, validUntilBlock, script, hash, messageMagic, }: FeelessTransactionModelAdd<TAttribute, TWitness, TSigner>);
get message(): Buffer;
get hash(): UInt256;
get hashHex(): UInt256Hex;
get message(): Buffer;
cloneWithConsensusOptions(options: TransactionConsensusOptions): FeelessTransactionModel<TAttribute, TWitness, TSigner>;

@@ -60,0 +60,0 @@ sign(_key: PrivateKey): FeelessTransactionModel<TAttribute, TWitness, TSigner>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FeelessTransactionModel = exports.DEFAULT_VERSION = exports.MAX_VALID_UNTIL_BLOCK_INCREMENT = exports.MAX_TRANSACTION_SIZE = exports.MAX_TRANSACTION_ATTRIBUTES = void 0;
const tslib_1 = require("tslib");
const bn_js_1 = tslib_1.__importDefault(require("bn.js"));
const bn_js_1 = require("bn.js");
const common_1 = require("../../common");

@@ -21,3 +20,3 @@ const crypto_1 = require("../../crypto");

this.hashHexInternal = utils_1.utils.lazy(() => common_1.common.uInt256ToHex(this.hash));
this.messageInternal = utils_1.utils.lazy(() => Serializable_1.getHashData(this.serializeUnsigned(), this.messageMagic));
this.messageInternal = utils_1.utils.lazy(() => Serializable_1.getSignData(this.hash, this.messageMagic));
this.version = version === undefined ? exports.DEFAULT_VERSION : version;

@@ -33,3 +32,4 @@ this.nonce = nonce;

const hashIn = hash;
this.hashInternal = hashIn === undefined ? utils_1.utils.lazy(() => crypto_1.crypto.hash256(this.message)) : () => hashIn;
this.hashInternal =
hashIn === undefined ? utils_1.utils.lazy(() => crypto_1.crypto.calculateHash(this.serializeUnsigned())) : () => hashIn;
if (this.attributes.length > exports.MAX_TRANSACTION_ATTRIBUTES) {

@@ -39,2 +39,5 @@ throw new common_1.InvalidFormatError(`Expected less than ${exports.MAX_TRANSACTION_ATTRIBUTES} attributes, found: ${attributes.length}`);

}
get message() {
return this.messageInternal();
}
get hash() {

@@ -46,5 +49,2 @@ return this.hashInternal();

}
get message() {
return this.messageInternal();
}
cloneWithConsensusOptions(options) {

@@ -72,4 +72,4 @@ return new FeelessTransactionModel({

writer.writeUInt32LE(this.nonce);
writer.writeUInt64LE(new bn_js_1.default(0));
writer.writeUInt64LE(new bn_js_1.default(0));
writer.writeUInt64LE(new bn_js_1.BN(0));
writer.writeUInt64LE(new bn_js_1.BN(0));
writer.writeUInt32LE(this.validUntilBlock);

@@ -76,0 +76,0 @@ writer.writeArray(this.signers, (signer) => {

@@ -5,3 +5,2 @@ import { JSONObject } from '@neo-one/utils';

import { ContractParameterTypeModel } from './ContractParameterTypeModel';
import { StorageFlagsModel } from './StorageFlagsModel';
import { AttributeTypeModel } from './transaction';

@@ -168,5 +167,3 @@ import { TriggerType, TriggerTypeJSON } from './trigger';

readonly value: string;
readonly isConstant: boolean;
}
export declare type StorageFlagsJSON = keyof typeof StorageFlagsModel;
export interface WitnessJSON {

@@ -339,3 +336,3 @@ readonly invocation: string;

readonly manifest: ContractManifestJSON;
readonly activeblockindex: number;
readonly updatehistory: readonly number[];
}

@@ -365,3 +362,5 @@ export interface Nep17TransfersJSON {

}
export interface BlockBaseJSON {
export interface HeaderJSON {
readonly hash: string;
readonly size: number;
readonly version: number;

@@ -372,23 +371,11 @@ readonly previousblockhash: string;

readonly index: number;
readonly primary: number;
readonly nextconsensus: string;
readonly witnesses: readonly WitnessJSON[];
readonly nextblockhash?: string;
readonly witnesses: readonly WitnessJSON[];
readonly hash: string;
readonly size: number;
readonly confirmations?: number;
}
export interface ConsensusDataJSON {
readonly primary: number;
readonly nonce: string;
}
export interface HeaderJSON extends BlockBaseJSON {
}
export interface BlockJSON extends BlockBaseJSON {
export interface BlockJSON extends HeaderJSON {
readonly tx: readonly TransactionJSON[];
readonly consensusdata?: ConsensusDataJSON;
}
export interface TrimmedBlockJSON extends BlockBaseJSON {
readonly consensusdata?: ConsensusDataJSON;
readonly hashes: readonly string[];
}
export interface NetworkSettingsJSON {

@@ -407,2 +394,9 @@ readonly blockcount: number;

readonly memorypoolmaxtransactions: number;
readonly maxtraceableblocks: number;
readonly maxblocksize: number;
readonly maxblocksystemfee: number;
readonly maxtransactionsperblock: number;
readonly nativeupdatehistory: {
readonly [key: string]: readonly number[];
};
}

@@ -409,0 +403,0 @@ export interface NotificationJSON {

@@ -152,2 +152,4 @@ /// <reference types="node" />

MOD = 162,
POW = 163,
SQRT = 164,
SHL = 168,

@@ -189,3 +191,4 @@ SHR = 169,

ISTYPE = 217,
CONVERT = 219
CONVERT = 219,
PRINT = 255
}

@@ -203,10 +206,4 @@ export declare type OpCode = keyof typeof Op;

export declare enum SysCall {
'System.Binary.Serialize' = "System.Binary.Serialize",
'System.Binary.Deserialize' = "System.Binary.Deserialize",
'System.Binary.Base64Encode' = "System.Binary.Base64Encode",
'System.Binary.Base64Decode' = "System.Binary.Base64Decode",
'System.Contract.Call' = "System.Contract.Call",
'System.Contract.CallEx' = "System.Contract.CallEx",
'System.Contract.CallNative' = "System.Contract.CallNative",
'System.Contract.IsStandard' = "System.Contract.IsStandard",
'System.Contract.GetCallFlags' = "System.Contract.GetCallFlags",

@@ -216,13 +213,8 @@ 'System.Contract.NativeOnPersist' = "System.Contract.NativeOnPersist",

'System.Contract.CreateStandardAccount' = "System.Contract.CreateStandardAccount",
'Neo.Crypto.RIPEMD160' = "Neo.Crypto.RIPEMD160",
'Neo.Crypto.SHA256' = "Neo.Crypto.SHA256",
'Neo.Crypto.VerifyWithECDsaSecp256r1' = "Neo.Crypto.VerifyWithECDsaSecp256r1",
'Neo.Crypto.VerifyWithECDsaSecp256k1' = "Neo.Crypto.VerifyWithECDsaSecp256k1",
'Neo.Crypto.CheckMultisigWithECDsaSecp256r1' = "Neo.Crypto.CheckMultisigWithECDsaSecp256r1",
'Neo.Crypto.CheckMultisigWithECDsaSecp256k1' = "Neo.Crypto.CheckMultisigWithECDsaSecp256k1",
'System.Contract.CreateMultisigAccount' = "System.Contract.CreateMultisigAccount",
'Neo.Crypto.CheckSig' = "Neo.Crypto.CheckSig",
'Neo.Crypto.CheckMultisig' = "Neo.Crypto.CheckMultisig",
'System.Iterator.Create' = "System.Iterator.Create",
'System.Iterator.Next' = "System.Iterator.Next",
'System.Iterator.Value' = "System.Iterator.Value",
'System.Json.Serialize' = "System.Json.Serialize",
'System.Json.Deserialize' = "System.Json.Deserialize",
'System.Runtime.Platform' = "System.Runtime.Platform",

@@ -247,18 +239,7 @@ 'System.Runtime.GetTrigger' = "System.Runtime.GetTrigger",

'System.Storage.Put' = "System.Storage.Put",
'System.Storage.PutEx' = "System.Storage.PutEx",
'System.Storage.Delete' = "System.Storage.Delete",
'System.Binary.Base58Encode' = "System.Binary.Base58Encode",
'System.Binary.Base58Decode' = "System.Binary.Base58Decode",
'System.Binary.Itoa' = "System.Binary.Itoa",
'System.Binary.Atoi' = "System.Binary.Atoi"
'System.Storage.Delete' = "System.Storage.Delete"
}
export declare enum SysCallHashNum {
'System.Binary.Serialize' = 1058799908,
'System.Binary.Deserialize' = 1383911647,
'System.Binary.Base64Encode' = 2898219894,
'System.Binary.Base64Decode' = 3684926659,
'System.Contract.Call' = 1652382546,
'System.Contract.CallEx' = 4008971483,
'System.Contract.CallNative' = 452426599,
'System.Contract.IsStandard' = 3614154117,
'System.Contract.GetCallFlags' = 2514107009,

@@ -268,13 +249,8 @@ 'System.Contract.NativeOnPersist' = 786152595,

'System.Contract.CreateStandardAccount' = 3482945282,
'Neo.Crypto.RIPEMD160' = 651286226,
'Neo.Crypto.SHA256' = 3618403345,
'Neo.Crypto.VerifyWithECDsaSecp256r1' = 2504265080,
'Neo.Crypto.VerifyWithECDsaSecp256k1' = 2117882807,
'Neo.Crypto.CheckMultisigWithECDsaSecp256r1' = 328069039,
'Neo.Crypto.CheckMultisigWithECDsaSecp256k1' = 1472655282,
'System.Contract.CreateMultisigAccount' = 1781786889,
'Neo.Crypto.CheckSig' = 1953789610,
'Neo.Crypto.CheckMultisig' = 2077125797,
'System.Iterator.Create' = 3982817063,
'System.Iterator.Next' = 2617830812,
'System.Iterator.Value' = 4082417437,
'System.Json.Serialize' = 613230155,
'System.Json.Deserialize' = 2812036878,
'System.Runtime.Platform' = 2994339062,

@@ -299,8 +275,3 @@ 'System.Runtime.GetTrigger' = 3917297824,

'System.Storage.Put' = 3862894724,
'System.Storage.PutEx' = 1944165178,
'System.Storage.Delete' = 794346989,
'System.Binary.Base58Encode' = 1062711399,
'System.Binary.Base58Decode' = 1844941367,
'System.Binary.Itoa' = 2078521981,
'System.Binary.Atoi' = 473448683
'System.Storage.Delete' = 794346989
}

@@ -329,1 +300,7 @@ export declare type SysCallName = keyof typeof SysCall;

export declare const toSysCallName: (hash: SysCallHashNum) => SysCallHashName;
export declare const operandSizePrefixTable: {
readonly [K in ByteCode]: number;
};
export declare const operandSizeTable: {
readonly [K in ByteCode]: number;
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toSysCallName = exports.toSysCallHash = exports.sha256 = exports.toVMStateJSON = exports.assertVMStateJSON = exports.isVMStateJSON = exports.assertVMState = exports.VMState = exports.getSysCallHash = exports.assertSysCallHash = exports.assertSysCall = exports.SysCallHashNum = exports.SysCall = exports.assertByteCode = exports.isByteCode = exports.ByteBuffer = exports.Byte = exports.Op = void 0;
exports.operandSizeTable = exports.operandSizePrefixTable = exports.toSysCallName = exports.toSysCallHash = exports.sha256 = exports.toVMStateJSON = exports.assertVMStateJSON = exports.isVMStateJSON = exports.assertVMState = exports.VMState = exports.getSysCallHash = exports.assertSysCallHash = exports.assertSysCall = exports.SysCallHashNum = exports.SysCall = exports.assertByteCode = exports.isByteCode = exports.ByteBuffer = exports.Byte = exports.Op = void 0;
const tslib_1 = require("tslib");

@@ -160,2 +160,4 @@ const crypto_1 = require("crypto");

Op[Op["MOD"] = 162] = "MOD";
Op[Op["POW"] = 163] = "POW";
Op[Op["SQRT"] = 164] = "SQRT";
Op[Op["SHL"] = 168] = "SHL";

@@ -198,2 +200,3 @@ Op[Op["SHR"] = 169] = "SHR";

Op[Op["CONVERT"] = 219] = "CONVERT";
Op[Op["PRINT"] = 255] = "PRINT";
})(Op = exports.Op || (exports.Op = {}));

@@ -211,10 +214,4 @@ exports.Byte = Op;

(function (SysCall) {
SysCall["System.Binary.Serialize"] = "System.Binary.Serialize";
SysCall["System.Binary.Deserialize"] = "System.Binary.Deserialize";
SysCall["System.Binary.Base64Encode"] = "System.Binary.Base64Encode";
SysCall["System.Binary.Base64Decode"] = "System.Binary.Base64Decode";
SysCall["System.Contract.Call"] = "System.Contract.Call";
SysCall["System.Contract.CallEx"] = "System.Contract.CallEx";
SysCall["System.Contract.CallNative"] = "System.Contract.CallNative";
SysCall["System.Contract.IsStandard"] = "System.Contract.IsStandard";
SysCall["System.Contract.GetCallFlags"] = "System.Contract.GetCallFlags";

@@ -224,13 +221,8 @@ SysCall["System.Contract.NativeOnPersist"] = "System.Contract.NativeOnPersist";

SysCall["System.Contract.CreateStandardAccount"] = "System.Contract.CreateStandardAccount";
SysCall["Neo.Crypto.RIPEMD160"] = "Neo.Crypto.RIPEMD160";
SysCall["Neo.Crypto.SHA256"] = "Neo.Crypto.SHA256";
SysCall["Neo.Crypto.VerifyWithECDsaSecp256r1"] = "Neo.Crypto.VerifyWithECDsaSecp256r1";
SysCall["Neo.Crypto.VerifyWithECDsaSecp256k1"] = "Neo.Crypto.VerifyWithECDsaSecp256k1";
SysCall["Neo.Crypto.CheckMultisigWithECDsaSecp256r1"] = "Neo.Crypto.CheckMultisigWithECDsaSecp256r1";
SysCall["Neo.Crypto.CheckMultisigWithECDsaSecp256k1"] = "Neo.Crypto.CheckMultisigWithECDsaSecp256k1";
SysCall["System.Contract.CreateMultisigAccount"] = "System.Contract.CreateMultisigAccount";
SysCall["Neo.Crypto.CheckSig"] = "Neo.Crypto.CheckSig";
SysCall["Neo.Crypto.CheckMultisig"] = "Neo.Crypto.CheckMultisig";
SysCall["System.Iterator.Create"] = "System.Iterator.Create";
SysCall["System.Iterator.Next"] = "System.Iterator.Next";
SysCall["System.Iterator.Value"] = "System.Iterator.Value";
SysCall["System.Json.Serialize"] = "System.Json.Serialize";
SysCall["System.Json.Deserialize"] = "System.Json.Deserialize";
SysCall["System.Runtime.Platform"] = "System.Runtime.Platform";

@@ -255,19 +247,8 @@ SysCall["System.Runtime.GetTrigger"] = "System.Runtime.GetTrigger";

SysCall["System.Storage.Put"] = "System.Storage.Put";
SysCall["System.Storage.PutEx"] = "System.Storage.PutEx";
SysCall["System.Storage.Delete"] = "System.Storage.Delete";
SysCall["System.Binary.Base58Encode"] = "System.Binary.Base58Encode";
SysCall["System.Binary.Base58Decode"] = "System.Binary.Base58Decode";
SysCall["System.Binary.Itoa"] = "System.Binary.Itoa";
SysCall["System.Binary.Atoi"] = "System.Binary.Atoi";
})(SysCall = exports.SysCall || (exports.SysCall = {}));
var SysCallHashNum;
(function (SysCallHashNum) {
SysCallHashNum[SysCallHashNum["System.Binary.Serialize"] = 1058799908] = "System.Binary.Serialize";
SysCallHashNum[SysCallHashNum["System.Binary.Deserialize"] = 1383911647] = "System.Binary.Deserialize";
SysCallHashNum[SysCallHashNum["System.Binary.Base64Encode"] = 2898219894] = "System.Binary.Base64Encode";
SysCallHashNum[SysCallHashNum["System.Binary.Base64Decode"] = 3684926659] = "System.Binary.Base64Decode";
SysCallHashNum[SysCallHashNum["System.Contract.Call"] = 1652382546] = "System.Contract.Call";
SysCallHashNum[SysCallHashNum["System.Contract.CallEx"] = 4008971483] = "System.Contract.CallEx";
SysCallHashNum[SysCallHashNum["System.Contract.CallNative"] = 452426599] = "System.Contract.CallNative";
SysCallHashNum[SysCallHashNum["System.Contract.IsStandard"] = 3614154117] = "System.Contract.IsStandard";
SysCallHashNum[SysCallHashNum["System.Contract.GetCallFlags"] = 2514107009] = "System.Contract.GetCallFlags";

@@ -277,13 +258,8 @@ SysCallHashNum[SysCallHashNum["System.Contract.NativeOnPersist"] = 786152595] = "System.Contract.NativeOnPersist";

SysCallHashNum[SysCallHashNum["System.Contract.CreateStandardAccount"] = 3482945282] = "System.Contract.CreateStandardAccount";
SysCallHashNum[SysCallHashNum["Neo.Crypto.RIPEMD160"] = 651286226] = "Neo.Crypto.RIPEMD160";
SysCallHashNum[SysCallHashNum["Neo.Crypto.SHA256"] = 3618403345] = "Neo.Crypto.SHA256";
SysCallHashNum[SysCallHashNum["Neo.Crypto.VerifyWithECDsaSecp256r1"] = 2504265080] = "Neo.Crypto.VerifyWithECDsaSecp256r1";
SysCallHashNum[SysCallHashNum["Neo.Crypto.VerifyWithECDsaSecp256k1"] = 2117882807] = "Neo.Crypto.VerifyWithECDsaSecp256k1";
SysCallHashNum[SysCallHashNum["Neo.Crypto.CheckMultisigWithECDsaSecp256r1"] = 328069039] = "Neo.Crypto.CheckMultisigWithECDsaSecp256r1";
SysCallHashNum[SysCallHashNum["Neo.Crypto.CheckMultisigWithECDsaSecp256k1"] = 1472655282] = "Neo.Crypto.CheckMultisigWithECDsaSecp256k1";
SysCallHashNum[SysCallHashNum["System.Contract.CreateMultisigAccount"] = 1781786889] = "System.Contract.CreateMultisigAccount";
SysCallHashNum[SysCallHashNum["Neo.Crypto.CheckSig"] = 1953789610] = "Neo.Crypto.CheckSig";
SysCallHashNum[SysCallHashNum["Neo.Crypto.CheckMultisig"] = 2077125797] = "Neo.Crypto.CheckMultisig";
SysCallHashNum[SysCallHashNum["System.Iterator.Create"] = 3982817063] = "System.Iterator.Create";
SysCallHashNum[SysCallHashNum["System.Iterator.Next"] = 2617830812] = "System.Iterator.Next";
SysCallHashNum[SysCallHashNum["System.Iterator.Value"] = 4082417437] = "System.Iterator.Value";
SysCallHashNum[SysCallHashNum["System.Json.Serialize"] = 613230155] = "System.Json.Serialize";
SysCallHashNum[SysCallHashNum["System.Json.Deserialize"] = 2812036878] = "System.Json.Deserialize";
SysCallHashNum[SysCallHashNum["System.Runtime.Platform"] = 2994339062] = "System.Runtime.Platform";

@@ -308,8 +284,3 @@ SysCallHashNum[SysCallHashNum["System.Runtime.GetTrigger"] = 3917297824] = "System.Runtime.GetTrigger";

SysCallHashNum[SysCallHashNum["System.Storage.Put"] = 3862894724] = "System.Storage.Put";
SysCallHashNum[SysCallHashNum["System.Storage.PutEx"] = 1944165178] = "System.Storage.PutEx";
SysCallHashNum[SysCallHashNum["System.Storage.Delete"] = 794346989] = "System.Storage.Delete";
SysCallHashNum[SysCallHashNum["System.Binary.Base58Encode"] = 1062711399] = "System.Binary.Base58Encode";
SysCallHashNum[SysCallHashNum["System.Binary.Base58Decode"] = 1844941367] = "System.Binary.Base58Decode";
SysCallHashNum[SysCallHashNum["System.Binary.Itoa"] = 2078521981] = "System.Binary.Itoa";
SysCallHashNum[SysCallHashNum["System.Binary.Atoi"] = 473448683] = "System.Binary.Atoi";
})(SysCallHashNum = exports.SysCallHashNum || (exports.SysCallHashNum = {}));

@@ -372,3 +343,385 @@ const isSysCall = (value) => SysCall[value] !== undefined;

exports.toSysCallName = (hash) => exports.assertSysCallHash(SysCallHashNum[hash]);
exports.operandSizePrefixTable = {
[Op.PUSHINT8]: 0,
[Op.PUSHINT16]: 0,
[Op.PUSHINT32]: 0,
[Op.PUSHINT64]: 0,
[Op.PUSHINT128]: 0,
[Op.PUSHINT256]: 0,
[Op.PUSHA]: 0,
[Op.PUSHNULL]: 0,
[Op.PUSHDATA1]: 1,
[Op.PUSHDATA2]: 2,
[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Op.LT]: 0,
[Op.LE]: 0,
[Op.GT]: 0,
[Op.GE]: 0,
[Op.MIN]: 0,
[Op.MAX]: 0,
[Op.WITHIN]: 0,
[Op.PACK]: 0,
[Op.UNPACK]: 0,
[Op.NEWARRAY0]: 0,
[Op.NEWARRAY]: 0,
[Op.NEWARRAY_T]: 1,
[Op.NEWSTRUCT0]: 0,
[Op.NEWSTRUCT]: 0,
[Op.NEWMAP]: 0,
[Op.SIZE]: 0,
[Op.HASKEY]: 0,
[Op.KEYS]: 0,
[Op.VALUES]: 0,
[Op.PICKITEM]: 0,
[Op.APPEND]: 0,
[Op.SETITEM]: 0,
[Op.REVERSEITEMS]: 0,
[Op.REMOVE]: 0,
[Op.CLEARITEMS]: 0,
[Op.POPITEM]: 0,
[Op.ISNULL]: 0,
[Op.ISTYPE]: 1,
[Op.CONVERT]: 1,
[Op.PRINT]: 0,
};
//# sourceMappingURL=vm.js.map
import BigNumber from 'bignumber.js';
import { Op } from './models';
export declare const ECDsaVerifyPrice: BigNumber;
export declare const CheckSigPrice: BigNumber;
export declare const getOpCodePrice: (value: Op) => BigNumber;
export declare const signatureContractCost: BigNumber;
export declare const multiSignatureContractCost: (m: number, n: number) => BigNumber;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.multiSignatureContractCost = exports.signatureContractCost = exports.getOpCodePrice = exports.ECDsaVerifyPrice = void 0;
exports.multiSignatureContractCost = exports.signatureContractCost = exports.getOpCodePrice = exports.CheckSigPrice = void 0;
const tslib_1 = require("tslib");
const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
const models_1 = require("./models");
exports.ECDsaVerifyPrice = new bignumber_js_1.default(1000000);
const ScriptBuilder_1 = require("./ScriptBuilder");
exports.CheckSigPrice = new bignumber_js_1.default(1 << 15);
const opCodePrices = {
[models_1.Op.PUSHINT8]: new bignumber_js_1.default(30),
[models_1.Op.PUSHINT16]: new bignumber_js_1.default(30),
[models_1.Op.PUSHINT32]: new bignumber_js_1.default(30),
[models_1.Op.PUSHINT64]: new bignumber_js_1.default(30),
[models_1.Op.PUSHINT128]: new bignumber_js_1.default(120),
[models_1.Op.PUSHINT256]: new bignumber_js_1.default(120),
[models_1.Op.PUSHA]: new bignumber_js_1.default(120),
[models_1.Op.PUSHNULL]: new bignumber_js_1.default(30),
[models_1.Op.PUSHDATA1]: new bignumber_js_1.default(180),
[models_1.Op.PUSHDATA2]: new bignumber_js_1.default(13000),
[models_1.Op.PUSHDATA4]: new bignumber_js_1.default(110000),
[models_1.Op.PUSHM1]: new bignumber_js_1.default(30),
[models_1.Op.PUSH0]: new bignumber_js_1.default(30),
[models_1.Op.PUSH1]: new bignumber_js_1.default(30),
[models_1.Op.PUSH2]: new bignumber_js_1.default(30),
[models_1.Op.PUSH3]: new bignumber_js_1.default(30),
[models_1.Op.PUSH4]: new bignumber_js_1.default(30),
[models_1.Op.PUSH5]: new bignumber_js_1.default(30),
[models_1.Op.PUSH6]: new bignumber_js_1.default(30),
[models_1.Op.PUSH7]: new bignumber_js_1.default(30),
[models_1.Op.PUSH8]: new bignumber_js_1.default(30),
[models_1.Op.PUSH9]: new bignumber_js_1.default(30),
[models_1.Op.PUSH10]: new bignumber_js_1.default(30),
[models_1.Op.PUSH11]: new bignumber_js_1.default(30),
[models_1.Op.PUSH12]: new bignumber_js_1.default(30),
[models_1.Op.PUSH13]: new bignumber_js_1.default(30),
[models_1.Op.PUSH14]: new bignumber_js_1.default(30),
[models_1.Op.PUSH15]: new bignumber_js_1.default(30),
[models_1.Op.PUSH16]: new bignumber_js_1.default(30),
[models_1.Op.NOP]: new bignumber_js_1.default(30),
[models_1.Op.JMP]: new bignumber_js_1.default(70),
[models_1.Op.JMP_L]: new bignumber_js_1.default(70),
[models_1.Op.JMPIF]: new bignumber_js_1.default(70),
[models_1.Op.JMPIF_L]: new bignumber_js_1.default(70),
[models_1.Op.JMPIFNOT]: new bignumber_js_1.default(70),
[models_1.Op.JMPIFNOT_L]: new bignumber_js_1.default(70),
[models_1.Op.JMPEQ]: new bignumber_js_1.default(70),
[models_1.Op.JMPEQ_L]: new bignumber_js_1.default(70),
[models_1.Op.JMPNE]: new bignumber_js_1.default(70),
[models_1.Op.JMPNE_L]: new bignumber_js_1.default(70),
[models_1.Op.JMPGT]: new bignumber_js_1.default(70),
[models_1.Op.JMPGT_L]: new bignumber_js_1.default(70),
[models_1.Op.JMPGE]: new bignumber_js_1.default(70),
[models_1.Op.JMPGE_L]: new bignumber_js_1.default(70),
[models_1.Op.JMPLT]: new bignumber_js_1.default(70),
[models_1.Op.JMPLT_L]: new bignumber_js_1.default(70),
[models_1.Op.JMPLE]: new bignumber_js_1.default(70),
[models_1.Op.JMPLE_L]: new bignumber_js_1.default(70),
[models_1.Op.CALL]: new bignumber_js_1.default(22000),
[models_1.Op.CALL_L]: new bignumber_js_1.default(22000),
[models_1.Op.CALLA]: new bignumber_js_1.default(22000),
[models_1.Op.ABORT]: new bignumber_js_1.default(30),
[models_1.Op.ASSERT]: new bignumber_js_1.default(30),
[models_1.Op.THROW]: new bignumber_js_1.default(22000),
[models_1.Op.TRY]: new bignumber_js_1.default(100),
[models_1.Op.TRY_L]: new bignumber_js_1.default(100),
[models_1.Op.ENDTRY]: new bignumber_js_1.default(100),
[models_1.Op.ENDTRY_L]: new bignumber_js_1.default(100),
[models_1.Op.ENDFINALLY]: new bignumber_js_1.default(100),
[models_1.Op.PUSHINT8]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSHINT16]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSHINT32]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSHINT64]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSHINT128]: new bignumber_js_1.default(1 << 2),
[models_1.Op.PUSHINT256]: new bignumber_js_1.default(1 << 2),
[models_1.Op.PUSHA]: new bignumber_js_1.default(1 << 2),
[models_1.Op.PUSHNULL]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSHDATA1]: new bignumber_js_1.default(1 << 3),
[models_1.Op.PUSHDATA2]: new bignumber_js_1.default(1 << 9),
[models_1.Op.PUSHDATA4]: new bignumber_js_1.default(1 << 12),
[models_1.Op.PUSHM1]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH0]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH1]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH2]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH3]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH4]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH5]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH6]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH7]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH8]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH9]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH10]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH11]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH12]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH13]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH14]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH15]: new bignumber_js_1.default(1 << 0),
[models_1.Op.PUSH16]: new bignumber_js_1.default(1 << 0),
[models_1.Op.NOP]: new bignumber_js_1.default(1 << 0),
[models_1.Op.JMP]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMP_L]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPIF]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPIF_L]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPIFNOT]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPIFNOT_L]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPEQ]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPEQ_L]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPNE]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPNE_L]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPGT]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPGT_L]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPGE]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPGE_L]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPLT]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPLT_L]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPLE]: new bignumber_js_1.default(1 << 1),
[models_1.Op.JMPLE_L]: new bignumber_js_1.default(1 << 1),
[models_1.Op.CALL]: new bignumber_js_1.default(1 << 9),
[models_1.Op.CALL_L]: new bignumber_js_1.default(1 << 9),
[models_1.Op.CALLA]: new bignumber_js_1.default(1 << 9),
[models_1.Op.CALLT]: new bignumber_js_1.default(1 << 15),
[models_1.Op.ABORT]: new bignumber_js_1.default(0),
[models_1.Op.ASSERT]: new bignumber_js_1.default(1 << 0),
[models_1.Op.THROW]: new bignumber_js_1.default(1 << 9),
[models_1.Op.TRY]: new bignumber_js_1.default(1 << 2),
[models_1.Op.TRY_L]: new bignumber_js_1.default(1 << 2),
[models_1.Op.ENDTRY]: new bignumber_js_1.default(1 << 2),
[models_1.Op.ENDTRY_L]: new bignumber_js_1.default(1 << 2),
[models_1.Op.ENDFINALLY]: new bignumber_js_1.default(1 << 2),
[models_1.Op.RET]: new bignumber_js_1.default(0),
[models_1.Op.SYSCALL]: new bignumber_js_1.default(0),
[models_1.Op.DEPTH]: new bignumber_js_1.default(60),
[models_1.Op.DROP]: new bignumber_js_1.default(60),
[models_1.Op.NIP]: new bignumber_js_1.default(60),
[models_1.Op.XDROP]: new bignumber_js_1.default(400),
[models_1.Op.CLEAR]: new bignumber_js_1.default(400),
[models_1.Op.DUP]: new bignumber_js_1.default(60),
[models_1.Op.OVER]: new bignumber_js_1.default(60),
[models_1.Op.PICK]: new bignumber_js_1.default(60),
[models_1.Op.TUCK]: new bignumber_js_1.default(60),
[models_1.Op.SWAP]: new bignumber_js_1.default(60),
[models_1.Op.ROT]: new bignumber_js_1.default(60),
[models_1.Op.ROLL]: new bignumber_js_1.default(400),
[models_1.Op.REVERSE3]: new bignumber_js_1.default(60),
[models_1.Op.REVERSE4]: new bignumber_js_1.default(60),
[models_1.Op.REVERSEN]: new bignumber_js_1.default(400),
[models_1.Op.INITSSLOT]: new bignumber_js_1.default(400),
[models_1.Op.INITSLOT]: new bignumber_js_1.default(1600),
[models_1.Op.LDSFLD0]: new bignumber_js_1.default(60),
[models_1.Op.LDSFLD1]: new bignumber_js_1.default(60),
[models_1.Op.LDSFLD2]: new bignumber_js_1.default(60),
[models_1.Op.LDSFLD3]: new bignumber_js_1.default(60),
[models_1.Op.LDSFLD4]: new bignumber_js_1.default(60),
[models_1.Op.LDSFLD5]: new bignumber_js_1.default(60),
[models_1.Op.LDSFLD6]: new bignumber_js_1.default(60),
[models_1.Op.LDSFLD]: new bignumber_js_1.default(60),
[models_1.Op.STSFLD0]: new bignumber_js_1.default(60),
[models_1.Op.STSFLD1]: new bignumber_js_1.default(60),
[models_1.Op.STSFLD2]: new bignumber_js_1.default(60),
[models_1.Op.STSFLD3]: new bignumber_js_1.default(60),
[models_1.Op.STSFLD4]: new bignumber_js_1.default(60),
[models_1.Op.STSFLD5]: new bignumber_js_1.default(60),
[models_1.Op.STSFLD6]: new bignumber_js_1.default(60),
[models_1.Op.STSFLD]: new bignumber_js_1.default(60),
[models_1.Op.LDLOC0]: new bignumber_js_1.default(60),
[models_1.Op.LDLOC1]: new bignumber_js_1.default(60),
[models_1.Op.LDLOC2]: new bignumber_js_1.default(60),
[models_1.Op.LDLOC3]: new bignumber_js_1.default(60),
[models_1.Op.LDLOC4]: new bignumber_js_1.default(60),
[models_1.Op.LDLOC5]: new bignumber_js_1.default(60),
[models_1.Op.LDLOC6]: new bignumber_js_1.default(60),
[models_1.Op.LDLOC]: new bignumber_js_1.default(60),
[models_1.Op.STLOC0]: new bignumber_js_1.default(60),
[models_1.Op.STLOC1]: new bignumber_js_1.default(60),
[models_1.Op.STLOC2]: new bignumber_js_1.default(60),
[models_1.Op.STLOC3]: new bignumber_js_1.default(60),
[models_1.Op.STLOC4]: new bignumber_js_1.default(60),
[models_1.Op.STLOC5]: new bignumber_js_1.default(60),
[models_1.Op.STLOC6]: new bignumber_js_1.default(60),
[models_1.Op.STLOC]: new bignumber_js_1.default(60),
[models_1.Op.LDARG0]: new bignumber_js_1.default(60),
[models_1.Op.LDARG1]: new bignumber_js_1.default(60),
[models_1.Op.LDARG2]: new bignumber_js_1.default(60),
[models_1.Op.LDARG3]: new bignumber_js_1.default(60),
[models_1.Op.LDARG4]: new bignumber_js_1.default(60),
[models_1.Op.LDARG5]: new bignumber_js_1.default(60),
[models_1.Op.LDARG6]: new bignumber_js_1.default(60),
[models_1.Op.LDARG]: new bignumber_js_1.default(60),
[models_1.Op.STARG0]: new bignumber_js_1.default(60),
[models_1.Op.STARG1]: new bignumber_js_1.default(60),
[models_1.Op.STARG2]: new bignumber_js_1.default(60),
[models_1.Op.STARG3]: new bignumber_js_1.default(60),
[models_1.Op.STARG4]: new bignumber_js_1.default(60),
[models_1.Op.STARG5]: new bignumber_js_1.default(60),
[models_1.Op.STARG6]: new bignumber_js_1.default(60),
[models_1.Op.STARG]: new bignumber_js_1.default(60),
[models_1.Op.NEWBUFFER]: new bignumber_js_1.default(80000),
[models_1.Op.MEMCPY]: new bignumber_js_1.default(80000),
[models_1.Op.CAT]: new bignumber_js_1.default(80000),
[models_1.Op.SUBSTR]: new bignumber_js_1.default(80000),
[models_1.Op.LEFT]: new bignumber_js_1.default(80000),
[models_1.Op.RIGHT]: new bignumber_js_1.default(80000),
[models_1.Op.INVERT]: new bignumber_js_1.default(100),
[models_1.Op.AND]: new bignumber_js_1.default(200),
[models_1.Op.OR]: new bignumber_js_1.default(200),
[models_1.Op.XOR]: new bignumber_js_1.default(200),
[models_1.Op.EQUAL]: new bignumber_js_1.default(1000),
[models_1.Op.NOTEQUAL]: new bignumber_js_1.default(1000),
[models_1.Op.SIGN]: new bignumber_js_1.default(100),
[models_1.Op.ABS]: new bignumber_js_1.default(100),
[models_1.Op.NEGATE]: new bignumber_js_1.default(100),
[models_1.Op.INC]: new bignumber_js_1.default(100),
[models_1.Op.DEC]: new bignumber_js_1.default(100),
[models_1.Op.ADD]: new bignumber_js_1.default(200),
[models_1.Op.SUB]: new bignumber_js_1.default(200),
[models_1.Op.MUL]: new bignumber_js_1.default(300),
[models_1.Op.DIV]: new bignumber_js_1.default(300),
[models_1.Op.MOD]: new bignumber_js_1.default(300),
[models_1.Op.SHL]: new bignumber_js_1.default(300),
[models_1.Op.SHR]: new bignumber_js_1.default(300),
[models_1.Op.NOT]: new bignumber_js_1.default(100),
[models_1.Op.BOOLAND]: new bignumber_js_1.default(200),
[models_1.Op.BOOLOR]: new bignumber_js_1.default(200),
[models_1.Op.NZ]: new bignumber_js_1.default(100),
[models_1.Op.NUMEQUAL]: new bignumber_js_1.default(200),
[models_1.Op.NUMNOTEQUAL]: new bignumber_js_1.default(200),
[models_1.Op.LT]: new bignumber_js_1.default(200),
[models_1.Op.LE]: new bignumber_js_1.default(200),
[models_1.Op.GT]: new bignumber_js_1.default(200),
[models_1.Op.GE]: new bignumber_js_1.default(200),
[models_1.Op.MIN]: new bignumber_js_1.default(200),
[models_1.Op.MAX]: new bignumber_js_1.default(200),
[models_1.Op.WITHIN]: new bignumber_js_1.default(200),
[models_1.Op.PACK]: new bignumber_js_1.default(15000),
[models_1.Op.UNPACK]: new bignumber_js_1.default(15000),
[models_1.Op.NEWARRAY0]: new bignumber_js_1.default(400),
[models_1.Op.NEWARRAY]: new bignumber_js_1.default(15000),
[models_1.Op.NEWARRAY_T]: new bignumber_js_1.default(15000),
[models_1.Op.NEWSTRUCT0]: new bignumber_js_1.default(400),
[models_1.Op.NEWSTRUCT]: new bignumber_js_1.default(15000),
[models_1.Op.NEWMAP]: new bignumber_js_1.default(200),
[models_1.Op.SIZE]: new bignumber_js_1.default(150),
[models_1.Op.HASKEY]: new bignumber_js_1.default(270000),
[models_1.Op.KEYS]: new bignumber_js_1.default(500),
[models_1.Op.VALUES]: new bignumber_js_1.default(270000),
[models_1.Op.PICKITEM]: new bignumber_js_1.default(270000),
[models_1.Op.APPEND]: new bignumber_js_1.default(270000),
[models_1.Op.SETITEM]: new bignumber_js_1.default(270000),
[models_1.Op.REVERSEITEMS]: new bignumber_js_1.default(270000),
[models_1.Op.REMOVE]: new bignumber_js_1.default(500),
[models_1.Op.CLEARITEMS]: new bignumber_js_1.default(400),
[models_1.Op.ISNULL]: new bignumber_js_1.default(60),
[models_1.Op.ISTYPE]: new bignumber_js_1.default(60),
[models_1.Op.CONVERT]: new bignumber_js_1.default(80000),
[models_1.Op.DEPTH]: new bignumber_js_1.default(1 << 1),
[models_1.Op.DROP]: new bignumber_js_1.default(1 << 1),
[models_1.Op.NIP]: new bignumber_js_1.default(1 << 1),
[models_1.Op.XDROP]: new bignumber_js_1.default(1 << 4),
[models_1.Op.CLEAR]: new bignumber_js_1.default(1 << 4),
[models_1.Op.DUP]: new bignumber_js_1.default(1 << 1),
[models_1.Op.OVER]: new bignumber_js_1.default(1 << 1),
[models_1.Op.PICK]: new bignumber_js_1.default(1 << 1),
[models_1.Op.TUCK]: new bignumber_js_1.default(1 << 1),
[models_1.Op.SWAP]: new bignumber_js_1.default(1 << 1),
[models_1.Op.ROT]: new bignumber_js_1.default(1 << 1),
[models_1.Op.ROLL]: new bignumber_js_1.default(1 << 4),
[models_1.Op.REVERSE3]: new bignumber_js_1.default(1 << 1),
[models_1.Op.REVERSE4]: new bignumber_js_1.default(1 << 1),
[models_1.Op.REVERSEN]: new bignumber_js_1.default(1 << 4),
[models_1.Op.INITSSLOT]: new bignumber_js_1.default(1 << 4),
[models_1.Op.INITSLOT]: new bignumber_js_1.default(1 << 6),
[models_1.Op.LDSFLD0]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDSFLD1]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDSFLD2]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDSFLD3]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDSFLD4]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDSFLD5]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDSFLD6]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDSFLD]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STSFLD0]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STSFLD1]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STSFLD2]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STSFLD3]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STSFLD4]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STSFLD5]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STSFLD6]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STSFLD]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDLOC0]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDLOC1]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDLOC2]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDLOC3]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDLOC4]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDLOC5]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDLOC6]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDLOC]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STLOC0]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STLOC1]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STLOC2]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STLOC3]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STLOC4]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STLOC5]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STLOC6]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STLOC]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDARG0]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDARG1]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDARG2]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDARG3]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDARG4]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDARG5]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDARG6]: new bignumber_js_1.default(1 << 1),
[models_1.Op.LDARG]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STARG0]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STARG1]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STARG2]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STARG3]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STARG4]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STARG5]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STARG6]: new bignumber_js_1.default(1 << 1),
[models_1.Op.STARG]: new bignumber_js_1.default(1 << 1),
[models_1.Op.NEWBUFFER]: new bignumber_js_1.default(1 << 8),
[models_1.Op.MEMCPY]: new bignumber_js_1.default(1 << 11),
[models_1.Op.CAT]: new bignumber_js_1.default(1 << 11),
[models_1.Op.SUBSTR]: new bignumber_js_1.default(1 << 11),
[models_1.Op.LEFT]: new bignumber_js_1.default(1 << 11),
[models_1.Op.RIGHT]: new bignumber_js_1.default(1 << 11),
[models_1.Op.INVERT]: new bignumber_js_1.default(1 << 2),
[models_1.Op.AND]: new bignumber_js_1.default(1 << 3),
[models_1.Op.OR]: new bignumber_js_1.default(1 << 3),
[models_1.Op.XOR]: new bignumber_js_1.default(1 << 3),
[models_1.Op.EQUAL]: new bignumber_js_1.default(1 << 5),
[models_1.Op.NOTEQUAL]: new bignumber_js_1.default(1 << 5),
[models_1.Op.SIGN]: new bignumber_js_1.default(1 << 2),
[models_1.Op.ABS]: new bignumber_js_1.default(1 << 2),
[models_1.Op.NEGATE]: new bignumber_js_1.default(1 << 2),
[models_1.Op.INC]: new bignumber_js_1.default(1 << 2),
[models_1.Op.DEC]: new bignumber_js_1.default(1 << 2),
[models_1.Op.ADD]: new bignumber_js_1.default(1 << 3),
[models_1.Op.SUB]: new bignumber_js_1.default(1 << 3),
[models_1.Op.MUL]: new bignumber_js_1.default(1 << 3),
[models_1.Op.DIV]: new bignumber_js_1.default(1 << 3),
[models_1.Op.MOD]: new bignumber_js_1.default(1 << 3),
[models_1.Op.POW]: new bignumber_js_1.default(1 << 6),
[models_1.Op.SQRT]: new bignumber_js_1.default(1 << 11),
[models_1.Op.SHL]: new bignumber_js_1.default(1 << 3),
[models_1.Op.SHR]: new bignumber_js_1.default(1 << 3),
[models_1.Op.NOT]: new bignumber_js_1.default(1 << 2),
[models_1.Op.BOOLAND]: new bignumber_js_1.default(1 << 3),
[models_1.Op.BOOLOR]: new bignumber_js_1.default(1 << 3),
[models_1.Op.NZ]: new bignumber_js_1.default(1 << 2),
[models_1.Op.NUMEQUAL]: new bignumber_js_1.default(1 << 3),
[models_1.Op.NUMNOTEQUAL]: new bignumber_js_1.default(1 << 3),
[models_1.Op.LT]: new bignumber_js_1.default(1 << 3),
[models_1.Op.LE]: new bignumber_js_1.default(1 << 3),
[models_1.Op.GT]: new bignumber_js_1.default(1 << 3),
[models_1.Op.GE]: new bignumber_js_1.default(1 << 3),
[models_1.Op.MIN]: new bignumber_js_1.default(1 << 3),
[models_1.Op.MAX]: new bignumber_js_1.default(1 << 3),
[models_1.Op.WITHIN]: new bignumber_js_1.default(1 << 3),
[models_1.Op.PACK]: new bignumber_js_1.default(1 << 11),
[models_1.Op.UNPACK]: new bignumber_js_1.default(1 << 11),
[models_1.Op.NEWARRAY0]: new bignumber_js_1.default(1 << 4),
[models_1.Op.NEWARRAY]: new bignumber_js_1.default(1 << 9),
[models_1.Op.NEWARRAY_T]: new bignumber_js_1.default(1 << 9),
[models_1.Op.NEWSTRUCT0]: new bignumber_js_1.default(1 << 4),
[models_1.Op.NEWSTRUCT]: new bignumber_js_1.default(1 << 9),
[models_1.Op.NEWMAP]: new bignumber_js_1.default(1 << 3),
[models_1.Op.SIZE]: new bignumber_js_1.default(1 << 2),
[models_1.Op.HASKEY]: new bignumber_js_1.default(1 << 6),
[models_1.Op.KEYS]: new bignumber_js_1.default(1 << 4),
[models_1.Op.VALUES]: new bignumber_js_1.default(1 << 13),
[models_1.Op.PICKITEM]: new bignumber_js_1.default(1 << 6),
[models_1.Op.APPEND]: new bignumber_js_1.default(1 << 13),
[models_1.Op.SETITEM]: new bignumber_js_1.default(1 << 13),
[models_1.Op.REVERSEITEMS]: new bignumber_js_1.default(1 << 13),
[models_1.Op.REMOVE]: new bignumber_js_1.default(1 << 4),
[models_1.Op.CLEARITEMS]: new bignumber_js_1.default(1 << 4),
[models_1.Op.POPITEM]: new bignumber_js_1.default(1 << 4),
[models_1.Op.ISNULL]: new bignumber_js_1.default(1 << 1),
[models_1.Op.ISTYPE]: new bignumber_js_1.default(1 << 1),
[models_1.Op.CONVERT]: new bignumber_js_1.default(1 << 13),
};

@@ -197,3 +202,3 @@ exports.getOpCodePrice = (value) => {

if (fee === undefined) {
throw new Error(`unknown Opcode: ${value}`);
throw new Error(`Unknown Opcode: ${value}`);
}

@@ -204,12 +209,11 @@ return fee;

.multipliedBy(2)
.plus(exports.getOpCodePrice(models_1.Op.PUSHNULL))
.plus(exports.getOpCodePrice(models_1.Op.SYSCALL))
.plus(exports.ECDsaVerifyPrice);
.plus(exports.CheckSigPrice);
exports.multiSignatureContractCost = (m, n) => exports.getOpCodePrice(models_1.Op.PUSHDATA1)
.multipliedBy(m + n)
.plus(exports.getOpCodePrice(models_1.Op.PUSHINT8).multipliedBy(2))
.plus(exports.getOpCodePrice(models_1.Op.PUSHNULL))
.plus(exports.getOpCodePrice(new ScriptBuilder_1.ScriptBuilder().emitPushInt(m).build()[0]))
.plus(exports.getOpCodePrice(new ScriptBuilder_1.ScriptBuilder().emitPushInt(n).build()[0]))
.plus(exports.getOpCodePrice(models_1.Op.SYSCALL))
.plus(exports.ECDsaVerifyPrice.multipliedBy(n));
.plus(exports.CheckSigPrice.multipliedBy(n));
//# sourceMappingURL=prices.js.map
import { BaseScriptBuilder } from './BaseScriptBuilder';
import { UInt160 } from './common';
import { CallFlags } from './models';
import { SysCallName } from './models/vm';

@@ -12,5 +13,5 @@ import { ScriptBuilderParam } from './types';

emitPushArray(params: readonly ScriptBuilderParam[]): this;
emitAppCallInvocation(operation: string, ...params: ScriptBuilderParam[]): this;
emitAppCallInvocation(operation: string, flags: CallFlags, ...params: ScriptBuilderParam[]): this;
emitAppCallVerification(scriptHash: UInt160): this;
emitDynamicAppCall(scriptHash: UInt160, operation: string, ...params: ScriptBuilderParam[]): this;
emitDynamicAppCall(scriptHash: UInt160, operation: string, flags: CallFlags, ...params: readonly ScriptBuilderParam[]): this;
emitPushMap(params: ReadonlyMap<ScriptBuilderParam, ScriptBuilderParam>): this;

@@ -17,0 +18,0 @@ emitPushObject(params: {

@@ -6,3 +6,2 @@ "use strict";

const common_1 = require("./common");
const models_1 = require("./models");
const vm_1 = require("./models/vm");

@@ -14,3 +13,3 @@ const paramUtils_1 = require("./paramUtils");

this.pushParamCallbacks = {
undefined: () => this.emitOp('PUSHNULL'),
undefined: () => this.emitPush(Buffer.alloc(0, 0)),
array: (param) => this.emitPushArray(param),

@@ -51,5 +50,5 @@ map: (param) => this.emitPushMap(param),

}
emitAppCallInvocation(operation, ...params) {
emitAppCallInvocation(operation, flags, ...params) {
this.emitPushArray(params);
this.emitPushInt(models_1.CallFlags.All);
this.emitPushInt(flags);
return this.emitPushParam(operation);

@@ -61,4 +60,4 @@ }

}
emitDynamicAppCall(scriptHash, operation, ...params) {
this.emitAppCallInvocation(operation, ...params);
emitDynamicAppCall(scriptHash, operation, flags, ...params) {
this.emitAppCallInvocation(operation, flags, ...params);
return this.emitAppCallVerification(scriptHash);

@@ -65,0 +64,0 @@ }

@@ -8,3 +8,3 @@ /// <reference types="node" />

import { ECPoint, UInt160, UInt160Hex, UInt256 } from './common';
import { AccountContract, AttributeTypeModel, OracleResponseCode, TriggerTypeJSON, VerifyResultModel, VMState, VMStateJSON, Wildcard } from './models';
import { AccountContract, AttributeTypeModel, CallFlags, OracleResponseCode, TriggerTypeJSON, VerifyResultModel, VMState, VMStateJSON, Wildcard } from './models';
export declare type AddressString = string;

@@ -65,2 +65,3 @@ export declare type Hash256String = string;

readonly index: number;
readonly primaryIndex: number;
readonly nextConsensus: AddressString;

@@ -72,9 +73,5 @@ readonly witnesses: readonly Witness[];

}
export interface ConsensusData {
readonly primaryIndex: number;
readonly nonce: BufferString;
}
export interface Block extends Header {
export interface Block {
readonly header: Header;
readonly transactions: readonly ConfirmedTransaction[];
readonly consensusData?: ConsensusData;
}

@@ -405,2 +402,3 @@ export interface TransactionReceipt {

readonly offset: number;
readonly safe: boolean;
}

@@ -454,2 +452,16 @@ export interface ContractEventDescriptorClient {

}
export interface MethodToken {
readonly hash: string;
readonly method: string;
readonly paramCount: number;
readonly hasReturnValue: boolean;
readonly callFlags: CallFlags;
}
export interface NefFile {
readonly magic: number;
readonly compiler: string;
readonly script: string;
readonly tokens: readonly MethodToken[];
readonly checksum: number;
}
declare const OpaqueTagSymbol: unique symbol;

@@ -512,3 +524,4 @@ export interface ForwardValue {

readonly id: number;
readonly script: BufferString;
readonly updateCounter: number;
readonly nef: NefFile;
readonly hash: UInt160Hex;

@@ -642,3 +655,3 @@ readonly manifest: ContractManifest;

readonly type: 'Integer';
readonly value: BigNumber;
readonly value: BN;
}

@@ -691,4 +704,3 @@ export interface RawByteStringStackItem extends RawStackItemBase {

}
export interface RawApplicationLogData {
readonly txId?: string;
export interface RawExecutionData {
readonly trigger: TriggerTypeJSON;

@@ -701,2 +713,7 @@ readonly vmState: VMStateJSON;

}
export interface RawApplicationLogData {
readonly txId?: string;
readonly blockHash?: string;
readonly executions: readonly RawExecutionData[];
}
export interface ParamJSONArray extends ReadonlyArray<ParamJSON> {

@@ -724,3 +741,2 @@ }

export interface StorageItem {
readonly address: string;
readonly key: string;

@@ -727,0 +743,0 @@ readonly value: string;

@@ -61,2 +61,3 @@ /// <reference types="node" />

ONE_HUNDRED_MILLION_FIXED8: BN;
MAP_STACK_ITEM_MAX_KEY_SIZE: number;
uInt160ToBuffer: (value: UInt160 | UInt160Hex) => Buffer;

@@ -89,3 +90,5 @@ add0x: (value: string) => string;

hexToECPoint: (value: ECPoint | ECPointHex) => ECPoint;
base64ToECPoint: (value: ECPoint | ECPointHex) => ECPoint;
ecPointToString: (value: ECPoint | ECPointHex) => string;
ecPointToBase64: (value: ECPoint | ECPointHex) => ECPointHex;
ecPointCompare: (a: ECPoint | ECPointHex, b: ECPoint | ECPointHex) => 0 | 1 | -1;

@@ -111,2 +114,4 @@ stringToECPoint: (value: ECPoint | ECPointHex) => ECPoint;

ContractManagement: string;
StdLib: string;
CryptoLib: string;
Ledger: string;

@@ -122,2 +127,4 @@ NEO: string;

ContractManagement: UInt160;
StdLib: UInt160;
CryptoLib: UInt160;
Ledger: UInt160;

@@ -124,0 +131,0 @@ NEO: UInt160;

@@ -60,2 +60,4 @@ import { makeErrorWithCode } from '@neo-one/utils';

const bufferToECPoint = asECPoint;
const ecPointToBase64 = (value) => typeof value === 'string' ? value : value.toString('base64');
const base64ToECPoint = (value) => bufferToECPoint(typeof value === 'string' ? Buffer.from(value, 'base64') : value);
const ecPointToHex = (value) => typeof value === 'string' ? value : value.toString('hex');

@@ -124,13 +126,17 @@ const hexToECPoint = (value) => bufferToECPoint(typeof value === 'string' ? Buffer.from(value, 'hex') : value);

const nativeScriptHashes = {
ContractManagement: '0xa501d7d7d10983673b61b7a2d3a813b36f9f0e43',
Ledger: '0x971d69c6dd10ce88e7dfffec1dc603c6125a8764',
NEO: '0xf61eebf573ea36593fd43aa150c055ad7906ab83',
GAS: '0x70e2301955bf1e74cbb31d18c2f96972abadb328',
Policy: '0x79bcd398505eb779df6e67e4be6c14cded08e2f2',
RoleManagement: '0x597b1471bbce497b7809e2c8f10db67050008b02',
Oracle: '0x8dc0e742cbdfdeda51ff8a8b78d46829144c80ee',
NameService: '0xa2b524b68dfe43a9d56af84f443c6b9843b8028c',
ContractManagement: '0xfffdc93764dbaddd97c48f252a53ea4643faa3fd',
StdLib: '0xacce6fd80d44e1796aa0c2c625e9e4e0ce39efc0',
CryptoLib: '0x726cb6e0cd8628a1350a611384688911ab75f51b',
Ledger: '0xda65b600f7124ce6c79950c1772a36403104f2be',
NEO: '0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5',
GAS: '0xd2a4cff31913016155e38e474a2c06d08be276cf',
Policy: '0xcc5e4edd9f5f8dba8bb65734541df7a1c081c67b',
RoleManagement: '0x49cf4e5378ffcd4dec034fd98a174c5491e395e2',
Oracle: '0xfe924b7cfe89ddd271abaf7210a80a7e11178758',
NameService: '0x7a8fcf0392cd625647907afa8e45cc66872b596b',
};
const nativeHashes = {
ContractManagement: hexToUInt160(nativeScriptHashes.ContractManagement),
StdLib: hexToUInt160(nativeScriptHashes.StdLib),
CryptoLib: hexToUInt160(nativeScriptHashes.CryptoLib),
Ledger: hexToUInt160(nativeScriptHashes.Ledger),

@@ -144,2 +150,3 @@ NEO: hexToUInt160(nativeScriptHashes.NEO),

};
const MAP_STACK_ITEM_MAX_KEY_SIZE = 64;
export const common = {

@@ -171,2 +178,3 @@ D8,

ONE_HUNDRED_MILLION_FIXED8,
MAP_STACK_ITEM_MAX_KEY_SIZE,
uInt160ToBuffer,

@@ -199,3 +207,5 @@ add0x,

hexToECPoint,
base64ToECPoint,
ecPointToString,
ecPointToBase64,
ecPointCompare,

@@ -202,0 +212,0 @@ stringToECPoint,

@@ -23,2 +23,3 @@ import { utils as commonUtils } from '@neo-one/utils';

case 'Hash160':
case 'Address':
value = common.uInt160ToBuffer(crypto.addressToScriptHash({

@@ -25,0 +26,0 @@ addressVersion: common.NEO_ADDRESS_VERSION,

@@ -29,2 +29,3 @@ /// <reference types="node" />

hash256: (value: Buffer) => UInt256;
calculateHash: (value: Buffer) => UInt256;
sign: ({ message, privateKey }: {

@@ -89,3 +90,2 @@ readonly message: Buffer;

createPrivateKey: () => PrivateKey;
isMultiSigContract: (script: Buffer) => boolean;
isMultiSigContractWithResult: (script: Buffer) => MultiSigResult;

@@ -92,0 +92,0 @@ isSignatureContract: (script: Buffer) => boolean;

@@ -29,2 +29,3 @@ import ECKey from '@neo-one/ec-key';

const hash256 = (value) => common.bufferToUInt256(sha256(sha256(value)));
const calculateHash = (value) => common.bufferToUInt256(sha256(value));
const hmacSha512 = (key, data) => createHmac('sha512', key).update(data).digest();

@@ -168,4 +169,3 @@ const sign = ({ message, privateKey }) => {

builder.emitPushECPoint(publicKey);
builder.emitOp('PUSHNULL');
builder.emitSysCall('Neo.Crypto.VerifyWithECDsaSecp256r1');
builder.emitSysCall('Neo.Crypto.CheckSig');
return builder.build();

@@ -181,4 +181,3 @@ };

builder.emitPushECPoint(publicKey);
builder.emitOp('PUSHNULL');
builder.emitSysCall('Neo.Crypto.VerifyWithECDsaSecp256r1');
builder.emitSysCall('Neo.Crypto.CheckSig');
return builder.build();

@@ -216,4 +215,3 @@ };

builder.emitPushInt(publicKeysSorted.length);
builder.emitOp('PUSHNULL');
builder.emitSysCall('Neo.Crypto.CheckMultisigWithECDsaSecp256r1');
builder.emitSysCall('Neo.Crypto.CheckMultisig');
return builder.build();

@@ -255,4 +253,3 @@ };

builder.emitPushInt(publicKeysSorted.length);
builder.emitOp('PUSHNULL');
builder.emitSysCall('Neo.Crypto.CheckMultisigWithECDsaSecp256r1');
builder.emitSysCall('Neo.Crypto.CheckMultisig');
return builder.build();

@@ -352,75 +349,4 @@ };

};
const checkMultisigWithECDsaSecp256r1 = Buffer.from('138defaf', 'hex');
const verifyECDsaSecp256r1 = Buffer.from('95440d78', 'hex');
const isMultiSigContract = (script) => {
let m = 0;
let n = 0;
let i = 0;
if (script.length < 43)
return false;
if (script[i] > Op.PUSH16)
return false;
if (script[i] < Op.PUSH1 && script[i] !== 1 && script[i] !== 2)
return false;
switch (script[i]) {
case Op.PUSHINT8:
m = script[++i];
++i;
break;
case Op.PUSHINT16:
m = script.readUInt16LE(++i);
i += 2;
break;
default:
const b = script[i];
if (b >= Op.PUSH1 && b <= Op.PUSH16) {
m = b - Op.PUSH0;
++i;
break;
}
return false;
}
if (m < 1 || m > 1024)
return false;
while (script[i] == Op.PUSHDATA1) {
if (script.length <= i + 35)
return false;
if (script[++i] !== 33)
return false;
i += 34;
++n;
}
if (n < m || n > 1024)
return false;
switch (script[i]) {
case Op.PUSHINT8:
if (n != script[++i])
return false;
++i;
break;
case Op.PUSHINT16:
if (script.length < i + 3 || n != script.readUInt16LE(++i))
return false;
i += 2;
break;
default:
const b = script[i];
if (b >= Op.PUSH1 && b <= Op.PUSH16) {
if (n !== b - Op.PUSH0)
return false;
++i;
break;
}
return false;
}
if (script[i++] !== Op.PUSHNULL)
return false;
if (script[i++] !== Op.SYSCALL)
return false;
if (script.length !== i + 4)
return false;
if (!script.slice(i).equals(checkMultisigWithECDsaSecp256r1))
return false;
return true;
};
const checkMultisig = Buffer.from('7bce6ca5', 'hex');
const checkSig = Buffer.from('747476aa', 'hex');
const isMultiSigContractWithResult = (script) => {

@@ -431,3 +357,3 @@ let m = 0;

let points = [];
if (script.length < 43)
if (script.length < 42)
return { result: false };

@@ -490,19 +416,16 @@ if (script[i] > Op.PUSH16)

}
if (script[i++] !== Op.PUSHNULL)
if (script.length !== i + 5)
return { result: false };
if (script[i++] !== Op.SYSCALL)
return { result: false };
if (script.length !== i + 4)
if (!script.slice(i).equals(checkMultisig))
return { result: false };
if (!script.slice(i).equals(checkMultisigWithECDsaSecp256r1))
return { result: false };
return { result: true, m, n, points };
};
const isSignatureContract = (script) => script.length === 41 &&
const isSignatureContract = (script) => script.length === 40 &&
script[0] === Op.PUSHDATA1 &&
script[1] === 33 &&
script[35] === Op.PUSHNULL &&
script[36] === Op.SYSCALL &&
script.slice(37).equals(verifyECDsaSecp256r1);
const isStandardContract = (script) => isSignatureContract(script) || isMultiSigContract(script);
script[35] === Op.SYSCALL &&
script.slice(36).equals(checkSig);
const isStandardContract = (script) => isSignatureContract(script) || isMultiSigContractWithResult(script).result;
const HARDENED_KEY_OFFSET = 0x80000000;

@@ -651,2 +574,3 @@ const EXTENDED_KEY_BYTES = 78;

hash256,
calculateHash,
sign,

@@ -682,3 +606,2 @@ verify,

createPrivateKey,
isMultiSigContract,
isMultiSigContractWithResult,

@@ -685,0 +608,0 @@ isSignatureContract,

@@ -379,3 +379,3 @@ /// <reference types="node" />

export declare const InvalidJumpError: {
new (op: "PUSHINT8" | "PUSHINT16" | "PUSHINT32" | "PUSHINT64" | "PUSHINT128" | "PUSHINT256" | "PUSHA" | "PUSHNULL" | "PUSHDATA1" | "PUSHDATA2" | "PUSHDATA4" | "PUSHM1" | "PUSH0" | "PUSH1" | "PUSH2" | "PUSH3" | "PUSH4" | "PUSH5" | "PUSH6" | "PUSH7" | "PUSH8" | "PUSH9" | "PUSH10" | "PUSH11" | "PUSH12" | "PUSH13" | "PUSH14" | "PUSH15" | "PUSH16" | "NOP" | "JMP" | "JMP_L" | "JMPIF" | "JMPIF_L" | "JMPIFNOT" | "JMPIFNOT_L" | "JMPEQ" | "JMPEQ_L" | "JMPNE" | "JMPNE_L" | "JMPGT" | "JMPGT_L" | "JMPGE" | "JMPGE_L" | "JMPLT" | "JMPLT_L" | "JMPLE" | "JMPLE_L" | "CALL" | "CALL_L" | "CALLA" | "CALLT" | "ABORT" | "ASSERT" | "THROW" | "TRY" | "TRY_L" | "ENDTRY" | "ENDTRY_L" | "ENDFINALLY" | "RET" | "SYSCALL" | "DEPTH" | "DROP" | "NIP" | "XDROP" | "CLEAR" | "DUP" | "OVER" | "PICK" | "TUCK" | "SWAP" | "ROT" | "ROLL" | "REVERSE3" | "REVERSE4" | "REVERSEN" | "INITSSLOT" | "INITSLOT" | "LDSFLD0" | "LDSFLD1" | "LDSFLD2" | "LDSFLD3" | "LDSFLD4" | "LDSFLD5" | "LDSFLD6" | "LDSFLD" | "STSFLD0" | "STSFLD1" | "STSFLD2" | "STSFLD3" | "STSFLD4" | "STSFLD5" | "STSFLD6" | "STSFLD" | "LDLOC0" | "LDLOC1" | "LDLOC2" | "LDLOC3" | "LDLOC4" | "LDLOC5" | "LDLOC6" | "LDLOC" | "STLOC0" | "STLOC1" | "STLOC2" | "STLOC3" | "STLOC4" | "STLOC5" | "STLOC6" | "STLOC" | "LDARG0" | "LDARG1" | "LDARG2" | "LDARG3" | "LDARG4" | "LDARG5" | "LDARG6" | "LDARG" | "STARG0" | "STARG1" | "STARG2" | "STARG3" | "STARG4" | "STARG5" | "STARG6" | "STARG" | "NEWBUFFER" | "MEMCPY" | "CAT" | "SUBSTR" | "LEFT" | "RIGHT" | "INVERT" | "AND" | "OR" | "XOR" | "EQUAL" | "NOTEQUAL" | "SIGN" | "ABS" | "NEGATE" | "INC" | "DEC" | "ADD" | "SUB" | "MUL" | "DIV" | "MOD" | "SHL" | "SHR" | "NOT" | "BOOLAND" | "BOOLOR" | "NZ" | "NUMEQUAL" | "NUMNOTEQUAL" | "LT" | "LE" | "GT" | "GE" | "MIN" | "MAX" | "WITHIN" | "PACK" | "UNPACK" | "NEWARRAY0" | "NEWARRAY" | "NEWARRAY_T" | "NEWSTRUCT0" | "NEWSTRUCT" | "NEWMAP" | "SIZE" | "HASKEY" | "KEYS" | "VALUES" | "PICKITEM" | "APPEND" | "SETITEM" | "REVERSEITEMS" | "REMOVE" | "CLEARITEMS" | "POPITEM" | "ISNULL" | "ISTYPE" | "CONVERT"): {
new (op: "PUSHINT8" | "PUSHINT16" | "PUSHINT32" | "PUSHINT64" | "PUSHINT128" | "PUSHINT256" | "PUSHA" | "PUSHNULL" | "PUSHDATA1" | "PUSHDATA2" | "PUSHDATA4" | "PUSHM1" | "PUSH0" | "PUSH1" | "PUSH2" | "PUSH3" | "PUSH4" | "PUSH5" | "PUSH6" | "PUSH7" | "PUSH8" | "PUSH9" | "PUSH10" | "PUSH11" | "PUSH12" | "PUSH13" | "PUSH14" | "PUSH15" | "PUSH16" | "NOP" | "JMP" | "JMP_L" | "JMPIF" | "JMPIF_L" | "JMPIFNOT" | "JMPIFNOT_L" | "JMPEQ" | "JMPEQ_L" | "JMPNE" | "JMPNE_L" | "JMPGT" | "JMPGT_L" | "JMPGE" | "JMPGE_L" | "JMPLT" | "JMPLT_L" | "JMPLE" | "JMPLE_L" | "CALL" | "CALL_L" | "CALLA" | "CALLT" | "ABORT" | "ASSERT" | "THROW" | "TRY" | "TRY_L" | "ENDTRY" | "ENDTRY_L" | "ENDFINALLY" | "RET" | "SYSCALL" | "DEPTH" | "DROP" | "NIP" | "XDROP" | "CLEAR" | "DUP" | "OVER" | "PICK" | "TUCK" | "SWAP" | "ROT" | "ROLL" | "REVERSE3" | "REVERSE4" | "REVERSEN" | "INITSSLOT" | "INITSLOT" | "LDSFLD0" | "LDSFLD1" | "LDSFLD2" | "LDSFLD3" | "LDSFLD4" | "LDSFLD5" | "LDSFLD6" | "LDSFLD" | "STSFLD0" | "STSFLD1" | "STSFLD2" | "STSFLD3" | "STSFLD4" | "STSFLD5" | "STSFLD6" | "STSFLD" | "LDLOC0" | "LDLOC1" | "LDLOC2" | "LDLOC3" | "LDLOC4" | "LDLOC5" | "LDLOC6" | "LDLOC" | "STLOC0" | "STLOC1" | "STLOC2" | "STLOC3" | "STLOC4" | "STLOC5" | "STLOC6" | "STLOC" | "LDARG0" | "LDARG1" | "LDARG2" | "LDARG3" | "LDARG4" | "LDARG5" | "LDARG6" | "LDARG" | "STARG0" | "STARG1" | "STARG2" | "STARG3" | "STARG4" | "STARG5" | "STARG6" | "STARG" | "NEWBUFFER" | "MEMCPY" | "CAT" | "SUBSTR" | "LEFT" | "RIGHT" | "INVERT" | "AND" | "OR" | "XOR" | "EQUAL" | "NOTEQUAL" | "SIGN" | "ABS" | "NEGATE" | "INC" | "DEC" | "ADD" | "SUB" | "MUL" | "DIV" | "MOD" | "POW" | "SQRT" | "SHL" | "SHR" | "NOT" | "BOOLAND" | "BOOLOR" | "NZ" | "NUMEQUAL" | "NUMNOTEQUAL" | "LT" | "LE" | "GT" | "GE" | "MIN" | "MAX" | "WITHIN" | "PACK" | "UNPACK" | "NEWARRAY0" | "NEWARRAY" | "NEWARRAY_T" | "NEWSTRUCT0" | "NEWSTRUCT" | "NEWMAP" | "SIZE" | "HASKEY" | "KEYS" | "VALUES" | "PICKITEM" | "APPEND" | "SETITEM" | "REVERSEITEMS" | "REMOVE" | "CLEARITEMS" | "POPITEM" | "ISNULL" | "ISTYPE" | "CONVERT" | "PRINT"): {
readonly name: string;

@@ -391,3 +391,3 @@ readonly code: string;

export declare const InvalidScriptError: {
new (op: "PUSHINT8" | "PUSHINT16" | "PUSHINT32" | "PUSHINT64" | "PUSHINT128" | "PUSHINT256" | "PUSHA" | "PUSHNULL" | "PUSHDATA1" | "PUSHDATA2" | "PUSHDATA4" | "PUSHM1" | "PUSH0" | "PUSH1" | "PUSH2" | "PUSH3" | "PUSH4" | "PUSH5" | "PUSH6" | "PUSH7" | "PUSH8" | "PUSH9" | "PUSH10" | "PUSH11" | "PUSH12" | "PUSH13" | "PUSH14" | "PUSH15" | "PUSH16" | "NOP" | "JMP" | "JMP_L" | "JMPIF" | "JMPIF_L" | "JMPIFNOT" | "JMPIFNOT_L" | "JMPEQ" | "JMPEQ_L" | "JMPNE" | "JMPNE_L" | "JMPGT" | "JMPGT_L" | "JMPGE" | "JMPGE_L" | "JMPLT" | "JMPLT_L" | "JMPLE" | "JMPLE_L" | "CALL" | "CALL_L" | "CALLA" | "CALLT" | "ABORT" | "ASSERT" | "THROW" | "TRY" | "TRY_L" | "ENDTRY" | "ENDTRY_L" | "ENDFINALLY" | "RET" | "SYSCALL" | "DEPTH" | "DROP" | "NIP" | "XDROP" | "CLEAR" | "DUP" | "OVER" | "PICK" | "TUCK" | "SWAP" | "ROT" | "ROLL" | "REVERSE3" | "REVERSE4" | "REVERSEN" | "INITSSLOT" | "INITSLOT" | "LDSFLD0" | "LDSFLD1" | "LDSFLD2" | "LDSFLD3" | "LDSFLD4" | "LDSFLD5" | "LDSFLD6" | "LDSFLD" | "STSFLD0" | "STSFLD1" | "STSFLD2" | "STSFLD3" | "STSFLD4" | "STSFLD5" | "STSFLD6" | "STSFLD" | "LDLOC0" | "LDLOC1" | "LDLOC2" | "LDLOC3" | "LDLOC4" | "LDLOC5" | "LDLOC6" | "LDLOC" | "STLOC0" | "STLOC1" | "STLOC2" | "STLOC3" | "STLOC4" | "STLOC5" | "STLOC6" | "STLOC" | "LDARG0" | "LDARG1" | "LDARG2" | "LDARG3" | "LDARG4" | "LDARG5" | "LDARG6" | "LDARG" | "STARG0" | "STARG1" | "STARG2" | "STARG3" | "STARG4" | "STARG5" | "STARG6" | "STARG" | "NEWBUFFER" | "MEMCPY" | "CAT" | "SUBSTR" | "LEFT" | "RIGHT" | "INVERT" | "AND" | "OR" | "XOR" | "EQUAL" | "NOTEQUAL" | "SIGN" | "ABS" | "NEGATE" | "INC" | "DEC" | "ADD" | "SUB" | "MUL" | "DIV" | "MOD" | "SHL" | "SHR" | "NOT" | "BOOLAND" | "BOOLOR" | "NZ" | "NUMEQUAL" | "NUMNOTEQUAL" | "LT" | "LE" | "GT" | "GE" | "MIN" | "MAX" | "WITHIN" | "PACK" | "UNPACK" | "NEWARRAY0" | "NEWARRAY" | "NEWARRAY_T" | "NEWSTRUCT0" | "NEWSTRUCT" | "NEWMAP" | "SIZE" | "HASKEY" | "KEYS" | "VALUES" | "PICKITEM" | "APPEND" | "SETITEM" | "REVERSEITEMS" | "REMOVE" | "CLEARITEMS" | "POPITEM" | "ISNULL" | "ISTYPE" | "CONVERT", ip: number): {
new (op: "PUSHINT8" | "PUSHINT16" | "PUSHINT32" | "PUSHINT64" | "PUSHINT128" | "PUSHINT256" | "PUSHA" | "PUSHNULL" | "PUSHDATA1" | "PUSHDATA2" | "PUSHDATA4" | "PUSHM1" | "PUSH0" | "PUSH1" | "PUSH2" | "PUSH3" | "PUSH4" | "PUSH5" | "PUSH6" | "PUSH7" | "PUSH8" | "PUSH9" | "PUSH10" | "PUSH11" | "PUSH12" | "PUSH13" | "PUSH14" | "PUSH15" | "PUSH16" | "NOP" | "JMP" | "JMP_L" | "JMPIF" | "JMPIF_L" | "JMPIFNOT" | "JMPIFNOT_L" | "JMPEQ" | "JMPEQ_L" | "JMPNE" | "JMPNE_L" | "JMPGT" | "JMPGT_L" | "JMPGE" | "JMPGE_L" | "JMPLT" | "JMPLT_L" | "JMPLE" | "JMPLE_L" | "CALL" | "CALL_L" | "CALLA" | "CALLT" | "ABORT" | "ASSERT" | "THROW" | "TRY" | "TRY_L" | "ENDTRY" | "ENDTRY_L" | "ENDFINALLY" | "RET" | "SYSCALL" | "DEPTH" | "DROP" | "NIP" | "XDROP" | "CLEAR" | "DUP" | "OVER" | "PICK" | "TUCK" | "SWAP" | "ROT" | "ROLL" | "REVERSE3" | "REVERSE4" | "REVERSEN" | "INITSSLOT" | "INITSLOT" | "LDSFLD0" | "LDSFLD1" | "LDSFLD2" | "LDSFLD3" | "LDSFLD4" | "LDSFLD5" | "LDSFLD6" | "LDSFLD" | "STSFLD0" | "STSFLD1" | "STSFLD2" | "STSFLD3" | "STSFLD4" | "STSFLD5" | "STSFLD6" | "STSFLD" | "LDLOC0" | "LDLOC1" | "LDLOC2" | "LDLOC3" | "LDLOC4" | "LDLOC5" | "LDLOC6" | "LDLOC" | "STLOC0" | "STLOC1" | "STLOC2" | "STLOC3" | "STLOC4" | "STLOC5" | "STLOC6" | "STLOC" | "LDARG0" | "LDARG1" | "LDARG2" | "LDARG3" | "LDARG4" | "LDARG5" | "LDARG6" | "LDARG" | "STARG0" | "STARG1" | "STARG2" | "STARG3" | "STARG4" | "STARG5" | "STARG6" | "STARG" | "NEWBUFFER" | "MEMCPY" | "CAT" | "SUBSTR" | "LEFT" | "RIGHT" | "INVERT" | "AND" | "OR" | "XOR" | "EQUAL" | "NOTEQUAL" | "SIGN" | "ABS" | "NEGATE" | "INC" | "DEC" | "ADD" | "SUB" | "MUL" | "DIV" | "MOD" | "POW" | "SQRT" | "SHL" | "SHR" | "NOT" | "BOOLAND" | "BOOLOR" | "NZ" | "NUMEQUAL" | "NUMNOTEQUAL" | "LT" | "LE" | "GT" | "GE" | "MIN" | "MAX" | "WITHIN" | "PACK" | "UNPACK" | "NEWARRAY0" | "NEWARRAY" | "NEWARRAY_T" | "NEWSTRUCT0" | "NEWSTRUCT" | "NEWMAP" | "SIZE" | "HASKEY" | "KEYS" | "VALUES" | "PICKITEM" | "APPEND" | "SETITEM" | "REVERSEITEMS" | "REMOVE" | "CLEARITEMS" | "POPITEM" | "ISNULL" | "ISTYPE" | "CONVERT" | "PRINT", ip: number): {
readonly name: string;

@@ -394,0 +394,0 @@ readonly code: string;

@@ -19,2 +19,3 @@ export * from './BinaryWriter';

export * from './disassembleByteCode';
export * from './script';
export * from './Script';
export * from './Instruction';

@@ -19,4 +19,5 @@ export * from './BinaryWriter';

export * from './disassembleByteCode';
export * from './script';
export * from './Script';
export * from './Instruction';
//# sourceMappingURL=index.js.map

@@ -11,1 +11,7 @@ export declare enum CallFlags {

}
export declare const isCallFlag: (value: number) => value is CallFlags;
export declare const assertCallFlags: (value: number) => CallFlags;
export declare type CallFlagsJSON = keyof typeof CallFlags;
export declare const isCallFlagsJSON: (type: string) => type is "None" | "All" | "ReadStates" | "WriteStates" | "AllowCall" | "AllowNotify" | "States" | "ReadOnly";
export declare const assertCallFlagsJSON: (type: string) => CallFlagsJSON;
export declare const toCallFlagsJSON: (type: CallFlags) => "None" | "All" | "ReadStates" | "WriteStates" | "AllowCall" | "AllowNotify" | "States" | "ReadOnly";

@@ -0,1 +1,2 @@

import { InvalidFormatError } from '../common';
export var CallFlags;

@@ -12,3 +13,18 @@ (function (CallFlags) {

})(CallFlags || (CallFlags = {}));
export const isCallFlag = (value) => CallFlags[value] !== undefined;
export const assertCallFlags = (value) => {
if (isCallFlag(value)) {
return value;
}
throw new InvalidFormatError(`Expected StackItemType, found: ${value}`);
};
export const isCallFlagsJSON = (type) => CallFlags[type] !== undefined;
export const assertCallFlagsJSON = (type) => {
if (isCallFlagsJSON(type)) {
return type;
}
throw new InvalidFormatError();
};
export const toCallFlagsJSON = (type) => assertCallFlagsJSON(CallFlags[type]);
//# sourceMappingURL=CallFlags.js.map

@@ -6,3 +6,2 @@ export * from './AccountContract';

export * from './Serializable';
export * from './StorageFlagsModel';
export * from './WitnessModel';

@@ -9,0 +8,0 @@ export * from './WitnessScopeModel';

@@ -6,3 +6,2 @@ export * from './AccountContract';

export * from './Serializable';
export * from './StorageFlagsModel';
export * from './WitnessModel';

@@ -9,0 +8,0 @@ export * from './WitnessScopeModel';

@@ -25,5 +25,5 @@ /// <reference types="node" />

serializeHeader(writer: BinaryWriter): void;
serializeBeforeChecksumBase(writer: BinaryWriter): void;
serializeForChecksumBase(writer: BinaryWriter): void;
serializeWireBase(writer: BinaryWriter): void;
serializeJSON(): NefFileJSON;
}

@@ -9,3 +9,3 @@ import { crypto } from '../crypto';

this.serializeWire = createSerializeWire(this.serializeWireBase.bind(this));
this.serializeForChecksum = createSerializeWire(this.serializeBeforeChecksumBase.bind(this));
this.serializeForChecksum = createSerializeWire(this.serializeForChecksumBase.bind(this));
this.headerSize = utils.lazy(() => IOHelper.sizeOfUInt32LE + IOHelper.sizeOfFixedString(64));

@@ -21,3 +21,3 @@ this.sizeInternal = utils.lazy(() => this.headerSize() +

this.script = script;
this.checkSum = checkSum ?? crypto.sha256(this.serializeForChecksum()).readUInt32LE(0);
this.checkSum = checkSum ?? crypto.hash256(this.serializeForChecksum()).readUInt32LE(0);
}

@@ -31,3 +31,3 @@ get size() {

}
serializeBeforeChecksumBase(writer) {
serializeForChecksumBase(writer) {
this.serializeHeader(writer);

@@ -40,3 +40,3 @@ writer.writeUInt16LE(0);

serializeWireBase(writer) {
this.serializeBeforeChecksumBase(writer);
this.serializeForChecksumBase(writer);
writer.writeUInt32LE(this.checkSum);

@@ -43,0 +43,0 @@ }

/// <reference types="node" />
import { BinaryWriter } from '../BinaryWriter';
import { UInt256 } from '../common';
export declare type SerializeWire = () => Buffer;

@@ -12,2 +13,2 @@ export interface SerializableWire {

}
export declare const getHashData: (wire: Buffer, magic: number) => Buffer;
export declare const getSignData: (hash: UInt256, magic: number) => Buffer;

@@ -7,6 +7,6 @@ import { BinaryWriter } from '../BinaryWriter';

};
export const getHashData = (wire, magic) => {
export const getSignData = (hash, magic) => {
const writer = new BinaryWriter();
writer.writeUInt32LE(magic);
writer.writeBytes(wire);
writer.writeUInt256(hash);
return writer.toBuffer();

@@ -13,0 +13,0 @@ };

@@ -55,5 +55,5 @@ /// <reference types="node" />

constructor({ version, nonce, attributes, witnesses, signers, validUntilBlock, script, hash, messageMagic, }: FeelessTransactionModelAdd<TAttribute, TWitness, TSigner>);
get message(): Buffer;
get hash(): UInt256;
get hashHex(): UInt256Hex;
get message(): Buffer;
cloneWithConsensusOptions(options: TransactionConsensusOptions): FeelessTransactionModel<TAttribute, TWitness, TSigner>;

@@ -60,0 +60,0 @@ sign(_key: PrivateKey): FeelessTransactionModel<TAttribute, TWitness, TSigner>;

@@ -5,3 +5,3 @@ import BN from 'bn.js';

import { utils } from '../../utils';
import { createSerializeWire, getHashData } from '../Serializable';
import { createSerializeWire, getSignData } from '../Serializable';
import { WitnessModel } from '../WitnessModel';

@@ -17,3 +17,3 @@ export const MAX_TRANSACTION_ATTRIBUTES = 16;

this.hashHexInternal = utils.lazy(() => common.uInt256ToHex(this.hash));
this.messageInternal = utils.lazy(() => getHashData(this.serializeUnsigned(), this.messageMagic));
this.messageInternal = utils.lazy(() => getSignData(this.hash, this.messageMagic));
this.version = version === undefined ? DEFAULT_VERSION : version;

@@ -29,3 +29,4 @@ this.nonce = nonce;

const hashIn = hash;
this.hashInternal = hashIn === undefined ? utils.lazy(() => crypto.hash256(this.message)) : () => hashIn;
this.hashInternal =
hashIn === undefined ? utils.lazy(() => crypto.calculateHash(this.serializeUnsigned())) : () => hashIn;
if (this.attributes.length > MAX_TRANSACTION_ATTRIBUTES) {

@@ -35,2 +36,5 @@ throw new InvalidFormatError(`Expected less than ${MAX_TRANSACTION_ATTRIBUTES} attributes, found: ${attributes.length}`);

}
get message() {
return this.messageInternal();
}
get hash() {

@@ -42,5 +46,2 @@ return this.hashInternal();

}
get message() {
return this.messageInternal();
}
cloneWithConsensusOptions(options) {

@@ -47,0 +48,0 @@ return new FeelessTransactionModel({

@@ -5,3 +5,2 @@ import { JSONObject } from '@neo-one/utils';

import { ContractParameterTypeModel } from './ContractParameterTypeModel';
import { StorageFlagsModel } from './StorageFlagsModel';
import { AttributeTypeModel } from './transaction';

@@ -168,5 +167,3 @@ import { TriggerType, TriggerTypeJSON } from './trigger';

readonly value: string;
readonly isConstant: boolean;
}
export declare type StorageFlagsJSON = keyof typeof StorageFlagsModel;
export interface WitnessJSON {

@@ -339,3 +336,3 @@ readonly invocation: string;

readonly manifest: ContractManifestJSON;
readonly activeblockindex: number;
readonly updatehistory: readonly number[];
}

@@ -365,3 +362,5 @@ export interface Nep17TransfersJSON {

}
export interface BlockBaseJSON {
export interface HeaderJSON {
readonly hash: string;
readonly size: number;
readonly version: number;

@@ -372,23 +371,11 @@ readonly previousblockhash: string;

readonly index: number;
readonly primary: number;
readonly nextconsensus: string;
readonly witnesses: readonly WitnessJSON[];
readonly nextblockhash?: string;
readonly witnesses: readonly WitnessJSON[];
readonly hash: string;
readonly size: number;
readonly confirmations?: number;
}
export interface ConsensusDataJSON {
readonly primary: number;
readonly nonce: string;
}
export interface HeaderJSON extends BlockBaseJSON {
}
export interface BlockJSON extends BlockBaseJSON {
export interface BlockJSON extends HeaderJSON {
readonly tx: readonly TransactionJSON[];
readonly consensusdata?: ConsensusDataJSON;
}
export interface TrimmedBlockJSON extends BlockBaseJSON {
readonly consensusdata?: ConsensusDataJSON;
readonly hashes: readonly string[];
}
export interface NetworkSettingsJSON {

@@ -407,2 +394,9 @@ readonly blockcount: number;

readonly memorypoolmaxtransactions: number;
readonly maxtraceableblocks: number;
readonly maxblocksize: number;
readonly maxblocksystemfee: number;
readonly maxtransactionsperblock: number;
readonly nativeupdatehistory: {
readonly [key: string]: readonly number[];
};
}

@@ -409,0 +403,0 @@ export interface NotificationJSON {

@@ -152,2 +152,4 @@ /// <reference types="node" />

MOD = 162,
POW = 163,
SQRT = 164,
SHL = 168,

@@ -189,3 +191,4 @@ SHR = 169,

ISTYPE = 217,
CONVERT = 219
CONVERT = 219,
PRINT = 255
}

@@ -203,10 +206,4 @@ export declare type OpCode = keyof typeof Op;

export declare enum SysCall {
'System.Binary.Serialize' = "System.Binary.Serialize",
'System.Binary.Deserialize' = "System.Binary.Deserialize",
'System.Binary.Base64Encode' = "System.Binary.Base64Encode",
'System.Binary.Base64Decode' = "System.Binary.Base64Decode",
'System.Contract.Call' = "System.Contract.Call",
'System.Contract.CallEx' = "System.Contract.CallEx",
'System.Contract.CallNative' = "System.Contract.CallNative",
'System.Contract.IsStandard' = "System.Contract.IsStandard",
'System.Contract.GetCallFlags' = "System.Contract.GetCallFlags",

@@ -216,13 +213,8 @@ 'System.Contract.NativeOnPersist' = "System.Contract.NativeOnPersist",

'System.Contract.CreateStandardAccount' = "System.Contract.CreateStandardAccount",
'Neo.Crypto.RIPEMD160' = "Neo.Crypto.RIPEMD160",
'Neo.Crypto.SHA256' = "Neo.Crypto.SHA256",
'Neo.Crypto.VerifyWithECDsaSecp256r1' = "Neo.Crypto.VerifyWithECDsaSecp256r1",
'Neo.Crypto.VerifyWithECDsaSecp256k1' = "Neo.Crypto.VerifyWithECDsaSecp256k1",
'Neo.Crypto.CheckMultisigWithECDsaSecp256r1' = "Neo.Crypto.CheckMultisigWithECDsaSecp256r1",
'Neo.Crypto.CheckMultisigWithECDsaSecp256k1' = "Neo.Crypto.CheckMultisigWithECDsaSecp256k1",
'System.Contract.CreateMultisigAccount' = "System.Contract.CreateMultisigAccount",
'Neo.Crypto.CheckSig' = "Neo.Crypto.CheckSig",
'Neo.Crypto.CheckMultisig' = "Neo.Crypto.CheckMultisig",
'System.Iterator.Create' = "System.Iterator.Create",
'System.Iterator.Next' = "System.Iterator.Next",
'System.Iterator.Value' = "System.Iterator.Value",
'System.Json.Serialize' = "System.Json.Serialize",
'System.Json.Deserialize' = "System.Json.Deserialize",
'System.Runtime.Platform' = "System.Runtime.Platform",

@@ -247,18 +239,7 @@ 'System.Runtime.GetTrigger' = "System.Runtime.GetTrigger",

'System.Storage.Put' = "System.Storage.Put",
'System.Storage.PutEx' = "System.Storage.PutEx",
'System.Storage.Delete' = "System.Storage.Delete",
'System.Binary.Base58Encode' = "System.Binary.Base58Encode",
'System.Binary.Base58Decode' = "System.Binary.Base58Decode",
'System.Binary.Itoa' = "System.Binary.Itoa",
'System.Binary.Atoi' = "System.Binary.Atoi"
'System.Storage.Delete' = "System.Storage.Delete"
}
export declare enum SysCallHashNum {
'System.Binary.Serialize' = 1058799908,
'System.Binary.Deserialize' = 1383911647,
'System.Binary.Base64Encode' = 2898219894,
'System.Binary.Base64Decode' = 3684926659,
'System.Contract.Call' = 1652382546,
'System.Contract.CallEx' = 4008971483,
'System.Contract.CallNative' = 452426599,
'System.Contract.IsStandard' = 3614154117,
'System.Contract.GetCallFlags' = 2514107009,

@@ -268,13 +249,8 @@ 'System.Contract.NativeOnPersist' = 786152595,

'System.Contract.CreateStandardAccount' = 3482945282,
'Neo.Crypto.RIPEMD160' = 651286226,
'Neo.Crypto.SHA256' = 3618403345,
'Neo.Crypto.VerifyWithECDsaSecp256r1' = 2504265080,
'Neo.Crypto.VerifyWithECDsaSecp256k1' = 2117882807,
'Neo.Crypto.CheckMultisigWithECDsaSecp256r1' = 328069039,
'Neo.Crypto.CheckMultisigWithECDsaSecp256k1' = 1472655282,
'System.Contract.CreateMultisigAccount' = 1781786889,
'Neo.Crypto.CheckSig' = 1953789610,
'Neo.Crypto.CheckMultisig' = 2077125797,
'System.Iterator.Create' = 3982817063,
'System.Iterator.Next' = 2617830812,
'System.Iterator.Value' = 4082417437,
'System.Json.Serialize' = 613230155,
'System.Json.Deserialize' = 2812036878,
'System.Runtime.Platform' = 2994339062,

@@ -299,8 +275,3 @@ 'System.Runtime.GetTrigger' = 3917297824,

'System.Storage.Put' = 3862894724,
'System.Storage.PutEx' = 1944165178,
'System.Storage.Delete' = 794346989,
'System.Binary.Base58Encode' = 1062711399,
'System.Binary.Base58Decode' = 1844941367,
'System.Binary.Itoa' = 2078521981,
'System.Binary.Atoi' = 473448683
'System.Storage.Delete' = 794346989
}

@@ -329,1 +300,7 @@ export declare type SysCallName = keyof typeof SysCall;

export declare const toSysCallName: (hash: SysCallHashNum) => SysCallHashName;
export declare const operandSizePrefixTable: {
readonly [K in ByteCode]: number;
};
export declare const operandSizeTable: {
readonly [K in ByteCode]: number;
};

@@ -156,2 +156,4 @@ import { createHash } from 'crypto';

Op[Op["MOD"] = 162] = "MOD";
Op[Op["POW"] = 163] = "POW";
Op[Op["SQRT"] = 164] = "SQRT";
Op[Op["SHL"] = 168] = "SHL";

@@ -194,2 +196,3 @@ Op[Op["SHR"] = 169] = "SHR";

Op[Op["CONVERT"] = 219] = "CONVERT";
Op[Op["PRINT"] = 255] = "PRINT";
})(Op || (Op = {}));

@@ -207,10 +210,4 @@ export const Byte = Op;

(function (SysCall) {
SysCall["System.Binary.Serialize"] = "System.Binary.Serialize";
SysCall["System.Binary.Deserialize"] = "System.Binary.Deserialize";
SysCall["System.Binary.Base64Encode"] = "System.Binary.Base64Encode";
SysCall["System.Binary.Base64Decode"] = "System.Binary.Base64Decode";
SysCall["System.Contract.Call"] = "System.Contract.Call";
SysCall["System.Contract.CallEx"] = "System.Contract.CallEx";
SysCall["System.Contract.CallNative"] = "System.Contract.CallNative";
SysCall["System.Contract.IsStandard"] = "System.Contract.IsStandard";
SysCall["System.Contract.GetCallFlags"] = "System.Contract.GetCallFlags";

@@ -220,13 +217,8 @@ SysCall["System.Contract.NativeOnPersist"] = "System.Contract.NativeOnPersist";

SysCall["System.Contract.CreateStandardAccount"] = "System.Contract.CreateStandardAccount";
SysCall["Neo.Crypto.RIPEMD160"] = "Neo.Crypto.RIPEMD160";
SysCall["Neo.Crypto.SHA256"] = "Neo.Crypto.SHA256";
SysCall["Neo.Crypto.VerifyWithECDsaSecp256r1"] = "Neo.Crypto.VerifyWithECDsaSecp256r1";
SysCall["Neo.Crypto.VerifyWithECDsaSecp256k1"] = "Neo.Crypto.VerifyWithECDsaSecp256k1";
SysCall["Neo.Crypto.CheckMultisigWithECDsaSecp256r1"] = "Neo.Crypto.CheckMultisigWithECDsaSecp256r1";
SysCall["Neo.Crypto.CheckMultisigWithECDsaSecp256k1"] = "Neo.Crypto.CheckMultisigWithECDsaSecp256k1";
SysCall["System.Contract.CreateMultisigAccount"] = "System.Contract.CreateMultisigAccount";
SysCall["Neo.Crypto.CheckSig"] = "Neo.Crypto.CheckSig";
SysCall["Neo.Crypto.CheckMultisig"] = "Neo.Crypto.CheckMultisig";
SysCall["System.Iterator.Create"] = "System.Iterator.Create";
SysCall["System.Iterator.Next"] = "System.Iterator.Next";
SysCall["System.Iterator.Value"] = "System.Iterator.Value";
SysCall["System.Json.Serialize"] = "System.Json.Serialize";
SysCall["System.Json.Deserialize"] = "System.Json.Deserialize";
SysCall["System.Runtime.Platform"] = "System.Runtime.Platform";

@@ -251,19 +243,8 @@ SysCall["System.Runtime.GetTrigger"] = "System.Runtime.GetTrigger";

SysCall["System.Storage.Put"] = "System.Storage.Put";
SysCall["System.Storage.PutEx"] = "System.Storage.PutEx";
SysCall["System.Storage.Delete"] = "System.Storage.Delete";
SysCall["System.Binary.Base58Encode"] = "System.Binary.Base58Encode";
SysCall["System.Binary.Base58Decode"] = "System.Binary.Base58Decode";
SysCall["System.Binary.Itoa"] = "System.Binary.Itoa";
SysCall["System.Binary.Atoi"] = "System.Binary.Atoi";
})(SysCall || (SysCall = {}));
export var SysCallHashNum;
(function (SysCallHashNum) {
SysCallHashNum[SysCallHashNum["System.Binary.Serialize"] = 1058799908] = "System.Binary.Serialize";
SysCallHashNum[SysCallHashNum["System.Binary.Deserialize"] = 1383911647] = "System.Binary.Deserialize";
SysCallHashNum[SysCallHashNum["System.Binary.Base64Encode"] = 2898219894] = "System.Binary.Base64Encode";
SysCallHashNum[SysCallHashNum["System.Binary.Base64Decode"] = 3684926659] = "System.Binary.Base64Decode";
SysCallHashNum[SysCallHashNum["System.Contract.Call"] = 1652382546] = "System.Contract.Call";
SysCallHashNum[SysCallHashNum["System.Contract.CallEx"] = 4008971483] = "System.Contract.CallEx";
SysCallHashNum[SysCallHashNum["System.Contract.CallNative"] = 452426599] = "System.Contract.CallNative";
SysCallHashNum[SysCallHashNum["System.Contract.IsStandard"] = 3614154117] = "System.Contract.IsStandard";
SysCallHashNum[SysCallHashNum["System.Contract.GetCallFlags"] = 2514107009] = "System.Contract.GetCallFlags";

@@ -273,13 +254,8 @@ SysCallHashNum[SysCallHashNum["System.Contract.NativeOnPersist"] = 786152595] = "System.Contract.NativeOnPersist";

SysCallHashNum[SysCallHashNum["System.Contract.CreateStandardAccount"] = 3482945282] = "System.Contract.CreateStandardAccount";
SysCallHashNum[SysCallHashNum["Neo.Crypto.RIPEMD160"] = 651286226] = "Neo.Crypto.RIPEMD160";
SysCallHashNum[SysCallHashNum["Neo.Crypto.SHA256"] = 3618403345] = "Neo.Crypto.SHA256";
SysCallHashNum[SysCallHashNum["Neo.Crypto.VerifyWithECDsaSecp256r1"] = 2504265080] = "Neo.Crypto.VerifyWithECDsaSecp256r1";
SysCallHashNum[SysCallHashNum["Neo.Crypto.VerifyWithECDsaSecp256k1"] = 2117882807] = "Neo.Crypto.VerifyWithECDsaSecp256k1";
SysCallHashNum[SysCallHashNum["Neo.Crypto.CheckMultisigWithECDsaSecp256r1"] = 328069039] = "Neo.Crypto.CheckMultisigWithECDsaSecp256r1";
SysCallHashNum[SysCallHashNum["Neo.Crypto.CheckMultisigWithECDsaSecp256k1"] = 1472655282] = "Neo.Crypto.CheckMultisigWithECDsaSecp256k1";
SysCallHashNum[SysCallHashNum["System.Contract.CreateMultisigAccount"] = 1781786889] = "System.Contract.CreateMultisigAccount";
SysCallHashNum[SysCallHashNum["Neo.Crypto.CheckSig"] = 1953789610] = "Neo.Crypto.CheckSig";
SysCallHashNum[SysCallHashNum["Neo.Crypto.CheckMultisig"] = 2077125797] = "Neo.Crypto.CheckMultisig";
SysCallHashNum[SysCallHashNum["System.Iterator.Create"] = 3982817063] = "System.Iterator.Create";
SysCallHashNum[SysCallHashNum["System.Iterator.Next"] = 2617830812] = "System.Iterator.Next";
SysCallHashNum[SysCallHashNum["System.Iterator.Value"] = 4082417437] = "System.Iterator.Value";
SysCallHashNum[SysCallHashNum["System.Json.Serialize"] = 613230155] = "System.Json.Serialize";
SysCallHashNum[SysCallHashNum["System.Json.Deserialize"] = 2812036878] = "System.Json.Deserialize";
SysCallHashNum[SysCallHashNum["System.Runtime.Platform"] = 2994339062] = "System.Runtime.Platform";

@@ -304,8 +280,3 @@ SysCallHashNum[SysCallHashNum["System.Runtime.GetTrigger"] = 3917297824] = "System.Runtime.GetTrigger";

SysCallHashNum[SysCallHashNum["System.Storage.Put"] = 3862894724] = "System.Storage.Put";
SysCallHashNum[SysCallHashNum["System.Storage.PutEx"] = 1944165178] = "System.Storage.PutEx";
SysCallHashNum[SysCallHashNum["System.Storage.Delete"] = 794346989] = "System.Storage.Delete";
SysCallHashNum[SysCallHashNum["System.Binary.Base58Encode"] = 1062711399] = "System.Binary.Base58Encode";
SysCallHashNum[SysCallHashNum["System.Binary.Base58Decode"] = 1844941367] = "System.Binary.Base58Decode";
SysCallHashNum[SysCallHashNum["System.Binary.Itoa"] = 2078521981] = "System.Binary.Itoa";
SysCallHashNum[SysCallHashNum["System.Binary.Atoi"] = 473448683] = "System.Binary.Atoi";
})(SysCallHashNum || (SysCallHashNum = {}));

@@ -368,3 +339,385 @@ const isSysCall = (value) => SysCall[value] !== undefined;

export const toSysCallName = (hash) => assertSysCallHash(SysCallHashNum[hash]);
export const operandSizePrefixTable = {
[Op.PUSHINT8]: 0,
[Op.PUS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POW]: 0,
[Op.SQRT]: 0,
[Op.SHL]: 0,
[Op.SHR]: 0,
[Op.NOT]: 0,
[Op.BOOLAND]: 0,
[Op.BOOLOR]: 0,
[Op.NZ]: 0,
[Op.NUMEQUAL]: 0,
[Op.NUMNOTEQUAL]: 0,
[Op.LT]: 0,
[Op.LE]: 0,
[Op.GT]: 0,
[Op.GE]: 0,
[Op.MIN]: 0,
[Op.MAX]: 0,
[Op.WITHIN]: 0,
[Op.PACK]: 0,
[Op.UNPACK]: 0,
[Op.NEWARRAY0]: 0,
[Op.NEWARRAY]: 0,
[Op.NEWARRAY_T]: 1,
[Op.NEWSTRUCT0]: 0,
[Op.NEWSTRUCT]: 0,
[Op.NEWMAP]: 0,
[Op.SIZE]: 0,
[Op.HASKEY]: 0,
[Op.KEYS]: 0,
[Op.VALUES]: 0,
[Op.PICKITEM]: 0,
[Op.APPEND]: 0,
[Op.SETITEM]: 0,
[Op.REVERSEITEMS]: 0,
[Op.REMOVE]: 0,
[Op.CLEARITEMS]: 0,
[Op.POPITEM]: 0,
[Op.ISNULL]: 0,
[Op.ISTYPE]: 1,
[Op.CONVERT]: 1,
[Op.PRINT]: 0,
};
//# sourceMappingURL=vm.js.map
import BigNumber from 'bignumber.js';
import { Op } from './models';
export declare const ECDsaVerifyPrice: BigNumber;
export declare const CheckSigPrice: BigNumber;
export declare const getOpCodePrice: (value: Op) => BigNumber;
export declare const signatureContractCost: BigNumber;
export declare const multiSignatureContractCost: (m: number, n: number) => BigNumber;
import BigNumber from 'bignumber.js';
import { Op } from './models';
export const ECDsaVerifyPrice = new BigNumber(1000000);
import { ScriptBuilder } from './ScriptBuilder';
export const CheckSigPrice = new BigNumber(1 << 15);
const opCodePrices = {
[Op.PUSHINT8]: new BigNumber(30),
[Op.PUSHINT16]: new BigNumber(30),
[Op.PUSHINT32]: new BigNumber(30),
[Op.PUSHINT64]: new BigNumber(30),
[Op.PUSHINT128]: new BigNumber(120),
[Op.PUSHINT256]: new BigNumber(120),
[Op.PUSHA]: new BigNumber(120),
[Op.PUSHNULL]: new BigNumber(30),
[Op.PUSHDATA1]: new BigNumber(180),
[Op.PUSHDATA2]: new BigNumber(13000),
[Op.PUSHDATA4]: new BigNumber(110000),
[Op.PUSHM1]: new BigNumber(30),
[Op.PUSH0]: new BigNumber(30),
[Op.PUSH1]: new BigNumber(30),
[Op.PUSH2]: new BigNumber(30),
[Op.PUSH3]: new BigNumber(30),
[Op.PUSH4]: new BigNumber(30),
[Op.PUSH5]: new BigNumber(30),
[Op.PUSH6]: new BigNumber(30),
[Op.PUSH7]: new BigNumber(30),
[Op.PUSH8]: new BigNumber(30),
[Op.PUSH9]: new BigNumber(30),
[Op.PUSH10]: new BigNumber(30),
[Op.PUSH11]: new BigNumber(30),
[Op.PUSH12]: new BigNumber(30),
[Op.PUSH13]: new BigNumber(30),
[Op.PUSH14]: new BigNumber(30),
[Op.PUSH15]: new BigNumber(30),
[Op.PUSH16]: new BigNumber(30),
[Op.NOP]: new BigNumber(30),
[Op.JMP]: new BigNumber(70),
[Op.JMP_L]: new BigNumber(70),
[Op.JMPIF]: new BigNumber(70),
[Op.JMPIF_L]: new BigNumber(70),
[Op.JMPIFNOT]: new BigNumber(70),
[Op.JMPIFNOT_L]: new BigNumber(70),
[Op.JMPEQ]: new BigNumber(70),
[Op.JMPEQ_L]: new BigNumber(70),
[Op.JMPNE]: new BigNumber(70),
[Op.JMPNE_L]: new BigNumber(70),
[Op.JMPGT]: new BigNumber(70),
[Op.JMPGT_L]: new BigNumber(70),
[Op.JMPGE]: new BigNumber(70),
[Op.JMPGE_L]: new BigNumber(70),
[Op.JMPLT]: new BigNumber(70),
[Op.JMPLT_L]: new BigNumber(70),
[Op.JMPLE]: new BigNumber(70),
[Op.JMPLE_L]: new BigNumber(70),
[Op.CALL]: new BigNumber(22000),
[Op.CALL_L]: new BigNumber(22000),
[Op.CALLA]: new BigNumber(22000),
[Op.ABORT]: new BigNumber(30),
[Op.ASSERT]: new BigNumber(30),
[Op.THROW]: new BigNumber(22000),
[Op.TRY]: new BigNumber(100),
[Op.TRY_L]: new BigNumber(100),
[Op.ENDTRY]: new BigNumber(100),
[Op.ENDTRY_L]: new BigNumber(100),
[Op.ENDFINALLY]: new BigNumber(100),
[Op.PUSHINT8]: new BigNumber(1 << 0),
[Op.PUSHINT16]: new BigNumber(1 << 0),
[Op.PUSHINT32]: new BigNumber(1 << 0),
[Op.PUSHINT64]: new BigNumber(1 << 0),
[Op.PUSHINT128]: new BigNumber(1 << 2),
[Op.PUSHINT256]: new BigNumber(1 << 2),
[Op.PUSHA]: new BigNumber(1 << 2),
[Op.PUSHNULL]: new BigNumber(1 << 0),
[Op.PUSHDATA1]: new BigNumber(1 << 3),
[Op.PUSHDATA2]: new BigNumber(1 << 9),
[Op.PUSHDATA4]: new BigNumber(1 << 12),
[Op.PUSHM1]: new BigNumber(1 << 0),
[Op.PUSH0]: new BigNumber(1 << 0),
[Op.PUSH1]: new BigNumber(1 << 0),
[Op.PUSH2]: new BigNumber(1 << 0),
[Op.PUSH3]: new BigNumber(1 << 0),
[Op.PUSH4]: new BigNumber(1 << 0),
[Op.PUSH5]: new BigNumber(1 << 0),
[Op.PUSH6]: new BigNumber(1 << 0),
[Op.PUSH7]: new BigNumber(1 << 0),
[Op.PUSH8]: new BigNumber(1 << 0),
[Op.PUSH9]: new BigNumber(1 << 0),
[Op.PUSH10]: new BigNumber(1 << 0),
[Op.PUSH11]: new BigNumber(1 << 0),
[Op.PUSH12]: new BigNumber(1 << 0),
[Op.PUSH13]: new BigNumber(1 << 0),
[Op.PUSH14]: new BigNumber(1 << 0),
[Op.PUSH15]: new BigNumber(1 << 0),
[Op.PUSH16]: new BigNumber(1 << 0),
[Op.NOP]: new BigNumber(1 << 0),
[Op.JMP]: new BigNumber(1 << 1),
[Op.JMP_L]: new BigNumber(1 << 1),
[Op.JMPIF]: new BigNumber(1 << 1),
[Op.JMPIF_L]: new BigNumber(1 << 1),
[Op.JMPIFNOT]: new BigNumber(1 << 1),
[Op.JMPIFNOT_L]: new BigNumber(1 << 1),
[Op.JMPEQ]: new BigNumber(1 << 1),
[Op.JMPEQ_L]: new BigNumber(1 << 1),
[Op.JMPNE]: new BigNumber(1 << 1),
[Op.JMPNE_L]: new BigNumber(1 << 1),
[Op.JMPGT]: new BigNumber(1 << 1),
[Op.JMPGT_L]: new BigNumber(1 << 1),
[Op.JMPGE]: new BigNumber(1 << 1),
[Op.JMPGE_L]: new BigNumber(1 << 1),
[Op.JMPLT]: new BigNumber(1 << 1),
[Op.JMPLT_L]: new BigNumber(1 << 1),
[Op.JMPLE]: new BigNumber(1 << 1),
[Op.JMPLE_L]: new BigNumber(1 << 1),
[Op.CALL]: new BigNumber(1 << 9),
[Op.CALL_L]: new BigNumber(1 << 9),
[Op.CALLA]: new BigNumber(1 << 9),
[Op.CALLT]: new BigNumber(1 << 15),
[Op.ABORT]: new BigNumber(0),
[Op.ASSERT]: new BigNumber(1 << 0),
[Op.THROW]: new BigNumber(1 << 9),
[Op.TRY]: new BigNumber(1 << 2),
[Op.TRY_L]: new BigNumber(1 << 2),
[Op.ENDTRY]: new BigNumber(1 << 2),
[Op.ENDTRY_L]: new BigNumber(1 << 2),
[Op.ENDFINALLY]: new BigNumber(1 << 2),
[Op.RET]: new BigNumber(0),
[Op.SYSCALL]: new BigNumber(0),
[Op.DEPTH]: new BigNumber(60),
[Op.DROP]: new BigNumber(60),
[Op.NIP]: new BigNumber(60),
[Op.XDROP]: new BigNumber(400),
[Op.CLEAR]: new BigNumber(400),
[Op.DUP]: new BigNumber(60),
[Op.OVER]: new BigNumber(60),
[Op.PICK]: new BigNumber(60),
[Op.TUCK]: new BigNumber(60),
[Op.SWAP]: new BigNumber(60),
[Op.ROT]: new BigNumber(60),
[Op.ROLL]: new BigNumber(400),
[Op.REVERSE3]: new BigNumber(60),
[Op.REVERSE4]: new BigNumber(60),
[Op.REVERSEN]: new BigNumber(400),
[Op.INITSSLOT]: new BigNumber(400),
[Op.INITSLOT]: new BigNumber(1600),
[Op.LDSFLD0]: new BigNumber(60),
[Op.LDSFLD1]: new BigNumber(60),
[Op.LDSFLD2]: new BigNumber(60),
[Op.LDSFLD3]: new BigNumber(60),
[Op.LDSFLD4]: new BigNumber(60),
[Op.LDSFLD5]: new BigNumber(60),
[Op.LDSFLD6]: new BigNumber(60),
[Op.LDSFLD]: new BigNumber(60),
[Op.STSFLD0]: new BigNumber(60),
[Op.STSFLD1]: new BigNumber(60),
[Op.STSFLD2]: new BigNumber(60),
[Op.STSFLD3]: new BigNumber(60),
[Op.STSFLD4]: new BigNumber(60),
[Op.STSFLD5]: new BigNumber(60),
[Op.STSFLD6]: new BigNumber(60),
[Op.STSFLD]: new BigNumber(60),
[Op.LDLOC0]: new BigNumber(60),
[Op.LDLOC1]: new BigNumber(60),
[Op.LDLOC2]: new BigNumber(60),
[Op.LDLOC3]: new BigNumber(60),
[Op.LDLOC4]: new BigNumber(60),
[Op.LDLOC5]: new BigNumber(60),
[Op.LDLOC6]: new BigNumber(60),
[Op.LDLOC]: new BigNumber(60),
[Op.STLOC0]: new BigNumber(60),
[Op.STLOC1]: new BigNumber(60),
[Op.STLOC2]: new BigNumber(60),
[Op.STLOC3]: new BigNumber(60),
[Op.STLOC4]: new BigNumber(60),
[Op.STLOC5]: new BigNumber(60),
[Op.STLOC6]: new BigNumber(60),
[Op.STLOC]: new BigNumber(60),
[Op.LDARG0]: new BigNumber(60),
[Op.LDARG1]: new BigNumber(60),
[Op.LDARG2]: new BigNumber(60),
[Op.LDARG3]: new BigNumber(60),
[Op.LDARG4]: new BigNumber(60),
[Op.LDARG5]: new BigNumber(60),
[Op.LDARG6]: new BigNumber(60),
[Op.LDARG]: new BigNumber(60),
[Op.STARG0]: new BigNumber(60),
[Op.STARG1]: new BigNumber(60),
[Op.STARG2]: new BigNumber(60),
[Op.STARG3]: new BigNumber(60),
[Op.STARG4]: new BigNumber(60),
[Op.STARG5]: new BigNumber(60),
[Op.STARG6]: new BigNumber(60),
[Op.STARG]: new BigNumber(60),
[Op.NEWBUFFER]: new BigNumber(80000),
[Op.MEMCPY]: new BigNumber(80000),
[Op.CAT]: new BigNumber(80000),
[Op.SUBSTR]: new BigNumber(80000),
[Op.LEFT]: new BigNumber(80000),
[Op.RIGHT]: new BigNumber(80000),
[Op.INVERT]: new BigNumber(100),
[Op.AND]: new BigNumber(200),
[Op.OR]: new BigNumber(200),
[Op.XOR]: new BigNumber(200),
[Op.EQUAL]: new BigNumber(1000),
[Op.NOTEQUAL]: new BigNumber(1000),
[Op.SIGN]: new BigNumber(100),
[Op.ABS]: new BigNumber(100),
[Op.NEGATE]: new BigNumber(100),
[Op.INC]: new BigNumber(100),
[Op.DEC]: new BigNumber(100),
[Op.ADD]: new BigNumber(200),
[Op.SUB]: new BigNumber(200),
[Op.MUL]: new BigNumber(300),
[Op.DIV]: new BigNumber(300),
[Op.MOD]: new BigNumber(300),
[Op.SHL]: new BigNumber(300),
[Op.SHR]: new BigNumber(300),
[Op.NOT]: new BigNumber(100),
[Op.BOOLAND]: new BigNumber(200),
[Op.BOOLOR]: new BigNumber(200),
[Op.NZ]: new BigNumber(100),
[Op.NUMEQUAL]: new BigNumber(200),
[Op.NUMNOTEQUAL]: new BigNumber(200),
[Op.LT]: new BigNumber(200),
[Op.LE]: new BigNumber(200),
[Op.GT]: new BigNumber(200),
[Op.GE]: new BigNumber(200),
[Op.MIN]: new BigNumber(200),
[Op.MAX]: new BigNumber(200),
[Op.WITHIN]: new BigNumber(200),
[Op.PACK]: new BigNumber(15000),
[Op.UNPACK]: new BigNumber(15000),
[Op.NEWARRAY0]: new BigNumber(400),
[Op.NEWARRAY]: new BigNumber(15000),
[Op.NEWARRAY_T]: new BigNumber(15000),
[Op.NEWSTRUCT0]: new BigNumber(400),
[Op.NEWSTRUCT]: new BigNumber(15000),
[Op.NEWMAP]: new BigNumber(200),
[Op.SIZE]: new BigNumber(150),
[Op.HASKEY]: new BigNumber(270000),
[Op.KEYS]: new BigNumber(500),
[Op.VALUES]: new BigNumber(270000),
[Op.PICKITEM]: new BigNumber(270000),
[Op.APPEND]: new BigNumber(270000),
[Op.SETITEM]: new BigNumber(270000),
[Op.REVERSEITEMS]: new BigNumber(270000),
[Op.REMOVE]: new BigNumber(500),
[Op.CLEARITEMS]: new BigNumber(400),
[Op.ISNULL]: new BigNumber(60),
[Op.ISTYPE]: new BigNumber(60),
[Op.CONVERT]: new BigNumber(80000),
[Op.DEPTH]: new BigNumber(1 << 1),
[Op.DROP]: new BigNumber(1 << 1),
[Op.NIP]: new BigNumber(1 << 1),
[Op.XDROP]: new BigNumber(1 << 4),
[Op.CLEAR]: new BigNumber(1 << 4),
[Op.DUP]: new BigNumber(1 << 1),
[Op.OVER]: new BigNumber(1 << 1),
[Op.PICK]: new BigNumber(1 << 1),
[Op.TUCK]: new BigNumber(1 << 1),
[Op.SWAP]: new BigNumber(1 << 1),
[Op.ROT]: new BigNumber(1 << 1),
[Op.ROLL]: new BigNumber(1 << 4),
[Op.REVERSE3]: new BigNumber(1 << 1),
[Op.REVERSE4]: new BigNumber(1 << 1),
[Op.REVERSEN]: new BigNumber(1 << 4),
[Op.INITSSLOT]: new BigNumber(1 << 4),
[Op.INITSLOT]: new BigNumber(1 << 6),
[Op.LDSFLD0]: new BigNumber(1 << 1),
[Op.LDSFLD1]: new BigNumber(1 << 1),
[Op.LDSFLD2]: new BigNumber(1 << 1),
[Op.LDSFLD3]: new BigNumber(1 << 1),
[Op.LDSFLD4]: new BigNumber(1 << 1),
[Op.LDSFLD5]: new BigNumber(1 << 1),
[Op.LDSFLD6]: new BigNumber(1 << 1),
[Op.LDSFLD]: new BigNumber(1 << 1),
[Op.STSFLD0]: new BigNumber(1 << 1),
[Op.STSFLD1]: new BigNumber(1 << 1),
[Op.STSFLD2]: new BigNumber(1 << 1),
[Op.STSFLD3]: new BigNumber(1 << 1),
[Op.STSFLD4]: new BigNumber(1 << 1),
[Op.STSFLD5]: new BigNumber(1 << 1),
[Op.STSFLD6]: new BigNumber(1 << 1),
[Op.STSFLD]: new BigNumber(1 << 1),
[Op.LDLOC0]: new BigNumber(1 << 1),
[Op.LDLOC1]: new BigNumber(1 << 1),
[Op.LDLOC2]: new BigNumber(1 << 1),
[Op.LDLOC3]: new BigNumber(1 << 1),
[Op.LDLOC4]: new BigNumber(1 << 1),
[Op.LDLOC5]: new BigNumber(1 << 1),
[Op.LDLOC6]: new BigNumber(1 << 1),
[Op.LDLOC]: new BigNumber(1 << 1),
[Op.STLOC0]: new BigNumber(1 << 1),
[Op.STLOC1]: new BigNumber(1 << 1),
[Op.STLOC2]: new BigNumber(1 << 1),
[Op.STLOC3]: new BigNumber(1 << 1),
[Op.STLOC4]: new BigNumber(1 << 1),
[Op.STLOC5]: new BigNumber(1 << 1),
[Op.STLOC6]: new BigNumber(1 << 1),
[Op.STLOC]: new BigNumber(1 << 1),
[Op.LDARG0]: new BigNumber(1 << 1),
[Op.LDARG1]: new BigNumber(1 << 1),
[Op.LDARG2]: new BigNumber(1 << 1),
[Op.LDARG3]: new BigNumber(1 << 1),
[Op.LDARG4]: new BigNumber(1 << 1),
[Op.LDARG5]: new BigNumber(1 << 1),
[Op.LDARG6]: new BigNumber(1 << 1),
[Op.LDARG]: new BigNumber(1 << 1),
[Op.STARG0]: new BigNumber(1 << 1),
[Op.STARG1]: new BigNumber(1 << 1),
[Op.STARG2]: new BigNumber(1 << 1),
[Op.STARG3]: new BigNumber(1 << 1),
[Op.STARG4]: new BigNumber(1 << 1),
[Op.STARG5]: new BigNumber(1 << 1),
[Op.STARG6]: new BigNumber(1 << 1),
[Op.STARG]: new BigNumber(1 << 1),
[Op.NEWBUFFER]: new BigNumber(1 << 8),
[Op.MEMCPY]: new BigNumber(1 << 11),
[Op.CAT]: new BigNumber(1 << 11),
[Op.SUBSTR]: new BigNumber(1 << 11),
[Op.LEFT]: new BigNumber(1 << 11),
[Op.RIGHT]: new BigNumber(1 << 11),
[Op.INVERT]: new BigNumber(1 << 2),
[Op.AND]: new BigNumber(1 << 3),
[Op.OR]: new BigNumber(1 << 3),
[Op.XOR]: new BigNumber(1 << 3),
[Op.EQUAL]: new BigNumber(1 << 5),
[Op.NOTEQUAL]: new BigNumber(1 << 5),
[Op.SIGN]: new BigNumber(1 << 2),
[Op.ABS]: new BigNumber(1 << 2),
[Op.NEGATE]: new BigNumber(1 << 2),
[Op.INC]: new BigNumber(1 << 2),
[Op.DEC]: new BigNumber(1 << 2),
[Op.ADD]: new BigNumber(1 << 3),
[Op.SUB]: new BigNumber(1 << 3),
[Op.MUL]: new BigNumber(1 << 3),
[Op.DIV]: new BigNumber(1 << 3),
[Op.MOD]: new BigNumber(1 << 3),
[Op.POW]: new BigNumber(1 << 6),
[Op.SQRT]: new BigNumber(1 << 11),
[Op.SHL]: new BigNumber(1 << 3),
[Op.SHR]: new BigNumber(1 << 3),
[Op.NOT]: new BigNumber(1 << 2),
[Op.BOOLAND]: new BigNumber(1 << 3),
[Op.BOOLOR]: new BigNumber(1 << 3),
[Op.NZ]: new BigNumber(1 << 2),
[Op.NUMEQUAL]: new BigNumber(1 << 3),
[Op.NUMNOTEQUAL]: new BigNumber(1 << 3),
[Op.LT]: new BigNumber(1 << 3),
[Op.LE]: new BigNumber(1 << 3),
[Op.GT]: new BigNumber(1 << 3),
[Op.GE]: new BigNumber(1 << 3),
[Op.MIN]: new BigNumber(1 << 3),
[Op.MAX]: new BigNumber(1 << 3),
[Op.WITHIN]: new BigNumber(1 << 3),
[Op.PACK]: new BigNumber(1 << 11),
[Op.UNPACK]: new BigNumber(1 << 11),
[Op.NEWARRAY0]: new BigNumber(1 << 4),
[Op.NEWARRAY]: new BigNumber(1 << 9),
[Op.NEWARRAY_T]: new BigNumber(1 << 9),
[Op.NEWSTRUCT0]: new BigNumber(1 << 4),
[Op.NEWSTRUCT]: new BigNumber(1 << 9),
[Op.NEWMAP]: new BigNumber(1 << 3),
[Op.SIZE]: new BigNumber(1 << 2),
[Op.HASKEY]: new BigNumber(1 << 6),
[Op.KEYS]: new BigNumber(1 << 4),
[Op.VALUES]: new BigNumber(1 << 13),
[Op.PICKITEM]: new BigNumber(1 << 6),
[Op.APPEND]: new BigNumber(1 << 13),
[Op.SETITEM]: new BigNumber(1 << 13),
[Op.REVERSEITEMS]: new BigNumber(1 << 13),
[Op.REMOVE]: new BigNumber(1 << 4),
[Op.CLEARITEMS]: new BigNumber(1 << 4),
[Op.POPITEM]: new BigNumber(1 << 4),
[Op.ISNULL]: new BigNumber(1 << 1),
[Op.ISTYPE]: new BigNumber(1 << 1),
[Op.CONVERT]: new BigNumber(1 << 13),
};

@@ -193,3 +198,3 @@ export const getOpCodePrice = (value) => {

if (fee === undefined) {
throw new Error(`unknown Opcode: ${value}`);
throw new Error(`Unknown Opcode: ${value}`);
}

@@ -200,12 +205,11 @@ return fee;

.multipliedBy(2)
.plus(getOpCodePrice(Op.PUSHNULL))
.plus(getOpCodePrice(Op.SYSCALL))
.plus(ECDsaVerifyPrice);
.plus(CheckSigPrice);
export const multiSignatureContractCost = (m, n) => getOpCodePrice(Op.PUSHDATA1)
.multipliedBy(m + n)
.plus(getOpCodePrice(Op.PUSHINT8).multipliedBy(2))
.plus(getOpCodePrice(Op.PUSHNULL))
.plus(getOpCodePrice(new ScriptBuilder().emitPushInt(m).build()[0]))
.plus(getOpCodePrice(new ScriptBuilder().emitPushInt(n).build()[0]))
.plus(getOpCodePrice(Op.SYSCALL))
.plus(ECDsaVerifyPrice.multipliedBy(n));
.plus(CheckSigPrice.multipliedBy(n));
//# sourceMappingURL=prices.js.map
import { BaseScriptBuilder } from './BaseScriptBuilder';
import { UInt160 } from './common';
import { CallFlags } from './models';
import { SysCallName } from './models/vm';

@@ -12,5 +13,5 @@ import { ScriptBuilderParam } from './types';

emitPushArray(params: readonly ScriptBuilderParam[]): this;
emitAppCallInvocation(operation: string, ...params: ScriptBuilderParam[]): this;
emitAppCallInvocation(operation: string, flags: CallFlags, ...params: ScriptBuilderParam[]): this;
emitAppCallVerification(scriptHash: UInt160): this;
emitDynamicAppCall(scriptHash: UInt160, operation: string, ...params: ScriptBuilderParam[]): this;
emitDynamicAppCall(scriptHash: UInt160, operation: string, flags: CallFlags, ...params: readonly ScriptBuilderParam[]): this;
emitPushMap(params: ReadonlyMap<ScriptBuilderParam, ScriptBuilderParam>): this;

@@ -17,0 +18,0 @@ emitPushObject(params: {

import { BaseScriptBuilder } from './BaseScriptBuilder';
import { common } from './common';
import { CallFlags } from './models';
import { getSysCallHash } from './models/vm';

@@ -10,3 +9,3 @@ import { scriptBuilderParamTo } from './paramUtils';

this.pushParamCallbacks = {
undefined: () => this.emitOp('PUSHNULL'),
undefined: () => this.emitPush(Buffer.alloc(0, 0)),
array: (param) => this.emitPushArray(param),

@@ -47,5 +46,5 @@ map: (param) => this.emitPushMap(param),

}
emitAppCallInvocation(operation, ...params) {
emitAppCallInvocation(operation, flags, ...params) {
this.emitPushArray(params);
this.emitPushInt(CallFlags.All);
this.emitPushInt(flags);
return this.emitPushParam(operation);

@@ -57,4 +56,4 @@ }

}
emitDynamicAppCall(scriptHash, operation, ...params) {
this.emitAppCallInvocation(operation, ...params);
emitDynamicAppCall(scriptHash, operation, flags, ...params) {
this.emitAppCallInvocation(operation, flags, ...params);
return this.emitAppCallVerification(scriptHash);

@@ -61,0 +60,0 @@ }

@@ -8,3 +8,3 @@ /// <reference types="node" />

import { ECPoint, UInt160, UInt160Hex, UInt256 } from './common';
import { AccountContract, AttributeTypeModel, OracleResponseCode, TriggerTypeJSON, VerifyResultModel, VMState, VMStateJSON, Wildcard } from './models';
import { AccountContract, AttributeTypeModel, CallFlags, OracleResponseCode, TriggerTypeJSON, VerifyResultModel, VMState, VMStateJSON, Wildcard } from './models';
export declare type AddressString = string;

@@ -65,2 +65,3 @@ export declare type Hash256String = string;

readonly index: number;
readonly primaryIndex: number;
readonly nextConsensus: AddressString;

@@ -72,9 +73,5 @@ readonly witnesses: readonly Witness[];

}
export interface ConsensusData {
readonly primaryIndex: number;
readonly nonce: BufferString;
}
export interface Block extends Header {
export interface Block {
readonly header: Header;
readonly transactions: readonly ConfirmedTransaction[];
readonly consensusData?: ConsensusData;
}

@@ -405,2 +402,3 @@ export interface TransactionReceipt {

readonly offset: number;
readonly safe: boolean;
}

@@ -454,2 +452,16 @@ export interface ContractEventDescriptorClient {

}
export interface MethodToken {
readonly hash: string;
readonly method: string;
readonly paramCount: number;
readonly hasReturnValue: boolean;
readonly callFlags: CallFlags;
}
export interface NefFile {
readonly magic: number;
readonly compiler: string;
readonly script: string;
readonly tokens: readonly MethodToken[];
readonly checksum: number;
}
declare const OpaqueTagSymbol: unique symbol;

@@ -512,3 +524,4 @@ export interface ForwardValue {

readonly id: number;
readonly script: BufferString;
readonly updateCounter: number;
readonly nef: NefFile;
readonly hash: UInt160Hex;

@@ -642,3 +655,3 @@ readonly manifest: ContractManifest;

readonly type: 'Integer';
readonly value: BigNumber;
readonly value: BN;
}

@@ -691,4 +704,3 @@ export interface RawByteStringStackItem extends RawStackItemBase {

}
export interface RawApplicationLogData {
readonly txId?: string;
export interface RawExecutionData {
readonly trigger: TriggerTypeJSON;

@@ -701,2 +713,7 @@ readonly vmState: VMStateJSON;

}
export interface RawApplicationLogData {
readonly txId?: string;
readonly blockHash?: string;
readonly executions: readonly RawExecutionData[];
}
export interface ParamJSONArray extends ReadonlyArray<ParamJSON> {

@@ -724,3 +741,2 @@ }

export interface StorageItem {
readonly address: string;
readonly key: string;

@@ -727,0 +743,0 @@ readonly value: string;

{
"name": "@neo-one/client-common",
"version": "3.2.0-preview5",
"version": "3.3.1-rc1",
"description": "NEO•ONE client common code.",

@@ -17,3 +17,3 @@ "main": "./dist/cjs/index",

"@neo-one/ec-key": "^0.1.0",
"@neo-one/utils": "^3.1.0",
"@neo-one/utils": "3.3.0-rc1",
"@types/bn.js": "^4.11.5",

@@ -20,0 +20,0 @@ "bignumber.js": "^9.0.0",

# NEO•ONE
This branch is under heavy development during our migration to [N3](https://neo.org/). Please see the [master-2.x](https://github.com/neo-one-suite/neo-one/tree/master-2.x) branch for currently published source code.
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=shield)](#contributors)

@@ -4,0 +6,0 @@ [![CircleCI](https://circleci.com/gh/neo-one-suite/neo-one.svg?style=shield)](https://circleci.com/gh/neo-one-suite/neo-one)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc