tiddlybit
tiddlybit copied to clipboard
Can't push INT to stack
I am having problems when trying to push int to the stack. OpCode.byCode(integer) is undefined

Yes I don't think tiddlybit supports adding integers to the stack just by passing it as a number. Instead it attempts to get the relevant OPcode from the given number. This approach is what bsv.js@v1 did, although not sure if v2 does things differently.
As I understand it, integers are pushed on the stack using a varint encoding method, so for now you need to handle that encoding yourself and pass the buffer to the stack.
Cool. But it's still a bug that the lookup of opcodes doesn't actually work. The method being called is undefined.
Oh right. I thought it was returning undefined because you were passing a number that wasn't an opcode byte number. I see now. Let me look in to that.
What version are you on? I think this might be fixed in 0.0.6
0.0.6 I just installed whatever was latest.
Is the problem not reproducible on your side?
Ah I see the issue now. The function OpCode.byCode() was renamed to OpCode.byByte(). The reason for my confusion is a I remember this came up before and was fixed, but I can see now that the function is used twice so I only fixed it in one of those places 😅
Apologies for the confusion - I'll sort this out over the weekend.