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
5 changes: 0 additions & 5 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ export default [...compat.extends(
"no-case-declarations": "off",
quotes: "off",

"@/quotes": ["error", "single", {
avoidEscape: true,
allowTemplateLiterals: true,
}],

"prefer-rest-params": "off",
"no-bitwise": "off",
"no-console": "off",
Expand Down
3 changes: 2 additions & 1 deletion ts_src/psbt/psbtutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import * as bscript from '../script.js';
import { Transaction } from '../transaction.js';
import { hash160 } from '../crypto.js';
import * as payments from '../payments/index.js';
import type { PaymentCreator } from '../payments/index.js';
import * as tools from 'uint8array-tools';

/**
* Checks if a given payment factory can generate a payment script from a given script.
* @param payment The payment factory to check.
* @returns A function that takes a script and returns a boolean indicating whether the payment factory can generate a payment script from the script.
*/
function isPaymentFactory(payment: any): (script: Uint8Array) => boolean {
function isPaymentFactory(payment: PaymentCreator): (script: Uint8Array) => boolean {
return (script: Uint8Array): boolean => {
try {
payment({ output: script });
Expand Down
12 changes: 6 additions & 6 deletions ts_src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,25 @@ export interface Tapleaf {
}

export const TAPLEAF_VERSION_MASK = 0xfe;
export function isTapleaf(o: any): o is Tapleaf {
if (!o || !('output' in o)) return false;
export function isTapleaf(o: unknown): o is Tapleaf {
if (!o || typeof o !== 'object' || !('output' in o)) return false;
if (!(o.output instanceof Uint8Array)) return false;
if (o.version !== undefined)
return (o.version & TAPLEAF_VERSION_MASK) === o.version;
return true;
}

/**
* Binary tree repsenting script path spends for a Taproot input.
* Binary tree representing script path spends for a Taproot input.
* Each node is either a single Tapleaf, or a pair of Tapleaf | Taptree.
* The tree has no balancing requirements.
*/
export type Taptree = [Taptree | Tapleaf, Taptree | Tapleaf] | Tapleaf;

export function isTaptree(scriptTree: any): scriptTree is Taptree {
export function isTaptree(scriptTree: unknown): scriptTree is Taptree {
if (!Array.isArray(scriptTree)) return isTapleaf(scriptTree);
if (scriptTree.length !== 2) return false;
return scriptTree.every((t: any) => isTaptree(t));
return scriptTree.every((t: unknown) => isTaptree(t));
}

export interface TinySecp256k1Interface {
Expand Down Expand Up @@ -110,7 +110,7 @@ export const SatoshiSchema = v.pipe(
v.maxValue(0x7fff_ffff_ffff_ffffn),
);

export const NullablePartial = (a: Record<string, any>) =>
export const NullablePartial = (a: Record<string, unknown>) =>
v.object(
Object.entries(a).reduce(
(acc, next) => ({ ...acc, [next[0]]: v.nullish(next[1]) }),
Expand Down