pushNativeCodeScript method
dynamic
pushNativeCodeScript
(List objs)
Implementation
pushNativeCodeScript(List<dynamic> objs) {
for (var obj in objs) {
if (obj is String) {
pushHexStr(obj);
} else if (obj is Uint8List) {
pushHex(obj);
} else if (obj is bool) {
pushBool(obj);
} else if (obj is int) {
pushInt(obj);
} else if (obj is BigInt) {
pushBigInt(obj);
} else if (obj is Struct) {
pushInt(0);
pushOpcode(OpCode.newstruct);
pushOpcode(OpCode.toaltstack);
for (var item in obj.list) {
pushCodeParamScript(item);
pushOpcode(OpCode.dupfromaltstack);
pushOpcode(OpCode.swap);
pushOpcode(OpCode.append);
}
pushOpcode(OpCode.fromaltstack);
} else if (obj is List<Struct>) {
pushInt(0);
pushOpcode(OpCode.newstruct);
pushOpcode(OpCode.toaltstack);
for (var item in obj) {
pushCodeParamScript(item);
}
pushOpcode(OpCode.fromaltstack);
pushInt(obj.length);
pushOpcode(OpCode.pack);
} else if (obj is List<dynamic>) {
pushCodeParamScript(obj);
pushInt(obj.length);
pushOpcode(OpCode.pack);
} else {
throw ArgumentError(
'Unsupported param type: ' + obj.runtimeType.toString());
}
}
}