# Multisig

### Calls

#### approveAsMulti

Register approval for a dispatch to be made from a deterministic composite account if approved by a total of `threshold - 1` of `other_signatories`.

Payment: `DepositBase` will be reserved if this is the first approval, plus `threshold` times `DepositFactor`. It is returned once this dispatch happens or is cancelled.

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

* `threshold`: The total number of approvals for this dispatch before it is executed.
* `other_signatories`: The accounts (other than the sender) who can approve this dispatch. May not be empty.
* `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is not the first approval, then it must be `Some`, with the timepoint (block number and transaction index) of the first approval transaction.
* `call_hash`: The hash of the call to be executed.

NOTE: If this is the final approval, you will want to use `as_multi` instead.

**Namespace**

```
api.tx.multisig.approveAsMulti
```

**Type**

```typescript
function approveAsMulti(
  threshold: u16,
  other_signatories: Vec<SeedPrimitivesSignatureAccountId20>,
  maybe_timepoint: Option<PalletMultisigTimepoint>,
  call_hash: [u8;32],
  max_weight: WeightV1
)
```

#### asMulti

Register approval for a dispatch to be made from a deterministic composite account if approved by a total of `threshold - 1` of `other_signatories`.

If there are enough, then dispatch the call.

Payment: `DepositBase` will be reserved if this is the first approval, plus `threshold` times `DepositFactor`. It is returned once this dispatch happens or is cancelled.

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

* `threshold`: The total number of approvals for this dispatch before it is executed.
* `other_signatories`: The accounts (other than the sender) who can approve this dispatch. May not be empty.
* `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is not the first approval, then it must be `Some`, with the timepoint (block number and transaction index) of the first approval transaction.
* `call`: The call to be executed.

NOTE: Unless this is the final approval, you will generally want to use `approve_as_multi` instead, since it only requires a hash of the call.

Result is equivalent to the dispatched result if `threshold` is exactly `1`. Otherwise on success, result is `Ok` and the result from the interior call, if it was executed, may be found in the deposited `MultisigExecuted` event.

**Namespace**

```
api.tx.multisig.asMulti
```

**Type**

```typescript
function asMulti(
  threshold: u16,
  other_signatories: Vec<SeedPrimitivesSignatureAccountId20>,
  maybe_timepoint: Option<PalletMultisigTimepoint>,
  call: WrapperKeepOpaque<Call>,
  store_call: bool,
  max_weight: WeightV1
)
```

#### asMultiThreshold1

Immediately dispatch a multi-signature call using a single approval from the caller.

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

* `other_signatories`: The accounts (other than the sender) who are part of the multi-signature, but do not participate in the approval process.
* `call`: The call to be executed.

Result is equivalent to the dispatched result.

**Namespace**

```
api.tx.multisig.asMultiThreshold1
```

**Type**

```typescript
function asMultiThreshold1(
  other_signatories: Vec<SeedPrimitivesSignatureAccountId20>,
  call: Call
)
```

#### cancelAsMulti

Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously for this operation will be unreserved on success.

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

* `threshold`: The total number of approvals for this dispatch before it is executed.
* `other_signatories`: The accounts (other than the sender) who can approve this dispatch. May not be empty.
* `timepoint`: The timepoint (block number and transaction index) of the first approval transaction for this dispatch.
* `call_hash`: The hash of the call to be executed.

**Namespace**

```
api.tx.multisig.cancelAsMulti
```

**Type**

```typescript
function cancelAsMulti(
  threshold: u16,
  other_signatories: Vec<SeedPrimitivesSignatureAccountId20>,
  timepoint: PalletMultisigTimepoint,
  call_hash: [u8;32]
)
```

### Storage

#### calls

**Namespace**

```
api.query.multisig.calls
```

**Type**

```typescript
function calls(
  [u8;32]
): Option<(WrapperKeepOpaque<Call>,SeedPrimitivesSignatureAccountId20,u128)>
```

#### multisigs

The set of open multisig operations.

**Namespace**

```
api.query.multisig.multisigs
```

**Type**

```typescript
function multisigs(
  SeedPrimitivesSignatureAccountId20,
  [u8;32]
): Option<PalletMultisigMultisig>
```

### Events

#### MultisigApproval

A multisig operation has been approved by someone.

**Namespace**

```
api.events.multisig.MultisigApproval
```

**Type**

```typescript
type MultisigApproval = {
  approving: SeedPrimitivesSignatureAccountId20,
  timepoint: PalletMultisigTimepoint,
  multisig: SeedPrimitivesSignatureAccountId20,
  call_hash: [u8;32]
}
```

#### MultisigCancelled

A multisig operation has been cancelled.

**Namespace**

```
api.events.multisig.MultisigCancelled
```

**Type**

```typescript
type MultisigCancelled = {
  cancelling: SeedPrimitivesSignatureAccountId20,
  timepoint: PalletMultisigTimepoint,
  multisig: SeedPrimitivesSignatureAccountId20,
  call_hash: [u8;32]
}
```

#### MultisigExecuted

A multisig operation has been executed.

**Namespace**

```
api.events.multisig.MultisigExecuted
```

**Type**

```typescript
type MultisigExecuted = {
  approving: SeedPrimitivesSignatureAccountId20,
  timepoint: PalletMultisigTimepoint,
  multisig: SeedPrimitivesSignatureAccountId20,
  call_hash: [u8;32],
  result: Result<Null, SpRuntimeDispatchError>
}
```

#### NewMultisig

A new multisig operation has begun.

**Namespace**

```
api.events.multisig.NewMultisig
```

**Type**

```typescript
type NewMultisig = {
  approving: SeedPrimitivesSignatureAccountId20,
  multisig: SeedPrimitivesSignatureAccountId20,
  call_hash: [u8;32]
}
```

### Errors

#### AlreadyApproved

Call is already approved by this signatory.

**Namespace**

```
api.errors.multisig.AlreadyApproved
```

#### AlreadyStored

The data to be stored is already stored.

**Namespace**

```
api.errors.multisig.AlreadyStored
```

#### MaxWeightTooLow

The maximum weight information provided was too low.

**Namespace**

```
api.errors.multisig.MaxWeightTooLow
```

#### MinimumThreshold

Threshold must be 2 or greater.

**Namespace**

```
api.errors.multisig.MinimumThreshold
```

#### NoApprovalsNeeded

Call doesn't need any (more) approvals.

**Namespace**

```
api.errors.multisig.NoApprovalsNeeded
```

#### NotFound

Multisig operation not found when attempting to cancel.

**Namespace**

```
api.errors.multisig.NotFound
```

#### NoTimepoint

No timepoint was given, yet the multisig operation is already underway.

**Namespace**

```
api.errors.multisig.NoTimepoint
```

#### NotOwner

Only the account that originally created the multisig is able to cancel it.

**Namespace**

```
api.errors.multisig.NotOwner
```

#### SenderInSignatories

The sender was contained in the other signatories; it shouldn't be.

**Namespace**

```
api.errors.multisig.SenderInSignatories
```

#### SignatoriesOutOfOrder

The signatories were provided out of order; they should be ordered.

**Namespace**

```
api.errors.multisig.SignatoriesOutOfOrder
```

#### TooFewSignatories

There are too few signatories in the list.

**Namespace**

```
api.errors.multisig.TooFewSignatories
```

#### TooManySignatories

There are too many signatories in the list.

**Namespace**

```
api.errors.multisig.TooManySignatories
```

#### UnexpectedTimepoint

A timepoint was given, yet no multisig operation is underway.

**Namespace**

```
api.errors.multisig.UnexpectedTimepoint
```

#### WrongTimepoint

A different timepoint was given to the multisig operation that is underway.

**Namespace**

```
api.errors.multisig.WrongTimepoint
```

### Constants

#### depositBase

The base amount of currency needed to reserve for creating a multisig execution or to store a dispatch call for later.

This is held for an additional storage item whose value size is `4 + sizeof((BlockNumber, Balance, AccountId))` bytes and whose key size is `32 + sizeof(AccountId)` bytes.

**Namespace**

```
api.consts.multisig.depositBase
```

**Type**

```typescript
type depositBase = u128
```

#### depositFactor

The amount of currency needed per unit threshold when creating a multisig execution.

This is held for adding 32 bytes more into a pre-existing storage value.

**Namespace**

```
api.consts.multisig.depositFactor
```

**Type**

```typescript
type depositFactor = u128
```

#### maxSignatories

The maximum amount of signatories allowed in the multisig.

**Namespace**

```
api.consts.multisig.maxSignatories
```

**Type**

```typescript
type maxSignatories = u16
```
