Private requests
Private requests go through WalletAccountV6 (see Connect).
Reading the balance
wallet_strk20Balances asks the user to share the private balance of the tokens named. The grant
lasts an hour, or until valid_until (a Unix time, at most a day ahead). While it lasts, Outis
answers without asking.
await wallet.request({
type: "wallet_strk20Balances",
params: { tokens: [STRK] },
});Setting up
An account has to be registered in the privacy pool once before any private action. Until then,
private requests are refused with NOT_REGISTERED (118). A dApp can ask for the registration
(wallet API 0.10.5) with a register action. The action has to be alone in its request, and it
carries nothing but its type.
await wallet.request({
type: "wallet_strk20InvokeTransaction",
params: { actions: [{ type: "register" }] },
});Outis asks the user to set up Privacy Mode, proves the registration and sends it from the account,
which pays the fees from its public balance. Through wallet_strk20PrepareInvoke, Outis hands the
dApp the call and proof instead, or a preview with simulate. A request to register an account that
is registered already is refused with INVALID_REQUEST_PAYLOAD (114). So is a register action
that comes with any other action.
Private actions
A request lists its actions:
transfer: a private payment. Its amount can be"OPEN", for the invoked contract to fill.withdraw: to a public address.invoke: one contract per request, run after everything else. This is how private swaps work. Its calldata can name${poolAddress}and${openNoteIds[0]}.
await wallet.request({
type: "wallet_strk20InvokeTransaction",
params: {
actions: [{ type: "transfer", token: STRK, recipient, amount }],
},
});-
wallet_strk20InvokeTransaction: Outis proves the actions, and its relayer sends them, paid from the private balance. -
wallet_strk20PrepareInvoke: Outis proves them and returns theapply_actionscall with its proof, for the dApp to send. Withsimulate, it runs them without a proof instead.When the dApp sends that call back through
wallet_addInvokeTransaction, the user's account sends it only if every action is a transfer, or a withdrawal to one of the wallet's own accounts. Anything else could fund a shadow account in public. The dApp sends those calls itself (through a paymaster), or askswallet_strk20InvokeTransaction.
A request that can't work is refused before the user is asked. See Errors.
Not yet
Deposits and shadow accounts are refused.