Skip to content

Commit

Permalink
Merge pull request #1 from bitcoin-sv/formatting
Browse files Browse the repository at this point in the history
Needed to run the linter for readability mainly
  • Loading branch information
brandonbryant12 committed Mar 21, 2024
2 parents d483e83 + f651273 commit 5412dda
Show file tree
Hide file tree
Showing 17 changed files with 668 additions and 445 deletions.
8 changes: 4 additions & 4 deletions examples/client.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import PaymailClient from '../src/client/paymailClient.js';
import PaymailClient from '../src/client/paymailClient.js'

const client = new PaymailClient();

(async () => {
const publicProfile = await client.getPublicProfile('satoshi@localhost');
console.log(publicProfile);
})();
const publicProfile = await client.getPublicProfile('satoshi@localhost')
console.log(publicProfile)
})()
55 changes: 27 additions & 28 deletions examples/mockUser.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
import { HD } from '@bsv/sdk';
import { HD } from '@bsv/sdk'

class MockUser {
private alias: string;
private avatarUrl: string;
private extendedPrivateKey: string;

constructor(alias, avatartUrl, extendedPrivateKey) {
this.alias = alias;
this.avatarUrl = avatartUrl;
this.extendedPrivateKey = extendedPrivateKey;
}

getAlias() {
return this.alias;
}

getAvatarUrl() {
return this.avatarUrl;
}

getExtendedPrivateKey() {
return new HD().fromString(this.extendedPrivateKey);
}
private readonly alias: string
private readonly avatarUrl: string
private readonly extendedPrivateKey: string

constructor (alias, avatartUrl, extendedPrivateKey) {
this.alias = alias
this.avatarUrl = avatartUrl
this.extendedPrivateKey = extendedPrivateKey
}

getAlias () {
return this.alias
}

getAvatarUrl () {
return this.avatarUrl
}

getExtendedPrivateKey () {
return new HD().fromString(this.extendedPrivateKey)
}
}


const mockUser1 = new MockUser(
'satoshi',
'https://cdns-images.dzcdn.net/images/artist/0cd4444701460a1ccf94d150e37476d9/500x500.jpg',
'xprv9s21ZrQH143K3JXfv6ia4roUARejG3VEEjbhNS1BbeHMFF2V1zBd949FrxUJZat3FSFLEA9wZxjUV2NdbbvD9uCiibdRfpaBVGysQaZxduX');
'satoshi',
'https://cdns-images.dzcdn.net/images/artist/0cd4444701460a1ccf94d150e37476d9/500x500.jpg',
'xprv9s21ZrQH143K3JXfv6ia4roUARejG3VEEjbhNS1BbeHMFF2V1zBd949FrxUJZat3FSFLEA9wZxjUV2NdbbvD9uCiibdRfpaBVGysQaZxduX')

export { mockUser1 };
export { mockUser1 }

export default MockUser;
export default MockUser
38 changes: 19 additions & 19 deletions examples/server.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import express from 'express';
import PaymailRouter from '../src/router/router.js';
import PublicProfileRoute from '../src/router/routes/publicProfileRoute.js';
import { mockUser1 } from './mockUser.js';
const app = express();
import express from 'express'
import PaymailRouter from '../src/router/router.js'
import PublicProfileRoute from '../src/router/routes/publicProfileRoute.js'
import { mockUser1 } from './mockUser.js'
const app = express()

const baseUrl = 'http://localhost:3000';
const baseUrl = 'http://localhost:3000'

const publicProfileRoute = new PublicProfileRoute((name, domain) => {
if (name === mockUser1.getAlias()) {
return {
name: mockUser1.getAlias(),
domain,
avatarUrl: mockUser1.getAvatarUrl()
}
if (name === mockUser1.getAlias()) {
return {
name: mockUser1.getAlias(),
domain,
avatarUrl: mockUser1.getAvatarUrl()
}
throw new Error('User not found')
}
throw new Error('User not found')
})

const routes = [publicProfileRoute];
const routes = [publicProfileRoute]

const paymailRouter = new PaymailRouter(baseUrl, routes);
const paymailRouter = new PaymailRouter(baseUrl, routes)

app.use(paymailRouter.getRouter());
app.use(paymailRouter.getRouter())

const PORT = 3000;
const PORT = 3000
app.listen(PORT, () => {
console.log(`Server is running on http://localhost:${PORT}`);
});
console.log(`Server is running on http://localhost:${PORT}`)
})
Loading

0 comments on commit 5412dda

Please sign in to comment.