Available methods and data
List of available methods and data returned by StarknetKit.
Wallet
wallet is a StarknetWindowObject and supports JSON-RPC Integration.
Requests to wallet can be done using the .request method. The following methods are available:
- wallet_getPermissions
- wallet_requestAccounts
- wallet_watchAsset
- wallet_addStarknetChain
- wallet_switchStarknetChain
- wallet_requestChainId
- wallet_deploymentData
- wallet_addInvokeTransaction
- wallet_addDeclareTransaction
- wallet_signTypedData
- wallet_supportedSpecs
- wallet_supportedWalletApi
Examples:
await wallet.request({ type: "wallet_requestAccounts" }) // replaces .enable()
 
await wallet.request({ type: "wallet_requestChainId" })
 
await wallet.request({
  type: "wallet_addInvokeTransaction",
  params: {
    calls: [call],
  },
})
 
await wallet.request({
  type: "wallet_signTypedData",
  params: typedData,
})wallet can also listen to events using the .on method:
const accountChangeHandler: AccountChangeEventHandler = (
  accounts?: string[],
) => {}
 
const networkChangeHandler: NetworkChangeEventHandler = async (
  chainId?: ChainId,
  accounts?: string[],
) => {}
 
wallet?.on("accountsChanged", accountChangeHandler)
wallet?.on("networkChanged", networkChangeHandler)
 
// Remove event listener
wallet?.off("accountsChanged", accountChangeHandler)
wallet?.off("networkChanged", networkChangeHandler)Connector data
connectorData is an object containing the account and chainId of the connected wallet:
type ConnectorData = {
  account?: string
  chainId?: bigint
}Connector
connector is an object containing data and methods related to the connected wallet. It is useful for StarknetKit and starknet-react combo, see here.