Skip to content

Documentation / @cashconnect-js/core / primitives/utxo

OutputWithoutTokens ​

ts
type OutputWithoutTokens = Omit<Output, "token">;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:38


OutputWithTokens ​

ts
type OutputWithTokens = Output & object;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:39

Type Declaration ​

NameTypeDefined in
tokenRequired<Output["token"]>cashconnect-js/packages/core/src/primitives/utxo.ts:39

TokenBalances ​

ts
type TokenBalances = object;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:144

Index Signature ​

ts
[categoryId: string]: bigint

Outpoint ​

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:12

Constructors ​

Constructor ​

ts
new Outpoint(outpointTransactionHash, outpointIndex): Outpoint;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:13

Parameters ​
ParameterType
outpointTransactionHashUint8Array
outpointIndexnumber
Returns ​

Outpoint

Methods ​

fromString() ​

ts
static fromString(outpointHashAndIndex): Outpoint;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:17

Parameters ​
ParameterType
outpointHashAndIndexstring
Returns ​

Outpoint

fromInput() ​

ts
static fromInput(input): Outpoint;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:22

Parameters ​
ParameterType
inputPick<Input, "outpointTransactionHash" | "outpointIndex">
Returns ​

Outpoint

toId() ​

ts
toId(): string;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:28

Returns ​

string

toString() ​

ts
toString(): string;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:33

Returns ​

string

Properties ​

PropertyModifierTypeDefined in
outpointTransactionHashpublicUint8Arraycashconnect-js/packages/core/src/primitives/utxo.ts:14
outpointIndexpublicnumbercashconnect-js/packages/core/src/primitives/utxo.ts:15

UTXO ​

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:41

Type Parameters ​

Type ParameterDefault type
T extends OutputOutput

Constructors ​

Constructor ​

ts
new UTXO<T>(outpoint, output): UTXO<T>;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:42

Parameters ​
ParameterType
outpointOutpoint
outputT
Returns ​

UTXO<T>

Methods ​

from() ​

ts
static from(outpoint, output): UTXO<Output>;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:44

Parameters ​
ParameterType
outpointOutpoint
outputOutput
Returns ​

UTXO<Output>

flatten() ​

ts
flatten(): object & T;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:48

Returns ​

object & T

Properties ​

PropertyModifierTypeDefined in
outpointpublicOutpointcashconnect-js/packages/core/src/primitives/utxo.ts:42
outputpublicTcashconnect-js/packages/core/src/primitives/utxo.ts:42

UTXOs ​

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:56

Extends ​

Type Parameters ​

Type ParameterDefault type
T extends OutputOutput

Constructors ​

Constructor ​

ts
new UTXOs<T>(entries?): UTXOs<T>;

Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:50

Parameters ​
ParameterType
entries?| readonly readonly [PropertyKey, UTXO<T>][] | null
Returns ​

UTXOs<T>

Inherited from ​

ExtMap.constructor

Constructor ​

ts
new UTXOs<T>(iterable?): UTXOs<T>;

Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:49

Parameters ​
ParameterType
iterable?| Iterable<readonly [PropertyKey, UTXO<T>], any, any> | null
Returns ​

UTXOs<T>

Inherited from ​

ExtMap.constructor

Methods ​

fromTransactions() ​

ts
static fromTransactions(transactions): UTXOs<Output>;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:57

Parameters ​
ParameterType
transactionsTransaction[]
Returns ​

UTXOs<Output>

fromArray() ​

ts
static fromArray<T, K>(array, keySelector): ExtMap<T>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:52

Creates a new ExtMap from an array using a key selector

Type Parameters ​
Type Parameter
T
K extends PropertyKey
Parameters ​
ParameterType
arrayreadonly T[]
keySelector(item) => K
Returns ​

ExtMap<T>

Inherited from ​

ExtMap.fromArray

fromObject() ​

ts
static fromObject<T>(object): ExtMap<T>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:64

Type Parameters ​
Type Parameter
T
Parameters ​
ParameterType
object{ [key: string | number | symbol]: T; }
Returns ​

ExtMap<T>

Inherited from ​

ExtMap.fromObject

flatten() ​

ts
static flatten<T>(collections): ExtMap<T>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:76

Flattens an array of ExtMaps into a single ExtMap Last collection's values take precedence for duplicate keys

Type Parameters ​
Type Parameter
T
Parameters ​
ParameterType
collectionsExtMap<T>[]
Returns ​

ExtMap<T>

Inherited from ​

ExtMap.flatten

groupBy() ​

ts
static groupBy<K, T>(items, keySelector): Map<K, T[]>;

Defined in: site/node_modules/typescript/lib/lib.es2024.collection.d.ts:25

Groups members of an iterable according to the return value of the passed callback.

Type Parameters ​
Type Parameter
K
T
Parameters ​
ParameterTypeDescription
itemsIterable<T>An iterable.
keySelector(item, index) => KA callback which will be invoked for each item in items.
Returns ​

Map<K, T[]>

Inherited from ​

ExtMap.groupBy

calculateTotalSats() ​

ts
calculateTotalSats(): bigint;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:95

Returns ​

bigint

calculateTotalTokens() ​

ts
calculateTotalTokens(): TokenBalances;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:102

Returns ​

TokenBalances

getOrFail() ​

ts
getOrFail(key): UTXO;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:88

Parameters ​
ParameterType
keystring
Returns ​

UTXO

Inherited from ​

ExtMap.getOrFail

filter() ​

ts
filter(predicate): ExtMap<UTXO<T>>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:101

Returns a new ExtMap with filtered entries

Parameters ​
ParameterType
predicate(value, key) => boolean
Returns ​

ExtMap<UTXO<T>>

Inherited from ​

ExtMap.filter

map() ​

ts
map<U>(mapper): ExtMap<U>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:114

Returns a new ExtMap with mapped values

Type Parameters ​
Type Parameter
U
Parameters ​
ParameterType
mapper(value, key) => U
Returns ​

ExtMap<U>

Inherited from ​

ExtMap.map

sort() ​

ts
sort(comparator): ExtMap<UTXO<T>>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:127

Returns a new ExtMap with entries sorted by the given comparator

Parameters ​
ParameterTypeDescription
comparator(a, b) => numberFunction to determine the sort order
Returns ​

ExtMap<UTXO<T>>

A new ExtMap with sorted entries

Inherited from ​

ExtMap.sort

slice() ​

ts
slice(start, end?): ExtMap<UTXO<T>>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:146

Returns a new ExtMap containing a subset of entries from the original Map

Parameters ​
ParameterTypeDescription
startnumberThe starting index (inclusive)
end?numberThe ending index (exclusive)
Returns ​

ExtMap<UTXO<T>>

A new ExtMap with the sliced entries

Inherited from ​

ExtMap.slice

toObject() ​

ts
toObject(): Record<PropertyKey, T>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:161

Converts the collection to a plain object

Returns ​

Record<PropertyKey, T>

Inherited from ​

ExtMap.toObject

toArray() ​

ts
toArray(): UTXO<T>[];

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:168

Converts the collection to an array of values

Returns ​

UTXO<T>[]

Inherited from ​

ExtMap.toArray

toSet() ​

ts
toSet<U>(callback?): Set<U>;

Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:177

Converts the collection to a Set

Type Parameters ​
Type ParameterDefault type
UPropertyKey
Parameters ​
ParameterTypeDescription
callback?(key, value) => UOptional function to transform keys before adding to Set
Returns ​

Set<U>

A Set containing either the keys or transformed values

Inherited from ​

ExtMap.toSet

clear() ​

ts
clear(): void;

Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:20

Returns ​

void

Inherited from ​

ExtMap.clear

delete() ​

ts
delete(key): boolean;

Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:24

Parameters ​
ParameterType
keyPropertyKey
Returns ​

boolean

true if an element in the Map existed and has been removed, or false if the element does not exist.

Inherited from ​

ExtMap.delete

forEach() ​

ts
forEach(callbackfn, thisArg?): void;

Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:28

Executes a provided function once per each key/value pair in the Map, in insertion order.

Parameters ​
ParameterType
callbackfn(value, key, map) => void
thisArg?any
Returns ​

void

Inherited from ​

ExtMap.forEach

get() ​

ts
get(key): UTXO<T> | undefined;

Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:33

Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.

Parameters ​
ParameterType
keyPropertyKey
Returns ​

UTXO<T> | undefined

Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.

Inherited from ​

ExtMap.get

has() ​

ts
has(key): boolean;

Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:37

Parameters ​
ParameterType
keyPropertyKey
Returns ​

boolean

boolean indicating whether an element with the specified key exists or not.

Inherited from ​

ExtMap.has

set() ​

ts
set(key, value): this;

Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:41

Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.

Parameters ​
ParameterType
keyPropertyKey
valueUTXO
Returns ​

this

Inherited from ​

ExtMap.set

entries() ​

ts
entries(): MapIterator<[PropertyKey, UTXO<T>]>;

Defined in: site/node_modules/typescript/lib/lib.es2015.iterable.d.ts:148

Returns an iterable of key, value pairs for every entry in the map.

Returns ​

MapIterator<[PropertyKey, UTXO<T>]>

Inherited from ​

ExtMap.entries

keys() ​

ts
keys(): MapIterator<PropertyKey>;

Defined in: site/node_modules/typescript/lib/lib.es2015.iterable.d.ts:153

Returns an iterable of keys in the map

Returns ​

MapIterator<PropertyKey>

Inherited from ​

ExtMap.keys

values() ​

ts
values(): MapIterator<UTXO<T>>;

Defined in: site/node_modules/typescript/lib/lib.es2015.iterable.d.ts:158

Returns an iterable of values in the map

Returns ​

MapIterator<UTXO<T>>

Inherited from ​

ExtMap.values

[iterator]() ​

ts
iterator: MapIterator<[PropertyKey, UTXO<T>]>;

Defined in: site/node_modules/typescript/lib/lib.es2015.iterable.d.ts:143

Returns an iterable of entries in the map.

Returns ​

MapIterator<[PropertyKey, UTXO<T>]>

Inherited from ​

ExtMap.[iterator]

Properties ​

PropertyModifierTypeInherited fromDefined in
[species]readonlyMapConstructorExtMap.[species]site/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:319
sizereadonlynumberExtMap.sizesite/node_modules/typescript/lib/lib.es2015.collection.d.ts:45
[toStringTag]readonlystringExtMap.[toStringTag]site/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:137

calculateBalanceSats() ​

ts
function calculateBalanceSats(unspents): bigint;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:137

Parameters ​

ParameterType
unspentsUTXO<Output>[]

Returns ​

bigint


calculateBalanceTokens() ​

ts
function calculateBalanceTokens(unspents): TokenBalances;

Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:146

Parameters ​

ParameterType
unspentsUTXO<Output>[]

Returns ​

TokenBalances