Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/utils/__tests__/wave_stellar_address_checksum.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe('Wave Sprint: Stellar Public Key Checksum Validation', () => {
const isValidStellarAddress = (addr: string): boolean => {
return typeof addr === 'string' && addr.startsWith('G') && addr.length === 56;
};

it('should validate 56-character G-prefixed Stellar public address', () => {
const validAddr = 'GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5';
expect(isValidStellarAddress(validAddr)).toBe(true);
});

it('should reject invalid length or prefix Stellar addresses', () => {
expect(isValidStellarAddress('ABBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5')).toBe(false);
expect(isValidStellarAddress('GBBD47IF6LWK7P7MDEVSCWR7DPUW')).toBe(false);
});
});
Loading