scriptPubKey is okay, i found the method scriptPubKey.encode.