-
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
0 parents
commit 4cfbb11
Showing
73 changed files
with
35,098 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.DS_Store | ||
node_modules | ||
|
||
.env* | ||
!.env.project | ||
!.env.vault | ||
|
||
config/local.js | ||
.tmp | ||
|
||
*~ | ||
*# | ||
.vscode | ||
.node_history | ||
dump.rdb | ||
|
||
npm-debug.log | ||
lib-cov | ||
*.seed | ||
*.log | ||
*.out | ||
*.pid |
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,11 @@ | ||
FROM node:20 | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json package-lock.json pnpm-lock.yaml ./ | ||
RUN npm install -g pnpm && pnpm install | ||
|
||
COPY . . | ||
|
||
EXPOSE 80 | ||
ENTRYPOINT [ "node", "app.js" ] |
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,23 @@ | ||
/** | ||
* Gruntfile | ||
* | ||
* This Node script is executed when you run `grunt`-- and also when | ||
* you run `sails lift` (provided the grunt hook is installed and | ||
* hasn't been disabled). | ||
* | ||
* WARNING: | ||
* Unless you know what you're doing, you shouldn't change this file. | ||
* Check out the `tasks/` directory instead. | ||
* | ||
* For more information see: | ||
* https://sailsjs.com/anatomy/Gruntfile.js | ||
*/ | ||
module.exports = function(grunt) { | ||
|
||
var loadGruntTasks = require('sails-hook-grunt/accessible/load-grunt-tasks'); | ||
|
||
// Load Grunt task configurations (from `tasks/config/`) and Grunt | ||
// task registrations (from `tasks/register/`). | ||
loadGruntTasks(__dirname, grunt); | ||
|
||
}; |
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,22 @@ | ||
(The MIT License) | ||
|
||
Copyright 2024 TBD | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,27 @@ | ||
# Chain-chomp | ||
|
||
![Chomp](chomp.png) | ||
Used under [CC License](https://creativecommons.org/licenses/by-nc-nd/3.0/) from [KarlWarrior47](https://www.deviantart.com/karlwarrior47/art/Just-a-chain-chomp-940153554). | ||
|
||
Chain-chomp is an HTTP server for interacting Spyre smart contracts. | ||
|
||
## Getting Started | ||
|
||
Run locally using either `docker-compose`: | ||
|
||
``` | ||
docker-compose up | ||
``` | ||
|
||
or `pnpm`: | ||
|
||
``` | ||
pnpm install | ||
pnpm run dev | ||
``` | ||
|
||
## Building | ||
|
||
Build a docker image with: | ||
|
||
`docker build -t chain-chomp .` |
Empty file.
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,26 @@ | ||
module.exports = { | ||
|
||
friendlyName: 'Check Stake', | ||
description: '', | ||
|
||
inputs: { | ||
stake: { | ||
type: {}, | ||
required: true, | ||
}, | ||
sig: { | ||
type: {}, | ||
required: true, | ||
}, | ||
}, | ||
|
||
exits: { | ||
// | ||
}, | ||
|
||
fn: async function ({ stake, sig, }) { | ||
const addr = await Web3Service.stakeSignedCheck({ stake, sig, }); | ||
|
||
return { success: true, addr, }; | ||
}, | ||
}; |
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,31 @@ | ||
module.exports = { | ||
|
||
friendlyName: 'Find Txn', | ||
|
||
description: 'Finds txns.', | ||
|
||
inputs: { | ||
// | ||
}, | ||
|
||
exits: { | ||
// | ||
}, | ||
|
||
fn: async function () { | ||
let txns; | ||
try { | ||
txns = await Txn.find({}).limit(10); | ||
} catch (error) { | ||
return { | ||
success: false, | ||
error: error.message, | ||
}; | ||
} | ||
|
||
return { | ||
success: true, | ||
txns, | ||
}; | ||
}, | ||
}; |
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,38 @@ | ||
module.exports = { | ||
|
||
friendlyName: 'Get USDC balance.', | ||
|
||
description: '', | ||
|
||
inputs: { | ||
coin: { | ||
type: 'string', | ||
required: true, | ||
}, | ||
addr: { | ||
type: 'string', | ||
required: true, | ||
}, | ||
}, | ||
|
||
exits: { | ||
// | ||
}, | ||
|
||
fn: async function ({ coin, addr, }) { | ||
let balance; | ||
try { | ||
balance = await Web3Service.getBalance({ coin, addr, }); | ||
} catch (err) { | ||
return { | ||
success: false, | ||
error: err.message, | ||
}; | ||
} | ||
|
||
return { | ||
success: true, | ||
balance: balance.toString(), | ||
}; | ||
}, | ||
}; |
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,36 @@ | ||
module.exports = { | ||
|
||
friendlyName: 'Get Nonce', | ||
|
||
description: 'Gets the hangman nonce for a wallet.', | ||
|
||
inputs: { | ||
addr: { | ||
type: 'string', | ||
required: true, | ||
}, | ||
}, | ||
|
||
exits: { | ||
// | ||
}, | ||
|
||
fn: async function ({ addr, }) { | ||
let nonce; | ||
try { | ||
nonce = await Web3Service.getNonce({ addr, }); | ||
} catch (error) { | ||
Logger.warn('Error getting nonce:', error); | ||
|
||
return { | ||
success: false, | ||
error: error.message, | ||
}; | ||
} | ||
|
||
return { | ||
success: true, | ||
nonce: nonce.toString(), | ||
}; | ||
}, | ||
}; |
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,41 @@ | ||
module.exports = { | ||
|
||
friendlyName: 'Get Txn', | ||
|
||
description: 'Retrieves a txn.', | ||
|
||
inputs: { | ||
txnId: { | ||
type: 'string', | ||
required: true, | ||
}, | ||
}, | ||
|
||
exits: { | ||
// | ||
}, | ||
|
||
fn: async function ({ txnId, }) { | ||
let txn; | ||
try { | ||
txn = await Txn.findOne({ id: txnId, }); | ||
} catch (error) { | ||
return { | ||
success: false, | ||
error: error.message, | ||
}; | ||
} | ||
|
||
if (!txn) { | ||
return { | ||
success: false, | ||
error: 'Txn not found.', | ||
}; | ||
} | ||
|
||
return { | ||
success: true, | ||
txn, | ||
}; | ||
}, | ||
}; |
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,34 @@ | ||
module.exports = { | ||
|
||
friendlyName: 'Get WithdrawAfter', | ||
|
||
description: 'Returns the withdrawAfter timestamp for an address.', | ||
|
||
inputs: { | ||
addr: { | ||
type: 'string', | ||
required: true, | ||
}, | ||
}, | ||
|
||
exits: { | ||
// | ||
}, | ||
|
||
fn: async function ({ addr, }) { | ||
let withdrawAfter; | ||
try { | ||
withdrawAfter = await Web3Service.getWithdrawAfter({ addr, }); | ||
} catch (err) { | ||
return { | ||
success: false, | ||
error: err.message, | ||
}; | ||
} | ||
|
||
return { | ||
success: true, | ||
withdrawAfter: withdrawAfter.toString(), | ||
}; | ||
}, | ||
}; |
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,18 @@ | ||
module.exports = { | ||
|
||
friendlyName: 'Healthcheck', | ||
|
||
description: 'Checks if the server is up and running.', | ||
|
||
inputs: { | ||
// | ||
}, | ||
|
||
exits: { | ||
// | ||
}, | ||
|
||
fn: async function () { | ||
return { success: true }; | ||
}, | ||
}; |
Oops, something went wrong.