# Quickstart

By the end of this page your app has a sign-in button, runs a gas-free Sui transaction from the user's account and opens the deposit panel.

## 1. Get a platform key

Log in to the [dashboard](https://dashboard-ika-accounts.mpckit.xyz) and:

1. Under **API keys**, create a key. It is public by design: it identifies your platform, it doesn't authorize anything on its own.
2. Under **Settings → Allowed origins**, add every origin your app runs on, for example `https://app.example.com`. The key frame refuses to work anywhere else. Until you add one, it only answers on `localhost`.
3. Under **Billing**, top up. Sponsored transactions are paid from this balance.

## 2. Install

```bash
npm i @ika-accounts/sdk @mysten/sui
```

For React, add `@ika-accounts/react`. Packages: [@ika-accounts/sdk](https://www.npmjs.com/package/@ika-accounts/sdk), [@ika-accounts/react](https://www.npmjs.com/package/@ika-accounts/react).

## 3. Create the client

Create one instance for your whole app.

```ts
import { createIkaAccounts } from '@ika-accounts/sdk';

export const accounts = createIkaAccounts({
  apiKey: 'ika_…',                               // from the dashboard
  apiUrl: 'https://ika-accounts.mpckit.xyz',
  keysOrigin: 'https://ika-accounts.mpckit.xyz', // where users' keys live
  network: 'mainnet',
});

accounts.preload(); // fetch Ika parameters in the background (~20 MB, cached)
```

## 4. Sign in

`openConnect()` shows the Ika Accounts sign-in modal: every EVM and Solana wallet installed in the browser, grouped, with its own icon.

```ts
const addresses = await accounts.openConnect(); // null if the user closed it
if (addresses) console.log('Sui address', addresses.sui);
```

When the user comes back, reconnect without any prompt:

```ts
await accounts.reconnect(); // resolves null if there's nothing to restore
```

The Sui address is available immediately. The account's keys finish in the background, and the first transaction waits for them automatically.

## 5. Run a transaction

Pass a Sui `Transaction`, or steps that add to one. Gas is sponsored, so don't use the gas coin.

```ts
import { coinWithBalance } from '@mysten/sui/transactions';

const { digest } = await accounts.execute((tx, { address }) => {
  const payment = coinWithBalance({ type: '0x2::sui::SUI', balance: 100_000_000n, useGasCoin: false });
  const item = tx.moveCall({ target: `${PACKAGE}::shop::buy`, arguments: [tx.object(SHOP), payment] });
  tx.transferObjects([item], address);
});
```

The user's wallet shows what the transaction does and how their balances change, and asks them to approve. The first transaction also creates their dWallet.

## 6. Let users add funds

```ts
await accounts.openFunds({ tab: 'deposit', receive: 'SUI' });
```

The panel lists the user's balances on every chain, quotes what will arrive on Sui, and sends the deposit from their wallet with one confirmation. The same panel handles withdrawals: `openFunds({ tab: 'withdraw' })`.

## Next

- Skip the wallet prompt for routine transactions with [sessions](https://docs-ika-accounts.mpckit.xyz/transactions/#sessions).
- Fund a transaction and run it in one call with [`perform`](https://docs-ika-accounts.mpckit.xyz/transactions/#perform).
- Using React? See [React hooks](https://docs-ika-accounts.mpckit.xyz/reference/#react).
