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

Patch 1 #11

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a8d5289
add multi chain support
liangping Feb 21, 2023
be802c3
fix some issues
liangping Feb 21, 2023
ad527fa
set max width of logo
liangping Feb 21, 2023
7d56070
remove typo
liangping Feb 21, 2023
468fd89
display balance of faucet
liangping Feb 21, 2023
04775e3
合并EVMOS TX
liangping Feb 23, 2023
c053a9a
update config
liangping Feb 23, 2023
7d09c1f
fix the uptick chain2 facuet bugs
uptSmart Feb 27, 2023
4ce92a7
Merge pull request #2 from uptSmart/multi-chains
liangping Feb 27, 2023
9f73461
fixed upticks
liangping Feb 27, 2023
058ef7d
fix the balance show bug for uptick
uptSmart Feb 27, 2023
d46b0e1
Merge pull request #3 from uptSmart/multi-chains
liangping Feb 28, 2023
0cac916
add catch
liangping Mar 3, 2023
d0dc486
add exception catch
liangping Mar 6, 2023
8aa3726
catch error
liangping Mar 8, 2023
8cd43ff
add 0x address
liangping Mar 12, 2023
24367cb
add 0x address
liangping Mar 12, 2023
f389531
fix: fix -invalid string. Length must be a multiple of 4- error
mennatnaga Jul 4, 2023
bf09f88
Merge pull request #5 from mennatabuelnaga/multi-chains
liangping Jul 5, 2023
5c8c322
Update config.js
liangping Jul 30, 2023
23eaeed
Update config.js
liangping Jul 30, 2023
c25cc1f
edit ethermit
liangping Jul 31, 2023
bd6e00c
Merge branch 'multi-chains' of github.co
liangping Jul 31, 2023
6cd90a2
Merge remote-tracking branch 'sideprotocol/multi-chains' into multi-c…
liangping Jul 31, 2023
d9aa8e8
update balance query
liangping Jul 31, 2023
5d74438
fix: remove }
lesterli Aug 3, 2023
55313ed
Merge pull request #6 from octopus-network/multi-chains
liangping Aug 4, 2023
dcf37ea
Merge branch 'multi-chains' of github.com:ping-pub/faucet into multi-…
liangping Aug 4, 2023
0f159cb
support eth_secp256k1
lesterli Aug 5, 2023
4afb684
Merge pull request #7 from octopus-network/multi-chains
liangping Aug 5, 2023
c426431
Create FUNDING.yml
liangping Nov 28, 2023
cebfd6f
Merge branch 'multi-chains' of github.com:ping-pub/faucet into multi-…
liangping Jan 26, 2024
62d6d2f
add render and save
Jan 30, 2024
1a7392d
add template
liangping Jan 30, 2024
804405b
fix issue
liangping Jan 30, 2024
1a43bce
remove console
liangping Jan 30, 2024
b0f86cd
use 24 words list
liangping Jan 31, 2024
1478f3f
improve client ip when use cloudflare
liangping Feb 24, 2024
0208097
Create vercel.json
0xmtnslk Aug 5, 2024
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
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: ping-pub
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/node_modules
/web.js
/db
/db
.idea
.faucet
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@buf:registry=https://buf.build/gen/npm/v1
3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
npmScopes:
buf:
npmRegistryServer: "https://buf.build/gen/npm/v1"
10 changes: 6 additions & 4 deletions checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ export class FrequencyChecker {
})
}

async checkIp(ip) {
return this.check(ip, this.conf.limit.ip)
async checkIp(ip, chain) {
const chainLimit = this.conf.blockchains.find(x => x.name === chain)
return chainLimit ? this.check(ip, chainLimit.limit.ip ) : Promise.resolve(false)
}

async checkAddress(address) {
return this.check(address, this.conf.limit.address)
async checkAddress(address, chain) {
const chainLimit = this.conf.blockchains.find(x => x.name === chain)
return chainLimit ? this.check(address, chainLimit.limit.address ) : Promise.resolve(false)
}

async update(key) {
Expand Down
189 changes: 151 additions & 38 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,162 @@

import { stringToPath } from '@cosmjs/crypto'
import fs from 'fs'
// import { ethers } from 'ethers'
import { Wallet, utils } from 'ethers';

const HOME = ".faucet";
const mnemonic_path= `${HOME}/mnemonic.txt`
if (!fs.existsSync(mnemonic_path)) {
fs.mkdirSync(HOME, { recursive: true })
fs.writeFileSync(mnemonic_path, Wallet.fromMnemonic(
utils.entropyToMnemonic(utils.randomBytes(32))
).mnemonic.phrase)
}

const mnemonic = fs.readFileSync(mnemonic_path, 'utf8')
console.log("======================== faucet mnemonic =========================")
console.log(mnemonic)
console.log("==================================================================")

export default {
port: 80, // http port
port: 8088, // http port
db: {
path: "./db/faucet.db" // save request states
path: `${HOME}/history.db` // save request states
},
project: {
name: "Ping Testnet",
logo: "https://ping.pub/logo.svg",
deployer: `<a href="#">Your Brand</a>`
},
blockchain: {
// make sure that CORS is enabled in rpc section in config.toml
// cors_allowed_origins = ["*"]
rpc_endpoint: "https://rpc.sentry-02.theta-testnet.polypore.xyz",

},
sender: {
mnemonic: "surround miss nominee dream gap cross assault thank captain prosper drop duty group candy wealth weather scale put",
option: {
hdPaths: [stringToPath("m/44'/118'/0'/0/0")],
prefix: "cosmos"
}
name: "Demo of Side Exchange",
logo: "https://side.one/favicon.ico",
deployer: `<a href="https://demo.side.exchange">Side Exchange</a>`
},
tx: {
amount: {
denom: "uatom",
amount: "10000"
blockchains: [
{
name: "rigi-kent",
endpoint: {
// make sure that CORS is enabled in rpc section in config.toml
// cors_allowed_origins = ["*"]
rpc_endpoint: " https://testnet-rpc.side.one",
},
sender: {
mnemonic,
option: {
hdPaths: [stringToPath("m/44'/118'/0'/0/0")],
prefix: "side" // human readable address prefix
}
},
tx: {
amount: [
{
denom: "ukent",
amount: "1000000000"
},
{
denom: "uatom",
amount: "10000000000"
},
],
fee: {
amount: [
{
amount: "5000",
denom: "ukent"
}
],
gas: "200000"
},
},
limit: {
// how many times each wallet address is allowed in a window(24h)
address: 1,
// how many times each ip is allowed in a window(24h),
// if you use proxy, double check if the req.ip is return client's ip.
ip: 10
}
},
fee: {
amount: [
{
amount: "1000",
denom: "uatom"
{
type: 'Ethermint',
ids: {
chainId: 1818,
cosmosChainId: 'sidechain_1818-1',
},
name: "Proxima",
endpoint: {
// make sure that CORS is enabled in rpc section in config.toml
// cors_allowed_origins = ["*"]
rpc_endpoint: "https://proxima-rpc.side.exchange",
evm_endpoint: "http://13.229.237.39:8545/",
},
sender: {
mnemonic,
option: {
hdPaths: [stringToPath("m/44'/60")],
prefix: "prox"
}
],
gas: "200000"
},
tx: {
amount: {
denom: "aprox",
amount: "5000000000000000000"
},
fee: {
amount: [
{
amount: "100000",
denom: "aprox"
}
],
gas: "10000000000000"
},
},
limit: {
// how many times each wallet address is allowed in a window(24h)
address: 1,
// how many times each ip is allowed in a window(24h),
// if you use proxy, double check if the req.ip is return client's ip.
ip: 10
}
},
},
limit: {
// how many times each wallet address is allowed in a window(24h)
address: 1,
// how many times each ip is allowed in a window(24h),
// if you use proxy, double check if the req.ip is return client's ip.
ip: 10
}
}
{
type: 'Ethermint',
ids: {
chainId: 1819,
cosmosChainId: 'sidechain_1819-1',
},
name: "Toliman",
endpoint: {
// make sure that CORS is enabled in rpc section in config.toml
// cors_allowed_origins = ["*"]
rpc_endpoint: "https://toliman-rpc.side.exchange",
evm_endpoint: "http://52.77.209.10:8545/",
},
sender: {
mnemonic,
option: {
hdPaths: [stringToPath("m/44'/60/0'/0/0")],
prefix: "toli"
}
},
tx: {
amount: {
denom: "atoli",
amount: "5000000000000000000"
},
fee: {
amount: [
{
amount: "100000",
denom: "atoli"
}
],
gas: "10000000000000"
},
},
limit: {
// how many times each wallet address is allowed in a window(24h)
address: 1,
// how many times each ip is allowed in a window(24h),
// if you use proxy, double check if the req.ip is return client's ip.
ip: 10
}
},
]
}
Loading