Skip to content

Commit f3508ff

Browse files
authored
Merge pull request #600 from barry01-hash/seed_data
fix seed demo data
2 parents 3bf9e60 + 52f70f7 commit f3508ff

2 files changed

Lines changed: 68 additions & 5 deletions

File tree

backend/prisma/seed.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,29 @@ const pool = new pg.Pool({ connectionString });
77
const adapter = new PrismaPg(pool);
88
const prisma = new PrismaClient({ adapter });
99

10+
// Use stable, checksum-valid Stellar testnet/demo addresses so seeded rows
11+
// render correctly in the frontend and resolve against TOKEN_ADDRESSES.
12+
const DEMO_SENDER_PUBLIC_KEY = 'GCM5WPR4DDR24FSAX5LIEM4J7AI3KOWJYANSXEPKYXCSZOTAYXE75AFN';
13+
const DEMO_RECIPIENT_PUBLIC_KEY = 'GBJCHUKZMTFSLOMNC7P4TS4VJJBTCYL3XKSOLXAUJSD56C4LHND5TWUC';
14+
const DEMO_TOKEN_ADDRESS = 'CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA';
15+
1016
async function main() {
1117
console.log('Seeding database...');
1218

1319
// Create example users
1420
const user1 = await prisma.user.upsert({
15-
where: { publicKey: 'GBRPYH6QC6WGLH473XI3CL4B3I754SFSULN5K3X7G3X4I6SGRH3V3U12' },
21+
where: { publicKey: DEMO_SENDER_PUBLIC_KEY },
1622
update: {},
1723
create: {
18-
publicKey: 'GBRPYH6QC6WGLH473XI3CL4B3I754SFSULN5K3X7G3X4I6SGRH3V3U12',
24+
publicKey: DEMO_SENDER_PUBLIC_KEY,
1925
},
2026
});
2127

2228
const user2 = await prisma.user.upsert({
23-
where: { publicKey: 'GDRS6N3K7DQ6GKH47O6E5K5G7B7H7I7J7K7L7M7N7O7P7Q7R7S7T7U7V' },
29+
where: { publicKey: DEMO_RECIPIENT_PUBLIC_KEY },
2430
update: {},
2531
create: {
26-
publicKey: 'GDRS6N3K7DQ6GKH47O6E5K5G7B7H7I7J7K7L7M7N7O7P7Q7R7S7T7U7V',
32+
publicKey: DEMO_RECIPIENT_PUBLIC_KEY,
2733
},
2834
});
2935

@@ -37,7 +43,7 @@ async function main() {
3743
streamId: 101,
3844
sender: user1.publicKey,
3945
recipient: user2.publicKey,
40-
tokenAddress: 'CBTM5D262F6VQY4A6E4F6G7H8I9J0K1L2M3N4O5P6Q7R8S9T0U1V2W3X',
46+
tokenAddress: DEMO_TOKEN_ADDRESS,
4147
ratePerSecond: '100000000', // 10 XLM/sec if decimals=7
4248
depositedAmount: '1000000000000',
4349
withdrawnAmount: '0',

package-lock.json

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)