Lantern
Storing All Token Accounts for a Mint
This feature is designed for applications that make a lot of calls for the balances of a specific token, for example:
- A website that shows the balance of a particular token a lot.
- An application that provides access depending on user token balances.
- An application that calculates and sends rewards based on token balances.
- A game that uses tokens, can speed up any parts that require checking token balances.
- A DEX could route all USDC balance enquiries to Lantern
In these cases, Lantern will improve the speed of these applications substantially, while also greatly decreasing the RPC costs they incur! The fastest way to get started is with The Configurator. However, we'll detail how to manually configure this feature below.
To configure Lantern to store a mint, the configuration file needs to know the mint and program for the token you wish to store. For example this will store all token accounts for the PumpFun token:
"programs": {
"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb": {
"accounts": {
"pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn": {}
},
"discriminator": 2,
"filters": []
}
}Specifying More than one Mint
You may specify more than one mint to store. If they belong to the same token program, you can specify them in the same object, like so:
"programs": {
"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb": {
"accounts": {
"pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn": {},
"FLUXBmPhT3Fd1EDVFdg46YREqHBeNypn1h4EbnTzWERX": {}
},
"discriminator": 2,
"filters": []
}
}This will store both the PumpFun and FluxBot tokens. If the tokens belong to different programs, you need to split them out like so:
"programs": {
"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb": {
"accounts": {
"pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn": {},
"FLUXBmPhT3Fd1EDVFdg46YREqHBeNypn1h4EbnTzWERX": {}
},
"discriminator": 2,
"filters": []
},
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA": {
"accounts": {
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v": {}
},
"discriminator": 2,
"filters": []
}
}