extension icon indicating copy to clipboard operation
extension copied to clipboard

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

Open 314159265359879 opened this issue 9 months ago • 15 comments

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 avatar Mar 03 '25 10:03 314159265359879

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 avatar Mar 03 '25 18:03 314159265359879

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

kyranjamie avatar Mar 04 '25 09:03 kyranjamie

@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 avatar Mar 05 '25 10:03 314159265359879

@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?

314159265359879 avatar Mar 14 '25 21:03 314159265359879

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.

codeonedotzero avatar Mar 15 '25 03:03 codeonedotzero

Pinging @janniks too as he may know more.

314159265359879 avatar Mar 15 '25 09:03 314159265359879

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 avatar Mar 17 '25 19:03 codeonedotzero

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?

codeonedotzero avatar Mar 17 '25 21:03 codeonedotzero

@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.

kyranjamie avatar Mar 18 '25 06:03 kyranjamie

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.

codeonedotzero avatar Mar 18 '25 11:03 codeonedotzero

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

Image

ECBSJ avatar Mar 20 '25 13:03 ECBSJ

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.

codeonedotzero avatar Mar 21 '25 12:03 codeonedotzero

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?

314159265359879 avatar Mar 22 '25 19:03 314159265359879

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

ECBSJ avatar Apr 04 '25 01:04 ECBSJ

This issue is stale because it has been open for 60 days with no activity.

github-actions[bot] avatar Jun 20 '25 02:06 github-actions[bot]