Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Claim CLI Tool #69

Merged
merged 24 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added documentation/Claim_CLI/check_eligibility.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/Claim_CLI/cli_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/Claim_CLI/submit_a_claim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/Claim_CLI/submit_multisig.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions packages/claim-cli/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"require": ["ts-node/register"],
"watch-extensions": ["ts"],
"recursive": true,
"reporter": "spec",
"timeout": 60000
}
39 changes: 39 additions & 0 deletions packages/claim-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Claim CLI

This library is a tool to claim Lisk tokens without the need for UI. This tool can provide the following services:

- Check Eligibility
- Submit a Claim
- Publish a Multisig claim with completed signatures onchain

![cli_screenshot.png](../../documentation/Claim_CLI/cli_screenshot.png)

## Run

```
# Navigate to claim-cli package
cd packages/claim-cli

# Install dependencies
yarn && yarn build

# Start Claim CLI on mainnet
./bin/run.js start

# Or start Claim CLI on testnet
# ./bin/run.js start --network testnet
```

## Workflow

### Check Eligibility

![check_eligibility.png](../../documentation/Claim_CLI/check_eligibility.png)

### Submit a Claim

![img_2.png](../../documentation/Claim_CLI/submit_a_claim.png)

### Publish a Multisig claim with completed signatures onchain

![submit_multisig.png](../../documentation/Claim_CLI/submit_multisig.png)
3 changes: 3 additions & 0 deletions packages/claim-cli/bin/dev.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\dev" %*
6 changes: 6 additions & 0 deletions packages/claim-cli/bin/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env node_modules/.bin/ts-node
// eslint-disable-next-line node/shebang, unicorn/prefer-top-level-await
(async () => {
const oclif = await import('@oclif/core');
await oclif.execute({ development: true, dir: __dirname });
})();
3 changes: 3 additions & 0 deletions packages/claim-cli/bin/run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\run" %*
7 changes: 7 additions & 0 deletions packages/claim-cli/bin/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env node

// eslint-disable-next-line unicorn/prefer-top-level-await
(async () => {
const oclif = await import('@oclif/core');
await oclif.execute({ development: false, dir: __dirname });
})();
73 changes: 73 additions & 0 deletions packages/claim-cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"name": "@liskhq/claim-cli",
"version": "0.1.0",
"private": true,
"description": "CLI to claim process",
"author": "Lisk Foundation <[email protected]>, lightcurve GmbH <[email protected]>",
"license": "Apache-2.0",
"keywords": [
"blockchain",
"lisk"
],
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/LiskHQ/lisk-token-claim.git"
},
"bugs": {
"url": "https://github.com/LiskHQ/lisk-token-claim/issues"
},
"homepage": "https://github.com/LiskHQ/lisk-token-claim#readme",
"bin": {
"claim-cli": "./bin/run"
},
"engines": {
"node": ">=18.0.0"
},
"scripts": {
"build": "shx rm -rf dist tsconfig.tsbuildinfo && tsc -b",
"postpack": "shx rm -f oclif.manifest.json",
"prepack": "yarn build && oclif manifest && oclif readme",
"prepare": "yarn build",
"test": "mocha --forbid-only \"test/**/*.test.ts\""
},
"oclif": {
"bin": "claim-cli",
"dirname": "claim-cli",
"commands": {
"strategy": "single",
"target": "./dist/index.js"
},
"plugins": [
"@oclif/plugin-help"
]
},
"dependencies": {
"@inquirer/prompts": "^5.0.4",
"@liskhq/lisk-codec": "0.5.0",
"@liskhq/lisk-cryptography": "4.1.0",
"@liskhq/lisk-db": "0.3.10",
"@oclif/core": "^3.26.6",
"@oclif/plugin-help": "^6",
"@openzeppelin/merkle-tree": "^1.0.6",
"ethereumjs-util": "^7.1.5",
"ethers": "^6.8.1",
"inquirer": "^9.2.22",
"tweetnacl": "^1.0.3"
},
"devDependencies": {
"@oclif/prettier-config": "^0.2.1",
"@oclif/test": "^3.1.8",
"@types/chai": "^4",
"@types/inquirer": "^9.0.7",
"@types/mocha": "^9.0.0",
"@types/node": "^18",
"chai": "^4",
"mocha": "^10",
"oclif": "^4.10.5",
"shx": "^0.3.3",
"sinon": "^17.0.1",
"ts-node": "^10.9.2",
"typescript": "^5"
}
}
185 changes: 185 additions & 0 deletions packages/claim-cli/src/abi/IERC20.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
export default [
{
type: 'function',
name: 'allowance',
inputs: [
{
name: 'owner',
type: 'address',
internalType: 'address',
},
{
name: 'spender',
type: 'address',
internalType: 'address',
},
],
outputs: [
{
name: '',
type: 'uint256',
internalType: 'uint256',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'approve',
inputs: [
{
name: 'spender',
type: 'address',
internalType: 'address',
},
{
name: 'value',
type: 'uint256',
internalType: 'uint256',
},
],
outputs: [
{
name: '',
type: 'bool',
internalType: 'bool',
},
],
stateMutability: 'nonpayable',
},
{
type: 'function',
name: 'balanceOf',
inputs: [
{
name: 'account',
type: 'address',
internalType: 'address',
},
],
outputs: [
{
name: '',
type: 'uint256',
internalType: 'uint256',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'totalSupply',
inputs: [],
outputs: [
{
name: '',
type: 'uint256',
internalType: 'uint256',
},
],
stateMutability: 'view',
},
{
type: 'function',
name: 'transfer',
inputs: [
{
name: 'to',
type: 'address',
internalType: 'address',
},
{
name: 'value',
type: 'uint256',
internalType: 'uint256',
},
],
outputs: [
{
name: '',
type: 'bool',
internalType: 'bool',
},
],
stateMutability: 'nonpayable',
},
{
type: 'function',
name: 'transferFrom',
inputs: [
{
name: 'from',
type: 'address',
internalType: 'address',
},
{
name: 'to',
type: 'address',
internalType: 'address',
},
{
name: 'value',
type: 'uint256',
internalType: 'uint256',
},
],
outputs: [
{
name: '',
type: 'bool',
internalType: 'bool',
},
],
stateMutability: 'nonpayable',
},
{
type: 'event',
name: 'Approval',
inputs: [
{
name: 'owner',
type: 'address',
indexed: true,
internalType: 'address',
},
{
name: 'spender',
type: 'address',
indexed: true,
internalType: 'address',
},
{
name: 'value',
type: 'uint256',
indexed: false,
internalType: 'uint256',
},
],
anonymous: false,
},
{
type: 'event',
name: 'Transfer',
inputs: [
{
name: 'from',
type: 'address',
indexed: true,
internalType: 'address',
},
{
name: 'to',
type: 'address',
indexed: true,
internalType: 'address',
},
{
name: 'value',
type: 'uint256',
indexed: false,
internalType: 'uint256',
},
],
anonymous: false,
},
];
Loading
Loading