Skip to content

Commit

Permalink
Added increase paid storage examples for wallet API usage
Browse files Browse the repository at this point in the history
  • Loading branch information
dsawali committed Jan 17, 2023
1 parent 65f05fa commit 69a6bc3
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 14 deletions.
50 changes: 43 additions & 7 deletions docs/increase_paid_storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ This helps resolve an issue where several operations on the same contract would

For more information on this change, refer to this [MR](https://gitlab.com/tezos/tezos/-/merge_requests/5605) in the Tezos codebase.
## Examples
Similar to other operations, the Increase Paid Storage operation will be available in the Contract API (and later, the wallet API).
Similar to other operations, the Increase Paid Storage operation is available in the Contract and Wallet API

### Simple Usage
### Contract API

#### Simple Usage
```js
const op = await Tezos.contract.increasePaidStorage({
amount: 2,
Expand All @@ -25,8 +27,8 @@ await op.confirmation();

After waiting for the operation confirmation, you will also have access to various getters of the operation such as `status`, `amount`, `destination`, `fee`, `gasLimit`, `errors`, `storageLimit`, `consumedMilligas`.

### Usage in Batches
```js
#### Usage in Batches
```typescript
const op = await Tezos.contract
.batch()
.withOrigination({
Expand All @@ -45,12 +47,12 @@ const op = await Tezos.contract
destination: 'SMART_CONTRACT_ADDRESS'
})
.send();

await op.confirmation();
```

or
```js
```typescript
const op = await Tezos.contract.batch([
{
kind: 'origination',
Expand All @@ -69,4 +71,38 @@ const op = await Tezos.contract.batch([
await op.confirmation();
```

Both syntax will work fine for batching any operations, including `increase_paid_storage`.
Both syntax will work fine for batching any operations, including `increase_paid_storage`.

### Wallet API

#### Usage Example
```typescript
const op = await Tezos.wallet.increasePaidStorage({
amount: 1,
destination: simpleContractAddress
}).send();
```

#### Usage in Batches
```typescript
const batch = await Tezos.wallet
.batch()
.withOrigination({
balance: "1",
code: `parameter string;
storage string;
code {CAR;
PUSH string "Hello ";
CONCAT;
NIL operation; PAIR};
`,
init: `"test"`
})
.withIncreasePaidStorage({
amount: 1,
destination: simpleContractAddress
});

const op = await batch.send();
await op.confirmation();
```
50 changes: 43 additions & 7 deletions website/versioned_docs/version-15.1.0/increase_paid_storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ This helps resolve an issue where several operations on the same contract would

For more information on this change, refer to this [MR](https://gitlab.com/tezos/tezos/-/merge_requests/5605) in the Tezos codebase.
## Examples
Similar to other operations, the Increase Paid Storage operation will be available in the Contract API (and later, the wallet API).
Similar to other operations, the Increase Paid Storage operation is available in the Contract and Wallet API

### Simple Usage
### Contract API

#### Simple Usage
```js
const op = await Tezos.contract.increasePaidStorage({
amount: 2,
Expand All @@ -25,8 +27,8 @@ await op.confirmation();

After waiting for the operation confirmation, you will also have access to various getters of the operation such as `status`, `amount`, `destination`, `fee`, `gasLimit`, `errors`, `storageLimit`, `consumedMilligas`.

### Usage in Batches
```js
#### Usage in Batches
```typescript
const op = await Tezos.contract
.batch()
.withOrigination({
Expand All @@ -45,12 +47,12 @@ const op = await Tezos.contract
destination: 'SMART_CONTRACT_ADDRESS'
})
.send();

await op.confirmation();
```

or
```js
```typescript
const op = await Tezos.contract.batch([
{
kind: 'origination',
Expand All @@ -69,4 +71,38 @@ const op = await Tezos.contract.batch([
await op.confirmation();
```

Both syntax will work fine for batching any operations, including `increase_paid_storage`.
Both syntax will work fine for batching any operations, including `increase_paid_storage`.

### Wallet API

#### Usage Example
```typescript
const op = await Tezos.wallet.increasePaidStorage({
amount: 1,
destination: simpleContractAddress
}).send();
```

#### Usage in Batches
```typescript
const batch = await Tezos.wallet
.batch()
.withOrigination({
balance: "1",
code: `parameter string;
storage string;
code {CAR;
PUSH string "Hello ";
CONCAT;
NIL operation; PAIR};
`,
init: `"test"`
})
.withIncreasePaidStorage({
amount: 1,
destination: simpleContractAddress
});

const op = await batch.send();
await op.confirmation();
```

0 comments on commit 69a6bc3

Please sign in to comment.