Skip to content

Commit

Permalink
[docs] Removing patterns (#17012)
Browse files Browse the repository at this point in the history
## Description 

Removing patterns because they belong in move book.

## Test Plan 

How did you test the new or updated feature?

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
ronny-mysten authored Apr 2, 2024
1 parent e58c5df commit 227bd92
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 56 deletions.
4 changes: 1 addition & 3 deletions docs/content/concepts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ Sui is different than other blockchains. The concepts explored in this section p

<Cards>
<Card title="Move overview" href="concepts/sui-move-concepts"/>
<Card title="Patterns" href="concepts/sui-move-concepts/patterns"/>
<Card title="Package upgrades" href="concepts/sui-move-concepts/packages/upgrade">
</Card>
<Card title="Package upgrades" href="concepts/sui-move-concepts/packages/upgrade"/>
</Cards>

## Objects
Expand Down
4 changes: 0 additions & 4 deletions docs/content/concepts/sui-move-concepts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,3 @@ Move does not have a native type for strings, but it has a useful wrapper. See [
### One-time witness

A one-time witness (OTW) is a special instance of a type created in the module initializer and guaranteed to be unique with only one instance. See [One-Time Witness](./sui-move-concepts/one-time-witness.mdx) for an example.

### Patterns

Move coding patterns, or techniques, solve logic problems you encounter when developing Move packages for the Sui blockchain. See the [Patterns](./sui-move-concepts/patterns.mdx) section for a list of documented coding patterns.
29 changes: 0 additions & 29 deletions docs/content/concepts/sui-move-concepts/patterns.mdx

This file was deleted.

4 changes: 2 additions & 2 deletions docs/content/guides/developer/app-examples/coin-flip.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ Next, add some more code to this module:
```

- The first struct, `HouseData`, stores the most essential information pertaining to the game.
- The second struct, `HouseCap`, is a [capability](concepts/sui-move-concepts/patterns/capabilities.mdx) that initializes the house data.
- The third struct, `HOUSE_DATA`, is a [one-time witness](concepts/sui-move-concepts/one-time-witness.mdx) that ensures only a single instance of this `HouseData` ever exists.
- The second struct, `HouseCap`, is a capability that initializes the house data.
- The third struct, `HOUSE_DATA`, is a one-time witness that ensures only a single instance of this `HouseData` ever exists.
- The [`init` function](concepts/sui-move-concepts/init.mdx) creates and sends the `Publisher` and `HouseCap` objects to the sender.

So far, you've set up the data structures within the module. Now, create a function that initializes the house data and shares the `HouseData` object:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fun init(otw: WEATHER, ctx: &mut TxContext) {
}
```

- The first struct, `AdminCap`, is a [capability](concepts/sui-move-concepts/patterns/capabilities.mdx).
- The first struct, `AdminCap`, is a capability.
- The second struct, `WEATHER`, is a [one-time witness](concepts/sui-move-concepts/one-time-witness.mdx) that ensures only a single instance of this `Weather` ever exists.
- The `WeatherOracle` struct works as a registry and stores the `geoname_id`s of the `CityWeatherOracle`s as [dynamic fields](concepts/dynamic-fields.mdx).
- The [`init` function](concepts/sui-move-concepts/init.mdx) creates and sends the `Publisher` and `AdminCap` objects to the sender. Also, it creates a [shared object](concepts/object-ownership/shared.mdx) for all the `CityWeatherOracle`s.
Expand Down
2 changes: 1 addition & 1 deletion docs/content/guides/developer/sui-101/simulating-refs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Programmable transaction blocks (PTBs) do not currently allow the use of object

## The borrow module

The Sui framework includes a [borrow](https://github.com/MystenLabs/sui/blob/main/crates/sui-framework/docs/borrow.md) module that offers a solution to the reference problem. The module provides access to an object by value but builds a model that makes it impossible to destroy, transfer, or wrap the object retrieved. The borrow module exposes a `Referent` object that wraps another object (the object you want to reference). The module uses the [hot potato pattern](/concepts/sui-move-concepts/patterns/hot-potato.mdx) (via a `Borrow` instance) to allow retrieval of the wrapped object by value. Within the same PTB, the module then forces the object to be returned to the `Referent`. The `Borrow` instance guarantees that the object returned is the same that was retrieved.
The Sui framework includes a [borrow](https://github.com/MystenLabs/sui/blob/main/crates/sui-framework/docs/borrow.md) module that offers a solution to the reference problem. The module provides access to an object by value but builds a model that makes it impossible to destroy, transfer, or wrap the object retrieved. The borrow module exposes a `Referent` object that wraps another object (the object you want to reference). The module uses the hot potato pattern (via a `Borrow` instance) to allow retrieval of the wrapped object by value. Within the same PTB, the module then forces the object to be returned to the `Referent`. The `Borrow` instance guarantees that the object returned is the same that was retrieved.

As an example, consider the following module stub that exposes an object (`Asset`) and a function (`use_asset`) to use that object.

Expand Down
16 changes: 0 additions & 16 deletions docs/content/sidebars/concepts.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,6 @@ const concepts = [
'concepts/sui-move-concepts/packages/custom-policies',
],
},
{
type: 'category',
label: 'Patterns',
link: {
type: 'doc',
id: 'concepts/sui-move-concepts/patterns',
},
items: [
'concepts/sui-move-concepts/patterns/capabilities',
'concepts/sui-move-concepts/patterns/witness',
'concepts/sui-move-concepts/patterns/transferrable-witness',
'concepts/sui-move-concepts/patterns/hot-potato',
'concepts/sui-move-concepts/patterns/id-pointer',
'concepts/sui-move-concepts/patterns/app-extensions',
],
},
'concepts/sui-move-concepts/conventions',
],
},
Expand Down

0 comments on commit 227bd92

Please sign in to comment.