Adapt to new schema
This commit is contained in:
parent
cb56a30a3f
commit
fca814c149
@ -43,11 +43,19 @@ export default function MultisigView() {
|
||||
"Pubkey on chain is not of type MultisigThreshold",
|
||||
);
|
||||
|
||||
await window.keplr.enable(chain.chainId);
|
||||
window.keplr.defaultOptions = {
|
||||
sign: { preferNoSetFee: true, preferNoSetMemo: true, disableBalanceCheck: true },
|
||||
};
|
||||
|
||||
const { bech32Address: address } = await window.keplr.getKey(chain.chainId);
|
||||
|
||||
await createMultisigFromCompressedSecp256k1Pubkeys(
|
||||
newHostedMultisig.accountOnChain.pubkey.value.pubkeys.map((p) => p.value),
|
||||
Number(newHostedMultisig.accountOnChain.pubkey.value.threshold),
|
||||
chain.addressPrefix,
|
||||
chain.chainId,
|
||||
address,
|
||||
);
|
||||
|
||||
router.reload();
|
||||
|
||||
@ -91,11 +91,19 @@ export default function CreateMultisigForm() {
|
||||
);
|
||||
|
||||
try {
|
||||
await window.keplr.enable(chain.chainId);
|
||||
window.keplr.defaultOptions = {
|
||||
sign: { preferNoSetFee: true, preferNoSetMemo: true, disableBalanceCheck: true },
|
||||
};
|
||||
|
||||
const { bech32Address: address } = await window.keplr.getKey(chain.chainId);
|
||||
|
||||
const multisigAddress = await createMultisigFromCompressedSecp256k1Pubkeys(
|
||||
pubkeys,
|
||||
Number(threshold),
|
||||
chain.addressPrefix,
|
||||
chain.chainId,
|
||||
address,
|
||||
);
|
||||
|
||||
router.push(`/${chain.registryName}/${multisigAddress}`);
|
||||
|
||||
@ -27,6 +27,7 @@ export const createMultisigFromCompressedSecp256k1Pubkeys = async (
|
||||
threshold: number,
|
||||
addressPrefix: string,
|
||||
chainId: string,
|
||||
creator: string,
|
||||
): Promise<string> => {
|
||||
const pubkeys = compressedPubkeys.map((compressedPubkey) => {
|
||||
return {
|
||||
@ -41,6 +42,7 @@ export const createMultisigFromCompressedSecp256k1Pubkeys = async (
|
||||
const multisig = {
|
||||
address: multisigAddress,
|
||||
pubkeyJSON: JSON.stringify(multisigPubkey),
|
||||
creator,
|
||||
chainId,
|
||||
};
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { createMultisig } from "@/lib/graphqlHelpers";
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { createMultisig } from "../../../../../lib/graphqlHelpers";
|
||||
|
||||
export default async function multisigApi(req: NextApiRequest, res: NextApiResponse) {
|
||||
switch (req.method) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { createTransaction } from "../../../lib/graphqlHelpers";
|
||||
import { createTransaction, getMultisigId } from "../../../lib/graphqlHelpers";
|
||||
|
||||
export default async function transactionApi(req: NextApiRequest, res: NextApiResponse) {
|
||||
switch (req.method) {
|
||||
@ -7,7 +7,13 @@ export default async function transactionApi(req: NextApiRequest, res: NextApiRe
|
||||
try {
|
||||
const data = req.body;
|
||||
console.log("Function `createTransaction` invoked", data);
|
||||
const createTransactionResult = await createTransaction(data.dataJSON);
|
||||
|
||||
const multisigId = await getMultisigId(data.creator, data.chainId);
|
||||
if (!multisigId) {
|
||||
throw new Error("Multisig not found");
|
||||
}
|
||||
|
||||
const createTransactionResult = await createTransaction(data.dataJSON, multisigId);
|
||||
console.log("createTransactionResult:", createTransactionResult);
|
||||
res
|
||||
.status(200)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user