Zondax / ledger-stacks

Apache License 2.0
17 stars 7 forks source link

Support for stacks contract deploys #153

Closed edgarkhanzadian closed 6 months ago

edgarkhanzadian commented 6 months ago

Hello!

We are running into an issue with contract deploys using ledger device and I'm wondering if this library supports that feature. If it doesn't, are there any plans to support it in the future?

{
    "signatureRequest": {
      "returnCode": 27012,
      "errorMessage": "Data is invalid : Unsupported transaction payload"
    }
}

I've reproduced the bug using tests_zemu on my fork: https://github.com/edgarkhanzadian/ledger-stacks/commit/28923bbc8bb5154d1b1f66a59a627f602ec9796b

:link: zboto Link

neithanmo commented 6 months ago

thanks @edgarkhanzadian i will take a look early next week

neithanmo commented 6 months ago

Currently the app only supports the following payloads:

neithanmo commented 6 months ago

I could not find the documentation for this payload, and here it is not listed. @edgarkhanzadian can you provide it?

edgarkhanzadian commented 6 months ago

@neithanmo thank you for your time!

I am trying to sign a transaction that is created by makeUnsignedContractDeploy function. Now, looking at the source code it seems like it is utilizing a function called createSmartContractPayload, that creates a payload with id 0x06 if it has clarityVersion supplied to it (which makeUnsignedContractDeploy supplies to it unless it's told not to). 0x06 id was added later on, in sip15, and it specifies that that smart contract should be using clarity v2 instead of v1. https://github.com/stacksgov/sips/blob/main/sips/sip-015/sip-015-network-upgrade.md#new-transaction-versioned-smart-contract

I missed that clarity version part, it seems like this library can support deployments of smart contracts with clarity v1 but not v2.

neithanmo commented 6 months ago

via #155