@fleet-sdk/common 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @fleet-sdk/common
2
2
 
3
+ ## 0.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 9cbd414: Add `Block` and `BlockHeader` types.
8
+
3
9
  ## 0.2.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -127,6 +127,44 @@ type Box<T extends AmountType, R extends NonMandatoryRegisters = NonMandatoryReg
127
127
  index: number;
128
128
  };
129
129
 
130
+ type PoWSolution = {
131
+ pk: HexString;
132
+ w: HexString;
133
+ n: string;
134
+ d: number;
135
+ };
136
+ type BlockHeaderId = string;
137
+ type BlockTransactions = {
138
+ headerId: BlockHeaderId;
139
+ transactions: SignedTransaction[];
140
+ };
141
+ type BlockHeader = {
142
+ id: BlockHeaderId;
143
+ timestamp: number;
144
+ version: number;
145
+ adProofsRoot: HexString;
146
+ stateRoot: HexString;
147
+ transactionsRoot: HexString;
148
+ nBits: number;
149
+ extensionHash: HexString;
150
+ powSolutions: PoWSolution;
151
+ height: number;
152
+ difficulty: string;
153
+ parentId: BlockHeaderId;
154
+ votes: string;
155
+ size: number;
156
+ extensionId: HexString;
157
+ transactionsId: HexString;
158
+ adProofsId: HexString;
159
+ };
160
+ type Block = {
161
+ header: BlockHeader;
162
+ blockTransactions: BlockTransactions;
163
+ adProofs: unknown;
164
+ extension: unknown;
165
+ size: number;
166
+ };
167
+
130
168
  type ObjectSelector<T> = (item: T) => T[keyof T];
131
169
  declare function first(array: undefined): undefined;
132
170
  declare function first<T>(array: ArrayLike<T>): T;
@@ -265,4 +303,4 @@ declare abstract class Collection<InternalType, ExternalType> implements Iterabl
265
303
  reduce<U>(callbackFn: (accumulator: U, currentValue: InternalType, currentIndex: number, array: InternalType[]) => U, initialValue: U): U;
266
304
  }
267
305
 
268
- export { AddressType, Amount, AmountType, AssertErrorMessageInput, Base58String, Box, BoxCandidate, BoxId, BoxSummary, BuildOutputType, Collection, CollectionAddOptions, ContextExtension, DataInput, EIP12UnsignedDataInput, EIP12UnsignedInput, EIP12UnsignedTransaction, ErgoTreeHeaderFlag, ErgoTreeHex, FilterPredicate, HexString, MinimalBoxAmounts, Network, NewToken, NonMandatoryRegisters, OneOrMore, ProverResult, SignedInput, SignedTransaction, SortingDirection, SortingSelector, TokenAmount, TokenId, TokenTargetAmount, TransactionId, UTxOFilterParams, UnsignedInput, UnsignedTransaction, _0n, _10n, _127n, _128n, _1n, _63n, _7n, areEqual, areEqualBy, areRegistersDenselyPacked, assert, assertInstanceOf, assertTypeOf, at, byteSizeOf, chunk, clearUndefined, concatBytes, decimalize, depthOf, endsWith, ensureBigInt, ensureDefaults, ensureUTxOBigInt, ergoTreeHeaderFlags, first, hasDuplicates, hasDuplicatesBy, hasKey, isDefined, isEmpty, isFalsy, isHex, isTruthy, isUndefined, last, max, min, orderBy, percent, some, startsWith, sumBy, undecimalize, uniq, uniqBy, utxoDiff, utxoFilter, utxoSum };
306
+ export { AddressType, Amount, AmountType, AssertErrorMessageInput, Base58String, Block, BlockHeader, BlockHeaderId, BlockTransactions, Box, BoxCandidate, BoxId, BoxSummary, BuildOutputType, Collection, CollectionAddOptions, ContextExtension, DataInput, EIP12UnsignedDataInput, EIP12UnsignedInput, EIP12UnsignedTransaction, ErgoTreeHeaderFlag, ErgoTreeHex, FilterPredicate, HexString, MinimalBoxAmounts, Network, NewToken, NonMandatoryRegisters, OneOrMore, PoWSolution, ProverResult, SignedInput, SignedTransaction, SortingDirection, SortingSelector, TokenAmount, TokenId, TokenTargetAmount, TransactionId, UTxOFilterParams, UnsignedInput, UnsignedTransaction, _0n, _10n, _127n, _128n, _1n, _63n, _7n, areEqual, areEqualBy, areRegistersDenselyPacked, assert, assertInstanceOf, assertTypeOf, at, byteSizeOf, chunk, clearUndefined, concatBytes, decimalize, depthOf, endsWith, ensureBigInt, ensureDefaults, ensureUTxOBigInt, ergoTreeHeaderFlags, first, hasDuplicates, hasDuplicatesBy, hasKey, isDefined, isEmpty, isFalsy, isHex, isTruthy, isUndefined, last, max, min, orderBy, percent, some, startsWith, sumBy, undecimalize, uniq, uniqBy, utxoDiff, utxoFilter, utxoSum };
package/dist/index.d.ts CHANGED
@@ -127,6 +127,44 @@ type Box<T extends AmountType, R extends NonMandatoryRegisters = NonMandatoryReg
127
127
  index: number;
128
128
  };
129
129
 
130
+ type PoWSolution = {
131
+ pk: HexString;
132
+ w: HexString;
133
+ n: string;
134
+ d: number;
135
+ };
136
+ type BlockHeaderId = string;
137
+ type BlockTransactions = {
138
+ headerId: BlockHeaderId;
139
+ transactions: SignedTransaction[];
140
+ };
141
+ type BlockHeader = {
142
+ id: BlockHeaderId;
143
+ timestamp: number;
144
+ version: number;
145
+ adProofsRoot: HexString;
146
+ stateRoot: HexString;
147
+ transactionsRoot: HexString;
148
+ nBits: number;
149
+ extensionHash: HexString;
150
+ powSolutions: PoWSolution;
151
+ height: number;
152
+ difficulty: string;
153
+ parentId: BlockHeaderId;
154
+ votes: string;
155
+ size: number;
156
+ extensionId: HexString;
157
+ transactionsId: HexString;
158
+ adProofsId: HexString;
159
+ };
160
+ type Block = {
161
+ header: BlockHeader;
162
+ blockTransactions: BlockTransactions;
163
+ adProofs: unknown;
164
+ extension: unknown;
165
+ size: number;
166
+ };
167
+
130
168
  type ObjectSelector<T> = (item: T) => T[keyof T];
131
169
  declare function first(array: undefined): undefined;
132
170
  declare function first<T>(array: ArrayLike<T>): T;
@@ -265,4 +303,4 @@ declare abstract class Collection<InternalType, ExternalType> implements Iterabl
265
303
  reduce<U>(callbackFn: (accumulator: U, currentValue: InternalType, currentIndex: number, array: InternalType[]) => U, initialValue: U): U;
266
304
  }
267
305
 
268
- export { AddressType, Amount, AmountType, AssertErrorMessageInput, Base58String, Box, BoxCandidate, BoxId, BoxSummary, BuildOutputType, Collection, CollectionAddOptions, ContextExtension, DataInput, EIP12UnsignedDataInput, EIP12UnsignedInput, EIP12UnsignedTransaction, ErgoTreeHeaderFlag, ErgoTreeHex, FilterPredicate, HexString, MinimalBoxAmounts, Network, NewToken, NonMandatoryRegisters, OneOrMore, ProverResult, SignedInput, SignedTransaction, SortingDirection, SortingSelector, TokenAmount, TokenId, TokenTargetAmount, TransactionId, UTxOFilterParams, UnsignedInput, UnsignedTransaction, _0n, _10n, _127n, _128n, _1n, _63n, _7n, areEqual, areEqualBy, areRegistersDenselyPacked, assert, assertInstanceOf, assertTypeOf, at, byteSizeOf, chunk, clearUndefined, concatBytes, decimalize, depthOf, endsWith, ensureBigInt, ensureDefaults, ensureUTxOBigInt, ergoTreeHeaderFlags, first, hasDuplicates, hasDuplicatesBy, hasKey, isDefined, isEmpty, isFalsy, isHex, isTruthy, isUndefined, last, max, min, orderBy, percent, some, startsWith, sumBy, undecimalize, uniq, uniqBy, utxoDiff, utxoFilter, utxoSum };
306
+ export { AddressType, Amount, AmountType, AssertErrorMessageInput, Base58String, Block, BlockHeader, BlockHeaderId, BlockTransactions, Box, BoxCandidate, BoxId, BoxSummary, BuildOutputType, Collection, CollectionAddOptions, ContextExtension, DataInput, EIP12UnsignedDataInput, EIP12UnsignedInput, EIP12UnsignedTransaction, ErgoTreeHeaderFlag, ErgoTreeHex, FilterPredicate, HexString, MinimalBoxAmounts, Network, NewToken, NonMandatoryRegisters, OneOrMore, PoWSolution, ProverResult, SignedInput, SignedTransaction, SortingDirection, SortingSelector, TokenAmount, TokenId, TokenTargetAmount, TransactionId, UTxOFilterParams, UnsignedInput, UnsignedTransaction, _0n, _10n, _127n, _128n, _1n, _63n, _7n, areEqual, areEqualBy, areRegistersDenselyPacked, assert, assertInstanceOf, assertTypeOf, at, byteSizeOf, chunk, clearUndefined, concatBytes, decimalize, depthOf, endsWith, ensureBigInt, ensureDefaults, ensureUTxOBigInt, ergoTreeHeaderFlags, first, hasDuplicates, hasDuplicatesBy, hasKey, isDefined, isEmpty, isFalsy, isHex, isTruthy, isUndefined, last, max, min, orderBy, percent, some, startsWith, sumBy, undecimalize, uniq, uniqBy, utxoDiff, utxoFilter, utxoSum };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleet-sdk/common",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Internal utility functions, constants and types shared across @fleet-sdk packages.",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -0,0 +1,44 @@
1
+ import { HexString } from "./common";
2
+ import { SignedTransaction } from "./transactions";
3
+
4
+ export type PoWSolution = {
5
+ pk: HexString;
6
+ w: HexString;
7
+ n: string;
8
+ d: number;
9
+ };
10
+
11
+ export type BlockHeaderId = string;
12
+
13
+ export type BlockTransactions = {
14
+ headerId: BlockHeaderId;
15
+ transactions: SignedTransaction[];
16
+ };
17
+
18
+ export type BlockHeader = {
19
+ id: BlockHeaderId;
20
+ timestamp: number;
21
+ version: number;
22
+ adProofsRoot: HexString;
23
+ stateRoot: HexString;
24
+ transactionsRoot: HexString;
25
+ nBits: number;
26
+ extensionHash: HexString;
27
+ powSolutions: PoWSolution;
28
+ height: number;
29
+ difficulty: string;
30
+ parentId: BlockHeaderId;
31
+ votes: string;
32
+ size: number;
33
+ extensionId: HexString;
34
+ transactionsId: HexString;
35
+ adProofsId: HexString;
36
+ };
37
+
38
+ export type Block = {
39
+ header: BlockHeader;
40
+ blockTransactions: BlockTransactions;
41
+ adProofs: unknown; // TODO
42
+ extension: unknown; // TODO
43
+ size: number;
44
+ };
@@ -6,3 +6,4 @@ export * from "./proverResult";
6
6
  export * from "./registers";
7
7
  export * from "./token";
8
8
  export * from "./transactions";
9
+ export * from "./block";