Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
jinglescode committed Dec 26, 2024
1 parent 382cd8a commit b173402
Show file tree
Hide file tree
Showing 27 changed files with 1,213 additions and 716 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ export function CommonCardanoWallet() {
networkId: 0,
provider: provider,
}}
// webauthn={{
// networkId: 0,
// provider: provider,
// url: "http://localhost:3000",
// }}
/>
);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useState } from "react";

import { keepRelevant, Quantity, Unit } from "@meshsdk/core";
import { useWallet } from "@meshsdk/react";

import Input from "~/components/form/input";
Expand Down Expand Up @@ -36,8 +35,8 @@ function Left() {
codeTx += ` },\n`;
codeTx += ` rewardAddress,\n`;
codeTx += ` )\n`;
codeTx += ` .changeAddress(changeAddress)`;
codeTx += ` .selectUtxos(utxos, "keepRelevant", "10000000")\n`;
codeTx += ` .changeAddress(changeAddress)\n`;
codeTx += ` .selectUtxos(utxos, "keepRelevant", "10000000")`;

let codeBuildSign = ``;
codeBuildSign += `const unsignedTx = await txBuilder.complete();\n`;
Expand Down Expand Up @@ -129,7 +128,7 @@ function Right() {
codeSnippet += `txBuilder\n`;
codeSnippet += ` .voteDelegationCertificate(\n`;
codeSnippet += ` {\n`;
codeSnippet += ` dRepId: drepid,\n`;
codeSnippet += ` dRepId: '${drepid}',\n`;
codeSnippet += ` },\n`;
codeSnippet += ` rewardAddress,\n`;
codeSnippet += ` )\n`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ function Right(
});
setWallet(_wallet);

const address = _wallet.getChangeAddress();
setResponseAddress(address);
const addresses = _wallet.getAddresses();
setResponseAddress(JSON.stringify(addresses, null, 2));
}
} catch (error) {
setResponseError(`${error}`);
Expand All @@ -262,8 +262,8 @@ function Right(
});
setWallet(_wallet);

const address = _wallet.getChangeAddress();
setResponseAddress(address);
const addresses = _wallet.getAddresses();
setResponseAddress(JSON.stringify(addresses, null, 2));
} catch (error) {
setResponseError(`${error}`);
}
Expand All @@ -283,8 +283,8 @@ function Right(
});
setWallet(_wallet);

const address = _wallet.getChangeAddress();
setResponseAddress(address);
const addresses = _wallet.getAddresses();
setResponseAddress(JSON.stringify(addresses, null, 2));
} catch (error) {
setResponseError(`${error}`);
}
Expand All @@ -302,8 +302,8 @@ function Right(
});
setWallet(_wallet);

const address = _wallet.getChangeAddress();
setResponseAddress(address);
const addresses = _wallet.getAddresses();
setResponseAddress(JSON.stringify(addresses, null, 2));
} catch (error) {
setResponseError(`${error}`);
}
Expand Down Expand Up @@ -362,7 +362,7 @@ function Right(
response={responseAddress}
label="Load wallet and get address"
/>
<DemoResult response={responseAddress} label="Wallet's address" />
<DemoResult response={responseAddress} label="Wallet's addresses" />
<DemoResult response={responseError} label="Error" />
</Card>
</>
Expand Down
11 changes: 9 additions & 2 deletions apps/playground/src/pages/sitemap.xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,22 @@ function SiteMap() {}

function addLinks(pagesUrls: string[], pages: MenuItem[]) {
pages.forEach((api) => {
pagesUrls.push(api.link);
pushLink(pagesUrls, api.link);
if (api.items) {
api.items.forEach((item) => {
pagesUrls.push(item.link);
pushLink(pagesUrls, item.link);
});
}
});
}

function pushLink(pagesUrls: string[], link: string) {
if (link.includes("http") && !link.includes("meshjs.dev")) {
return;
}
pagesUrls.push(link);
}

export async function getServerSideProps({ res }: { res: any }) {
const pagesUrls: string[] = [];

Expand Down
46 changes: 45 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 0 additions & 25 deletions packages/mesh-provider/src/hydra/transactions/commit-utxo.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/mesh-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-icons": "^1.3.2",
"@radix-ui/react-label": "^2.1.1",
"@radix-ui/react-tooltip": "^1.1.4",
"class-variance-authority": "^0.7.1",
"tailwindcss-animate": "^1.0.7"
Expand Down
5 changes: 5 additions & 0 deletions packages/mesh-react/src/cardano-wallet/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ export const screens = {
subtitle:
"Instantly create a new burner wallet. No seed phrase required, keys are generated on your device.",
},
webauthn: {
title: "Passkey",
subtitle:
"Derive self-custody wallet on Chrome, Safari, or Firefox browsers on Android, iOS, macOS, and Windows devices, or using password managers.",
},
};
19 changes: 17 additions & 2 deletions packages/mesh-react/src/cardano-wallet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { screens } from "./data";
import ScreenBurner from "./screen-burner";
import ScreenMain from "./screen-main";
import ScreenP2P from "./screen-p2p";
import ScreenWebauthn from "./screen-webauthn";

interface ButtonProps {
label?: string;
Expand All @@ -39,6 +40,11 @@ interface ButtonProps {
networkId: 0 | 1;
provider: IFetcher & ISubmitter;
};
webauthn?: {
networkId: 0 | 1;
provider: IFetcher & ISubmitter;
url: string;
};
}

export const CardanoWallet = ({
Expand All @@ -49,13 +55,14 @@ export const CardanoWallet = ({
metamask = undefined,
cardanoPeerConnect = undefined,
burnerWallet = undefined,
webauthn = undefined,
}: ButtonProps) => {
const [open, setOpen] = useState(false);
const [screen, setScreen] = useState("main");
const { wallet, connected } = useWallet();

useEffect(() => {
if (connected && wallet) {
if (connected) {
if (onConnected) onConnected();
}
}, [connected, wallet]);
Expand Down Expand Up @@ -86,6 +93,7 @@ export const CardanoWallet = ({
setScreen={setScreen}
cardanoPeerConnect={cardanoPeerConnect != undefined}
burnerWallet={burnerWallet != undefined}
webauthn={webauthn != undefined}
/>
)}
{screen == "p2p" && (
Expand All @@ -101,7 +109,14 @@ export const CardanoWallet = ({
setOpen={setOpen}
/>
)}

{screen == "webauthn" && webauthn && (
<ScreenWebauthn
url={webauthn.url}
networkId={webauthn.networkId}
provider={webauthn.provider}
setOpen={setOpen}
/>
)}
<Footer />
</DialogContent>
</Dialog>
Expand Down
Loading

0 comments on commit b173402

Please sign in to comment.