each time you sign a transaction because of the randomness of the process used to generate the signature, you will get a different signature and a scriptsig as a result of that. so you can't conclude that your signature here is wrong just because you got a different one elsewhere.
I didn't know that but then if that is the case why is it that I get the same signature using either method every single time? Like if I use the same method, say the signrawtransaction method, I get the same hex each time. But if I use swiftcashjs-lib's TransactionBuilder.sign method, I get a different hex. That's why I think TransactionBuilder.sign in the js library is not doing what the signrawtransaction in the core wallet does. It must be doing something different IMO.
by the way when you want to check a transaction (its scripts) you need to post the scriptpub of the previous output that you are spending. in this case it is
76a914d4f5b4f2963c7df270eb900e0186a37cb4f851e888ac
YES! The createrawtransaction method in the wallet demands that but the js library doesn't ask for it. So my guess so far has been that it adds it automatically somehow but I could be wrong. Maybe that's what's causing the problem but I think in your breakdown of the hex, the pubscript seems to be included in the hex.
6a (push 106 byte)
47304402204a248ab66525b734d460602ffcc3dc34e65a174ccaed327885eee538a758a07d
022012dd13d94a37fff20f23fd6dfd6e21c18e257c44ed8f80e2b169d5a6e982680601
21 (push 33 byte)
021d1c9229b6e9ce28db46b5e4cd777419ce103e42b2e31989ef7efb6fd5536ef4
OP_DUP
OP_HASH160
14 (push 20 byte)
d4f5b4f2963c7df270eb900e0186a37cb4f851e
OP_EQUALVERIFY
OP_CHECKSIG
it is fine up to OP_CHECKSIG, i don't know how to check that yet so my guess would be something wrong in that part. i've bolded R and S. and S is smaller than N/2 too.
Yeah I also believe it's fine up to signature. The transaction seems to be fine. It's just the signature that is not accurate and when I do signrawtransaction of the hex with the wallet, it works. This js library is not signing the transaction properly. It's doing something different and I still can't figure out what that is.