-
Notifications
You must be signed in to change notification settings - Fork 31
Description
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”
- After connection: UI shows connected address, balances, transaction history
Problem:
We face two related challenges when interacting with our backend API (Adamik) for users connected via Argent Web Wallet:
-
Account Deployment requires Public Key: When a user initiates their first transaction, if their account isn’t deployed, our backend requires the
senderPubKeyto trigger deployment (mode: "deployAccount"). However, we’re unable to retrieve the public key after connection:useAccount()from@starknet-react/coregives 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.
-
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.executewhich re-encode the transaction details.
Request:
Could you please advise on the recommended approach for these scenarios?
-
Public Key Access: Is there a way to retrieve the public key from the connected account via
starknetkitor@starknet-react/corewhen using theWebWalletConnectorbefore 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. -
Generic Signing: Is there a method exposed by the
WebWalletConnectoror theaccountobject to request a signature for an arbitrary, pre-encoded transaction hash/payload (like the one returned by our backend's/encodeendpoint)?
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)