Skip to content

Commit

Permalink
working on fixing links to be multi-g8way
Browse files Browse the repository at this point in the history
  • Loading branch information
twilson63 committed Aug 16, 2023
1 parent 3b49bdd commit 0cad26d
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 53 deletions.
7 changes: 5 additions & 2 deletions src/components/avatar.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<script>
import { take, toUpper } from "ramda";
export let avatar =
"https://arweave.net/yCZMJWHprkdOHTtep2Y_uXzc_c9bmSpPvBzb8KyObWA";
import { getHost } from "../lib/utils.js";
const host = getHost(globalThis.location.hostname);
export let avatar = `https://${host}/yCZMJWHprkdOHTtep2Y_uXzc_c9bmSpPvBzb8KyObWA`;
export let name = "mrzzzzz";
const colors = [
Expand Down
40 changes: 9 additions & 31 deletions src/components/item.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import { profile } from "../store.js";
const host = getHostLink(window.location.hostname);
let percent = 0;
const store = tweened(0, { duration: 1000 });
//const store = spring(0, {stiffness: 0.3, damping: 0.3});
Expand All @@ -29,34 +30,14 @@
const dispatch = createEventDispatcher();
function navTo(id) {
window.open("https://arweave.dev/" + id);
window.open(host + "/" + id);
//router.goto("https://arweave.dev/" + id);
}
function handleStamp() {
dispatch("stamp", { asset: stamp.asset });
}
function handleSell() {
dispatch("sell", {
contract: stamp.asset,
name: stamp.title,
percent: 0,
price: "0.01",
units: unitsTotal,
canPurchase: unitsAvailable,
});
}
function handleBuy() {
dispatch("buy", {
contract: stamp.asset,
name: stamp.title,
units: unitsTotal,
canPurchase: unitsAvailable,
price: lowestPrice,
percent: 0,
});
}
async function getContract() {
try {
const info = await readState(stamp.asset);
Expand Down Expand Up @@ -154,10 +135,7 @@
<div class="flex-1 flex flex-col md:w-[450px]">
<h2 class="text-xl font-bold">
{#if stamp.type === "image"}
<a
target="_blank"
href="https://img.arweave.dev/#/show/{stamp.asset}"
>
<a target="_blank" href="https://img.{host}/#/show/{stamp.asset}">
{stamp.title.length > 35
? take(35, stamp.title) + "..."
: stamp.title}
Expand Down Expand Up @@ -190,7 +168,7 @@
>
</a>
{:else}
<a target="_blank" href="https://arweave.net/{stamp.asset}">
<a target="_blank" href="https://{host}/{stamp.asset}">
{stamp.title.length > 35
? take(35, stamp.title) + "..."
: stamp.title}
Expand Down Expand Up @@ -328,7 +306,7 @@
on:click|stopPropagation={handleSell}>Sell</button
> -->
<a
href={`https://pst.arweave.dev/#/show/${stamp.asset}`}
href={`https://bazar.${host}/#/asset/${stamp.asset}`}
target="_blank"
class="btn btn-outline btn-info rounded-none">Buy/Sell</a
>
Expand All @@ -341,14 +319,14 @@
<div class="w-full md:w-[600px] h-[350px]">
<img
class="mt-4 w-full md:w-[600px] h-[350px] object-contain"
src={"https://arweave.net/" + stamp.asset}
src={`https://${host}/` + stamp.asset}
alt={stamp.title}
/>
</div>
{:else if stamp.renderWith !== "" && stamp.renderWith.length === 43}
<iframe
class="mt-4 w-full md:w-[600px] h-[450px] object-contain"
src={`https://arweave.net/${stamp.renderWith}/?tx=${stamp.asset}`}
src={`https://${host}/${stamp.renderWith}/?tx=${stamp.asset}`}
alt={stamp.title}
/>
{:else if stamp.renderWith !== ""}
Expand All @@ -359,12 +337,12 @@
/>
{:else if stamp.type === "video"}
<video class="mt-4 w-full md:w-[600px] h-[350px]" controls>
<source src={"https://arweave.net/" + stamp.asset} />
<source src={`https://${host}/${stamp.asset}`} />
</video>
{:else}
<iframe
class="mt-4 w-full md:w-[600px] h-[350px]"
src={"https://arweave.net/" + stamp.asset}
src={`https://${host}/` + stamp.asset}
alt={stamp.title}
/>
{/if}
Expand Down
12 changes: 7 additions & 5 deletions src/components/profile.svelte
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<script>
import { getHost } from "../lib/utils.js";
const host = getHost(globalThis.location.hostname);
export let name;
export let avatar =
"https://tgbcqufuppegmlhigt2zosiv2q55qty4t4rg2gebmfm4vpvf.arweave.net/mYIoULR7yGYs_6DT1_l0kV1DvYTxyfIm0YgWFZyr6l0";
export let background =
"https://arweave.net/T2Kh2uOv3myw8L6BPE6kySs2QXjh8R3B1KolcW_MFQA/background.svg";
export let avatar = `https://${host}/mYIoULR7yGYs_6DT1_l0kV1DvYTxyfIm0YgWFZyr6l0`;
export let background = `https://${host}/T2Kh2uOv3myw8L6BPE6kySs2QXjh8R3B1KolcW_MFQA/background.svg`;
</script>

<div>
<div>
<img
class="h-32 w-full object-cover lg:h-48"
src={background ||
"https://arweave.net/T2Kh2uOv3myw8L6BPE6kySs2QXjh8R3B1KolcW_MFQA/background.svg"}
`https://${host}/T2Kh2uOv3myw8L6BPE6kySs2QXjh8R3B1KolcW_MFQA/background.svg`}
alt="background"
/>
</div>
Expand Down
5 changes: 4 additions & 1 deletion src/components/stamper-item.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<script>
import { getProfile } from "../lib/app.js";
import { getHost } from "../lib/utils.js";
const host = getHost(globalThis.location.hostname);
export let stamper;
</script>

Expand All @@ -26,7 +29,7 @@
<img
class="w-[64px] mask mask-circle"
src={profile.avatar ||
"https://arweave.net/yZ64EcoLWgY4jGZp6RIxR4O6wKGUuHVNu8JidQf4nFo"}
`https://${host}/yZ64EcoLWgY4jGZp6RIxR4O6wKGUuHVNu8JidQf4nFo`}
alt="avatar"
/>
<h2 class="text-2xl font-medium">
Expand Down
18 changes: 9 additions & 9 deletions src/lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ const options = {
internalWrites: true,
unsafeClient: 'skip',
remoteStateSyncEnabled: true,
remoteStateSyncSource: 'https://dre-5.warp.cc/contract'
remoteStateSyncSource: 'https://dre-u.warp.cc/contract'
}

const { WarpFactory, LoggerFactory } = window.warp;
LoggerFactory.INST.logLevel("fatal");

const CACHE = 'https://cache.permapages.app'
const CACHE = 'https://dre-u.warp.cc'
const GATEWAY = 'https://gateway.warp.cc'
const DRE = 'https://dre-1.warp.cc'
const DRE = 'https://dre-u.warp.cc'
//const BAR = 'KTzTXT_ANmF84fWEKHzWURD1LWd9QaFR9yfYUwH2Lxw';
const BAR = __BAR_CONTRACT__;
const STAMPCOIN = __STAMP_CONTRACT__;
Expand Down Expand Up @@ -76,10 +76,10 @@ export const isVouched = (addr) => Stamper.isVouched(addr).runWith({ arweave }).

export const addPair = (contract, pair) =>
warp.contract(contract).connect('use_wallet')
.setEvaluationOptions(options).writeInteraction({
function: 'addPair',
pair: BAR
})
.setEvaluationOptions(options).writeInteraction({
function: 'addPair',
pair: BAR
})

export const createOrder = (data) => Flex.createOrder(data).runWith({ warp }).toPromise()
export const allowOrder = (contract, target, qty) => Flex.allow(contract, target, qty).runWith({ warp }).toPromise()
Expand All @@ -93,7 +93,7 @@ export const readState = (contract) => {

export const dry = (data) => Flex.createOrder(data).runWith({ warp }).toPromise()
export const readBar = () => warp.contract(BAR).setEvaluationOptions(options).readState()
.then(({cachedValue}) => cachedValue.state )
.then(({ cachedValue }) => cachedValue.state)

//export const sellAsset = (contract, qty, price) => Flex.sell({ contract, BAR, qty, price }).runWith({ warp }).toPromise()
export const sellAsset = async (contract, qty, price) => {
Expand All @@ -112,7 +112,7 @@ export const sellAsset = async (contract, qty, price) => {
qty,
price: Math.floor(price) > 1 ? Math.floor(price) : 1
}, { strict: true })
.then(_ => c))
.then(_ => c))
.then(c => c.readState().then(({ cachedValue }) => cachedValue.state))
}
//Flex.sell2({ contract, BAR, qty, price }).runWith({ arweave }).toPromise()
Expand Down
11 changes: 7 additions & 4 deletions src/pages/home.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
import { assets, profile, collectors } from "../store.js";
import { find, propEq, mergeRight } from "ramda";
import { getHost } from "../lib/utils.js";
const host = getHost(globalThis.location.hostname);
let connectRequestFrom = { type: "none" };
let profileAR = 0;
let view = "hot";
Expand Down Expand Up @@ -78,8 +82,7 @@
let showPreview = false;
let previewData = {};
let defaultAvatarUrl =
"https://tgbcqufuppegmlhigt2zosiv2q55qty4t4rg2gebmfm4vpvf.arweave.net/mYIoULR7yGYs_6DT1_l0kV1DvYTxyfIm0YgWFZyr6l0";
let defaultAvatarUrl = `https://${host}/mYIoULR7yGYs_6DT1_l0kV1DvYTxyfIm0YgWFZyr6l0`;
let buyQty = 0;
Expand Down Expand Up @@ -401,14 +404,14 @@
function createPurchaseText(name, id) {
return encodeURI(`I just purchased an Atomic Asset - "${name}",
go to https://arweave.net/${id} to 🪧 STAMP!
go to https://${host}/${id} to 🪧 STAMP!
`);
}
function createSellText(name, id) {
return encodeURI(`👋🏻 Hey, I just listed my Tradeable Atomic Asset - "${name}" for sale on now.arweave.dev!
If you like my asset: arweave.net/${id} - go to now and consider purchasing or STAMPing 🪧.
If you like my asset: ${host}/${id} - go to now and consider purchasing or STAMPing 🪧.
Powered by the Permaweb 🐘
`);
Expand Down
5 changes: 4 additions & 1 deletion src/pages/stamper-detail.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
import { stampers } from "../store";
import { getProfile, listStampers, getTitle } from "../lib/app.js";
import { find, propEq, prop, map } from "ramda";
import { getHost } from "../lib/utils.js";
const host = getHost(globalThis.location.hostname);
export let id;
let profile = {
name: "Unknown",
avatar: "https://arweave.net/yZ64EcoLWgY4jGZp6RIxR4O6wKGUuHVNu8JidQf4nFo",
avatar: `https://${host}/yZ64EcoLWgY4jGZp6RIxR4O6wKGUuHVNu8JidQf4nFo`,
};
async function loadData() {
Expand Down

0 comments on commit 0cad26d

Please sign in to comment.