-
Notifications
You must be signed in to change notification settings - Fork 36
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 #1711 from demergent-labs/server_export_optional
get rid of the need for explicitly exporting Server
- Loading branch information
Showing
19 changed files
with
594 additions
and
638 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,14 +1,11 @@ | ||
import { Server } from 'azle'; | ||
import express from 'express'; | ||
|
||
import { rangeResponse } from './range_response'; | ||
|
||
export default Server(() => { | ||
const app = express(); | ||
const app = express(); | ||
|
||
app.use('/media', rangeResponse()); | ||
app.use('/media', rangeResponse()); | ||
|
||
app.use(express.static('/dist')); | ||
app.use(express.static('/dist')); | ||
|
||
return app.listen(); | ||
}); | ||
app.listen(); |
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
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,52 +1,49 @@ | ||
import { Server } from 'azle'; | ||
import { ethers } from 'ethers'; | ||
import express, { Request } from 'express'; | ||
|
||
export default Server(() => { | ||
const app = express(); | ||
const app = express(); | ||
|
||
app.get( | ||
'/keccak256', | ||
(req: Request<any, any, any, { message: string }>, res) => { | ||
res.send(ethers.keccak256(Buffer.from(req.query.message))); | ||
} | ||
); | ||
app.get( | ||
'/keccak256', | ||
(req: Request<any, any, any, { message: string }>, res) => { | ||
res.send(ethers.keccak256(Buffer.from(req.query.message))); | ||
} | ||
); | ||
|
||
app.get('/wallet-from-private-key', (req, res) => { | ||
const wallet = new ethers.Wallet( | ||
'afdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b1578140422a4f890' | ||
); | ||
app.get('/wallet-from-private-key', (req, res) => { | ||
const wallet = new ethers.Wallet( | ||
'afdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b1578140422a4f890' | ||
); | ||
|
||
res.json({ | ||
address: wallet.address, | ||
publicKey: wallet.signingKey.publicKey, | ||
privateKey: wallet.privateKey | ||
}); | ||
res.json({ | ||
address: wallet.address, | ||
publicKey: wallet.signingKey.publicKey, | ||
privateKey: wallet.privateKey | ||
}); | ||
}); | ||
|
||
// TODO this will run out of cycles until (hopefully) we move away from crypto-browserify | ||
app.get('/wallet-from-mnemonic', (req, res) => { | ||
const wallet = ethers.Wallet.fromPhrase( | ||
'indoor dish desk flag debris potato excuse depart ticket judge file exit' | ||
); | ||
|
||
// TODO this will run out of cycles until (hopefully) we move away from crypto-browserify | ||
app.get('/wallet-from-mnemonic', (req, res) => { | ||
const wallet = ethers.Wallet.fromPhrase( | ||
'indoor dish desk flag debris potato excuse depart ticket judge file exit' | ||
); | ||
|
||
res.json({ | ||
address: wallet.address, | ||
publicKey: wallet.signingKey.publicKey, | ||
privateKey: wallet.privateKey | ||
}); | ||
res.json({ | ||
address: wallet.address, | ||
publicKey: wallet.signingKey.publicKey, | ||
privateKey: wallet.privateKey | ||
}); | ||
}); | ||
|
||
// TODO this will run out of cycles until (hopefully) we move away from crypto-browserify | ||
app.get('/wallet-from-random', (req, res) => { | ||
const wallet = ethers.Wallet.createRandom(); | ||
// TODO this will run out of cycles until (hopefully) we move away from crypto-browserify | ||
app.get('/wallet-from-random', (req, res) => { | ||
const wallet = ethers.Wallet.createRandom(); | ||
|
||
res.json({ | ||
address: wallet.address, | ||
publicKey: wallet.signingKey.publicKey, | ||
privateKey: wallet.privateKey | ||
}); | ||
res.json({ | ||
address: wallet.address, | ||
publicKey: wallet.signingKey.publicKey, | ||
privateKey: wallet.privateKey | ||
}); | ||
|
||
return app.listen(); | ||
}); | ||
|
||
app.listen(); |
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
Oops, something went wrong.