> ## Documentation Index
> Fetch the complete documentation index at: https://docs.portalhq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# MPC progress callbacks

> This section describes how to check in on the status of each MPC operation

## Progress Callback Support

The `portal.createWallet()`, `portal.backupWallet()`, and `portal.recoverWallet()` functions all support an optional argument for a progress callback. This is a function that will be triggered at key points within these respective MPC operations to provide incremental updates, These incremental updates enable you to update your UI as the MPC operation progresses.

## Using Progress Callbacks

```typescript theme={null}
import { BackupMethods, MpcStatus } from '@portal-hq/web'

// Example using createWallet()
const address = await portal.createWallet((update: MpcStatus) => {
    console.log(`Status update:`, update.status)
    console.log(`MPC Operation done:`, update.done)
})

// Example using backupWallet()
const { cipherText } = await portal.backupWallet(BackupMethods.passkey, (update: MpcStatus) => {
    console.log(`Status update:`, update.status)
    console.log(`MPC Operation done:`, update.done)
})

// Example using recoverWallet()
const address = await portal.recoverWallet(cipherText, BackupMethods.passkey, {}, (update: MpcStatus) => {
    console.log(`Status update:`, update.status)
    console.log(`MPC Operation done:`, update.done)
})
```

## MPC Statuses

These are all the possible statuses that will be returned through the callbacks on the MPC operations.

```typescript theme={null}
generatingShare = "Generating share"
parsingShare = "Parsing share"
storingShare = "Storing share"
encryptingShare = "Encrypting share"
decryptingShare = "Decrypting share"
readingShare = "Reading share"
recoveringBackupShare = "Recovering backup share"
recoveringSigningShare = "Recovering signing share"
done = "Done"
```

### Generate Status Flow

```json theme={null}
{"done": false, "status": "Generating share"}
{"done": false, "status": "Storing share"}
{"done": true, "status": "Done"}
```

### Backup Status Flow

```json theme={null}
{"done": false, "status": "Reading share"}
{"done": false, "status": "Generating share"}
{"done": false, "status": "Encrypting share"}
{"done": false, "status": "Storing share"}
{"done": true, "status": "Done"}
```

### Recover Status Flow

```json theme={null}
{"done": false, "status": "Reading share"}
{"done": false, "status": "Decrypting share"}
{"done": false, "status": "Parsing share"}
{"done": false, "status": "Recovering signing share"}
{"done": false, "status": "Generating share"}
{"done": false, "status": "Storing share"}
{"done": false, "status": "Recovering backup share"}
{"done": false, "status": "Generating share"}
{"done": false, "status": "Encrypting share"}
{"done": false, "status": "Storing share"}
{"done": true, "status": "Done"}
```
