Skip to content

Connecting fails, dev can't sign transactions on local devnet with Leather #6160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
314159265359879 opened this issue Mar 3, 2025 · 15 comments
Assignees
Labels
area:developers area:testnet bug Functionality broken bug-p2 Critical functionality broken for few users, with no clear workarounds for:development

Comments

@314159265359879
Copy link
Contributor

Adding conversation with a dev here

Image

Kyran mentioned this may be related to what is mentioned in #6117 and is discussing with Jannik about changes on their end (many).

@314159265359879 314159265359879 added area:developers area:testnet bug Functionality broken bug-p2 Critical functionality broken for few users, with no clear workarounds for:development labels Mar 3, 2025
Copy link

linear bot commented Mar 3, 2025

@kyranjamie kyranjamie self-assigned this Mar 3, 2025
@314159265359879
Copy link
Contributor Author

Additionally shared by the dev who reported this:

Looks like the issue is in the use-submit-stx-transaction.ts file in the Leather extension... I don't see any handler for devnet network, only testnet and mainnet.
At least it looks that way with my limited knowledge of the wallet
In the networks.hook.ts file

@314159265359879 314159265359879 changed the title Connecting fails, dev can't signing transactions on local devnet with Leather Connecting fails, dev can't sign transactions on local devnet with Leather Mar 3, 2025
@kyranjamie
Copy link
Collaborator

@314159265359879 what version of stacks.js are they using? Do both v6 and 7 have this issue?

@314159265359879
Copy link
Contributor Author

@kyranjamie, from the dev:

Is stacks.js it's own thing? I did a "npm list" and I only see these two libraries installed.

├── @stacks/[email protected]
├── @stacks/[email protected]
specifically stacks libraries

@314159265359879
Copy link
Contributor Author

@kyranjamie update from the dev:

I was out of town for a week... back and updated to (Leather) 6.65.0

It looks like it is submitting transactions to devnet now. I am getting a ton of JsonRpcErrors back though. Is there anything else I need to do?

The errors I've seen are saying the User Cancelled the Transaction, even though the transaction is sent and confirmed successfully.

Any thoughts?

@codeonedotzero
Copy link

The transaction goes through without any issue, but the

const response = await request('stx_callContract', {...

is wrapped in a try/catch and it falls into the catch block.

The error I'm catching is "JsonRpcError: User rejected transaction signing request"

But I did not reject the transaction and it successfully confirmed. I just seem to be getting this back from the promise (maybe when the popup closes)? I've upgraded everything to the latest Connect libraries and am submitting transactions to testnet.

@314159265359879
Copy link
Contributor Author

Pinging @janniks too as he may know more.

@codeonedotzero
Copy link

Any thoughts on what could cause this exception?

My workflow is:

  1. Send the transaction using stx_callContract within a try/catch
  2. When successful, call internal API to save data and create a PENDING record in off-chain database
  3. Chainhook looks up transaction, and marks it CONFIRMED

The trouble is the JsonRpcError puts me into the catch even though the transaction goes through. This means that I can't provide the user any feedback until the chainhook finally triggers the confirmation workflows to insert the record.

It is functional, but the UI suffers without being able to provide the user PENDING feedback.

@codeonedotzero
Copy link

codeonedotzero commented Mar 17, 2025

To assist... I did see this in rpc-helpers.ts

export async function handleRpcMessage({
  method,
  path,
  port,
  requestParams,
  requestId,
}: HandleRpcMessageArgs) {
  void trackRpcRequestSuccess({ endpoint: method });

  const { urlParams, tabId } = makeSearchParamsWithDefaults(port, requestParams);
  const { id } = await triggerRequestWindowOpen(path, urlParams);

  listenForPopupClose({
    tabId,
    id,
    response: createRpcErrorResponse(method, {
      id: requestId,
      error: {
        code: RpcErrorCode.USER_REJECTION,
        message: RpcErrorMessage.UserRejectedSigning,
      },
    }),
  });
}

Would this throw the exception any time the popup closes? Even if it closing itself after the transaction leaves?

@kyranjamie
Copy link
Collaborator

@codeonedotzero this is because closing the window is pretty much a cancel action. If you approve the action, it should fire the success event. If you were to immediately close window, this would trigger, but wouldn't matter as the success response promise has already resolved.

@codeonedotzero
Copy link

codeonedotzero commented Mar 18, 2025

Did you not read the defect, or maybe I'm not understanding your response to the issue?

I am approving the message, the transaction is successfully sent to testnet, it successfully confirms.

Still, when the popup closes itself I get the error message from the wallet provider.

  1. I click Confirm in wallet popup.
  2. Transaction is submitted to the chain.
  3. Wallet self closes.
  4. I get the JsonRpcError that the user rejected the signing request.

@ECBSJ
Copy link

ECBSJ commented Mar 20, 2025

I can also confirm that I too receive that error response right after a tx is successfully broadcasted

Image

@codeonedotzero
Copy link

Was this resolved in 6.65.1?

I'm noticing I'm not seeing this error anymore. Not sure if it was because of something I changed or your new version.

@314159265359879
Copy link
Contributor Author

I can also confirm that I too receive that error response right after a tx is successfully broadcasted

Image

@ECBSJ Are you still seeing the issue with 6.65.1 of the Leather extension?

@ECBSJ
Copy link

ECBSJ commented Apr 4, 2025

Yes I still do. Looks like I get it on many methods such as getAddresses:

Image

I'm on Leather v6.65.2
@stacks/connect v8.1.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:developers area:testnet bug Functionality broken bug-p2 Critical functionality broken for few users, with no clear workarounds for:development
Projects
None yet
Development

No branches or pull requests

4 participants