Skip to content

Commit

Permalink
Create api.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 7, 2024
1 parent 3b6a2a1 commit 75f5938
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions projects/PiWalletBot/client/context/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import axios from 'axios';

const api = axios.create({
baseURL: 'https://api.pi.network',
});

export const getPiBalance = async () => {
const response = await api.get('/balance');
return response.data;
};

export const sendPiTransaction = async (amount, recipient) => {
const response = await api.post('/transaction', {
amount,
recipient,
});
return response.data;
};

export default api;

0 comments on commit 75f5938

Please sign in to comment.