Skip to content

Commit

Permalink
🔧 Use irys gateway on testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Sep 17, 2024
1 parent 6381adf commit 03ca61a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions components/ContentFingerprintLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator'
import { IPFS_VIEW_GATEWAY_URL } from '~/constant';
import { ARWEAVE_ENDPOINT, IPFS_VIEW_GATEWAY_URL } from '~/constant';
export enum ContentFirgerprints {
arweave = 'ar',
Expand All @@ -30,7 +30,7 @@ export default class ContentFingerprintLink extends Vue {
if (!this.item) return null
switch (this.prefix) {
case ContentFirgerprints.arweave:
return `https://arweave.net/${this.item.slice(5)}`
return `${ARWEAVE_ENDPOINT}/${this.item.slice(5)}`
case ContentFirgerprints.ipfs:
return `${IPFS_VIEW_GATEWAY_URL}/${this.item.slice(7)}`
Expand Down
6 changes: 5 additions & 1 deletion components/FileUploadedInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
class="mb-[12px]"
>
<a
:href="`https://arweave.net/${arweaveId}`"
:href="`${arweaveEndPoint}/${arweaveId}`"
target="_blank"
rel="noopener noreferrer"
>
Expand All @@ -51,10 +51,14 @@
<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator'
import { ARWEAVE_ENDPOINT } from '~/constant'
@Component
export default class FileUploadedInfo extends Vue {
@Prop(String) readonly ipfsHash!: string
@Prop(String) readonly arweaveId!: string
@Prop(Number) readonly step: number | undefined
arweaveEndPoint = ARWEAVE_ENDPOINT
}
</script>
2 changes: 2 additions & 0 deletions constant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,5 @@ export const LIKECOIN_CHAIN_STAKING_ENDPOINT = IS_TESTNET
export const UPLOAD_FILESIZE_MAX = 200 * 1024 * 1024; // 200MB

export const NFT_BOOK_PRESS_URL = IS_TESTNET ? 'https://likecoin-nft-book-press-testnet.netlify.app/' : 'https://likecoin.github.io/nft-book-press/';

export const ARWEAVE_ENDPOINT = IS_TESTNET ? 'https://gateway.irys.xyz' : 'https://arweave.net';
3 changes: 2 additions & 1 deletion pages/new/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
import { namespace } from 'vuex-class'
import { ARWEAVE_ENDPOINT } from '~/constant';
import { ISCNRecordWithID } from '~/utils/cosmos/iscn/iscn.type'
import { logTrackerEvent } from '~/utils/logger';
Expand Down Expand Up @@ -171,7 +172,7 @@ export default class NewIndexPage extends Vue {
if ((this.urlIpfsHash || this.urlArweaveId) && this.shouldSkipToMintNFT) {
this.state = 'iscn';
let url;
if (this.urlArweaveId) url = `https://arweave.net/${this.urlArweaveId}`;
if (this.urlArweaveId) url = `${ARWEAVE_ENDPOINT}/${this.urlArweaveId}`;
else if (this.urlIpfsHash) url = `https://ipfs.io/ipfs/${this.urlIpfsHash}`;
if (url) {
const { data, headers } = await this.$axios.get(url, { responseType: 'blob' })
Expand Down
4 changes: 2 additions & 2 deletions pages/nft/iscn/_iscnId.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ import {
} from '~/constant/api'
import { getSigningClient } from '~/utils/cosmos/iscn/sign'
import { ISCNRecordWithID } from '~/utils/cosmos/iscn/iscn.type'
import { LIKER_LAND_URL, LIKER_NFT_API_WALLET, LIKER_NFT_FEE_WALLET } from '~/constant'
import { ARWEAVE_ENDPOINT, LIKER_LAND_URL, LIKER_NFT_API_WALLET, LIKER_NFT_FEE_WALLET } from '~/constant'
import sendLIKE from '~/utils/cosmos/sign'
import { getAccountBalance } from '~/utils/cosmos'
import { logTrackerEvent } from '~/utils/logger'
Expand Down Expand Up @@ -729,7 +729,7 @@ export default class NFTMintPage extends Vue {
}
if (arweaveID) {
try {
const { data } = await this.$axios.get(`https://arweave.net/${arweaveID}`, { responseType: 'blob' })
const { data } = await this.$axios.get(`${ARWEAVE_ENDPOINT}/${arweaveID}`, { responseType: 'blob' })
this.ogImageBlob = data
this.defaultOgImageBlob = data
this.ogImageArweaveId = arweaveID
Expand Down
3 changes: 2 additions & 1 deletion pages/view/_iscnId/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ import {
WALLET_TYPE_REPLACER,
IPFS_VIEW_GATEWAY_URL,
LIKER_LAND_URL,
ARWEAVE_ENDPOINT,
} from '~/constant'
Expand Down Expand Up @@ -686,7 +687,7 @@ export default class ViewIscnIdPage extends Vue {
get viewContentURL() {
const arURL = this.recordData.contentFingerprints.find(a => a.startsWith('ar://'));
if (arURL) return `https://arweave.net/${arURL.slice(5)}`
if (arURL) return `${ARWEAVE_ENDPOINT}/${arURL.slice(5)}`
const ipfsURL = this.recordData.contentFingerprints.find(a => a.startsWith('ipfs://'));
if (ipfsURL) return `${IPFS_VIEW_GATEWAY_URL}/${ipfsURL.slice(7)}`
const httpsURL = this.recordData.contentFingerprints.find(a => a.startsWith('https://'));
Expand Down

0 comments on commit 03ca61a

Please sign in to comment.