token.ts 581 B

1234567891011121314151617181920212223
  1. import { Token } from '@raydium-io/raydium-sdk';
  2. import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
  3. import { PublicKey } from '@solana/web3.js';
  4. export function getToken(token: string) {
  5. switch (token) {
  6. case 'WSOL': {
  7. return Token.WSOL;
  8. }
  9. case 'USDC': {
  10. return new Token(
  11. TOKEN_PROGRAM_ID,
  12. new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'),
  13. 6,
  14. 'USDC',
  15. 'USDC',
  16. );
  17. }
  18. default: {
  19. throw new Error(`Unsupported quote mint "${token}". Supported values are USDC and WSOL`);
  20. }
  21. }
  22. }