Documentation / @cashconnect-js/core / primitives/utxo
OutputWithoutTokens
type OutputWithoutTokens = Omit<Output, "token">;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:38
OutputWithTokens
type OutputWithTokens = Output & object;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:39
Type Declaration
| Name | Type | Defined in |
|---|---|---|
token | Required<Output["token"]> | cashconnect-js/packages/core/src/primitives/utxo.ts:39 |
TokenBalances
type TokenBalances = object;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:144
Index Signature
[categoryId: string]: bigintOutpoint
Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:12
Constructors
Constructor
new Outpoint(outpointTransactionHash, outpointIndex): Outpoint;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:13
Parameters
| Parameter | Type |
|---|---|
outpointTransactionHash | Uint8Array |
outpointIndex | number |
Returns
Methods
fromString()
static fromString(outpointHashAndIndex): Outpoint;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:17
Parameters
| Parameter | Type |
|---|---|
outpointHashAndIndex | string |
Returns
fromInput()
static fromInput(input): Outpoint;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:22
Parameters
| Parameter | Type |
|---|---|
input | Pick<Input, "outpointTransactionHash" | "outpointIndex"> |
Returns
toId()
toId(): string;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:28
Returns
string
toString()
toString(): string;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:33
Returns
string
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
outpointTransactionHash | public | Uint8Array | cashconnect-js/packages/core/src/primitives/utxo.ts:14 |
outpointIndex | public | number | cashconnect-js/packages/core/src/primitives/utxo.ts:15 |
UTXO
Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:41
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends Output | Output |
Constructors
Constructor
new UTXO<T>(outpoint, output): UTXO<T>;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:42
Parameters
| Parameter | Type |
|---|---|
outpoint | Outpoint |
output | T |
Returns
UTXO<T>
Methods
from()
static from(outpoint, output): UTXO<Output>;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:44
Parameters
| Parameter | Type |
|---|---|
outpoint | Outpoint |
output | Output |
Returns
UTXO<Output>
flatten()
flatten(): object & T;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:48
Returns
object & T
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
outpoint | public | Outpoint | cashconnect-js/packages/core/src/primitives/utxo.ts:42 |
output | public | T | cashconnect-js/packages/core/src/primitives/utxo.ts:42 |
UTXOs
Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:56
Extends
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends Output | Output |
Constructors
Constructor
new UTXOs<T>(entries?): UTXOs<T>;Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:50
Parameters
| Parameter | Type |
|---|---|
entries? | | readonly readonly [PropertyKey, UTXO<T>][] | null |
Returns
UTXOs<T>
Inherited from
Constructor
new UTXOs<T>(iterable?): UTXOs<T>;Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:49
Parameters
| Parameter | Type |
|---|---|
iterable? | | Iterable<readonly [PropertyKey, UTXO<T>], any, any> | null |
Returns
UTXOs<T>
Inherited from
Methods
fromTransactions()
static fromTransactions(transactions): UTXOs<Output>;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:57
Parameters
| Parameter | Type |
|---|---|
transactions | Transaction[] |
Returns
UTXOs<Output>
fromArray()
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
| Parameter | Type |
|---|---|
array | readonly T[] |
keySelector | (item) => K |
Returns
ExtMap<T>
Inherited from
fromObject()
static fromObject<T>(object): ExtMap<T>;Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:64
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
object | { [key: string | number | symbol]: T; } |
Returns
ExtMap<T>
Inherited from
flatten()
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
| Parameter | Type |
|---|---|
collections | ExtMap<T>[] |
Returns
ExtMap<T>
Inherited from
groupBy()
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
| Parameter | Type | Description |
|---|---|---|
items | Iterable<T> | An iterable. |
keySelector | (item, index) => K | A callback which will be invoked for each item in items. |
Returns
Map<K, T[]>
Inherited from
calculateTotalSats()
calculateTotalSats(): bigint;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:95
Returns
bigint
calculateTotalTokens()
calculateTotalTokens(): TokenBalances;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:102
Returns
getOrFail()
getOrFail(key): UTXO;Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:88
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
Inherited from
filter()
filter(predicate): ExtMap<UTXO<T>>;Defined in: cashconnect-js/packages/core/src/primitives/utils.ts:101
Returns a new ExtMap with filtered entries
Parameters
| Parameter | Type |
|---|---|
predicate | (value, key) => boolean |
Returns
Inherited from
map()
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
| Parameter | Type |
|---|---|
mapper | (value, key) => U |
Returns
ExtMap<U>
Inherited from
sort()
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
| Parameter | Type | Description |
|---|---|---|
comparator | (a, b) => number | Function to determine the sort order |
Returns
A new ExtMap with sorted entries
Inherited from
slice()
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
| Parameter | Type | Description |
|---|---|---|
start | number | The starting index (inclusive) |
end? | number | The ending index (exclusive) |
Returns
A new ExtMap with the sliced entries
Inherited from
toObject()
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
toArray()
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
toSet()
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 Parameter | Default type |
|---|---|
U | PropertyKey |
Parameters
| Parameter | Type | Description |
|---|---|---|
callback? | (key, value) => U | Optional function to transform keys before adding to Set |
Returns
Set<U>
A Set containing either the keys or transformed values
Inherited from
clear()
clear(): void;Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:20
Returns
void
Inherited from
delete()
delete(key): boolean;Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:24
Parameters
| Parameter | Type |
|---|---|
key | PropertyKey |
Returns
boolean
true if an element in the Map existed and has been removed, or false if the element does not exist.
Inherited from
forEach()
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
| Parameter | Type |
|---|---|
callbackfn | (value, key, map) => void |
thisArg? | any |
Returns
void
Inherited from
get()
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
| Parameter | Type |
|---|---|
key | PropertyKey |
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
has()
has(key): boolean;Defined in: site/node_modules/typescript/lib/lib.es2015.collection.d.ts:37
Parameters
| Parameter | Type |
|---|---|
key | PropertyKey |
Returns
boolean
boolean indicating whether an element with the specified key exists or not.
Inherited from
set()
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
| Parameter | Type |
|---|---|
key | PropertyKey |
value | UTXO |
Returns
this
Inherited from
entries()
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
keys()
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
values()
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
[iterator]()
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
Properties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
[species] | readonly | MapConstructor | ExtMap.[species] | site/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:319 |
size | readonly | number | ExtMap.size | site/node_modules/typescript/lib/lib.es2015.collection.d.ts:45 |
[toStringTag] | readonly | string | ExtMap.[toStringTag] | site/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:137 |
calculateBalanceSats()
function calculateBalanceSats(unspents): bigint;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:137
Parameters
| Parameter | Type |
|---|---|
unspents | UTXO<Output>[] |
Returns
bigint
calculateBalanceTokens()
function calculateBalanceTokens(unspents): TokenBalances;Defined in: cashconnect-js/packages/core/src/primitives/utxo.ts:146
Parameters
| Parameter | Type |
|---|---|
unspents | UTXO<Output>[] |