-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from bitcoin-sv/formatting
Needed to run the linter for readability mainly
- Loading branch information
Showing
17 changed files
with
668 additions
and
445 deletions.
There are no files selected for viewing
This file contains 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
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) | ||
})() |
This file contains 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
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 |
This file contains 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
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}`) | ||
}) |
Oops, something went wrong.