-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Craig M. <[email protected]>
- Loading branch information
1 parent
57e3e37
commit 404bf55
Showing
24 changed files
with
1,142 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
NEXT_PUBLIC_PUBLISHABLE_KEY= | ||
NEXT_PUBLIC_CLIENT_ID= |
6 changes: 6 additions & 0 deletions
6
examples/orderbook/fulfill-listing-with-nextjs/.eslintrc.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"root": true, | ||
"extends": [ | ||
"next/core-web-vitals" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
.yarn/install-state.gz | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
.next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
This example application demonstrates how to fill a listing using the Immutable SDK. The application connects to the Immutable Sandbox environment and requires a valid client ID and publishable API key (which can be retrieved from the Immutable Hub). | ||
|
||
In order to fill a listing, valid ERC721 or ERC1155 orders should exist in the system. The application will prompt the user to connect their Passport wallet and approve the settlement contract to transfer the currency tokens on their behalf. Once the currency is approved, a listing is filled on a best effort basis. | ||
|
||
## Features | ||
- Fill a ERC721 listing | ||
- Fill a ERC1155 listing | ||
|
||
## Prerequisites | ||
- Node.js | ||
|
||
## Getting Started | ||
1. Install the dependencies: | ||
|
||
```bash | ||
yarn | ||
``` | ||
|
||
2. Copy the `.env.example` file to `.env`: | ||
|
||
```bash | ||
cp .env.example .env | ||
``` | ||
|
||
3. Replace the `NEXT_PUBLIC_PUBLISHABLE_KEY` and `NEXT_PUBLIC_CLIENT_ID` with your own values from the Immutable Hub. | ||
|
||
|
||
4. Run the development server: | ||
|
||
```bash | ||
yarn dev | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) with your browser and you'll be navigated to the home screen. | ||
|
||
## Fill a ERC721 listing | ||
1. Click on the "Fulfill listing - Complete fulfillment with ERC721" button | ||
2. Connect your Passport wallet | ||
3. Filter listings based on criteria, | ||
- NFT Contract Address: The contract address of the ERC721 token | ||
- Currency Type: The type of currency (Native or ERC20) you'd like to receive for the item | ||
4. Click on the "Buy" button | ||
5. Approve the settlement contract to transfer tokens on your behalf | ||
6. If successful, the listing will be created and the order ID will be displayed | ||
7. If unsuccessful, an error message will be displayed | ||
|
||
## Fill a ERC1155 listing | ||
1. Click on the "Fulfill listing - Complete fulfillment with ERC1155" button | ||
2. Connect your Passport wallet | ||
3. Filter listings based on criteria, | ||
- NFT Contract Address: The contract address of the ERC1155 token | ||
- Currency Type: The type of currency (Native or ERC20) you'd like to receive for the item | ||
4. Click on the "Buy" button | ||
5. Approve the settlement contract to transfer tokens on your behalf | ||
6. If successful, the listing will be created and the order ID will be displayed | ||
7. If unsuccessful, an error message will be displayed | ||
|
||
## Required Environment Variables | ||
|
||
- NEXT_PUBLIC_PUBLISHABLE_KEY // replace with your publishable API key from Hub | ||
- NEXT_PUBLIC_CLIENT_ID // replace with your client ID from Hub |
4 changes: 4 additions & 0 deletions
4
examples/orderbook/fulfill-listing-with-nextjs/next.config.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
|
||
export default nextConfig; |
29 changes: 29 additions & 0 deletions
29
examples/orderbook/fulfill-listing-with-nextjs/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "@examples/fulfill-listing-with-nextjs", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint", | ||
"test": "playwright test" | ||
}, | ||
"dependencies": { | ||
"@biom3/react": "^0.26.1", | ||
"@imtbl/sdk": "latest", | ||
"ethers": "^5.7.2", | ||
"next": "14.2.7", | ||
"react": "^18", | ||
"react-dom": "^18" | ||
}, | ||
"devDependencies": { | ||
"@playwright/test": "^1.45.3", | ||
"@types/node": "^20", | ||
"@types/react": "^18", | ||
"@types/react-dom": "^18", | ||
"eslint": "^8", | ||
"eslint-config-next": "14.2.7", | ||
"typescript": "^5" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
examples/orderbook/fulfill-listing-with-nextjs/playwright.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { defineConfig, devices } from "@playwright/test"; | ||
|
||
export default defineConfig({ | ||
testDir: "./tests", | ||
fullyParallel: true, | ||
forbidOnly: !!process.env.CI, | ||
retries: process.env.CI ? 2 : 0, | ||
workers: process.env.CI ? 1 : undefined, | ||
reporter: "html", | ||
|
||
use: { | ||
baseURL: "http://localhost:3000", | ||
trace: "on-first-retry", | ||
}, | ||
|
||
projects: [ | ||
{ name: "chromium", use: { ...devices["Desktop Chrome"] } }, | ||
{ name: "firefox", use: { ...devices["Desktop Firefox"] } }, | ||
{ name: "webkit", use: { ...devices["Desktop Safari"] } }, | ||
|
||
{ name: "Mobile Chrome", use: { ...devices["Pixel 5"] } }, | ||
{ name: "Mobile Safari", use: { ...devices["iPhone 12"] } }, | ||
], | ||
|
||
webServer: { | ||
command: "yarn dev", | ||
url: "http://localhost:3000", | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
}); |
Binary file not shown.
Oops, something went wrong.