Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArConnect 1.20.4 #554

Merged
merged 10 commits into from
Nov 27, 2024
4 changes: 2 additions & 2 deletions assets/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1693,8 +1693,8 @@
"message": "A provably neutral publishing platform aimed at dis-intermediating the truth. Publish assertions, and take your position in the Fact Marketplace!",
"description": "placeholder for example get started"
},
"example_bark_description" : {
"message": "Bark is a decentralized exchange to swap assets on the aoComputer network.",
"example_botega_description" : {
"message": "Botega is a decentralized exchange to swap assets on the aoComputer network.",
"description": "placeholder for example get started"
},
"connect_with_us_title": {
Expand Down
4 changes: 2 additions & 2 deletions assets/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1682,8 +1682,8 @@
"message": "一个旨在去中介化真相的证明中立出版平台。发布声明,并在事实市场中占据您的位置!",
"description": "Placeholder for example get started"
},
"example_bark_description": {
"message": "Bark 是一个去中心化交易所,用于在 aoComputer 网络上交换资产。",
"example_botega_description": {
"message": "Botega 是一个去中心化交易所,用于在 aoComputer 网络上交换资产。",
"description": "Placeholder for example get started"
},
"connect_with_us_title": {
Expand Down
7 changes: 7 additions & 0 deletions assets/ecosystem/botega.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 3 additions & 4 deletions src/components/popup/WalletHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,9 @@ export default function WalletHeader() {
{
icon: <Users01 style={{ width: "18px", height: "18px" }} />,
title: "setting_contacts",
route: () =>
browser.tabs.create({
url: browser.runtime.getURL("tabs/dashboard.html#/contacts")
})
route: () => {
push("/quick-settings/contacts");
}
},
{
icon: <Container style={{ width: "18px", height: "17px" }} />,
Expand Down
16 changes: 9 additions & 7 deletions src/components/popup/WalletSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import Arweave from "arweave";
import { svgie } from "~utils/svgies";
import { Action } from "./WalletHeader";
import copy from "copy-to-clipboard";
import { useHistory } from "~utils/hash_router";

export default function WalletSwitcher({
open,
Expand Down Expand Up @@ -165,6 +166,8 @@ export default function WalletSwitcher({
// toasts
const { setToast } = useToasts();

const [push] = useHistory();

return (
<AnimatePresence>
{open && (
Expand Down Expand Up @@ -239,6 +242,7 @@ export default function WalletSwitcher({
</Wallet>
))}
</Wallets>

{showOptions && (
<ActionBar>
<AddWalletButton
Expand All @@ -258,13 +262,11 @@ export default function WalletSwitcher({
position="topEnd"
>
<EditButton
onClick={() =>
browser.tabs.create({
url: browser.runtime.getURL(
`tabs/dashboard.html#/wallets/${activeAddress}`
)
})
}
onClick={(e) => {
e.preventDefault();

push(`/quick-settings/wallets/${activeAddress}`);
}}
/>
</TooltipV2>
</ActionBar>
Expand Down
29 changes: 29 additions & 0 deletions src/injected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,35 @@ for (const mod of modules) {
// @ts-expect-error
window.arweaveWallet = WalletAPI;

/*
if (process.env.NODE_ENV === "development") {
// @ts-expect-error
window.arweaveWalletDev = WalletAPI;

console.log(`Forcing development wallet (${ WalletAPI.walletName } ${ WalletAPI.walletVersion }) to be injected...`);

const t0 = Date.now();

const intervalID = setInterval(() => {
if (window.arweaveWallet && window.arweaveWallet !== WalletAPI) {
// @ts-expect-error
console.log(`Another wallet (${ window.arweaveWallet.walletName } ${ window.arweaveWallet.walletVersion }) was injected. Overriding...`);

// @ts-expect-error
window.arweaveWallet = WalletAPI;
}

const elapsed = Date.now() - t0;

if (elapsed >= 30000) {
console.log(`Stopped forcing development wallet (${ WalletAPI.walletName } ${ WalletAPI.walletVersion }) to be injected.`);

clearInterval(intervalID);
}
}, 250);
}
*/

// at the end of the injected script,
// we dispatch the wallet loaded event
dispatchEvent(new CustomEvent("arweaveWalletLoaded", { detail: {} }));
Expand Down
19 changes: 13 additions & 6 deletions src/routes/popup/tokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import { useStorage } from "@plasmohq/storage/hook";

export default function Tokens() {
const [isLoading, setIsLoading] = useState(false);
const [hasNextPage, setHasNextPage] = useState(true);
const [hasNextPage, setHasNextPage] = useState<boolean | undefined>(
undefined
);
// all tokens
const tokens = useTokens();
// ao Tokens
Expand Down Expand Up @@ -166,9 +168,7 @@ export default function Tokens() {
onClick={() => push(`/token/${token.id}`)}
onSettingsClick={(e) => {
e.preventDefault();
window.open(
`${browser.runtime.getURL("tabs/dashboard.html")}#/tokens`
);
push(`/quick-settings/tokens/${token.id}`);
}}
key={i}
/>
Expand All @@ -192,9 +192,10 @@ export default function Tokens() {
}}
/>
))}

{aoSupport && hasNextPage && (
<ButtonV2
disabled={!hasNextPage || isLoading}
disabled={isLoading}
style={{ alignSelf: "center", marginTop: "5px" }}
onClick={searchAoTokens}
>
Expand All @@ -207,8 +208,14 @@ export default function Tokens() {
)}
</ButtonV2>
)}

<ManageButton
href={`${browser.runtime.getURL("tabs/dashboard.html")}#/tokens`}
// TODO: The base should be iframe.html for the extension and some domain for the iframe.
href="#/quick-settings/tokens"
onClick={(e) => {
e.preventDefault();
push("/quick-settings/tokens");
}}
>
<EditIcon />
{browser.i18n.getMessage("manage_assets_button")}
Expand Down
28 changes: 15 additions & 13 deletions src/routes/popup/transaction/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default function Transaction({ id: rawId, gw, message }: Props) {
timestamp
}
}
}
}
`,
{ id },
gateway
Expand Down Expand Up @@ -387,15 +387,16 @@ export default function Transaction({ id: rawId, gw, message }: Props) {
<AddContact>
{browser.i18n.getMessage("user_not_in_contacts")}{" "}
<span
onClick={() => {
onClick={(e) => {
e.preventDefault();

trackEvent(EventType.ADD_CONTACT, {
fromSendFlow: true
});
browser.tabs.create({
url: browser.runtime.getURL(
`tabs/dashboard.html#/contacts/new?address=${fromAddress}`
)
});

push(
`/quick-settings/contacts/new?address=${fromAddress}`
);
}}
>
{browser.i18n.getMessage("create_contact")}
Expand Down Expand Up @@ -438,15 +439,16 @@ export default function Transaction({ id: rawId, gw, message }: Props) {
<AddContact>
{browser.i18n.getMessage("user_not_in_contacts")}{" "}
<span
onClick={() => {
onClick={(e) => {
e.preventDefault();

trackEvent(EventType.ADD_CONTACT, {
fromSendFlow: true
});
browser.tabs.create({
url: browser.runtime.getURL(
`tabs/dashboard.html#/contacts/new?address=${toAddress}`
)
});

push(
`/quick-settings/contacts/new?address=${toAddress}`
);
}}
>
{browser.i18n.getMessage("create_contact")}
Expand Down
6 changes: 3 additions & 3 deletions src/routes/welcome/gettingStarted/explore.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Spacer, Text } from "@arconnect/components";
import AstroLogo from "url:/assets/ecosystem/astro.png";
import protocollandLogo from "url:/assets/ecosystem/protocolland.svg";
import barkLogo from "url:/assets/ecosystem/bark.png";
import botegaLogo from "url:/assets/ecosystem/botega.svg";
import Paragraph from "~components/Paragraph";
import browser from "webextension-polyfill";
import styled from "styled-components";
Expand Down Expand Up @@ -41,9 +41,9 @@ export default function Explore() {
</Item>
<Item>
<ImageWrapper>
<Image src={barkLogo} alt={"Bark"} draggable={false} />
<Image src={botegaLogo} alt={"Botega"} draggable={false} />
</ImageWrapper>
{browser.i18n.getMessage("example_bark_description")}
{browser.i18n.getMessage("example_botega_description")}
</Item>
</Content>
<Spacer y={1.5} />
Expand Down
22 changes: 4 additions & 18 deletions src/tokens/aoTokens/ao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,11 @@ export const defaultAoTokens: TokenInfo[] = [
processId: "m3PaWzK4PTG9lAaqYQPaPdOcXdO8hYqi5Fe9NWqXd0w"
},
{
Name: "TRUNK",
Ticker: "TRUNK",
Denomination: 3,
Logo: "4eTBOaxZSSyGbpKlHyilxNKhXbocuZdiMBYIORjS4f0",
processId: "OT9qTE2467gcozb2g8R6D6N3nQS94ENcaAIJfUzHCww"
},
{
Name: "Bark",
Ticker: "BRKTST",
Denomination: 3,
Logo: "AdFxCN1eEPboxNpCNL23WZRNhIhiamOeS-TUwx_Nr3Q",
processId: "8p7ApPZxC_37M06QHVejCQrKsHbcJEerd3jWNkDUWPQ"
},
{
Name: "Astro USD (Test)",
Ticker: "USDA-TST",
Name: "Q Arweave",
Ticker: "qAR",
Denomination: 12,
Logo: "",
processId: "GcFxqTQnKHcr304qnOcq00ZqbaYGDn4Wbb0DHAM-wvU"
Logo: "26yDr08SuwvNQ4VnhAfV4IjJcOOlQ4tAQLc1ggrCPu0",
processId: "NG-0lVX882MG5nhARrSzyprEK6ejonHpdUmaaMPsHE8"
}
];

Expand Down
12 changes: 6 additions & 6 deletions src/utils/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import arwikiLogo from "url:/assets/ecosystem/arwiki.png";
import bazarLogo from "url:/assets/ecosystem/bazar.png";
import protocollandLogo from "url:/assets/ecosystem/protocolland.svg";
import permaswapLogo from "url:/assets/ecosystem/permaswap.svg";
import barkLogo from "url:/assets/ecosystem/bark.png";
import botegaLogo from "url:/assets/ecosystem/botega.svg";
import arnsLogo from "url:/assets/ecosystem/arns.svg";
import astroLogo from "url:/assets/ecosystem/astro.png";
import permapagesLogo from "url:/assets/ecosystem/permapages.svg";
Expand Down Expand Up @@ -38,17 +38,17 @@ export interface App {

export const apps: App[] = [
{
name: "Bark",
name: "Botega",
category: "Exchange",
description: "Bark is the AO Computer's first decentralized exchange.",
description: "Botega is the AO Computer's first decentralized exchange.",
assets: {
logo: barkLogo,
thumbnail: "/apps/bark/thumbnail.png",
logo: botegaLogo,
thumbnail: "",
lightBackground: "rgba(230, 235, 240, 1)",
darkBackground: "rgba(19, 28, 37, 1)"
},
links: {
website: "https://bark.arweave.dev"
website: "https://botega.arweave.dev/#/swap"
}
},
{
Expand Down