Methods
Pallad’s Web Provider implementation is based on RFC-0008: Mina Provider JavaScript API.
Authentication
Section titled “Authentication”The zkApp gets authenticated (added to trusted apps) after users approves the connection to their wallets after a request. In other words, in Pallad it happens automatically when zkApp requests any Web Connector method.
Provider instance
Section titled “Provider instance”In order to use Pallad’s provider instance, zkApp can request the announcement of available providers, and then filter the Pallad instance from the list.
const providers = [];window.addEventListener("mina:announceProvider", (event) => { providers.push(event.detail);});window.dispatchEvent(new Event("mina:requestProvider"));const provider = providers.find((provider) => provider.info.slug === "pallad");// => { info, provider }Wallet methods
Section titled “Wallet methods”mina_accounts
Section titled “mina_accounts”await provider.request({ method: 'mina_accounts' ){ jsonrpc: "1.0", result: ["B62..."]}mina_chainId
Section titled “mina_chainId”await provider.request({ method: 'mina_chainId' ){ jsonrpc: "1.0", result: "29936104443aaf264a7f0192ac64b1c7173198c1ed404c1bcff5e562e05eb7f6"}mina_getBalance
Section titled “mina_getBalance”await provider.request({ method: 'mina_getBalance' ){ jsonrpc: "1.0", result: 256.1}mina_requestNetwork
Section titled “mina_requestNetwork”await provider.request({ method: "mina_requestNetwork" });{ jsonrpc: "1.0", result: { chainId: "29936104443aaf264a7f0192ac64b1c7173198c1ed404c1bcff5e562e05eb7f6", networkName: "Devnet" }}mina_addChain
Section titled “mina_addChain”TBC
mina_switchChain
Section titled “mina_switchChain”TBC
Signing Methods
Section titled “Signing Methods”mina_sign
Section titled “mina_sign”await provider.request({ method: "mina_sign", params: { message: "Message to sign" },});{ jsonrpc: "1.0", result: { signature: { field: "26688777148479764993896686318312196265329713747492845934030403162209826011969", scalar: "3622081775165555485446094478234519383850142528029688247658006921004458225034" }, publicKey: "B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS", data: "Message to sign" }}mina_signFields
Section titled “mina_signFields”await provider.request({ method: "mina_signFields", params: { fields: [0] },});TBC