File size: 870 Bytes
dcf8b6b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// One-time: generate a fresh Stellar testnet keypair, fund it via friendbot,
// and print the keys so you can save them to .env.

import { Keypair } from "@stellar/stellar-sdk";

const kp = Keypair.random();
const pub = kp.publicKey();
const sec = kp.secret();

console.log("Generated new testnet keypair:");
console.log(`  Public:  ${pub}`);
console.log(`  Secret:  ${sec}`);
console.log();

console.log("Funding via friendbot...");
const res = await fetch(`https://friendbot.stellar.org?addr=${pub}`);
if (!res.ok) {
  console.error(`Friendbot failed: ${res.status}`);
  console.error(await res.text());
  process.exit(1);
}
console.log("✓ Funded with 10,000 testnet XLM");
console.log();

console.log("Add to .env:");
console.log(`  AGENT_OWNER_SECRET_TESTNET=${sec}`);
console.log();
console.log(`Verify: https://stellar.expert/explorer/testnet/account/${pub}`);