This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Stellar App</title> | |
</head> | |
<body> | |
<main id="app"></main> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import App from "./App"; | |
const target = document.getElementById("app"); | |
ReactDOM.render(<App />, target); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Box } from "@chakra-ui/core"; | |
import { ThemeProvider, CSSReset } from "@chakra-ui/core"; | |
import Wallet from "./components/wallet"; | |
const App = () => { | |
return ( | |
<ThemeProvider> | |
<CSSReset /> | |
<Box |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
const Wallet = () => { | |
return <p>Hola mundo!</p>; | |
}; | |
export default Wallet; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import StellarSdk from "stellar-sdk"; | |
const server = new StellarSdk.Server("https://horizon-testnet.stellar.org"); | |
const loadAccount = async publicKey => { | |
// Cargamos la cuenta a través del sdk de Stellar | |
const account = await server.loadAccount(publicKey); | |
return account; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import StellarSdk from "stellar-sdk"; | |
const server = new StellarSdk.Server("https://horizon-testnet.stellar.org"); | |
const sendTransaction = async (secret, destination, amount) => { | |
try { | |
const sourceKeys = StellarSdk.Keypair.fromSecret(secret); | |
// Revisamos que la cuenta exista para evitar errores | |
// y cobros innecesarios de comisiones | |
await server.loadAccount(destination); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// utils/create-pair.js | |
import StellarSdk from "stellar-sdk"; | |
const pair = StellarSdk.Keypair.random(); | |
const createTestAccount = () => { | |
// Creamos nuestro par de llaves | |
const secret = pair.secret(); | |
const publicKey = pair.publicKey(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
import CopyKey from "./components/copy-key"; | |
import Start from "./components/start"; | |
import Main from "./components/main"; | |
const Wallet = () => { | |
// Valores de las llaves | |
const [secret, setSecret] = useState(localStorage.secret); | |
const [publicKey, setPublicKey] = useState(localStorage.publicKey); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
import StellarSdk from "stellar-sdk"; | |
import { | |
Heading, | |
Text, | |
Button, | |
InputGroup, | |
Input, | |
useToast | |
} from "@chakra-ui/core"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { activeTestAccount } from "../../../../utils/create-pair"; | |
import { | |
Stack, | |
Alert, | |
AlertIcon, | |
Text, | |
Box, | |
Button, | |
useClipboard, |