Skip to content

Instantly share code, notes, and snippets.

@kmjones1979
kmjones1979 / TUTORIAL.md
Last active December 12, 2025 11:33
Tutorial for ampersend-sdk in Typescript

Ampersend TypeScript SDK Tutorial

Workshop Duration: 10 minutes

This tutorial walks through the Ampersend TypeScript SDK for integrating x402 payment capabilities into MCP (Model Context Protocol) applications. The x402 protocol extends HTTP with a standard way for servers to request payment before providing resources, using the 402 "Payment Required" status code. By the end of this tutorial, you'll understand how to build MCP clients that can pay for tools, MCP servers that charge for tools, and proxy servers that add payments to existing MCP infrastructure.


Table of Contents

@kmjones1979
kmjones1979 / TUTORIAL.md
Last active December 12, 2025 11:33
Tutorial for ampersend-sdk in Python

Ampersend Python SDK Tutorial

Workshop Duration: 10 minutes

This tutorial walks through the Ampersend Python SDK for integrating x402 payment capabilities into A2A (Agent-to-Agent) applications. The x402 protocol extends HTTP with a standard way for servers to request payment before providing resources, using the 402 "Payment Required" status code. By the end of this tutorial, you'll understand how to build both buyer (client) and seller (server) agents that can exchange micropayments for AI services.


Table of Contents

@kmjones1979
kmjones1979 / sweepMultipleAccounts.ts
Created June 12, 2025 22:29
example sweeper for deployer and burner wallet accounts
import * as dotenv from "dotenv";
dotenv.config();
import { ethers, Wallet } from "ethers";
import { config } from "hardhat";
import password from "@inquirer/password";
import { input, confirm, select } from "@inquirer/prompts";
interface AccountInfo {
address: string;
wallet: Wallet;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "./MentorNFT.sol";
@kmjones1979
kmjones1979 / MentorNFT.sol
Created June 10, 2025 21:51
Updated Version
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
// --- Custom Errors ---
error MentorNFT_ZeroAddressOwner();
@kmjones1979
kmjones1979 / README.md
Last active September 26, 2025 09:51
πŸš€ Stablecoin Challenge Tutorial

πŸš€ Stablecoin Challenge - Complete Developer Tutorial πŸ’°

Welcome to the most exciting DeFi adventure! πŸŽ‰ Get ready to dive into the world of stablecoins, yield farming, and automated market making!

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
// --- Custom Errors ---
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "./MentorNFT.sol";
@kmjones1979
kmjones1979 / FunctionsConsumer.sol
Created November 25, 2024 15:22
Example contract to run chainlink function.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {FunctionsClient} from "./@chainlink/contracts/src/v0.8/functions/dev/1_0_0/FunctionsClient.sol";
import {ConfirmedOwner} from "./@chainlink/contracts/src/v0.8/shared/access/ConfirmedOwner.sol";
import {FunctionsRequest} from "./@chainlink/contracts/src/v0.8/functions/dev/1_0_0/libraries/FunctionsRequest.sol";
contract FunctionsConsumerExample is FunctionsClient, ConfirmedOwner, ERC721 {
using FunctionsRequest for FunctionsRequest.Request;
@kmjones1979
kmjones1979 / mission-1.js
Created November 25, 2024 15:20
Javascript for Chainlink Function
// This example show how to check if an account is enlisted in the mission
const account = args[0].toLowerCase() // make sure the account is in lowercase
const query_url = args[1] //https://api.studio.thegraph.com/query/37762/mymission/version/latest
// Uncomment to use Graph API Key (for published missions)
//const graphKey = secrets.graphKey
const graphRequest = Functions.makeHttpRequest({
url: `${query_url}`,
method: "POST",