Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@
A few examples using `fundjs` and `fundjs-react`.

The examples require a local DevNet to be running. This repo includes a script for quickly
starting and running a DevNet
starting and running a DevNet.

## Compatibility

| Examples branch | fundjs | fundjs-react | cosmjs | Mainchain |
|---|---|---|---|---|
| `dev` (current) | `^0.2.0` | `^0.2.0` | `^0.38.0` | `8-vaxildan` upgrade + later (SDK v0.54.3 / IBC-go v11 / CometBFT v0.39) |
| `main` historical | `^0.1.0` | `^0.1.0` | `^0.32.4` | up to `7-taryon` (SDK v0.50 era) |

The `^0.2.0` bump aligns with the vaxildan-era stream-key widening: `MsgClaimStream` / `MsgCancelStream` / `MsgUpdateFlowRate` and the `streamByReceiverSender` query all now require a `denom` field to disambiguate which stream within a `(sender, receiver)` pair to act on. Examples updated to pass `denom: 'nund'` (the Unification chain's base denom). The `devnet.sh` script auto-resolves the latest released `und` binary via the GitHub API — no hardcoded version change needed; once vaxildan releases, the DevNet picks it up automatically.

## DevNet

Expand Down
4 changes: 4 additions & 0 deletions examples/react/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Dockerfile
.next
node_modules
.env
27 changes: 27 additions & 0 deletions examples/react/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM node:18.20-alpine AS builder

USER node

WORKDIR /home/node/app

COPY --chown=node . .

ENV NEXT_PUBLIC_CHAIN_LIST=unification,unificationtestnet
ENV NEXT_PUBLIC_DEFAULT_CHAIN=unification

RUN yarn install --frozen-lockfile --production && yarn add sharp && yarn build

FROM node:18.20-alpine

USER node

WORKDIR /home/node/app

COPY --from=builder --chown=node /home/node/app/node_modules ./node_modules
COPY --from=builder --chown=node /home/node/app/.next ./.next
COPY --from=builder --chown=node /home/node/app/public ./public
COPY --from=builder --chown=node /home/node/app/package.json .

EXPOSE 3000

CMD [ "yarn", "start" ]
4 changes: 4 additions & 0 deletions examples/react/hooks/useCancelStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ export function useCancelSteam(chainName: string) {
return;
}

// `denom` field required from fundjs-react@^0.2.0 (vaxildan Stage 5b
// multi-denom stream key). For Unification chains this is the chain's
// base denom (typically `nund`).
const msg = MessageComposer.withTypeUrl.cancelStream({
receiver,
sender: address,
denom: chainCoin.base,
});

const fee: StdFee = {
Expand Down
5 changes: 5 additions & 0 deletions examples/react/hooks/useClaimStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ export function useClaimStream(chainName: string) {
return;
}

// The `denom` field on stream Msgs is required from fundjs-react@^0.2.0
// (vaxildan Stage 5b — chain stores streams under the
// (sender, receiver, denom) triple). For Unification chains the base
// denom is `chainCoin.base` (typically `nund`).
const msg = MessageComposer.withTypeUrl.claimStream({
sender,
receiver: address,
denom: chainCoin.base,
});

const fee: StdFee = {
Expand Down
4 changes: 4 additions & 0 deletions examples/react/hooks/useUpdateFlowRate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ export function useUpdateFlowRate(chainName: string) {
}: OnUpdateFlowRateOptions) {
if (!address) return;

// `denom` field required from fundjs-react@^0.2.0 (vaxildan Stage 5b
// multi-denom stream key). For Unification chains this is the chain's
// base denom (typically `nund`).
const msg = MessageComposer.withTypeUrl.updateFlowRate({
receiver,
sender: address,
flowRate: BigInt(flowRate),
denom: chainCoin.base,
});

const fee: StdFee = {
Expand Down
8 changes: 4 additions & 4 deletions examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
},
"dependencies": {
"@chain-registry/types": "0.45.65",
"@cosmjs/cosmwasm-stargate": "0.31.3",
"@cosmjs/stargate": "0.32.4",
"@cosmjs/cosmwasm-stargate": "^0.38.0",
"@cosmjs/stargate": "^0.38.0",
"@cosmos-kit/react": "2.17.0",
"@emotion/react": "11.10.6",
"@emotion/styled": "11.10.6",
"@interchain-ui/react": "1.24.0",
"@interchain-ui/react-no-ssr": "^0.1.9",
"@tanstack/react-query": "4.32.0",
"@unification-com/fundjs-react": "^0.1.0",
"@unification-com/fundjs-react": "^0.2.0",
"bignumber.js": "^9.1.1",
"chain-registry": "^1.64.4",
"cosmos-kit": "2.18.0",
Expand All @@ -44,4 +44,4 @@
"eslint-config-next": "13.0.5",
"typescript": "^5.1.6"
}
}
}
Loading