Skip to content

Commit

Permalink
Merge pull request #301 from Concordium/expose-block-item-type
Browse files Browse the repository at this point in the history
Expose type BlockItem again
  • Loading branch information
limemloh authored Oct 30, 2023
2 parents f947033 + 08ce904 commit 4497a03
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
6 changes: 6 additions & 0 deletions packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fix

- Export type `BlockItem` in the public API again, this was removed accidentally in v7.0.0.

## 7.0.0

### Breaking changes
Expand Down
19 changes: 19 additions & 0 deletions packages/sdk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1845,3 +1845,22 @@ export type HealthCheckResponse =
isHealthy: false;
message?: string;
};

/**
* Type representing an item which is included in a block, such as account transactions, chain updates or deployments of new credentials.
*/
export type BlockItem =
| {
kind: BlockItemKind.AccountTransactionKind;
transaction: {
accountTransaction: AccountTransaction;
signatures: AccountTransactionSignature;
};
}
| {
kind: BlockItemKind.CredentialDeploymentKind;
transaction: {
credential: TypedCredentialDeployment;
expiry: number;
};
};
23 changes: 1 addition & 22 deletions packages/sdk/src/wasm/deserialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ import {
deserializeUint8,
} from '../deserialization.js';
import { Cursor } from '../deserializationHelpers.js';
import {
AccountTransaction,
AccountTransactionSignature,
BlockItemKind,
TypedCredentialDeployment,
} from '../types.js';
import { BlockItem, BlockItemKind } from '../types.js';

function deserializeCredentialDeployment(serializedDeployment: Cursor) {
const raw = wasm.deserializeCredentialDeployment(
Expand All @@ -27,22 +22,6 @@ function deserializeCredentialDeployment(serializedDeployment: Cursor) {
}
}

export type BlockItem =
| {
kind: BlockItemKind.AccountTransactionKind;
transaction: {
accountTransaction: AccountTransaction;
signatures: AccountTransactionSignature;
};
}
| {
kind: BlockItemKind.CredentialDeploymentKind;
transaction: {
credential: TypedCredentialDeployment;
expiry: number;
};
};

/**
* Deserializes a transaction, from the binary format used to send it to the node, back into an js object.
* @param serializedTransaction A buffer containing the binary transaction. It is expected to start with the version and blockItemKind.
Expand Down

0 comments on commit 4497a03

Please sign in to comment.