Skip to content

Commit

Permalink
Create apiService.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 7, 2024
1 parent 342bb6b commit e3d63b9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions projects/PiWalletBot/server/services/apiService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import axios from 'axios';

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

export const getPiBalance = async (address) => {
const response = await apiService.get(`/balance/${address}`);
return response.data;
};

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

export default apiService;

0 comments on commit e3d63b9

Please sign in to comment.