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

# Sudo

## Calls

### setKey

Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo key.

The dispatch origin for this call must be *Signed*.

**Namespace**

```
api.tx.sudo.setKey
```

**Type**

```
function setKey(
  new: SeedPrimitivesSignatureAccountId20
)
```

### sudo

Authenticates the sudo key and dispatches a function call with `Root` origin.

The dispatch origin for this call must be *Signed*.

**Namespace**

```
api.tx.sudo.sudo
```

**Type**

```
function sudo(
  call: Call
)
```

### sudoAs

Authenticates the sudo key and dispatches a function call with `Signed` origin from a given account.

The dispatch origin for this call must be *Signed*.

**Namespace**

```
api.tx.sudo.sudoAs
```

**Type**

```
function sudoAs(
  who: SeedPrimitivesSignatureAccountId20,
  call: Call
)
```

### sudoUncheckedWeight

Authenticates the sudo key and dispatches a function call with `Root` origin. This function does not check the weight of the call, and instead allows the Sudo user to specify the weight of the call.

The dispatch origin for this call must be *Signed*.

**Namespace**

```
api.tx.sudo.sudoUncheckedWeight
```

**Type**

```
function sudoUncheckedWeight(
  call: Call,
  weight: WeightV1
)
```

## Storage

### key

The `AccountId` of the sudo key.

**Namespace**

```
api.query.sudo.key
```

**Type**

```
function key(

): Option<SeedPrimitivesSignatureAccountId20>
```

## Events

### KeyChanged

The \[sudoer] just switched identity; the old key is supplied if one existed.

**Namespace**

```
api.events.sudo.KeyChanged
```

**Type**

```
type KeyChanged = {
  old_sudoer: Option<SeedPrimitivesSignatureAccountId20>
}
```

### Sudid

A sudo just took place. \[result]

**Namespace**

```
api.events.sudo.Sudid
```

**Type**

```
type Sudid = {
  sudo_result: Result<Null, SpRuntimeDispatchError>
}
```

### SudoAsDone

A sudo just took place. \[result]

**Namespace**

```
api.events.sudo.SudoAsDone
```

**Type**

```
type SudoAsDone = {
  sudo_result: Result<Null, SpRuntimeDispatchError>
}
```

## Errors

### RequireSudo

Sender must be the Sudo account

**Namespace**

```
api.errors.sudo.RequireSudo
```

undefined
