Skip to content
This repository was archived by the owner on May 24, 2024. It is now read-only.

Add CodePen examples #40

Merged
merged 1 commit into from
Jun 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions source/includes/resources/listings.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const listing = await origin.listings.get(listingAddress)
name: "Kettlebell For Sale",
category: "Health and Beauty",
description: "32kg gorilla kettlebell",
location: "San Fransisco, CA",
location: "San Francisco, CA",
pictures: [],

address: "0x061b8d5f9e432e6b23d79fac02e5792eb8746ce5",
Expand All @@ -32,6 +32,7 @@ const listing = await origin.listings.get(listingAddress)

This will return information about the listing, combining information from IPFS and the blockchain. In the future, fields returned may differ based on the listing's schema.

<p data-height="440" data-theme-id="dark" data-slug-hash="vrzqYo" data-default-tab="js,result" data-user="originprotocol" data-embed-version="2" data-pen-title="Origin.js: Get Listing" class="codepen">See the Pen <a href="https://codepen.io/originprotocol/pen/vrzqYo/">Origin.js: Get Listing</a> by Origin Protocol (<a href="https://codepen.io/originprotocol">@originprotocol</a>) on <a href="https://codepen.io">CodePen</a>.</p>

## getByIndex

Expand All @@ -44,7 +45,7 @@ const listing = await origin.listings.getByIndex(1)
name: "Kettlebell For Sale",
category: "Health and Beauty",
description: "32kg gorilla kettlebell",
location: "San Fransisco, CA",
location: "San Francisco, CA",
pictures: [],

address: "659cbb0e2411a44db63778987b1e22153c086a95eb6b18bdf89de078917abc63",
Expand All @@ -56,11 +57,12 @@ const listing = await origin.listings.getByIndex(1)
}
```


**This method is deprecated**, and will be removed soon. Use `get` instead.

This will return information about the listing, combining information from IPFS and the blockchain. In the future, fields returned may differ based on the listing's schema.

<p data-height="420" data-theme-id="dark" data-slug-hash="VdGJwO" data-default-tab="js,result" data-user="originprotocol" data-embed-version="2" data-pen-title="Origin.js: Get Listing By Index" class="codepen">See the Pen <a href="https://codepen.io/originprotocol/pen/VdGJwO/">Origin.js: Get Listing By Index</a> by Origin Protocol (<a href="https://codepen.io/originprotocol">@originprotocol</a>) on <a href="https://codepen.io">CodePen</a>.</p>

## create

> To create a listing
Expand All @@ -69,7 +71,7 @@ This will return information about the listing, combining information from IPFS
const listingData = {
name: "Kettlebell For Sale",
category: "Health and Beauty",
location: "San Fransisco, CA",
location: "San Francisco, CA",
description:
"32kg gorilla kettlebell",
pictures: [],
Expand All @@ -88,6 +90,8 @@ The wallet used to create the listing is used as the seller.

A listing will expire 60 days after its expiration date.

<p data-height="780" data-theme-id="dark" data-slug-hash="oyPrNV" data-default-tab="js,result" data-user="originprotocol" data-embed-version="2" data-pen-title="Origin.js: Create Listing" class="codepen">See the Pen <a href="https://codepen.io/originprotocol/pen/oyPrNV/">Origin.js: Create Listing</a> by Origin Protocol (<a href="https://codepen.io/originprotocol">@originprotocol</a>) on <a href="https://codepen.io">CodePen</a>.</p>

## buy

> To buy a listing
Expand Down
1 change: 1 addition & 0 deletions source/layouts/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,6 @@ under the License.
<% end %>
</div>
</div>
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>
</body>
</html>