# Storage with/without annotations

> Source: https://taquito.io/docs/24.2.0/storage_annotations

This section shows how to write storage when :

- it has annotations
- it has no annotation
- it has a mix of annotated and not-annotated properties

To do so, let's look at three examples of contract origination showing initial values in the storage.

### When all the properties are annotated

```
//storage representation in Michelson

(pair
    (pair
        (pair (address %theAddress) (bool %theBool))
        (pair (nat %theNat) (int %theNumber)))
    (mutez %theTez))
```

We need to write the storage as a Javascript object and include the annotated names in it.

#### Contract API

```js
// const Tezos = new TezosToolkit('https://tezos-shadownet.octez.io');

try {
  const originationOp = await Tezos.contract.originate({
    code: contractStorageAnnot,
    storage: {
      theAddress: 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr',
      theBool: true,
      theNat: '3',
      theNumber: '5',
      theTez: '10',
    },
  });
  console.log(`Waiting for confirmation of origination for ${originationOp.contractAddress}...`);
  await originationOp.contract();
  console.log(`Origination completed.`);
} catch (error) {
  console.log(`Error: ${JSON.stringify(error, null, 2)}`);
}
```

  
#### Wallet API

```js
// const Tezos = new TezosToolkit('https://tezos-shadownet.octez.io');

try {
  const originationOp = await Tezos.wallet
    .originate({
      code: contractStorageAnnot,
      storage: {
        theAddress: 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr',
        theBool: true,
        theNat: '3',
        theNumber: '5',
        theTez: '10',
      },
    })
    .send();
  console.log(`Waiting for confirmation of origination...`);
  await originationOp.contract();
  console.log(`Origination completed.`);
} catch (error) {
  console.log(`Error: ${JSON.stringify(error, null, 2)}`);
}
```
  

### When there is no annotation

```
//storage representation in Michelson

(pair
    (pair
        (pair (address) (bool))
        (pair (nat) (int)))
    (mutez))
```

All properties in storage are accessible by the index corresponding to the order that the storage is defined.

#### Contract API

```js
// const Tezos = new TezosToolkit('https://tezos-shadownet.octez.io');

try {
  const originationOp = await Tezos.contract.originate({
    code: contractStorageWithoutAnnot,
    storage: {
      0: 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', //address
      1: true, //bool
      2: '3', //nat
      3: '5', //int
      4: '10', //mutez
    },
  });
  console.log(`Waiting for confirmation of origination for ${originationOp.contractAddress}...`);
  await originationOp.contract();
  console.log(`Origination completed.`);
} catch (error) {
  console.log(`Error: ${JSON.stringify(error, null, 2)}`);
}
```

  
#### Wallet API

```js
// const Tezos = new TezosToolkit('https://tezos-shadownet.octez.io');

try {
  const originationOp = await Tezos.wallet
    .originate({
      code: contractStorageWithoutAnnot,
      storage: {
        0: 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', //address
        1: true, //bool
        2: '3', //nat
        3: '5', //int
        4: '10', //mutez
      },
    })
    .send();
  console.log(`Waiting for confirmation of origination...`);
  await originationOp.contract();
  console.log(`Origination completed.`);
} catch (error) {
  console.log(`Error: ${JSON.stringify(error, null, 2)}`);
}
```
  

### When some arguments are annotated and others are not

```
//storage representation in Michelson

(pair
    (pair
        (pair (address) (bool))
        (pair (nat %theNat) (int %theNumber)))
    (mutez))
```

In the following example, only the elements in positions 2 and 3 have an annotation. We need to access these elements with their annotated name and the others with corresponding indexes.

Note that when proprieties have annotations, we cannot access them by index. For example, if you replace "theNat" by 2 and "theNumber" by 3 in this code example, it will fail.

#### Contract API

```js
// const Tezos = new TezosToolkit('https://tezos-shadownet.octez.io');

try {
  const originationOp = await Tezos.contract.originate({
    code: contractStorageWithAndWithoutAnnot,
    storage: {
      0: 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', //address
      1: true, //bool
      theNat: '3',
      theNumber: '5',
      4: '10', //mutez
    },
  });
  console.log(`Waiting for confirmation of origination for ${originationOp.contractAddress}...`);
  await originationOp.contract();
  console.log(`Origination completed.`);
} catch (error) {
  console.log(`Error: ${JSON.stringify(error, null, 2)}`);
}
```

  
#### Wallet API

```js
// const Tezos = new TezosToolkit('https://tezos-shadownet.octez.io');

try {
  const originationOp = await Tezos.wallet
    .originate({
      code: contractStorageWithAndWithoutAnnot,
      storage: {
        0: 'tz1PgQt52JMirBUhhkq1eanX8hVd1Fsg71Lr', //address
        1: true, //bool
        theNat: '3',
        theNumber: '5',
        4: '10', //mutez
      },
    })
    .send();
  console.log(`Waiting for confirmation of origination...`);
  await originationOp.contract();
  console.log(`Origination completed.`);
} catch (error) {
  console.log(`Error: ${JSON.stringify(error, null, 2)}`);
}
```
