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

Multi-chain, multi-denom support for drip #2917

Merged
merged 27 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d6e50de
docs(drip): example usage
cor Sep 4, 2024
dcabfe0
refactor(drip): basis for multi-chain multi-denom faucet
cor Sep 4, 2024
1056f3d
refactor(drip): one thread per chain, prepare for multi-denom
cor Sep 4, 2024
6fdac0b
feat(drip): aggregated multi-denom multisend
cor Sep 5, 2024
1acf8fe
feat(drip): better multi-denom batches
cor Sep 5, 2024
228ae5a
fix(drip): refactor bugs
cor Sep 5, 2024
a833510
feat(drip): working multidrip
cor Sep 5, 2024
4190650
feat(drip): multi-chain config
cor Sep 5, 2024
22c4cdc
docs(drip): cleanup examples
cor Sep 5, 2024
c50f48a
chore(drip): fmt
cor Oct 18, 2024
18562b4
chore(drip): fmt
cor Oct 18, 2024
1520e88
fix(drip): cargo lock
cor Oct 18, 2024
f806304
chore(drip): cargo clippy
PoisonPhang Jan 24, 2025
dbb7c8d
chore(drip): address comments
PoisonPhang Jan 24, 2025
f623722
fix(drip): zero version until release
PoisonPhang Jan 24, 2025
ce53ea1
chore(drip): fmt
PoisonPhang Jan 24, 2025
986200b
fix(drip): use cometbft-rpc
PoisonPhang Jan 24, 2025
6ff1c1b
chore(app): test faucet with new mutations
PoisonPhang Jan 25, 2025
f55d7c7
fix(chain-utils): do not stringify tx hash
PoisonPhang Jan 27, 2025
edbe785
chore: update generated graphql env
PoisonPhang Jan 27, 2025
d56c665
fix(app): use correct structure for faucet res
PoisonPhang Jan 27, 2025
5bd309b
chore: remove dictionary.txt
PoisonPhang Jan 27, 2025
10ad2e1
chore: fmt
PoisonPhang Jan 27, 2025
020af12
chore(app): remove debug print
PoisonPhang Jan 27, 2025
bbf7020
chore(drip): use spans to capture chain id
PoisonPhang Jan 29, 2025
fbed376
chore: fmt
PoisonPhang Jan 29, 2025
07c701e
chore(drip): remove todo
PoisonPhang Jan 29, 2025
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
4 changes: 1 addition & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/src/generated/graphql-env.d.ts

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions app/src/generated/schema.graphql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions app/src/lib/graphql/queries/faucet.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { graphql } from "gql.tada"

export const faucetUnoMutation2 = graphql(/* GraphQL */ `
mutation FaucetUnoMutation2($address: String!, $captchaToken: String!) {
faucet2 {
send(toAddress: $address, captchaToken: $captchaToken)
}
mutation UnoFaucetMutation(
$chainId: String!,
$denom: String!,
$address: String!,
$captchaToken: String!
) {
send(
chainId: $chainId,
denom: $denom,
address: $address,
captchaToken: $captchaToken
)
}
`)

Expand Down
10 changes: 6 additions & 4 deletions app/src/routes/faucet/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,28 @@ const requestUnoFromFaucet = async () => {
if ($unoFaucetState.kind === "SUBMITTING") {
try {
const result = await request(URLS().GRAPHQL, faucetUnoMutation2, {
chainId: "union-testnet-9",
denom: "muno",
address,
captchaToken: $unoFaucetState.captchaToken
})
if (result.faucet2 === null) {
if (result.send === null) {
unoFaucetState.set({
kind: "RESULT_ERR",
error: "Empty faucet response"
})
return
}

if (result.faucet2.send.startsWith("ERROR")) {
console.error(result.faucet2.send)
if (result.send.startsWith("ERROR")) {
console.error(result.send)
unoFaucetState.set({ kind: "RESULT_ERR", error: `Error from faucet` })
return
}

unoFaucetState.set({
kind: "RESULT_OK",
message: result.faucet2.send
message: result.send
})
} catch (error) {
unoFaucetState.set({
Expand Down
4 changes: 2 additions & 2 deletions drip/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ workspace = true
chain-utils = { workspace = true }
chrono = { workspace = true, features = ["clock"] }
clap = { workspace = true, features = ["derive"] }
cometbft-rpc = { workspace = true }
prost = { workspace = true }
protos = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
tendermint-rpc = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter", "json"] }
Expand All @@ -28,7 +28,7 @@ unionlabs = { workspace = true }

async-graphql = "7.0.6"
async-graphql-axum = "7.0.6"
async-sqlite = "0.2.2"
async-sqlite = { version = "0.2.2", features = ["bundled", "array", "vtab"] }
axum = "0.7.5"
recaptcha-verify = "0.1.5"
subtle-encoding = { workspace = true, features = ["bech32-preview"] }
32 changes: 31 additions & 1 deletion drip/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Drip

Faucet for Cosmos chains: [app.union.build/faucet]
Faucet for Cosmos chains: [app.union.build/faucet]. Supports multiple chains and multiple denoms per chains.

## Example usage

Commands are ran from repo root

Tab 1, Union Devnet:

```sh
nix run .#devnet-union -L

```

Tab 2, Stargaze Devnet (optional, multi-chain demo):

```sh
nix run .#devnet-stargaze -L
```

Tab 3, Drip:

```sh
nix run .#drip -- -c ./drip/config.json
```

Tab 4, Request:

```sh
cat ./drip/example-requests/union-devnet.json | http POST localhost:8000
cat ./drip/example-requests/stargaze-devnet.json | http POST localhost:8000
```

[app.union.build/faucet]: https://app.union.build/faucet
56 changes: 43 additions & 13 deletions drip/config.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,48 @@
{
"ws_url": "ws://localhost:26657/websocket",
"grpc_url": "http://localhost:9090",
"gas_config": {
"gas_price": "1.0",
"gas_denom": "muno",
"gas_multiplier": "1.1",
"max_gas": 40000000
},
"log_format": "text",
"secret": "invalid",
"bypass_secret": "helloworld",
"signer": "0xaa820fa947beb242032a41b6dc9a8b9c37d8f5fbcda0966b1ec80335b10a7d6f",
"faucet_denom": "muno",
"log_format": "text",
"amount": 13370,
"max_request_polls": 7,
"memo": "drip drop"
"chains": [
{
"id": "union-devnet-1",
"bech32_prefix": "union",
"memo": "drip drop greetings from union faucet",
"ws_url": "ws://localhost:26657/websocket",
"grpc_url": "http://localhost:9090",
"gas_config": {
"gas_price": "1.0",
"gas_denom": "muno",
"gas_multiplier": "1.1",
"max_gas": 40000000
},
"signer": "0xaa820fa947beb242032a41b6dc9a8b9c37d8f5fbcda0966b1ec80335b10a7d6f",
"coins": [
{
"denom": "muno",
"amount": 13370
}
]
},
{
"id": "stargaze-devnet-1",
"bech32_prefix": "stars",
"memo": "drip drop greetings from union faucet on stargaze",
"ws_url": "ws://localhost:26757/websocket",
"grpc_url": "http://localhost:9190",
"gas_config": {
"gas_price": "1.0",
"gas_denom": "ustars",
"gas_multiplier": "1.1",
"max_gas": 40000000
},
"signer": "0xaa820fa947beb242032a41b6dc9a8b9c37d8f5fbcda0966b1ec80335b10a7d6f",
"coins": [
{
"denom": "ustars",
"amount": 13370
}
]
}
]
}
9 changes: 9 additions & 0 deletions drip/example-requests/stargaze-devnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"query": "mutation UnoFaucetMutation($chain_id: String!, $denom: String!, $address: String!, $captchaToken: String!) { send(chainId: $chain_id, denom: $denom, address: $address, captchaToken: $captchaToken) }",
"variables": {
"chain_id": "stargaze-devnet-1",
"denom": "ustars",
"address": "stars1yt66vjvy3dp3m2e49tffvxe7vwf6qrukkj8ax6",
"captchaToken": "helloworld"
}
}
9 changes: 9 additions & 0 deletions drip/example-requests/union-devnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"query": "mutation UnoFaucetMutation($chain_id: String!, $denom: String!, $address: String!, $captchaToken: String!) { send(chainId: $chain_id, denom: $denom, address: $address, captchaToken: $captchaToken) }",
"variables": {
"chain_id": "union-devnet-1",
"denom": "muno",
"address": "union1m87a5scxnnk83wfwapxlufzm58qe2v65985exff70z95a2yr86yq7hl08h",
"captchaToken": "helloworld"
}
}
Loading