Skip to content
Merged
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
3 changes: 2 additions & 1 deletion modules/abstract-utxo/src/descriptor/descriptorWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import * as t from 'io-ts';
import { IWallet, WalletCoinSpecific } from '@bitgo/sdk-core';

import { UtxoWallet, UtxoWalletData } from '../wallet';
import type { DescriptorMap } from '../wasmUtil';

import { NamedDescriptor } from './NamedDescriptor';
import { DescriptorValidationPolicy, KeyTriple, toDescriptorMapValidate } from './validatePolicy';

import type { DescriptorMap } from './index';

type DescriptorWalletCoinSpecific = {
descriptors: NamedDescriptor[];
};
Expand Down
4 changes: 3 additions & 1 deletion modules/abstract-utxo/src/descriptor/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { descriptorWallet } from '@bitgo/wasm-utxo';

export { Miniscript, Descriptor } from '@bitgo/wasm-utxo';
export type { DescriptorMap } from '../wasmUtil';
export type DescriptorMap = descriptorWallet.DescriptorMap;
export { assertDescriptorWalletAddress } from './assertDescriptorWalletAddress';
export {
NamedDescriptor,
Expand Down
4 changes: 2 additions & 2 deletions modules/abstract-utxo/src/descriptor/validatePolicy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { EnvironmentName, Triple } from '@bitgo/sdk-core';
import { bip32, descriptorWallet } from '@bitgo/wasm-utxo';

import type { DescriptorMap } from '../wasmUtil';

import { parseDescriptor } from './builder';
import { hasValidSignature, NamedDescriptor, NamedDescriptorNative, toNamedDescriptorNative } from './NamedDescriptor';

import type { DescriptorMap } from './index';

export type KeyTriple = Triple<bip32.BIP32Interface>;

export interface DescriptorValidationPolicy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { Psbt, descriptorWallet } from '@bitgo/wasm-utxo';

import type { TransactionExplanationDescriptor } from '../fixedScript/explainTransaction';
import { UtxoCoinName } from '../../names';
import { sumValues } from '../../wasmUtil';

function sumValues(arr: { value: bigint }[]): bigint {
return arr.reduce((sum, e) => sum + e.value, 0n);
}

function toRecipient(output: descriptorWallet.ParsedOutput, coinName: UtxoCoinName): ITransactionRecipient {
const address = output.address ?? `scriptPubKey:${Buffer.from(output.script).toString('hex')}`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type { DescriptorMap } from '../../wasmUtil';
export type { DescriptorMap } from '../../descriptor';
export { explainPsbt } from './explainPsbt';
export { parse } from './parse';
export { parseToAmountType } from './parseToAmountType';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Psbt, descriptorWallet } from '@bitgo/wasm-utxo';

import type { SignerKey } from '../../wasmUtil';
type SignerKey = Parameters<typeof descriptorWallet.signWithKey>[1];

export class ErrorUnknownInput extends Error {
constructor(public vin: number) {
Expand Down
Loading