evm
Sign EVM charge Credentials
Choose a signing account
Create a server-only wallet.ts module, then import account wherever an example creates a local signing account.
wallet.ts
import { privateKeyToAccount } from 'viem/accounts'
export const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`)Namespace for EVM payment methods and known asset metadata.
Usage
import { , } from 'mppx/client'
import { } from 'viem/accounts'
const = (
'0x0123456789012345678901234567890123456789012345678901234567890123',
)
.({
: [
.({
,
: [...],
: '1.00',
}),
],
})privy.ts
import { PrivyClient } from '@privy-io/node'
import { createViemAccount } from '@privy-io/node/viem'
import { Mppx, evm } from 'mppx/client'
const privy = new PrivyClient({
appId: process.env.PRIVY_APP_ID!,
appSecret: process.env.PRIVY_APP_SECRET!,
})
const account = createViemAccount(privy, {
address: process.env.PRIVY_WALLET_ADDRESS as `0x${string}`,
walletId: process.env.PRIVY_WALLET_ID!,
})
Mppx.create({
methods: [
evm.charge({
account,
currencies: [evm.assets.baseSepolia.USDC],
maxAmount: '1.00',
}),
],
})Exports
assets
- Type:
typeof import('mppx/client').evm.assets
Known EVM asset metadata. Use evm.assets.base.USDC for Base mainnet, evm.assets.baseSepolia.USDC for Base Sepolia, evm.assets.celo.USDC or evm.assets.celo.USDT for Celo, and evm.assets.celoSepolia.USDC for Celo Sepolia.
Use evm.assets.define for custom EVM assets:
import { } from 'mppx/client'
const = ..({
: '0x1234567890abcdef1234567890abcdef12345678',
: 6,
: 'eip155:84532',
: {
: 'USD Coin',
: 'eip3009',
: '2',
},
})chains
- Type:
typeof import('mppx/client').evm.chains
Known EVM chain IDs. Use evm.chains.base for Base mainnet, evm.chains.baseSepolia for Base Sepolia, evm.chains.celo for Celo, and evm.chains.celoSepolia for Celo Sepolia.
charge
- Type:
typeof evm.charge
Creates an EVM charge payment method. See evm.charge.