diff --git a/README.md b/README.md index 7051c6201..859dfbaa5 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ Here's a list of open-source smart contracts, complete with documentation, live | Giftcard | Allows users to create a transactions to lock assets into the smart contract, which can be redeemed by any user | [[demo](https://meshjs.dev/smart-contracts/giftcard)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/giftcard)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshGiftcardContract)] | | Hello World | A simple lock-and-unlock assets contract, providing a hands-on introduction to end-to-end smart contract validation and transaction building | [[demo](https://meshjs.dev/smart-contracts/hello-world)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/hello-world)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshHelloWorldContract)] | | Marketplace | Allows anyone to buy and sell native assets such as NFTs | [[demo](https://meshjs.dev/smart-contracts/marketplace)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/marketplace)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshMarketplaceContract)] | -| NFT Minting Vending Machine | Mint NFTs with an automatically incremented index, which increases by one for each newly minted NFT | [[demo](https://meshjs.dev/smart-contracts/plutus-nft)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/plutus-nft)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshPlutusNFTContract)] | +| NFT Minting Machine | Mint NFTs with an automatically incremented index, which increases by one for each newly minted NFT | [[demo](https://meshjs.dev/smart-contracts/plutus-nft)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/plutus-nft)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshPlutusNFTContract)] | | Payment Splitter | Allows users to split incoming payments among a group of accounts | [[demo](https://meshjs.dev/smart-contracts/payment-splitter)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/payment-splitter)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshPaymentSplitterContract)] | | Swap | Facilitates the exchange of assets between two parties | [[demo](https://meshjs.dev/smart-contracts/swap)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/swap)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshSwapContract)] | | Vesting | Allows users to lock tokens for a period of time and withdraw the funds after the lockup period | [[demo](https://meshjs.dev/smart-contracts/vesting)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/vesting)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshVestingContract)] | diff --git a/apps/playground/src/components/sections/hero-two-sections.tsx b/apps/playground/src/components/sections/hero-two-sections.tsx index 9991edb28..6b525d7cf 100644 --- a/apps/playground/src/components/sections/hero-two-sections.tsx +++ b/apps/playground/src/components/sections/hero-two-sections.tsx @@ -1,4 +1,5 @@ import React from "react"; +import { ArrowRightIcon } from "@heroicons/react/24/solid"; import Link from "~/components/link"; import Codeblock from "../text/codeblock"; @@ -32,21 +33,10 @@ export default function HeroTwoSections({ {link && ( {link.label} - - - + )} diff --git a/apps/playground/src/data/catalyst.ts b/apps/playground/src/data/catalyst.ts index 7b425d0f1..d4e8f64c6 100644 --- a/apps/playground/src/data/catalyst.ts +++ b/apps/playground/src/data/catalyst.ts @@ -11,7 +11,7 @@ export const fund13 = [ { title: "Hydra Tools for administrating & interacting with Hydra Heads", desc: "Provide all the tools needed to integration Hydra on apps, to enable end-user operations like interacting with wallet, query UTXOs/balance and submit transactions.", - url: "https://cardano.ideascale.com/c/idea/130856", + url: "https://cardano.ideascale.com/c/cardano/idea/130856", completed: [], tobecompleted: [ `Hydra Provider`, @@ -24,7 +24,7 @@ export const fund13 = [ { title: "Cardano Devkit - 'Ganache' of Cardano for better DevXP", desc: "An app to launch local blockchain to test and deploy transactions and smart contracts, to run tests and experiments to develop Cardano applications.", - url: "https://cardano.ideascale.com/c/idea/130825", + url: "https://cardano.ideascale.com/c/cardano/idea/130825", completed: [], tobecompleted: [ `Improve devnet deployment`, @@ -36,7 +36,7 @@ export const fund13 = [ { title: "Cquisitor - Transaction Investigation Tool", desc: "Enhancing Devtools with hosted Rust-based validation modules, and improving error handling to provide clearer feedback, helping developers debug and validate efficiently.", - url: "https://cardano.ideascale.com/c/idea/131631", + url: "https://cardano.ideascale.com/c/cardano/idea/131631", completed: [], tobecompleted: [ `Update Cquisitor`, @@ -49,7 +49,7 @@ export const fund13 = [ { title: "Multisig Platform", desc: "Open source multisig platform for teams and organizations to manage their treasury and participate in governance.", - url: "https://cardano.ideascale.com/c/idea/131036", + url: "https://cardano.ideascale.com/c/cardano/idea/131036", completed: [], tobecompleted: [ `Full governance features`, @@ -63,7 +63,7 @@ export const fund13 = [ { title: "Builder Fest #2 in Asia", desc: "Hosting Buidler Fest #2, a 2-day event for tech-savvy Cardano builders to connect, showcase and share.", - url: "https://cardano.ideascale.com/c/idea/131981", + url: "https://cardano.ideascale.com/c/cardano/idea/131981", completed: [], tobecompleted: [ `Gathering of developers in Vietnam`, @@ -74,7 +74,7 @@ export const fund13 = [ { title: "Maintain Mesh and Build Developer Community", desc: "Maintenance and operations of the Mesh open source libraries and tool suits. Growing Cardano developer community.", - url: "https://cardano.ideascale.com/c/idea/131363", + url: "https://cardano.ideascale.com/c/cardano/idea/131363", completed: [], tobecompleted: [ `Provide community support`, @@ -90,7 +90,7 @@ export const fund12 = [ { title: "Cardano Service Layer Framework for DApps", desc: "R&D a framework to quickly spin up a service layer for specific Cardano DApps, allowing DApps to re-use all infrastructure such as contracts and MeshJS, while possible for custom protocol parameters.", - url: "https://cardano.ideascale.com/c/idea/121847", + url: "https://projectcatalyst.io/funds/12/cardano-open-developers/sidan-or-meshjs-cardano-service-layer-framework-for-dapps", completed: [ `Parallel Cardano Blockchain MeshJS Integration`, `Customized Protocol Parameters`, @@ -105,7 +105,7 @@ export const fund12 = [ { title: "New Features to Improve Developer experience and Adoption", desc: "We will upgrade Mesh by implementing CIP 45, WebRTC wallet connect, handle multiple serialization libs, revamp to support backend transactions building, and improve error messages to improve DevXP.", - url: "https://cardano.ideascale.com/c/idea/122160", + url: "https://projectcatalyst.io/funds/12/cardano-open-developers/mesh-new-features-to-improve-developer-experience-and-cardano-adoption", completed: [ "Mesh application wallet", "Modular CSL library", @@ -117,20 +117,21 @@ export const fund12 = [ { title: "Mesh Software as a Service", desc: "We provide hosted server instances for wallet and transactions builder by restful APIs, this allow integration and interaction to Cardano blockchain from any technology stacks and systems.", - url: "https://cardano.ideascale.com/c/idea/122098", - completed: ["Cloud infrastructure and transaction endpoints"], - tobecompleted: [ - "Hosted wallet / private key for signing", + url: "https://projectcatalyst.io/funds/12/cardano-use-cases-concept/mesh-software-as-a-service", + completed: [ + "Cloud infrastructure", "User-defined transaction building", "JSON schema for transaction", + "Utitlities for transaction building", ], + tobecompleted: ["Hosted wallet / private key for signing"], status: "In Progress", }, { title: "Maintaining Mesh SDK, community support and content creation to onboard developers", desc: "Maintenance and operations of Mesh SDK, community support and content creation, in order to onboard developers and users to the Cardano blockchain ecosystem.", - url: "https://cardano.ideascale.com/c/idea/122471", + url: "https://projectcatalyst.io/funds/12/cardano-open-developers/sustain-and-maintain-mesh-sdk", completed: [ `Provide community support`, `Resolve GitHub issues`, @@ -148,21 +149,17 @@ export const fund11 = [ desc: "We create a collection of open-source smart contracts with Aiken (including Workspace, Mesh TX builder components) and integrate them into the Mesh SDK library on Github - open and accessible to all. ", url: "https://projectcatalyst.io/funds/11/cardano-open-developers/aiken-open-source-smart-contract-library-by-meshjs-and-trustlevel", completed: [ - "Marketplace contract", - "Escrow contract", - "Vesting contract", - "Gift card contract", - "Coupon bond guaranteed contract", - ], - tobecompleted: [ - "Content ownership contract", - "Advanced contract #2", - "Advanced contract #3", - "Bad examples", + "Marketplace", + "Escrow", + "Vesting", + "Gift card", + "Coupon bond guaranteed", + "Content ownership", + "NFT minting machine", ], + tobecompleted: ["Bad examples"], status: "In Progress", }, - { title: "Sustain & Maintain MeshJS", desc: "This proposal enables implementations not limited to Voltaire features, Hydra & Aiken integration, and data providers integrations. Including bounties for issues, features, and learning materials.", diff --git a/apps/playground/src/data/links-smart-contracts.ts b/apps/playground/src/data/links-smart-contracts.ts index 01d3560d6..baa080913 100644 --- a/apps/playground/src/data/links-smart-contracts.ts +++ b/apps/playground/src/data/links-smart-contracts.ts @@ -54,7 +54,7 @@ export const metaContentOwnership = { icon: DocumentCheckIcon, }; export const metaMintPlutusNft = { - title: "NFT Minting Vending Machine", + title: "NFT Minting Machine", desc: "Mint NFT that ensure the token name is incremented by a counter", link: "/smart-contracts/plutus-nft", icon: PhotoIcon, diff --git a/apps/playground/src/pages/about/about-us/meeting.tsx b/apps/playground/src/pages/about/about-us/meeting.tsx index 320da0b95..1d6f9ec01 100644 --- a/apps/playground/src/pages/about/about-us/meeting.tsx +++ b/apps/playground/src/pages/about/about-us/meeting.tsx @@ -6,7 +6,7 @@ export default function AboutMeeting() { return ( <> diff --git a/apps/playground/src/pages/about/catalyst/index.tsx b/apps/playground/src/pages/about/catalyst/index.tsx index 7778e55c0..95db5a27a 100644 --- a/apps/playground/src/pages/about/catalyst/index.tsx +++ b/apps/playground/src/pages/about/catalyst/index.tsx @@ -62,6 +62,15 @@ function CardLink({ tobecompleted: string[]; status: string; }) { + function getDomain(url) { + url = url.replace(/(https?:\/\/)?(www.)?/i, ""); + + if (url.indexOf("/") !== -1) { + return url.split("/")[0]; + } + + return url; + } return (
@@ -118,7 +127,7 @@ function CardLink({
- projectcatalyst.io + {getDomain(url)}
diff --git a/apps/playground/src/pages/about/support-us/donate-section.tsx b/apps/playground/src/pages/about/support-us/donate-section.tsx index c83509967..3459cbbd3 100644 --- a/apps/playground/src/pages/about/support-us/donate-section.tsx +++ b/apps/playground/src/pages/about/support-us/donate-section.tsx @@ -3,6 +3,7 @@ import { useState } from "react"; import { CardanoWallet, useWallet } from "@meshsdk/react"; import { createTransactionDonate } from "~/backend/support"; +import Button from "~/components/button/button"; import Input from "~/components/form/input"; export default function SendPayment() { @@ -58,13 +59,9 @@ export default function SendPayment() { type="number" />
- + ) : ( !connected && ( diff --git a/apps/playground/src/pages/apis/transaction/common.tsx b/apps/playground/src/pages/apis/transaction/common.tsx index 3fe12f281..eaa6b7de2 100644 --- a/apps/playground/src/pages/apis/transaction/common.tsx +++ b/apps/playground/src/pages/apis/transaction/common.tsx @@ -3,7 +3,7 @@ import Codeblock from "~/components/text/codeblock"; export function Intro() { let example = ``; example += `import { Transaction } from '@meshsdk/core';\n\n`; - example += `const tx = new Transaction({ initiator: wallet, verbose: false });\n`; + example += `const tx = new Transaction({ initiator: wallet, verbose: true });\n`; example += `tx.foo(...); // add transaction methods\n`; example += `tx.bar(...); // add transaction methods\n\n`; example += `const unsignedTx = await tx.build();\n`; diff --git a/apps/playground/src/pages/apis/txbuilder/basics/initialize-txbuilder.tsx b/apps/playground/src/pages/apis/txbuilder/basics/initialize-txbuilder.tsx index b31534ecd..41a2fb74e 100644 --- a/apps/playground/src/pages/apis/txbuilder/basics/initialize-txbuilder.tsx +++ b/apps/playground/src/pages/apis/txbuilder/basics/initialize-txbuilder.tsx @@ -1,5 +1,4 @@ import Link from "~/components/link"; - import TwoColumnsScroll from "~/components/sections/two-columns-scroll"; import Codeblock from "~/components/text/codeblock"; @@ -21,6 +20,7 @@ function Left() { example += `const txBuilder = new MeshTxBuilder({\n`; example += ` fetcher: blockchainProvider,\n`; example += ` evaluator: blockchainProvider,\n`; + example += ` verbose: true,\n`; example += `});\n`; let signature = ``; @@ -31,6 +31,7 @@ function Left() { signature += ` serializer?: IMeshTxSerializer;\n`; signature += ` isHydra?: boolean;\n`; signature += ` params?: Partial;\n`; + signature += ` verbose?: boolean;\n`; signature += `}\n`; return ( @@ -80,6 +81,10 @@ function Left() {
  • params: You can pass in the protocol parameters directly.
  • +
  • + verbose: Set to true to enable verbose + logging. +
  • ); diff --git a/apps/playground/src/pages/home/index.tsx b/apps/playground/src/pages/home/index.tsx index eb579dba1..9628ba660 100644 --- a/apps/playground/src/pages/home/index.tsx +++ b/apps/playground/src/pages/home/index.tsx @@ -1,5 +1,7 @@ import { useEffect, useState } from "react"; +import { DocumentCheckIcon } from "@heroicons/react/24/solid"; +import Link from "~/components/link"; import HeroTwoSections from "~/components/sections/hero-two-sections"; export default function HomePage() { @@ -11,11 +13,11 @@ export default function HomePage() { return (
    +
    {!isSSR ? (
    } - // children={} + children={ + + Catalyst Proposals + + + } />
    ); diff --git a/packages/mesh-common/src/types/transaction-info.ts b/packages/mesh-common/src/types/transaction-info.ts index 8dac44cdc..21a4a97fe 100644 --- a/packages/mesh-common/src/types/transaction-info.ts +++ b/packages/mesh-common/src/types/transaction-info.ts @@ -8,4 +8,6 @@ export type TransactionInfo = { deposit: string; invalidBefore: string; invalidAfter: string; + blockHeight: number; + blockTime: number; }; diff --git a/packages/mesh-contract/README.md b/packages/mesh-contract/README.md index 1355a4d5a..d169ce841 100644 --- a/packages/mesh-contract/README.md +++ b/packages/mesh-contract/README.md @@ -11,7 +11,7 @@ Here's a list of open-source smart contracts, complete with documentation, live | Giftcard | Allows users to create a transactions to lock assets into the smart contract, which can be redeemed by any user | [[demo](https://meshjs.dev/smart-contracts/giftcard)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/giftcard)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshGiftcardContract)] | | Hello World | A simple lock-and-unlock assets contract, providing a hands-on introduction to end-to-end smart contract validation and transaction building | [[demo](https://meshjs.dev/smart-contracts/hello-world)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/hello-world)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshHelloWorldContract)] | | Marketplace | Allows anyone to buy and sell native assets such as NFTs | [[demo](https://meshjs.dev/smart-contracts/marketplace)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/marketplace)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshMarketplaceContract)] | -| NFT Minting Vending Machine | Mint NFTs with an automatically incremented index, which increases by one for each newly minted NFT | [[demo](https://meshjs.dev/smart-contracts/plutus-nft)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/plutus-nft)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshPlutusNFTContract)] | +| NFT Minting Machine | Mint NFTs with an automatically incremented index, which increases by one for each newly minted NFT | [[demo](https://meshjs.dev/smart-contracts/plutus-nft)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/plutus-nft)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshPlutusNFTContract)] | | Payment Splitter | Allows users to split incoming payments among a group of accounts | [[demo](https://meshjs.dev/smart-contracts/payment-splitter)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/payment-splitter)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshPaymentSplitterContract)] | | Swap | Facilitates the exchange of assets between two parties | [[demo](https://meshjs.dev/smart-contracts/swap)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/swap)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshSwapContract)] | | Vesting | Allows users to lock tokens for a period of time and withdraw the funds after the lockup period | [[demo](https://meshjs.dev/smart-contracts/vesting)] [[source](https://github.com/MeshJS/mesh/tree/main/packages/mesh-contract/src/vesting)] [[docs](https://docs.meshjs.dev/contracts/classes/MeshVestingContract)] | diff --git a/packages/mesh-provider/src/blockfrost.ts b/packages/mesh-provider/src/blockfrost.ts index 5606b1254..8b109a41d 100644 --- a/packages/mesh-provider/src/blockfrost.ts +++ b/packages/mesh-provider/src/blockfrost.ts @@ -162,6 +162,45 @@ export class BlockfrostProvider return utxosToAssets(utxos); } + /** + * Transactions for an address. + * @param address + * @returns - partial TransactionInfo + */ + async fetchAddressTransactions(address: string): Promise { + try { + const { data, status } = await this._axiosInstance.get( + `/addresses/${address}/transactions`, + ); + if (status === 200 || status == 202) { + return data.map((tx: any) => { + return { + blockHeight: tx.block_height, + blockTime: tx.block_time, + hash: tx.tx_hash, + index: tx.tx_index, + block: "", + slot: "", + fees: "", + size: 0, + deposit: "", + invalidBefore: "", + invalidAfter: "", + }; + }); + } + throw parseHttpError(data); + } catch (error) { + throw parseHttpError(error); + } + } + + /** + * UTXOs of the address. + * @param address - The address to fetch UTXO + * @param asset - UTXOs of a given asset​ + * @returns - Array of UTxOs + */ async fetchAddressUTxOs(address: string, asset?: string): Promise { const filter = asset !== undefined ? `/${asset}` : ""; const url = `addresses/${address}/utxos` + filter; @@ -456,6 +495,11 @@ export class BlockfrostProvider } } + /** + * A generic method to fetch data from a URL. + * @param url - The URL to fetch data from + * @returns - The data fetched from the URL + */ async get(url: string): Promise { try { const { data, status } = await this._axiosInstance.get(url); @@ -468,6 +512,31 @@ export class BlockfrostProvider } } + /** + * A generic method to post data to a URL. + * @param url - The URL to fetch data from + * @param body - Payload + * @param headers - Specify headers, default: { "Content-Type": "application/json" } + * @returns - Data + */ + async post( + url: string, + body: any, + headers = { "Content-Type": "application/json" }, + ): Promise { + try { + const { data, status } = await this._axiosInstance.post(url, body, { + headers, + }); + + if (status === 200 || status == 202) return data; + + throw parseHttpError(data); + } catch (error) { + throw parseHttpError(error); + } + } + /** * Allow you to listen to a transaction confirmation. Upon confirmation, the callback will be called. * @param txHash - The transaction hash to listen for confirmation diff --git a/packages/mesh-provider/src/koios.ts b/packages/mesh-provider/src/koios.ts index de3ff398f..9c99b7fd3 100644 --- a/packages/mesh-provider/src/koios.ts +++ b/packages/mesh-provider/src/koios.ts @@ -102,6 +102,42 @@ export class KoiosProvider implements IFetcher, IListener, ISubmitter { return utxosToAssets(utxos); } + /** + * Transactions for an address. + * @param address + * @returns - partial TransactionInfo + */ + async fetchAddressTransactions(address: string): Promise { + try { + const { data, status } = await this._axiosInstance.post( + `/address_txs`, + { + _addresses: [address], + } + ); + if (status === 200 || status == 202) { + return data.map((tx: any) => { + return { + blockHeight: tx.block_height, + blockTime: tx.block_time, + hash: tx.tx_hash, + index: 0, + block: "", + slot: "", + fees: "", + size: 0, + deposit: "", + invalidBefore: "", + invalidAfter: "", + }; + }); + } + throw parseHttpError(data); + } catch (error) { + throw parseHttpError(error); + } + } + async fetchAddressUTxOs(address: string, asset?: string): Promise { try { const { data, status } = await this._axiosInstance.post("address_info", { @@ -349,10 +385,15 @@ export class KoiosProvider implements IFetcher, IListener, ISubmitter { } } + /** + * A generic method to fetch data from a URL. + * @param url - The URL to fetch data from + * @returns - The data fetched from the URL + */ async get(url: string): Promise { try { const { data, status } = await this._axiosInstance.get(url); - if (status === 200) { + if (status === 200 || status == 202) { return data; } throw parseHttpError(data); @@ -361,6 +402,31 @@ export class KoiosProvider implements IFetcher, IListener, ISubmitter { } } + /** + * A generic method to post data to a URL. + * @param url - The URL to fetch data from + * @param body - Payload + * @param headers - Specify headers, default: { "Content-Type": "application/json" } + * @returns - Data + */ + async post( + url: string, + body: any, + headers = { "Content-Type": "application/json" }, + ): Promise { + try { + const { data, status } = await this._axiosInstance.post(url, body, { + headers, + }); + + if (status === 200 || status == 202) return data; + + throw parseHttpError(data); + } catch (error) { + throw parseHttpError(error); + } + } + onTxConfirmed(txHash: string, callback: () => void, limit = 100): void { let attempts = 0; diff --git a/packages/mesh-transaction/src/mesh-tx-builder/index.ts b/packages/mesh-transaction/src/mesh-tx-builder/index.ts index 37affecc7..76923d9d3 100644 --- a/packages/mesh-transaction/src/mesh-tx-builder/index.ts +++ b/packages/mesh-transaction/src/mesh-tx-builder/index.ts @@ -220,7 +220,7 @@ export class MeshTxBuilder extends MeshTxBuilderCore { !this.fetcher ) throw Error( - "Transaction information is incomplete while no fetcher instance is provided", + "Transaction information is incomplete while no fetcher instance is provided. Provide a `fetcher`.", ); for (let i = 0; i < incompleteTxIns.length; i++) { const currentTxIn = incompleteTxIns[i]!;