hirosystems / stacks.js

JavaScript libraries for identity, auth, storage and transactions on the Stacks blockchain.
https://stacks.js.org
MIT License
944 stars 307 forks source link

Fix ABI buffer encoding #1674

Closed janniks closed 2 months ago

janniks commented 2 months ago

I remember we've discussed this before, but I can't find or remember the answer. When calling a function, the explorer processes buff argument inputs as ascii instead of as hex. Is there any way to make it process the input as hex bytes?

Actually I think the problem is in stacks.js https://github.com/hirosystems/stacks.js/blob/f39637c924cc8b221f890a8bd9f8e0c9fb1f90e6/packages/transactions/src/contract-abi.ts#L174-L175

(https://github.com/hirosystems/stacks.js/blob/f39637c924cc8b221f890a8bd9f8e0c9fb1f90e6/packages/transactions/src/contract-abi.ts) case ClarityAbiTypeId.ClarityAbiTypeBuffer: return bufferCV(utf8ToBytes(val));