How it works
Glide lets users pay for a variety of on-chain transactions using any token on any chain. It provides simple APIs to integrate into your dapp or wallet.
Glide works by collecting a payment from the user in their preferred token and then execute the user transaction on behalf of the user directly on destination chain. This way, Glide can collect payment from the user on any chain and in any token, including fiat using credit/debit card payments.
Core concepts
- User Transaction: The user transaction is the transaction that the user wants to complete on the destination chain. It should be relayable (in other words, not rely on
msg.sender
) because it needs be executed by Glide relayer. - Session: A Glide session represents the user's intent to pay for a transaction. It consists of the user transaction and an unsigned payment transaction, also referred to as the quote.
- Payment Transaction: The payment transaction is the transaction that the user signs to pay for the session. It is a simple ETH transfer or ERC20 transfer.
High-level flow
- Create Glide session with user transaction and preferred payment token
- a. When the user wants to make a transaction, the dapp constructs the user transaction
- b. The dapp presents the user with a list of tokens they could pay in for this transaction
- c. The transaction is sent to Glide along with the user's preferred token to create a session
- Glide sends back an unsignedTransaction for the user to sign. This is the payment transaction in the user's preferred token
- The dapp presents the user with the unsignedTransaction to sign and then broadcasts it on-chain
- Finally, the dapp polls Glide for updates on the session as it waits for the payment to be received. Once received, Glide executes the user transaction and provides the transaction hash back to the dapp
Use cases
- Cross-token payments: Let users pay in any token they prefer, regardless of what the smart contract expects. If the contract expects ETH, but the user only has USDC balance, let them pay in USDC.
- Cross-chain payments: Let users pay on any-chain, regardless of where the smart contract is deployed. If the contract is deployed on Zora, but the user only has balance on Base, let them pay on Base.
- Alternate to on-ramp: When a user does not have the right tokens on the right chain to pay for a transaction, let them pay with what they already have instead of having them go through a lengthy on-ramp process.
- Smart contract risk isolation: User wallet only needs to sign the payment transaction, which is simple ETH transfer or ERC20 transfer. Glide interacts with the smart contract on behalf of the user, so the user wallet is not exposed to any smart contract interaction risks.
- Batch transactions: For contracts that takes erc20 as payment, it usually requires an approve transaction followed by the actual interaction transaction. Glide can batch these transactions, all the user needs to do is sign the Glide payment transaction.