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
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
},
"homepage": "https://github.com/utxorpc/node-sdk#readme",
"devDependencies": {
"tsup": "^8.2.4",
"tsx": "4.19.0",
"typescript": "5.5.4",
"@types/node": "22.10.2",
"vitest": "^2.1.8"
"@types/node": "22.15.33",
"tsup": "^8.5.0",
"tsx": "^4.20.3",
"typescript": "^5.8.3",
"vitest": "^3.2.4"
},
"dependencies": {
"@connectrpc/connect": "1.4",
Expand Down
50 changes: 25 additions & 25 deletions src/cardano.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export class QueryClient {
}

async readUtxosByOutputRef(
refs: { txHash: Uint8Array; outputIndex: number }[]
refs: { txHash: Uint8Array<ArrayBuffer>; outputIndex: number }[]
): Promise<Utxo[]> {
const searchResponse = await this.inner.readUtxos({
keys: refs.map((ref) => {
Expand All @@ -220,15 +220,15 @@ export class QueryClient {
return searchResponse.items.map(anyUtxoToChain);
}

async searchUtxosByAddress(address: Uint8Array): Promise<Utxo[]> {
async searchUtxosByAddress(address: Uint8Array<ArrayBuffer>): Promise<Utxo[]> {
return this.searchUtxosByMatch({
address: {
exactAddress: address,
},
});
}

async searchUtxosByPaymentPart(paymentPart: Uint8Array): Promise<Utxo[]> {
async searchUtxosByPaymentPart(paymentPart: Uint8Array<ArrayBuffer>): Promise<Utxo[]> {
return this.searchUtxosByMatch({
address: {
paymentPart: paymentPart,
Expand All @@ -237,7 +237,7 @@ export class QueryClient {
}

async searchUtxosByDelegationPart(
delegationPart: Uint8Array
delegationPart: Uint8Array<ArrayBuffer>
): Promise<Utxo[]> {
return this.searchUtxosByMatch({
address: {
Expand All @@ -247,18 +247,18 @@ export class QueryClient {
}

async searchUtxosByAsset(
policyId?: Uint8Array,
name?: Uint8Array
policyId?: Uint8Array<ArrayBuffer>,
name?: Uint8Array<ArrayBuffer>
): Promise<Utxo[]> {
return this.searchUtxosByMatch({
asset: (policyId && name) ? { policyId: policyId, assetName: name } : policyId ? { policyId } : { assetName: name },
});
}

async searchUtxosByAddressWithAsset(
address: Uint8Array,
policyId?: Uint8Array,
name?: Uint8Array
address: Uint8Array<ArrayBuffer>,
policyId?: Uint8Array<ArrayBuffer>,
name?: Uint8Array<ArrayBuffer>
): Promise<Utxo[]> {
return this.searchUtxosByMatch({
address: {
Expand All @@ -269,9 +269,9 @@ export class QueryClient {
}

async searchUtxosByPaymentPartWithAsset(
paymentPart: Uint8Array,
policyId?: Uint8Array,
name?: Uint8Array
paymentPart: Uint8Array<ArrayBuffer>,
policyId?: Uint8Array<ArrayBuffer>,
name?: Uint8Array<ArrayBuffer>
): Promise<Utxo[]> {
return this.searchUtxosByMatch({
address: {
Expand All @@ -282,9 +282,9 @@ export class QueryClient {
}

async searchUtxosByDelegationPartWithAsset(
delegationPart: Uint8Array,
policyId?: Uint8Array,
name?: Uint8Array
delegationPart: Uint8Array<ArrayBuffer>,
policyId?: Uint8Array<ArrayBuffer>,
name?: Uint8Array<ArrayBuffer>
): Promise<Utxo[]> {
return this.searchUtxosByMatch({
address: {
Expand Down Expand Up @@ -357,32 +357,32 @@ export class SubmitClient {
}

async *watchMempoolForAddress(
address: Uint8Array
address: Uint8Array<ArrayBuffer>
): AsyncIterable<MempoolEvent> {
yield* this.watchMempoolByMatch({
hasAddress: { exactAddress: address },
});
}

async *watchMempoolForPaymentPart(
paymentPart: Uint8Array
paymentPart: Uint8Array<ArrayBuffer>
): AsyncIterable<MempoolEvent> {
yield* this.watchMempoolByMatch({
hasAddress: { paymentPart: paymentPart },
});
}

async *watchMempoolForDelegationPart(
delegationPart: Uint8Array
delegationPart: Uint8Array<ArrayBuffer>
): AsyncIterable<MempoolEvent> {
yield* this.watchMempoolByMatch({
hasAddress: { delegationPart: delegationPart },
});
}

async *watchMempoolForAsset(
policyId?: Uint8Array,
assetName?: Uint8Array
policyId?: Uint8Array<ArrayBuffer>,
assetName?: Uint8Array<ArrayBuffer>
): AsyncIterable<MempoolEvent> {
yield* this.watchMempoolByMatch({
movesAsset: policyId ? { policyId } : { assetName },
Expand Down Expand Up @@ -442,32 +442,32 @@ export class WatchClient {
}

async *watchTxForAddress(
address: Uint8Array,
address: Uint8Array<ArrayBuffer>,
intersect?: ChainPoint[]
): AsyncIterable<TxEvent> {
const pattern = { hasAddress: { exactAddress: address } };
yield* this.watchTxByMatch(pattern, intersect);
}

async *watchTxForPaymentPart(
paymentPart: Uint8Array,
paymentPart: Uint8Array<ArrayBuffer>,
intersect?: ChainPoint[]
): AsyncIterable<TxEvent> {
const pattern = { hasAddress: { paymentPart } };
yield* this.watchTxByMatch(pattern, intersect);
}

async *watchTxForDelegationPart(
delegationPart: Uint8Array,
delegationPart: Uint8Array<ArrayBuffer>,
intersect?: ChainPoint[]
): AsyncIterable<TxEvent> {
const pattern = { hasAddress: { delegationPart } };
yield* this.watchTxByMatch(pattern, intersect);
}

async *watchTxForAsset(
policyId?: Uint8Array,
assetName?: Uint8Array,
policyId?: Uint8Array<ArrayBuffer>,
assetName?: Uint8Array<ArrayBuffer>,
intersect?: ChainPoint[]
): AsyncIterable<TxEvent> {
const pattern = policyId
Expand Down
6 changes: 3 additions & 3 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ export type GenericTxEvent<Tx> =

export type GenericTxInMempoolEvent<Tx> = {
stage: submit.Stage;
txoRef: Uint8Array;
nativeBytes: Uint8Array;
txoRef: Uint8Array<ArrayBuffer>;
nativeBytes: Uint8Array<ArrayBuffer>;
Tx: Tx | undefined;
};

export type GenericUtxo<Ref, Parsed> = {
txoRef: Ref;
parsedValued: Parsed | undefined;
nativeBytes: Uint8Array | undefined;
nativeBytes: Uint8Array<ArrayBuffer> | undefined;
};

export type ClientBuilderOptions = {
Expand Down