Skip to content

Instantly share code, notes, and snippets.

View alfonso-paella's full-sized avatar

Alfonso alfonso-paella

View GitHub Profile
@alfonso-paella
alfonso-paella / computeunits.js
Created December 25, 2023 22:55
[Solana] Get compute units spent for tx
const solanaWeb3 = require("@solana/web3.js");
async function getComputeUnits(txId, clusterName) {
// Use a public RPC endpoint
const connection = new solanaWeb3.Connection(
solanaWeb3.clusterApiUrl(clusterName),
"confirmed",
);
try {
// 1. Add this import line at the top of your file
import { CrossmintPayButton } from "@crossmint/client-sdk-react-ui";
// 2. Add this component wherever you want the Buy with card button to show
// Ensure the button shows even for your users who don't have connected their wallet!
<CrossmintPayButton
clientId="_YOUR_CLIENT_ID_"
environment="staging"
mintConfig={{
type: "candy-machine"
@alfonso-paella
alfonso-paella / crossmint_pay_react_eth_erc721_staging.jsx
Last active February 3, 2023 07:34
Gist to add Crossmint Pay with card for an ERC721 Ethereum contract
// 1. Add this import line at the top of your file
import { CrossmintPayButton } from "@crossmint/client-sdk-react-ui";
// 2. Add this component wherever you want the Buy with card button to show
// Ensure the button shows even for your users who don't have connected their wallet!
<CrossmintPayButton
clientId="_YOUR_CLIENT_ID_"
environment="staging"
mintConfig={{
type: "erc-721",
////// CLIENT SIDE
import classnames from 'classnames';
import * as anchor from '@project-serum/anchor';
import { Token, TOKEN_PROGRAM_ID } from '@solana/spl-token';
import { useState, useEffect } from 'react';
import { WalletMultiButton } from '@solana/wallet-adapter-react-ui';
import { useWallet, useConnection } from '@solana/wallet-adapter-react';
import { Container, Snackbar, Paper, CircularProgress } from '@material-ui/core';
import CTAButton from '../components/CTAButton';