Meta API
Browser-compatible meta-transaction client for AzothPay Gasless UX for subscriptions, payments, deposits & withdrawals β powered by EIP-712 and a relayer network.
β No axios β uses native fetch()
β Full EIP-712 signing (ethers-compatible)
β Non-custodial: user signs off-chain, relayer broadcasts on-chain
β Works in modern browsers and bundlers (Webpack, Vite, etc.)
π¦ Installation & Initialization
npm install @azothpay/api ethersimport { AzothPayMetaApiClient } from '@azothpay/api/browser';
const metaClient = new AzothPayMetaApiClient(
'https://azothpay.com', // production endpoint
'bsc-usdt', // 'bsc-usdc' | 'bsc-usdt' | 'pol-usdc'| 'pol-usdt'
'your-api-key' // issued after KYB and onboarding
);Constructor Parameters
baseUrl
β
API base URL, e.g. 'https://azothpay.com'
contract
β
Contract identifier: 'bsc-usdc' | 'bsc-usdt' | 'pol-usdc'| 'pol-usdt'
apiKey
β
API key (issued by AzothPay during onboarding)
provider
β
Optional ethers.Provider, can be set later via .setProvider()
π All requests automatically include the header: x-api-key: <your-api-key>
π Meta-Transaction Concept in AzothPay
Meta-transactions allow users to perform operations without paying gas themselves:
Client β API: call prepare*MetaTransaction(...) β get structured transactionData
Client β Wallet: call signMetaTransaction(...) β sign EIP-712 message with traits
Client β API: call executeMetaTransaction(...) β relayer submits the tx on-chain
Result: the user does not pay gas; they only pay according to your business logic (subscriptions, payments, etc.). Gas is paid by the relayer, which you or AzothPay control.
π Method Overview
1. Prepare Meta-Transactions (off-chain)
These methods prepare data for EIP-712 signing and later execution.
prepareSubscriptionMetaTransaction(params)
{ from, author, subscriptionRate, projectId }
{ from, method, data }
Prepares subscribe(...) call
prepareCancelSubscriptionMetaTransaction(author, params)
author, { from }
{ from, method, data }
Prepares unsubscribe(author) call
preparePaymentMetaTransaction(params)
{ from, to, amount }
from, method, data }
Prepares pay(to, amount) call
prepareDepositMetaTransaction(params)
{ from, amount, isPermit2? }
{ from, method, data }
Prepares deposit(amount, isPermit2) call
prepareWithdrawMetaTransaction(params)
{ from, amount, to? }
{ from, method, data }
Prepares withdraw(amount) or withdrawTo(to, amount) call
2. Signing (client-side, EIP-712)
signMetaTransaction(transactionData, signer, contractAddress, chainId, relayerAddress)
Signs prepared meta-transaction using EIP-712.
transactionData
object
Result of any prepare*MetaTransaction() call
signer
ethers.Signer
Ethers signer, e.g. provider.getSigner() from MetaMask
contractAddress
string
AzothPay contract address (0x...)
chainId
number
Chain ID (e.g. 137 for Polygon)
relayerAddress
string
Address of the relayer (operated by you or AzothPay)
Returns:
3. Execute Meta-Transaction (via relayer)
executeMetaTransaction(signedTransaction)
Sends signed meta-transaction payload to the relayer API. The relayer then broadcasts the corresponding on-chain transaction.
Returns (typical):
txHash: transaction hash after broadcast
status: 'pending' | 'confirmed' | 'failed'
On error β HTTP 4xx/5xx with error description
β οΈ The relayer must be authorized in the AzothPay contract.
Contact AzothPay if you want to use the shared relayer or run your own.
π Convenience βAll-in-Oneβ Methods
These helpers encapsulate: prepare β sign β execute.
createSubscriptionViaMetaTransaction(params, signer, contractAddress, chainId, relayerAddress)
Gasless subscription creation
cancelSubscriptionViaMetaTransaction(author, params, signer, contractAddress, chainId, relayerAddress)
Gasless subscription cancellation
makePaymentViaMetaTransaction(...)
Gasless one-off payment
depositFundsViaMetaTransaction(...)
Gasless deposit
withdrawFundsViaMetaTransaction(...)
Gasless withdraw
Example: Gasless Subscription
π Additional Methods
getNonce(address)
Returns the current nonce for given address (for replay protection)
setProvider(provider)
Sets/updates ethers.Provider (useful to fetch chainId etc.)
β οΈ Important Notes
Relayer security
Only trusted relayers should be allowed to execute meta-transactions.
AzothPay can provide a shared relayer or help you deploy your own.
Signature deadline
Each meta-transaction has a deadline (unix timestamp). After that time, the contract rejects the signature.
Replay protection
Contracts validate (nonceType, nonce) pairs β each combination is unique and can be used only once.
EIP-712 support
Wallet must support eth_signTypedData_v4 (MetaMask, WalletConnect, Coinbase Wallet, etc.).
π‘οΈ Security & Compatibility
β Supports ethers.js v5 and v6
β Uses native fetch() only (no axios)
β Compatible with modern bundlers (Webpack, Vite, etc.)
β Relies on BigInt β runtime will check for availability
β Default HTTP timeout: 10 seconds for API calls
π‘ AzothPay is non-custodial, audited, and stablecoin-native infrastructure for: adult, iGaming, VPN, donations.
Last updated