-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add metamask support, fixed giftcard, upgrade wallets
- Loading branch information
1 parent
c0fbb2f
commit 664b0ed
Showing
27 changed files
with
340 additions
and
69 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
apps/playground/src/components/cardano/mint-mesh-token.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { | ||
AppWallet, | ||
AssetMetadata, | ||
ForgeScript, | ||
Mint, | ||
Transaction, | ||
} from "@meshsdk/core"; | ||
import { useWallet } from "@meshsdk/react"; | ||
|
||
import { demoAssetMetadata, demoMnemonic } from "~/data/cardano"; | ||
import LiveCodeDemo from "../sections/live-code-demo"; | ||
import { getProvider } from "./mesh-wallet"; | ||
|
||
export default function MintMeshToken() { | ||
const { wallet, connected } = useWallet(); | ||
|
||
async function runDemo() { | ||
const blockchainProvider = getProvider(); | ||
const mintingWallet = new AppWallet({ | ||
networkId: 0, | ||
fetcher: blockchainProvider, | ||
submitter: blockchainProvider, | ||
key: { | ||
type: "mnemonic", | ||
words: demoMnemonic, | ||
}, | ||
}); | ||
|
||
const usedAddress = await wallet.getUsedAddresses(); | ||
const address = usedAddress[0]; | ||
const forgingScript = ForgeScript.withOneSignature( | ||
mintingWallet.getPaymentAddress(), | ||
); | ||
|
||
const tx = new Transaction({ initiator: wallet }); | ||
|
||
const asset: Mint = { | ||
assetName: "MeshToken", | ||
assetQuantity: "1", | ||
metadata: demoAssetMetadata, | ||
label: "721", | ||
recipient: address, | ||
}; | ||
tx.mintAsset(forgingScript, asset); | ||
|
||
const unsignedTx = await tx.build(); | ||
const signedTx = await wallet.signTx(unsignedTx, true); | ||
const signedTx2 = await mintingWallet.signTx(signedTx, true); | ||
const txHash = await wallet.submitTx(signedTx2); | ||
return txHash; | ||
} | ||
|
||
return ( | ||
<LiveCodeDemo | ||
title="Mint Mesh Token" | ||
subtitle="Mint a Mesh Token to try demos" | ||
runCodeFunction={runDemo} | ||
disabled={!connected} | ||
runDemoButtonTooltip={ | ||
!connected ? "Connect wallet to run this demo" : undefined | ||
} | ||
runDemoShowBrowseWalletConnect={true} | ||
hideDemoButtonIfnotConnected={true} | ||
hideConnectButtonIfConnected={true} | ||
></LiveCodeDemo> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
apps/playground/src/pages/apis/wallets/browserwallet/get-available-wallets.tsx
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.