Configuración
Configuración inicial de librerías externas.
Resumen
En esta sección, configuraremos el kit axios y la wallet Stellar. Todo lo que necesitas para que funcione.
Variables de entorno
Para este proyecto, usaremos el entorno dev. Para solicitar la clave de API, por favor ve a nuestro dApp y solicítala. Puedes ver esta sección más abajo también:
Solicitar clave APINEXT_PUBLIC_API_URL_DEV=https://dev.api.trustlesswork.com
NEXT_PUBLIC_API_KEY=TU CLAVE DE APIConfiguración de Axios
import axios from "axios";
/**
*
* Instancia de Axios
* @Reference URL: https://axios-http.com/docs/intro
*
*/
const http = axios.create({
baseURL: NEXT_PUBLIC_API_URL_DEV,
timeout: 60000, // 1 minuto
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.NEXT_PUBLIC_API_KEY}`,
},
});
export default http;
Configuración del Kit de Wallet Stellar
import {
StellarWalletsKit,
WalletNetwork,
FREIGHTER_ID,
FreighterModule,
} from "@creit.tech/stellar-wallets-kit";
/**
*
* Stellar Wallets Kit
* @Reference URL: https://stellarwalletskit.dev
*
*/
export const kit: StellarWalletsKit = new StellarWalletsKit({
network: WalletNetwork.TESTNET,
selectedWalletId: FREIGHTER_ID,
modules: [new FreighterModule()],
});
Última actualización
¿Te fue útil?