Virtual testnets
Introduction
When developing locally, you may want to test your integration with Glide without paying any real money.
Virtual TestNets are simulated blockchain networks, designed to replicate real networks. They fully track real network state without the need to use real tokens.
You can use the same contract addresses and wallet addresses as you would on the mainnet.
Supported Networks
See the list of supported networks here
If you need a specific network, please reach out to us at [email protected].
Setup
1. Update Glide client
import { createGlideConfig, chains } from "@paywithglide/glide-js";
export const config = createGlideConfig({
projectId: "your project id",
// Lists the chains where payments will be accepted
chains: [chains.baseVirtualTestnet, chains.optimismVirtualTestnet],
});
2. Update libraries
If you're using libraries such as wagmi/viem or wallet providers, update them to support the virtual testnets.
Here is an example on how to update wagmi:
import { chains } from "@paywithglide/glide-js";
export const wagmiConfig = createConfig({
chains: [
chains.baseVirtualTestnet,
chains.optimismVirtualTestnet,
],
transports: {
[chains.baseVirtualTestnet.id]: http(),
[chains.optimismVirtualTestnet.id]: http(),
},
connectors: [..]
});
3. Update calls to Glide
Finally, update any calls to Glide to use the virtual testnets.
If you're using createSession
, update the chainId
and optionally the paymentCurrency
:
const session = await createSession(config, {
chainId: chains.base.id,
chainId: chains.baseVirtualTestnet.id,
account: address,
abi: fabricABI,
address: "0x1169c6769c4F4B3cA1944AF0F26B36582fd5279d",
functionName: "mintFor",
args: [address, 999999907200n],
value: 999999907200n,
paymentCurrency: currencies.eth.on(chains.optimism),
});
Do the same for any calls to listPaymentOptions
, estimatePaymentAmount
, and createSession
.
4. Add virtual testnets to Metamask
Once you start testing locally, you will need to approve transactions on the virtual testnets. Use the network settings below to add the virtual testnets to your wallet:
Name | Chain ID | RPC URL | Add to Metamask |
---|---|---|---|
Glide Base Testnet | 454338453 | https://virtual.base.rpc.tenderly.co/6f4bdbd8-9adf-4776-879f-f8ad21e7f7e8 | |
Glide Optimism Testnet | 4543310 | https://virtual.optimism.rpc.tenderly.co/c5fc9c2b-72c9-4709-b861-d5ee81430675 |