diff --git a/apps/playground/src/components/layouts/sidebar/index.tsx b/apps/playground/src/components/layouts/sidebar/index.tsx index bee78460..58ae6e54 100644 --- a/apps/playground/src/components/layouts/sidebar/index.tsx +++ b/apps/playground/src/components/layouts/sidebar/index.tsx @@ -15,7 +15,7 @@ export default function Sidebar({ {sidebarItems.map((item, i) => { return (
  • - {item.to.startsWith("/") ? ( + {item.to.startsWith("/") || item.to.startsWith("http") ? ( {item.label} ) : ( diff --git a/apps/playground/src/data/links-yaci.ts b/apps/playground/src/data/links-yaci.ts index a151d633..3bd23352 100644 --- a/apps/playground/src/data/links-yaci.ts +++ b/apps/playground/src/data/links-yaci.ts @@ -1,5 +1,10 @@ import { MenuItem } from "~/types/menu-item"; +export const metaYaciHosted = { + title: "Hosted Yaci Devnet", + desc: "Connect to the hosted Yaci Devnet", + link: "https://cloud.meshjs.dev/yaci", +}; export const metaYaciGettingStarted = { title: "Getting Started", desc: "Set up Yaci Dev Kit and start the devnet", @@ -17,6 +22,7 @@ export const metaYaciProvider = { }; export const linksYaci: MenuItem[] = [ metaYaciGettingStarted, + metaYaciHosted, metaYaciTransactions, metaYaciProvider, ]; diff --git a/apps/playground/src/hooks/useProviders.ts b/apps/playground/src/hooks/useProviders.ts index 61e51b74..4ff5dfe9 100644 --- a/apps/playground/src/hooks/useProviders.ts +++ b/apps/playground/src/hooks/useProviders.ts @@ -31,7 +31,7 @@ export const useProviders = create( set({ maestroKey: { network, apiKey } }), koiosKey: undefined, setKoiosKey: (network, apiKey) => set({ koiosKey: { network, apiKey } }), - yaciUrl: "http://localhost:8080/api/v1/", + yaciUrl: "https://yaci-node.meshjs.dev/api/v1/", setYaciUrl: (url) => set({ yaciUrl: url }), ogmiosUrl: "", setOgmiosUrl: (url) => set({ ogmiosUrl: url }), diff --git a/apps/playground/src/pages/apis/wallets/meshwallet/sign-data.tsx b/apps/playground/src/pages/apis/wallets/meshwallet/sign-data.tsx index c9cca0a2..f41cfeaf 100644 --- a/apps/playground/src/pages/apis/wallets/meshwallet/sign-data.tsx +++ b/apps/playground/src/pages/apis/wallets/meshwallet/sign-data.tsx @@ -35,6 +35,10 @@ function Left() { to sign arbitrary data, to verify the data was signed by the owner of the private key.

    +

    + signData takes two arguments, the first one is the payload + to sign and the second one is the address (optional). +

    Example of a response from the endpoint:

    diff --git a/apps/playground/src/pages/guides/prove-wallet-ownership/index.mdx b/apps/playground/src/pages/guides/prove-wallet-ownership/index.mdx index 76dd0fb1..dc548e82 100644 --- a/apps/playground/src/pages/guides/prove-wallet-ownership/index.mdx +++ b/apps/playground/src/pages/guides/prove-wallet-ownership/index.mdx @@ -99,7 +99,7 @@ Lastly, we will return the **nonce** for the user to sign using their private ke ## Client: Verify ownership by signing the nonce -We are ready to use the private key associated with the wallet to sign the nonce with **await wallet.signData(userAddress, nonce)**, which enables the dApp to request the user to sign a payload according to [CIP-8](https://cips.cardano.org/cips/cip8/). +We are ready to use the private key associated with the wallet to sign the nonce with **await wallet.signData(nonce, userAddress)**, which enables the dApp to request the user to sign a payload according to [CIP-8](https://cips.cardano.org/cips/cip8/). We request the user's authorization and show them the message that is to be signed: **Sign to login in to Mesh: nonce**. Once accepted, the signature will be generated and the dApp will process the signature to authenticate the user. @@ -107,7 +107,7 @@ We request the user's authorization and show them the message that is to be sign async function frontendSignMessage(nonce) { try { const userAddress = (await wallet.getRewardAddresses())[0]; - const signature = await wallet.signData(userAddress, nonce); + const signature = await wallet.signData(nonce, userAddress); // do: send request with 'signature' and 'userAddress' to the backend } catch (error) { @@ -175,7 +175,7 @@ export default function Page() { async function frontendSignMessage(nonce) { try { const userAddress = (await wallet.getRewardAddresses())[0]; - const signature = await wallet.signData(userAddress, nonce); + const signature = await wallet.signData(nonce, userAddress); await backendVerifySignature(userAddress, signature); } catch (error) { setState(0); diff --git a/apps/playground/src/pages/yaci/getting-started/hosted.tsx b/apps/playground/src/pages/yaci/getting-started/hosted.tsx new file mode 100644 index 00000000..4ad130de --- /dev/null +++ b/apps/playground/src/pages/yaci/getting-started/hosted.tsx @@ -0,0 +1,46 @@ +import Link from "~/components/link"; +import TwoColumnsScroll from "~/components/sections/two-columns-scroll"; +import Codeblock from "~/components/text/codeblock"; + +export default function YaciHosted() { + return ( + + ); +} + +function Left() { + let code = ""; + code += `import { YaciProvider } from "@meshsdk/core";\n`; + code += `\n`; + code += `const blockchainProvider = new YaciProvider();\n`; + code += `const params = await blockchainProvider.fetchProtocolParameters();\n`; + code += `console.log(params);\n`; + + return ( + <> +

    Connect right away with Yaci Provider

    +

    + Mesh has a hosted Yaci Devnet that you can connect to right away. You + can use the following URL to connect to the hosted Yaci Devnet: +

    + +

    Import Yaci Provider

    +

    + Import YaciProvider and start using it to interact with the + Yaci Devnet. +

    + +

    + + Learn more about Yaci Provider + {" "} + and learn more about{" "} + hosted Yaci Devnet +

    + + ); +} diff --git a/apps/playground/src/pages/yaci/getting-started/index.tsx b/apps/playground/src/pages/yaci/getting-started/index.tsx index 33d0c61f..028fda42 100644 --- a/apps/playground/src/pages/yaci/getting-started/index.tsx +++ b/apps/playground/src/pages/yaci/getting-started/index.tsx @@ -6,6 +6,7 @@ import Metatags from "~/components/site/metatags"; import { metaYaciGettingStarted } from "~/data/links-yaci"; import { getPageLinks } from "../common"; import YaciCommands from "./commands"; +import YaciHosted from "./hosted"; import YaciSetup from "./setup"; import YaciStart from "./start"; @@ -24,6 +25,7 @@ const ReactPage: NextPage = () => { <> + diff --git a/apps/playground/src/pages/yaci/transactions/basic-transaction.tsx b/apps/playground/src/pages/yaci/transactions/basic-transaction.tsx index 4bb95558..0b79a3b6 100644 --- a/apps/playground/src/pages/yaci/transactions/basic-transaction.tsx +++ b/apps/playground/src/pages/yaci/transactions/basic-transaction.tsx @@ -68,7 +68,7 @@ function Left() { function Right() { const [userInput, setUserInput] = useState(yaci.address); const [userInput2, setUserInput2] = useState( - "http://localhost:8080/api/v1/", + "https://yaci-node.meshjs.dev/api/v1/", ); async function runDemo() { diff --git a/apps/playground/src/pages/yaci/transactions/provider.tsx b/apps/playground/src/pages/yaci/transactions/provider.tsx index a692f0e7..75bbbf6e 100644 --- a/apps/playground/src/pages/yaci/transactions/provider.tsx +++ b/apps/playground/src/pages/yaci/transactions/provider.tsx @@ -31,7 +31,7 @@ function Left() { />

    By default, the YaciProvider will use the default URL,{" "} - http://localhost:8080/api/v1/. If you want to use a custom + https://yaci-node.meshjs.dev/api/v1/. If you want to use a custom URL, you can pass it as a parameter.

    @@ -54,7 +54,7 @@ function Right() { demoAddresses.testnetPayment, ); const [userInput2, setUserInput2] = useState( - "http://localhost:8080/api/v1/", + "https://yaci-node.meshjs.dev/api/v1/", ); async function runDemo() { diff --git a/packages/mesh-provider/src/yaci.ts b/packages/mesh-provider/src/yaci.ts index 044d7986..ae2d779e 100644 --- a/packages/mesh-provider/src/yaci.ts +++ b/packages/mesh-provider/src/yaci.ts @@ -35,7 +35,7 @@ export class YaciProvider * Set the URL of the instance. * @param baseUrl The base URL of the instance. */ - constructor(baseUrl = "http://localhost:8080/api/v1/") { + constructor(baseUrl = "https://yaci-node.meshjs.dev/api/v1/") { this._axiosInstance = axios.create({ baseURL: baseUrl, }); diff --git a/packages/mesh-provider/test/yaci/evaluator.test.ts b/packages/mesh-provider/test/yaci/evaluator.test.ts index 2e0a90d5..b628a2ec 100644 --- a/packages/mesh-provider/test/yaci/evaluator.test.ts +++ b/packages/mesh-provider/test/yaci/evaluator.test.ts @@ -1,6 +1,6 @@ import { YaciProvider } from "@meshsdk/provider"; -const provider = new YaciProvider("http://localhost:8080/api/v1/"); +const provider = new YaciProvider("https://yaci-node.meshjs.dev/api/v1/"); const successTx = "84a60081825820ab11b83c9d46edf3e4f0124eccaec9c3469c4aa8bba47885991ea33f76f92d32000182825839005867c3b8e27840f556ac268b781578b14c5661fc63ee720dbeab663f9d4dcd7e454d2434164f4efb8edeb358d86a1dad9ec6224cfcbce3e6821a00111958a1581c9026ea35a0b0ca28e304ef94cc5a31c9e850db14a32dc3c69969fe83a14001825839005867c3b8e27840f556ac268b781578b14c5661fc63ee720dbeab663f9d4dcd7e454d2434164f4efb8edeb358d86a1dad9ec6224cfcbce3e61a3b89b0a8020009a1581c9026ea35a0b0ca28e304ef94cc5a31c9e850db14a32dc3c69969fe83a140010b5820df2de8c102f948422412af199867e5d472b9ff700473b2841e63209041b0e7df0d81825820ab11b83c9d46edf3e4f0124eccaec9c3469c4aa8bba47885991ea33f76f92d3200a20681590288590285010000332323232323232323232223232322533300832323232533300c3007300e3754002264a66601a6010601e6ea802454ccc034c020c03cdd519198008009bac30143011375400844a666026002298103d87a80001323253330113375e01e601260286ea80084cdd2a40006602c00497ae01330040040013017002301500114a229404c8cc004004c8cc004004c8cc004004dd5980b180b980b980b980b98099baa00622533301500114bd6f7b630099191919299980a99b9148900002153330153371e9101000021003100513301a337606ea4008dd3000998030030019bab3017003375c602a0046032004602e00244a666028002297ae0132333222323300100100322533301a00110031323301c374e660386ea4018cc070c064004cc070c0680052f5c066006006603c00460380026eb8c04c004dd5980a00099801801980c001180b0009129998098008a5113253330103253330113371e6eb8c0240040144cdc41bad301730183018001480005289bac301600213300300300114a0602c0026eb8c048c03cdd50008a50301130120023010001300c37540044601e0022930a99804a491856616c696461746f722072657475726e65642066616c7365001365632533300730020011533300b300a37540062930a998040030b0a99980399b874800800454ccc02cc028dd50018a4c2a6601000c2c2a6601000c2c60106ea8008dc3a4000a66666601800220022a6600a0062c2a6600a0062c2a6600a0062c2a6600a0062c92011672656465656d65723a204d696e74506f6c6172697479005734ae7155ceaab9e5573eae815d0aba257489812bd8799fd8799f5820ab11b83c9d46edf3e4f0124eccaec9c3469c4aa8bba47885991ea33f76f92d32ff00ff00010581840100d87980821a006acfc01ab2d05e00f5f6";