-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-gasless.js
More file actions
23 lines (18 loc) · 781 Bytes
/
test-gasless.js
File metadata and controls
23 lines (18 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const { Keypair } = require('@solana/web3.js');
async function testGasless() {
const inputMint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'; // USDC
const outputMint = 'So11111111111111111111111111111111111111112'; // SOL
const amount = '1000000'; // 1 USDC
const userPublicKey = Keypair.generate().publicKey.toString();
const url = `https://lite-api.jup.ag/ultra/v1/order?inputMint=${inputMint}&outputMint=${outputMint}&amount=${amount}&userPublicKey=${userPublicKey}&gasless=true`;
console.log('Fetching:', url);
try {
const response = await fetch(url);
const text = await response.text();
console.log('Status:', response.status);
console.log('Response:', text);
} catch (error) {
console.error('Error:', error);
}
}
testGasless();