Skip to content

[ FEAT ] Optimistic nonce Increment #14

@posaune0423

Description

@posaune0423

Issue

Due to the current implementation of starknetjs, nonce of the account is not incremented before tx confirmed. And this makes user interaction experience poor. So I think pixelaw client should update account nonce optimistically for avoiding duplicated nonce transaction sending and enable fast pixel update experience for users.

Error Message
index-HtQOeg78.js:129 Dp: RPC: starknet_addInvokeTransaction with params {
  "invoke_transaction": {
    "sender_address": "0x106e31736b5f5fa0188eb5a86ff98b4338d5f513d043ded06ac944432fd7f94",
    "calldata": [
      "0x1",
      "0x242b049a376eb129e57e860c6646fd80f2b06747b42bb3821064a70c0a76a36",
      "0x476d5e1b17fd9d508bd621909241c5eb4c67380f3651f54873c5c1f2b891f4",
      "0x5",
      "0x0",
      "0x0",
      "0x9",
      "0x52",
      "0xcda2a2ff"
    ],
    "type": "INVOKE",
    "max_fee": "0xba3204",
    "version": "0x1",
    "signature": [
      "0x3089cd8daf5874780c6c1e8c155b142527c82267262001db0cc11c1c7e807bb",
      "0x1da666e4f99c18d206f56f312b5dac0a5b0ca696cbd21ada2d6571432076c52"
    ],
    "nonce": "0x14e"
  }
}
 
        52: Invalid transaction nonce: "Invalid transaction nonce of contract at address 0x106e31736b5f5fa0188eb5a86ff98b4338d5f513d043ded06ac944432fd7f94. Account nonce: 0x14f; got: 0x14e."
    at qI.errorHandler (https://pixelaw-client.vercel.app/assets/index-HtQOeg78.js:38:11095)
    at qI.fetchEndpoint (https://pixelaw-client.vercel.app/assets/index-HtQOeg78.js:40:216)
    at async nK.execute (https://pixelaw-client.vercel.app/assets/index-HtQOeg78.js:40:111064)
    at async Object.interact (https://pixelaw-client.vercel.app/assets/index-HtQOeg78.js:129:28174)
    at async interact (https://pixelaw-client.vercel.app/assets/index-HtQOeg78.js:129:25001)
    at async https://pixelaw-client.vercel.app/assets/index-HtQOeg78.js:83:15971

Screen Recording

When I tap slowly, it's just fine. but when I try to tap fast, nonce increment error occuers.

ScreenRecording_09-04-2024.15-00-29_1.MP4

How to reproduce

You can try here

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions