generated from NEARBuilders/near-bos-webcomponent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from NEARBuilders/chore/replace-bundle
Adds script for generating index.html
- Loading branch information
Showing
199 changed files
with
505,559 additions
and
14,243 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
{ | ||
"account": "blackdrogon.near", | ||
"account": "example.near", | ||
"aliases": ["./aliases.mainnet.json"], | ||
"index": "blackdrogon.near/widget/Index" | ||
} | ||
"index": "example.near/widget/Index", | ||
"gateway": { | ||
"bundleUrl": "./dist", | ||
"tagName": "near-social-viewer" | ||
}, | ||
"ipfs": { | ||
"gateway": "https://ipfs.near.social/ipfs", | ||
"uploadApi": "https://ipfs.near.social/add", | ||
"uploadApiHeaders": {} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,28 @@ | ||
{ | ||
"blackdrogon.near": {} | ||
"example.near": { | ||
"widget": { | ||
"Index": { | ||
"metadata": { | ||
"name": "MintBOS Marketplace Template", | ||
"description": "Whitelabel marketplace template built with MintBOS on NEAR's decentralized front-end framework", | ||
"linktree": { | ||
"website": "" | ||
}, | ||
"image": { | ||
"ipfs_cid": "bafkreicwzq6dlcynhceovrtslsjja2d76b7ysnjih4qmqlk7atre3w2nay" | ||
}, | ||
"backgroundImage": { | ||
"ipfs_cid": "bafkreicwzq6dlcynhceovrtslsjja2d76b7ysnjih4qmqlk7atre3w2nay" | ||
}, | ||
"tags": { | ||
"bitte": "", | ||
"mintbos": "", | ||
"marketplace": "", | ||
"open-source": "", | ||
"app": "" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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,75 @@ | ||
# Custom Gateway | ||
|
||
This code represents a [near-bos-webcomponent](https://github.com/NEARBuilders/near-bos-webcomponent), which describes the version of the near-social-vm and its dependencies that is used to render the widgets. | ||
|
||
The gateway `bundleUrl` is configured in the [bos.config.json](../bos.config.json). It can either be a relative path to a web component's distribution bundle (`./gateway-bundle/dist`), such as this one, or it can use an existing bundle deployed to a remote url. | ||
|
||
## Setup & Local Development | ||
|
||
### Installing dependencies | ||
|
||
```bash | ||
pnpm install | ||
``` | ||
|
||
### Running the app | ||
|
||
First, run the development server: | ||
|
||
```bash | ||
pnpm run dev | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) in your browser to see the result. | ||
|
||
### Building for production | ||
|
||
```bash | ||
pnpm run prod | ||
``` | ||
|
||
## Customizing the Gateway | ||
|
||
This repository optionally includes a custom gateway for full control of the environment the Widgets run in. | ||
|
||
Reasons for customization may include: | ||
|
||
1. Supporting more or different versions of wallets | ||
2. Introducing external APIs through custom elements (e.g. `Wallet`, `Link`, or `StripePayment`) | ||
3. Query parameter pre-processing, router configurations, etc. | ||
|
||
Follow the [Customizing the Gateway](https://github.com/NEARBuilders/bos-workspace?tab=readme-ov-file#customizing-the-gateway) guide for how to customize. | ||
|
||
Once done, remember to [Publish the build to NEARFS](./gateway-bundle/README.md#publishing-to-nearfs), and then this bundleUrl can be configured in `bos.config.json`. | ||
|
||
## Publishing to NEARFS | ||
|
||
To publish, use the helper script to create and upload an [IPFS CAR](https://car.ipfs.io/), deployed to nearfs with a signature from your NEAR account. | ||
|
||
```bash | ||
pnpm prepare:release <signer account> <signer key> <network> | ||
``` | ||
|
||
This script will output the CID to terminal, as well as automatically save it under nearfs.cid in package.json. | ||
|
||
**Parameters:** | ||
|
||
- `signer account`: NEAR account to use for signing IPFS URL update transaction, see [web4-deploy](https://github.com/vgrichina/web4-deploy?tab=readme-ov-file#deploy-fully-on-chain-to-nearfs) | ||
- `signer key`: NEAR account private key to use for signing. Should have base58-encoded key starting with `ed25519:`. Will attempt to sign from keychain (~/.near-credentials/) if not provided. | ||
- `network`: NEAR network to use. Defaults to mainnet. | ||
|
||
This is an example of the NEARFS url, and you should replace with the cid you received above: | ||
|
||
<https://ipfs.web4.near.page/ipfs/bafybeiftqwg2qdfhjwuxt5cjvvsxflp6ghhwgz5db3i4tqipocvyzhn2bq/> | ||
|
||
After uploading, it normally takes some minutes before the files are visible on NEARFS. When going to the expected URL based on the IPFS address we saw above, we will first see the message `Not found`. | ||
|
||
## Deploy to Web4 | ||
|
||
Rather than deploying to a hosting provider like Vercel, this repository comes equipped with the scripts necessary to deploy to [Web4](https://github.com/vgrichina/web4), for fully decentralized web hosting. For full documentation, refer to [web4-deploy](https://github.com/vgrichina/web4-deploy). | ||
|
||
1. Build the distribution bundle, `pnpm run build` | ||
2. Be sure to have deployed a web4 smart contract, such as the [web4-min-contract](https://github.com/vgrichina/web4-min-contract) to web4.YOUR_ACCOUNT.near | ||
3. Configure with the web4 account and run `pnpm run web4:deploy` | ||
|
||
This final command will upload the `/dist` to [NEARFS](https://github.com/vgrichina/nearfs) and then call `web4_setStaticUrl` on your web4 contract to point to this uploaded bundle. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,8 @@ | ||
"use strict"; | ||
(self['webpackChunkgateway'] = self['webpackChunkgateway'] || []).push([["-_fde60"], { | ||
"?fde6": (function () { | ||
/* (ignored) */ | ||
|
||
}), | ||
|
||
}]); |
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,8 @@ | ||
"use strict"; | ||
(self['webpackChunkgateway'] = self['webpackChunkgateway'] || []).push([["-_fde61"], { | ||
"?fde6": (function () { | ||
/* (ignored) */ | ||
|
||
}), | ||
|
||
}]); |
Oops, something went wrong.