Connect
With get-starknet
The easiest way. get-starknet's connect() opens a
wallet picker, which lists Outis once the extension is installed:
import { connect } from "@starknet-io/get-starknet";
import { RpcProvider, WalletAccount } from "starknet";
const wallet = await connect();
const provider = new RpcProvider({ nodeUrl });
const account = await WalletAccount.connect(provider, wallet);Directly
The extension puts the standard Starknet wallet object in every page as window.starknet_outis,
with the id outis:
import { RpcProvider, WalletAccount } from "starknet";
const wallet = window.starknet_outis;
const provider = new RpcProvider({ nodeUrl });
const account = await WalletAccount.connect(provider, wallet);Private requests
Private requests need WalletAccountV6, through the wallet-standard
adapter. Either way, wrap the wallet you got:
import { StarknetInjectedWallet } from "@starknet-io/get-starknet-wallet-standard";
import { WalletAccountV6 } from "starknet";
const account = await WalletAccountV6.connect(
provider,
new StarknetInjectedWallet(wallet),
);Outis doesn't announce itself through the wallet-standard event yet, so a dApp that only listens for that event won't find it.
Networks
Outis serves Starknet mainnet and Sepolia. wallet_switchStarknetChain asks the user to switch, and
Outis then emits networkChanged. Ask for accounts again after a switch: each network has its own.