New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@x402/aptos

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@x402/aptos

x402 Payment Protocol Aptos Implementation

latest
Source
npmnpm
Version
2.8.0
Version published
Maintainers
2
Created
Source

@x402/aptos

Aptos implementation of the x402 payment protocol.

Installation

npm install @x402/aptos
# or
pnpm add @x402/aptos

Usage

Client

import { Account, Ed25519PrivateKey } from "@aptos-labs/ts-sdk";
import { ExactAptosScheme } from "@x402/aptos/exact/client";

// Create signer from private key
const privateKey = new Ed25519PrivateKey("0x...");
const account = Account.fromPrivateKey({ privateKey });

// Register scheme with client
client.register("aptos:*", new ExactAptosScheme(account));

Facilitator

import { Account, Ed25519PrivateKey } from "@aptos-labs/ts-sdk";
import { ExactAptosScheme } from "@x402/aptos/exact/facilitator";
import { toFacilitatorAptosSigner } from "@x402/aptos";

// Create facilitator signer
const privateKey = new Ed25519PrivateKey("0x...");
const account = Account.fromPrivateKey({ privateKey });
const signer = toFacilitatorAptosSigner(account);

// Register scheme with facilitator
facilitator.register("aptos:2", new ExactAptosScheme(signer));

Server

import { x402ResourceServer } from "@x402/core/server";
import { ExactAptosScheme } from "@x402/aptos/exact/server";

// Create and configure server
const server = new x402ResourceServer({ facilitatorUrl: "https://..." });
server.register("aptos:*", new ExactAptosScheme());

// Use parsePrice to convert amounts (e.g., "$1.00" or { amount: "1000000", asset: "0x..." })
// The scheme handles USDC conversion automatically

Features

  • Sponsored Transactions: Facilitators can pay gas fees on behalf of clients
  • Fungible Asset Transfers: Uses Aptos's native primary_fungible_store::transfer
  • Network Support: Mainnet (aptos:1) and Testnet (aptos:2)

Testnet Resources

For testing on Aptos testnet, you can obtain test tokens from these faucets:

  • Test APT: https://aptos.dev/network/faucet or through an account on geomi.dev
  • Test USDC: https://faucet.circle.com/

License

Apache-2.0

Keywords

x402

FAQs

Package last updated on 23 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts