Skip to content

Commit

Permalink
✨ Use dao action schema v2 in web app (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
doitian authored Feb 18, 2024
1 parent 0fdd1f4 commit 2860ac1
Show file tree
Hide file tree
Showing 10 changed files with 634 additions and 363 deletions.
2 changes: 1 addition & 1 deletion src/actions/deposit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { payFee } from "@/lib/cobuild/fee-manager";
export default async function deposit(_prevState, formData, config) {
config = config ?? getConfig();

const from = formData.get("lock");
const from = formData.get("from");

try {
let buildingPacket = await depositDao(config)(formData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ import useHeaderByNumber from "@/hooks/use-header-by-number";
import useCell from "@/hooks/use-cell";

import Capacity from "@/components/capacity";
import {
DaoCycleProgress,
DaoCycleProgressHint,
daoCycleProgressColor,
} from "@/components/dao-cycle-progress";
import * as dao from "@/lib/dao";
import Loading from "./loading";
import SignForm from "../../../sign-form";
Expand Down
12 changes: 6 additions & 6 deletions src/app/u/[wallet]/[connection]/deposit/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ export function TransactionForm({ formAction, formState, address }) {
<Alert color="failure">{formState.error}</Alert>
) : null}
<div>
<Label htmlFor="lock" value="From" />
<TextInput id="lock" name="lock" value={address} readOnly required />
<Label htmlFor="from" value="From" />
<TextInput id="from" name="from" value={address} readOnly required />
</div>
<div>
<Label htmlFor="capacity" value="Amount (CKB)" />
<Label htmlFor="amount" value="Amount (CKB)" />
<TextInput
id="capacity"
name="capacity"
id="amount"
name="amount"
type="number"
placeholder="0.0"
step="0.00000001"
min="77"
min="78"
required
helperText={
<>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/cobuild/__tests__/lock-actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ test("witness args layout", () => {
],
outputsData: ["0x"],
witnesses: [
"0x6e010000100000006e0100006e0100005a0100003538dfd53ad93d2e0a6e7f470295dcd71057d825e1f87229e5afe2a906aa7cfc099fdfa04442dac33548b6988af8af58d2052529088f7b73ef00800f7fbcddb3a7c6fd8ee18669228e57013528909037b7ceeca29bd7d04c1632ccb5dd9d6ba2487047b723183f8fef8798b83e87f908a68bed18860067c68f08811f2474fef82b8b05e1f0303efb898fe4d6de601198c7a7b864abbe6a21c73b2e787e187c5205000000007b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a225a5749354e7a41334d5749324e475531593255775a574a6b4d3259304e6d55324d7a63324e446b794d47466c4e575933596a49774f544e6a4f54417a4d44466b4e6d4a6b5a475a685a6a5a6c5a6a55775a546b785a51222c226f726967696e223a2268747470733a2f2f746573746e65742e6a6f7969642e646576222c2263726f73734f726967696e223a66616c73657d",
"0xe801000010000000dc010000e8010000c8010000013538dfd53ad93d2e0a6e7f470295dcd71057d825e1f87229e5afe2a906aa7cfc099fdfa04442dac33548b6988af8af58d2052529088f7b73ef00800f7fbcddb3fc4d858bec973befa4649f52df30ae6df10e96bc0ee46ad9fb879b6a6800ca3eb9c3fb1e4424d0bca229592ec5529ea8c3b6c36e60c4c973391dc159dea157142b8b05e1f0303efb898fe4d6de601198c7a7b864abbe6a21c73b2e787e187c5205000000007b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a225a6a45334e6a55304f574a6b4e3245775a6a566a4f474978597a55774f5452694f57557a4e546c6d596a453259546c6c596a63334d544532597a49354e444d344f4749334d475132595468694e6a6b345a474e6a4e77222c226f726967696e223a2268747470733a2f2f746573746e65742e6a6f7969642e646576222c2263726f73734f726967696e223a66616c73652c226f746865725f6b6579735f63616e5f62655f61646465645f68657265223a22646f206e6f7420636f6d7061726520636c69656e74446174614a534f4e20616761696e737420612074656d706c6174652e205365652068747470733a2f2f676f6f2e676c2f796162506578227d080000000100000000000000",
],
};
const inputBuildingPacket = {
Expand Down Expand Up @@ -162,6 +162,6 @@ test("witness args layout", () => {
outputBuildingPacket.value.lockActions[0].data,
);
expect(lockAction.digest).toBe(
"0xb878fcba4398b284a80c0d752154e7920b0aefc6296b31af23dff069d18f3760",
"0x6ea7155a88702a920203821996a13b24c0a2c4f1e0a94e141ca46202324ab0eb",
);
});
Loading

0 comments on commit 2860ac1

Please sign in to comment.