Skip to content

Request: Access Public Key & Generic Signing via Argent Web Wallet Connector #208

@G9NCUE

Description

@G9NCUE

Project: starknetkit (via WebWalletConnector)

Context:

Hi StarknetKit / Argent team,

We’re building a dApp using @starknet-react/core and starknetkit, where users connect via Argent Web Wallet to initiate transactions handled by a backend API.

After connection, we fetch address, balances, and transaction history via our backend API (Adamik).

(Screenshots attached)

  • Before connection: UI shows “Connect Wallet”
Image
  • After connection: UI shows connected address, balances, transaction history
Image

Problem:

We face two related challenges when interacting with our backend API (Adamik) for users connected via Argent Web Wallet:

  1. Account Deployment requires Public Key: When a user initiates their first transaction, if their account isn’t deployed, our backend requires the senderPubKey to trigger deployment (mode: "deployAccount"). However, we’re unable to retrieve the public key after connection:

    • useAccount() from @starknet-react/core gives us the address.
    • Trying account.signer.getPubKey() throws an error (expected valid private key..., got 0). We assume this is because the signer from Argent Web Wallet does not expose a private key to the frontend.
  2. Signing Backend-Encoded Transactions: Our backend API provides fully encoded transactions (including the deployment transaction mentioned above, and subsequent transfers) as a hex string or structured data. We need a way for the connected Argent Web Wallet user to sign this specific, pre-encoded transaction payload provided by our backend, rather than relying solely on higher-level frontend functions like account.execute which re-encode the transaction details.

Request:

Could you please advise on the recommended approach for these scenarios?

  1. Public Key Access: Is there a way to retrieve the public key from the connected account via starknetkit or @starknet-react/core when using the WebWalletConnector before the first transaction? If not, could this be exposed (read-only)? This is critical for initiating deployment via backend APIs as we use the pubkey as salt.

  2. Generic Signing: Is there a method exposed by the WebWalletConnector or the account object to request a signature for an arbitrary, pre-encoded transaction hash/payload (like the one returned by our backend's /encode endpoint)?

Supporting these two capabilities (accessing the pubKey upfront and signing pre-encoded transactions) would greatly facilitate integration with backend services that manage transaction encoding and broadcasting, especially for handling the essential StarkNet account deployment flow.

Thanks a lot for your help!

Fabrice
(Adamik CEO)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions