Skip to content

Commit

Permalink
thirdweb removed
Browse files Browse the repository at this point in the history
  • Loading branch information
tempe-techie committed Sep 12, 2024
1 parent c10ac85 commit 8d0069e
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 462 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ IMAGEKIT_PRIVATE_KEY=
LINK_PREVIEW_SERVICE=
RPC_CUSTOM=
TENOR_KEY=
THIRDWEB_CLIENT_ID=
ARWEAVE_KTY=
ARWEAVE_N=
ARWEAVE_E=
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ jobs:
timeout-minutes: 20
env: # Environment variables from either organization or repository settings page (for GitHub Actions).
TENOR_KEY: ${{ secrets.TENOR_KEY }}
THIRDWEB_CLIENT_ID: ${{ secrets.THIRDWEB_CLIENT_ID }}
IMAGEKIT_ENDPOINT: ${{ secrets.IMAGEKIT_ENDPOINT }}
IMAGEKIT_PUBLIC_KEY: ${{ secrets.IMAGEKIT_PUBLIC_KEY }}
IMAGEKIT_PRIVATE_KEY: ${{ secrets.IMAGEKIT_PRIVATE_KEY }}
steps:
- name: Checkout 🛎️
uses: actions/[email protected]
Expand Down
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,39 @@ Then, when you create a project on 4everland, make sure you select the `build` b

And in the build section delete the command and set build folder to empty (or `./`). The preset can be set to `Other`. No install command is needed either.

![](https://bafkreid6mzglrk5hklraua267sker6gqsfpy2ezmjj7yc2oqmx2arbynru.ipfs.w3s.link)
![](https://arweave.net/j6bPfBOYMOYFqg9V_80i8sPPqy7EXc3Nw9Lfyz6wjVg)

## GIFs (Tenor)

If you want to have GIF search implemented, create your own Tenor API Key on Google Cloud Console. Follow the instructions here: https://developers.google.com/tenor/guides/quickstart.

Then enter the key in environment variables (`TENOR_KEY`).

## Image upload (ThirdWeb/IPFS)
## Image upload (Arweave)

To support image uploads on IPFS please create an API key on ThirdWeb: https://thirdweb.com/dashboard/settings/api-keys
To support image uploads, create an Arweave Wallet (e.g. here:https://arweave.app/) and send some AR to it.

Make sure to whitelist only your website domain/URL. And also restrict (toggle off) the API key usage for other services apart from Storage Upload service (even Storage Download is not needed).
Then go to the wallet settings and download Backup Keyfile.

Then add the Client ID of your API key to your environment variables:
In this file you'll find 10 different variables, enter these into your .env file:

```bash
THIRDWEB_CLIENT_ID=
ARWEAVE_KTY=
ARWEAVE_N=
ARWEAVE_E=
ARWEAVE_D=
ARWEAVE_P=
ARWEAVE_Q=
ARWEAVE_DP=
ARWEAVE_DQ=
ARWEAVE_QI=
```

Also make sure these variables are set on your hosting provider (Netlify, Vercel, etc).

## Image upload fallback

It is recommended to use ImageKit as the fallback option, in case ThirdWeb has technical issues.
It is recommended to use ImageKit as the fallback option, in case Arweave has technical issues.

For this to work, create an account at [ImageKit.io](https://imagekit.io/) and add these environment variables to your project:

Expand Down
6 changes: 3 additions & 3 deletions components/nft/collection/ChangeNftTypeModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,21 @@

<p v-if="typeChoice == 1">
The "Static metadata URL" option means that all the NFTs in the collection have the same (static) image
and meta data. The metadata is stored offchain, usually on IPFS or on a centralized server. Use this
and meta data. The metadata is stored offchain, usually on Arweave, IPFS or on a centralized server. Use this
option if you have a URL of a single metadata
<strong>file</strong> (all NFTs have the same metadata and image).
</p>

<p v-if="typeChoice == 2">
The "Generative metadata (.json)" option means that all the NFTs in the collection have a different image
and different meta data. The metadata is stored offchain, usually on IPFS or on a centralized server. Use
and different meta data. The metadata is stored offchain, usually on Arweave, IPFS or on a centralized server. Use
this option if you have a metadata <strong>folder</strong> URL with multiple metadata files in it, where
these files HAVE a .json extension.
</p>

<p v-if="typeChoice == 3">
The "Generative metadata" option means that all the NFTs in the collection have a different image and
different meta data. The metadata is stored offchain, usually on IPFS or on a centralized server. Use this
different meta data. The metadata is stored offchain, usually on Arweave, IPFS or on a centralized server. Use this
option if you have a metadata <strong>folder</strong> URL with multiple metadata files in it, where these
files DO NOT HAVE a .json extension.
</p>
Expand Down
10 changes: 7 additions & 3 deletions components/nft/collection/SendNftModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,12 @@ export default {
return;
}
const tokenURI = await nftContract.tokenURI(this.tokenId);
let tokenURI = await nftContract.tokenURI(this.tokenId);
if (tokenURI.startsWith("ipfs://")) {
tokenURI = tokenURI.replace("ipfs://", this.$config.ipfsGateway);
} else if (tokenURI.startsWith("ar://")) {
tokenURI = tokenURI.replace("ar://", this.$config.arweaveGateway);
}
let json; // NFT metadata JSON
Expand All @@ -173,7 +175,7 @@ export default {
const res = await axios.get(tokenURI);
json = await res.data;
} catch (error) {
console.log("error fetching metadata from ipfs for token id: ", String(this.tokenId));
console.log("error fetching metadata for token id: ", String(this.tokenId));
}
} else {
const result = atob(tokenURI.substring(29));
Expand All @@ -182,7 +184,9 @@ export default {
if (json["image"].startsWith("ipfs://")) {
json["image"] = json["image"].replace("ipfs://", this.$config.ipfsGateway);
}
} else if (json["image"].startsWith("ar://")) {
json["image"] = json["image"].replace("ar://", this.$config.arweaveGateway);
}
this.nftImage = json["image"];
this.nftDataLoaded = true;
Expand Down
6 changes: 3 additions & 3 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default defineNuxtConfig({
activityPointsAddress: '0xC3623737209Cc141592B20bcEBCA6052AFCcD183',
airdropApAddress: '0x519Cc13253d5bd6bC0b635B9f337230B34B3b1e7', // chat token claim for APs
airdropClaimDomainsAddress: '0x8c54EAEA2DDAA8491a32F3A0D9B308d810aEA4fc', // chat token claim for domain holders
arweaveGateway: 'https://arweave.net/',
blockExplorerBaseUrl: 'https://sepolia.etherscan.io',
chatChannels: {
// go to Orbis Dashboard (https://useorbis.com/dashboard), create a new Project and then create a new Context for each of the channels below
Expand All @@ -61,13 +62,13 @@ export default defineNuxtConfig({
friendKeys: 'kjzl6cwe1jw14akr2rh1j3fhup1ewfr2uyyd6l85qllbe2d5fxywt7d8rqnau6j',
},
chatTokenAddress: '0x305912c0d03C22e6eB7D37E06A47ab899e48B9Af', // chat token address
chatTokenImage: 'https://bafkreigih3jk3d4fffzml27e7kqyn636t7v646ohxvhv3nzhkzfcmh4prq.ipfs.w3s.link', // chat token image
chatTokenImage: '', // chat token image
chatTokenSymbol: 'DEMO', // chat token symbol or name
domainRequiredToPost: true,
expiryCollections: 1000 * 60 * 60 * 24 * 7, // must be in milliseconds (0 means no expiration)
expiryUsernames: 1000 * 60 * 60 * 24 * 7, // must be in milliseconds (0 means no expiration)
favicon: '/img/favicon.svg',
fileUploadEnabled: true, // enable/disable file uploads (enable only if external file storage is used, e.g. IPFS via ThirdWeb)
fileUploadEnabled: true, // enable/disable file uploads (enable only if external file storage is used, e.g. Arweave)
fileUploadSizeLimit: 1 * 1024 * 1024, // max file upload size in bytes (1 * 1024 * 1024 = 1 MB)
fileUploadTokenService: process.env.FILE_UPLOAD_SERVICE || 'netlify', // "netlify" or "vercel" (or leave empty for no file uploads)
getPostsLimit: 30, // number of posts to fetch from Orbis in the getPosts() function
Expand Down Expand Up @@ -138,7 +139,6 @@ export default defineNuxtConfig({
swapPriceImpactMaxBps: 1000, // max price impact in bips (1 bps = 0.01%, 1000bps = 10%) for the swap function
swapRouterAddress: '', // iggy swap router contract address
tenorApiKey: process.env.TENOR_KEY || '',
thirdwebClientId: process.env.THIRDWEB_CLIENT_ID || '',
tldName: '.sepolia',
tokenAddress: null, // leave null if it's a native token of the chain
tokenDecimals: 18,
Expand Down
Loading

0 comments on commit 8d0069e

Please sign in to comment.