mirror of
https://github.com/zhigang1992/liquid-stacking.git
synced 2026-01-12 17:23:23 +08:00
conflict fixed
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
"multisig-plan": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./scripts/create-multisig-deployment-plan.ts",
|
||||
"multisig-sign": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./scripts/sign-multisig-deployment-plan.ts",
|
||||
"multisig-broadcast": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./scripts/broadcast-multisig-deployment-plan.ts",
|
||||
"multisig-analyse": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./scripts/analyse-multisig-deployment-plan.ts",
|
||||
"get-keys": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./scripts/get-secret-pubkeys.ts",
|
||||
"setup:clarity": "./scripts/clarinet_manager.sh clean && ./scripts/clarinet_manager.sh install",
|
||||
"test": "vitest run",
|
||||
|
||||
28
scripts/analyse-multisig-deployment-plan.ts
Normal file
28
scripts/analyse-multisig-deployment-plan.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import {
|
||||
MultiSigSpendingCondition,
|
||||
StacksMessageType,
|
||||
deserializeTransaction,
|
||||
} from "@stacks/transactions";
|
||||
import { assertSigner, readPlan } from "./utils.ts";
|
||||
import { getStacksAddress, getStacksPubkeys } from "./config.ts";
|
||||
import { inspect } from "util";
|
||||
|
||||
const address = getStacksAddress();
|
||||
const pubkeys = getStacksPubkeys();
|
||||
|
||||
readPlan()
|
||||
.then(plan => plan.map(tx => deserializeTransaction(tx)))
|
||||
.then(plan => {
|
||||
console.log(`Plan contains ${plan.length} transactions`);
|
||||
plan.map(tx => {
|
||||
try {
|
||||
assertSigner(tx.auth.spendingCondition, address);
|
||||
}
|
||||
catch (error) {
|
||||
console.log(`Transaction with txid ${tx.txid()}, signer is invalid for currently set address`);
|
||||
}
|
||||
console.log(inspect(tx, { showHidden: false, depth: null, colors: true }));
|
||||
const missingSigs = pubkeys.length - (tx.auth.spendingCondition as MultiSigSpendingCondition).fields.reduce((sum, field) => sum + (field.contents.type === StacksMessageType.MessageSignature ? 1 : 0), 0);
|
||||
console.log(missingSigs === 0 ? 'Transaction is fully signed' : `Transaction needs ${missingSigs} signature(s)`);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user