forked from gear-foundation/dapps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
52 additions
and
102 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
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
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import express from 'express'; | ||
import bodyParser from 'body-parser'; | ||
import { GaslessService } from './gasless-service'; | ||
import dotenv from 'dotenv'; | ||
|
||
export { GaslessService }; | ||
|
||
dotenv.config(); | ||
|
||
const app = express(); | ||
const gaslessService = new GaslessService(); | ||
|
||
app.use(bodyParser.json()); | ||
|
||
app.post('/issue', async function (req, res) { | ||
const data = req.body; | ||
const voucher = await gaslessService.issue(data.account, data.programId, data.amount, data.durationInSec); | ||
res.send(voucher); | ||
}); | ||
|
||
|
||
app.post('/prolong', async function (req, res) { | ||
const data = req.body; | ||
const voucher = await gaslessService.prolong(data.voucherId, data.account, data.balance, data.durationInSec); | ||
res.send("OK"); | ||
}); | ||
|
||
app.post('/revoke', async function (req, res) { | ||
const data = req.body; | ||
const voucher = await gaslessService.revoke(data.voucherId, data.account); | ||
res.send("OK"); | ||
}); | ||
|
||
const port = process.env.PORT || 3000; | ||
app.listen(port, () => { | ||
console.log(`Server is running on port ${port}`); | ||
}); |
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 |
---|---|---|
|
@@ -663,11 +663,6 @@ | |
resolved "https://registry.npmjs.org/@scure/base/-/base-1.1.3.tgz" | ||
integrity sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q== | ||
|
||
"@socket.io/component-emitter@~3.1.0": | ||
version "3.1.0" | ||
resolved "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz" | ||
integrity sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg== | ||
|
||
"@substrate/connect-extension-protocol@^2.0.0": | ||
version "2.1.0" | ||
resolved "https://registry.yarnpkg.com/@substrate/connect-extension-protocol/-/connect-extension-protocol-2.1.0.tgz#7df153f704702b98559e7e5e8a2ce17881fe1d1d" | ||
|
@@ -755,18 +750,6 @@ | |
dependencies: | ||
"@types/node" "*" | ||
|
||
"@types/cookie@^0.4.1": | ||
version "0.4.1" | ||
resolved "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz" | ||
integrity sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q== | ||
|
||
"@types/cors@^2.8.12": | ||
version "2.8.17" | ||
resolved "https://registry.npmjs.org/@types/cors/-/cors-2.8.17.tgz" | ||
integrity sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA== | ||
dependencies: | ||
"@types/node" "*" | ||
|
||
"@types/express-serve-static-core@^4.17.33": | ||
version "4.17.41" | ||
resolved "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.41.tgz" | ||
|
@@ -797,7 +780,7 @@ | |
resolved "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz" | ||
integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w== | ||
|
||
"@types/node@*", "@types/node@>=10.0.0", "@types/node@^20.10.0": | ||
"@types/node@*", "@types/node@^20.10.0": | ||
version "20.10.0" | ||
resolved "https://registry.npmjs.org/@types/node/-/node-20.10.0.tgz" | ||
integrity sha512-D0WfRmU9TQ8I9PFx9Yc+EBHw+vSpIub4IDvQivcp26PtPrdMGAq5SDcpXEo/epqa/DXotVpekHiLNTg3iaKXBQ== | ||
|
@@ -841,7 +824,7 @@ | |
resolved "https://registry.npmjs.org/@types/strip-json-comments/-/strip-json-comments-0.0.30.tgz" | ||
integrity sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ== | ||
|
||
accepts@~1.3.4, accepts@~1.3.8: | ||
accepts@~1.3.8: | ||
version "1.3.8" | ||
resolved "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz" | ||
integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== | ||
|
@@ -882,11 +865,6 @@ balanced-match@^1.0.0: | |
resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" | ||
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== | ||
|
||
[email protected], base64id@~2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz" | ||
integrity sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog== | ||
|
||
binary-extensions@^2.0.0: | ||
version "2.2.0" | ||
resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz" | ||
|
@@ -1001,19 +979,6 @@ [email protected]: | |
resolved "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz" | ||
integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== | ||
|
||
cookie@~0.4.1: | ||
version "0.4.2" | ||
resolved "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz" | ||
integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA== | ||
|
||
cors@~2.8.5: | ||
version "2.8.5" | ||
resolved "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz" | ||
integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g== | ||
dependencies: | ||
object-assign "^4" | ||
vary "^1" | ||
|
||
create-require@^1.1.0: | ||
version "1.1.1" | ||
resolved "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz" | ||
|
@@ -1031,7 +996,7 @@ [email protected]: | |
dependencies: | ||
ms "2.0.0" | ||
|
||
debug@^4.1.0, debug@~4.3.1, debug@~4.3.2: | ||
debug@^4.1.0: | ||
version "4.3.4" | ||
resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" | ||
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== | ||
|
@@ -1084,27 +1049,6 @@ encodeurl@~1.0.2: | |
resolved "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz" | ||
integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== | ||
|
||
engine.io-parser@~5.2.1: | ||
version "5.2.1" | ||
resolved "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz" | ||
integrity sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ== | ||
|
||
engine.io@~6.5.2: | ||
version "6.5.4" | ||
resolved "https://registry.npmjs.org/engine.io/-/engine.io-6.5.4.tgz" | ||
integrity sha512-KdVSDKhVKyOi+r5uEabrDLZw2qXStVvCsEB/LN3mw4WFi6Gx50jTyuxYVCwAAC0U46FdnzP/ScKRBTXb/NiEOg== | ||
dependencies: | ||
"@types/cookie" "^0.4.1" | ||
"@types/cors" "^2.8.12" | ||
"@types/node" ">=10.0.0" | ||
accepts "~1.3.4" | ||
base64id "2.0.0" | ||
cookie "~0.4.1" | ||
cors "~2.8.5" | ||
debug "~4.3.1" | ||
engine.io-parser "~5.2.1" | ||
ws "~8.11.0" | ||
|
||
escape-html@~1.0.3: | ||
version "1.0.3" | ||
resolved "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz" | ||
|
@@ -1461,11 +1405,6 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: | |
resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" | ||
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== | ||
|
||
object-assign@^4: | ||
version "4.1.1" | ||
resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" | ||
integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== | ||
|
||
object-inspect@^1.9.0: | ||
version "1.13.1" | ||
resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz" | ||
|
@@ -1655,34 +1594,6 @@ [email protected]: | |
dependencies: | ||
ws "^8.8.1" | ||
|
||
socket.io-adapter@~2.5.2: | ||
version "2.5.2" | ||
resolved "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz" | ||
integrity sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA== | ||
dependencies: | ||
ws "~8.11.0" | ||
|
||
socket.io-parser@~4.2.4: | ||
version "4.2.4" | ||
resolved "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz" | ||
integrity sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew== | ||
dependencies: | ||
"@socket.io/component-emitter" "~3.1.0" | ||
debug "~4.3.1" | ||
|
||
socket.io@^4.6.1: | ||
version "4.7.2" | ||
resolved "https://registry.npmjs.org/socket.io/-/socket.io-4.7.2.tgz" | ||
integrity sha512-bvKVS29/I5fl2FGLNHuXlQaUH/BlzX1IN6S+NKLNZpBsPZIDH+90eQmCs2Railn4YUiww4SzUedJ6+uzwFnKLw== | ||
dependencies: | ||
accepts "~1.3.4" | ||
base64id "~2.0.0" | ||
cors "~2.8.5" | ||
debug "~4.3.2" | ||
engine.io "~6.5.2" | ||
socket.io-adapter "~2.5.2" | ||
socket.io-parser "~4.2.4" | ||
|
||
source-map-support@^0.5.12: | ||
version "0.5.21" | ||
resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz" | ||
|
@@ -1821,7 +1732,7 @@ v8-compile-cache-lib@^3.0.1: | |
resolved "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz" | ||
integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== | ||
|
||
vary@^1, vary@~1.1.2: | ||
vary@~1.1.2: | ||
version "1.1.2" | ||
resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz" | ||
integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== | ||
|
@@ -1846,11 +1757,6 @@ ws@^8.8.1: | |
resolved "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz" | ||
integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g== | ||
|
||
ws@~8.11.0: | ||
version "8.11.0" | ||
resolved "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz" | ||
integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg== | ||
|
||
xtend@^4.0.0: | ||
version "4.0.2" | ||
resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz" | ||
|