@xyo-network/xl1-protocol-sdk 1.26.23 → 1.26.24

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.
@@ -1,36 +1,17 @@
1
1
  import type { SignedHydratedBlockWithHashMeta } from '@xyo-network/xl1-protocol-lib';
2
- /** FindBestUncle helper function. */
3
- export declare function findBestUncle(finalizedWindowedChain: SignedHydratedBlockWithHashMeta[], uncles: SignedHydratedBlockWithHashMeta[][]): [{
4
- schema: "network.xyo.boundwitness" & {
5
- readonly __schema: true;
6
- };
7
- addresses: (Lowercase<string> & {
8
- readonly __hex: true;
9
- } & {
10
- readonly __address: true;
11
- })[];
12
- payload_hashes: import("@xylabs/sdk-js").BrandedHash[];
13
- payload_schemas: import("@xyo-network/sdk-js").BrandedSchema<string>[];
14
- previous_hashes: (import("@xylabs/sdk-js").BrandedHash | null)[];
15
- $signatures: import("@xylabs/sdk-js").BrandedHex[];
16
- block: import("@xyo-network/xl1-protocol-lib").XL1BlockNumber;
17
- chain: import("@xylabs/sdk-js").BrandedHex;
18
- previous: import("@xylabs/sdk-js").BrandedHash | null;
19
- $epoch: number;
20
- _hash: import("@xylabs/sdk-js").BrandedHash;
21
- _dataHash: import("@xylabs/sdk-js").BrandedHash;
22
- $destination?: (Lowercase<string> & {
23
- readonly __hex: true;
24
- } & {
25
- readonly __address: true;
26
- }) | undefined;
27
- $sourceQuery?: import("@xylabs/sdk-js").BrandedHash | undefined;
28
- protocol?: number | undefined;
29
- step_hashes?: import("@xylabs/sdk-js").BrandedHash[] | undefined;
30
- }, {
31
- [x: string]: unknown;
32
- schema: import("@xyo-network/sdk-js").BrandedSchema<string>;
33
- _hash: import("@xylabs/sdk-js").BrandedHash;
34
- _dataHash: import("@xylabs/sdk-js").BrandedHash;
35
- }[]][];
2
+ /** Default minimum number of uncle candidates before selecting. */
3
+ export declare const DEFAULT_MIN_CANDIDATES = 2;
4
+ /** Default back-off timeout in milliseconds. If the head has not changed for this long, minCandidates is ignored. */
5
+ export declare const DEFAULT_BACKOFF_MS = 120000;
6
+ /** Options for findBestUncle block selection. */
7
+ export interface FindBestUncleOptions {
8
+ /** Back-off timeout in ms. If head age exceeds this, minCandidates is ignored. Default: 120_000. */
9
+ backoffMs?: number;
10
+ /** Minimum number of uncle candidates before selecting. Default: 2. */
11
+ minCandidates?: number;
12
+ /** Current timestamp in ms. Injectable for testing. Default: Date.now(). */
13
+ now?: number;
14
+ }
15
+ /** Selects the best uncle chain from candidates using Proof of Perfect scoring. */
16
+ export declare function findBestUncle(finalizedWindowedChain: SignedHydratedBlockWithHashMeta[], uncles: SignedHydratedBlockWithHashMeta[][], options?: FindBestUncleOptions): SignedHydratedBlockWithHashMeta[] | undefined;
36
17
  //# sourceMappingURL=findBestUncle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"findBestUncle.d.ts","sourceRoot":"","sources":["../../../../src/primitives/uncle/findBestUncle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAA;AAIpF,qCAAqC;AACrC,wBAAgB,aAAa,CAAC,sBAAsB,EAAE,+BAA+B,EAAE,EAAE,MAAM,EAAE,+BAA+B,EAAE,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAGnI"}
1
+ {"version":3,"file":"findBestUncle.d.ts","sourceRoot":"","sources":["../../../../src/primitives/uncle/findBestUncle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAA;AAIpF,mEAAmE;AACnE,eAAO,MAAM,sBAAsB,IAAI,CAAA;AAEvC,qHAAqH;AACrH,eAAO,MAAM,kBAAkB,SAAU,CAAA;AAEzC,iDAAiD;AACjD,MAAM,WAAW,oBAAoB;IACnC,oGAAoG;IACpG,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAC3B,sBAAsB,EAAE,+BAA+B,EAAE,EACzD,MAAM,EAAE,+BAA+B,EAAE,EAAE,EAC3C,OAAO,CAAC,EAAE,oBAAoB,GAC7B,+BAA+B,EAAE,GAAG,SAAS,CAiB/C"}
@@ -0,0 +1,4 @@
1
+ import type { SignedHydratedBlockWithHashMeta } from '@xyo-network/xl1-protocol-lib';
2
+ /** Extracts a canonical producer identity string from a block's signer addresses. */
3
+ export declare function getProducerKey(block: SignedHydratedBlockWithHashMeta): string;
4
+ //# sourceMappingURL=getProducerKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getProducerKey.d.ts","sourceRoot":"","sources":["../../../../src/primitives/uncle/getProducerKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAA;AAEpF,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,KAAK,EAAE,+BAA+B,GAAG,MAAM,CAE7E"}
@@ -1,4 +1,5 @@
1
1
  export * from './findBestUncle.ts';
2
2
  export * from './findUncles.ts';
3
+ export * from './getProducerKey.ts';
3
4
  export * from './scoreUncle.ts';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/primitives/uncle/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/primitives/uncle/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA"}
@@ -1,4 +1,6 @@
1
1
  import type { SignedHydratedBlockWithHashMeta } from '@xyo-network/xl1-protocol-lib';
2
- /** ScoreUncle helper function. */
2
+ /** Bonus applied when a candidate block is from a different producer than the current head. */
3
+ export declare const PRODUCER_DIVERSITY_BONUS = 1000;
4
+ /** Scores an uncle chain candidate for block selection (Proof of Perfect). */
3
5
  export declare function scoreUncle(finalizedWindowedChain: SignedHydratedBlockWithHashMeta[], blocks: SignedHydratedBlockWithHashMeta[]): number;
4
6
  //# sourceMappingURL=scoreUncle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scoreUncle.d.ts","sourceRoot":"","sources":["../../../../src/primitives/uncle/scoreUncle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAA;AAEpF,kCAAkC;AAClC,wBAAgB,UAAU,CAAC,sBAAsB,EAAE,+BAA+B,EAAE,EAAE,MAAM,EAAE,+BAA+B,EAAE,UAG9H"}
1
+ {"version":3,"file":"scoreUncle.d.ts","sourceRoot":"","sources":["../../../../src/primitives/uncle/scoreUncle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAA;AAIpF,+FAA+F;AAC/F,eAAO,MAAM,wBAAwB,OAAO,CAAA;AAE5C,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,sBAAsB,EAAE,+BAA+B,EAAE,EAAE,MAAM,EAAE,+BAA+B,EAAE,GAAG,MAAM,CAevI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/xl1-protocol-sdk",
3
- "version": "1.26.23",
3
+ "version": "1.26.24",
4
4
  "description": "XYO Layer One SDK Protocol",
5
5
  "homepage": "https://xylabs.com",
6
6
  "bugs": {
@@ -22,7 +22,6 @@
22
22
  "exports": {
23
23
  ".": {
24
24
  "types": "./dist/neutral/index.d.ts",
25
- "import": "./dist/neutral/index.mjs",
26
25
  "default": "./dist/neutral/index.mjs"
27
26
  },
28
27
  "./test": {
@@ -35,7 +34,6 @@
35
34
  },
36
35
  "./package.json": "./package.json"
37
36
  },
38
- "types": "./dist/neutral/index.d.ts",
39
37
  "files": [
40
38
  "dist",
41
39
  "!**/*.bench.*",
@@ -47,8 +45,8 @@
47
45
  "async-mutex": "~0.5.0",
48
46
  "cosmiconfig": "^9.0.1",
49
47
  "lru-cache": "^11.3.3",
50
- "@xyo-network/xl1-schema": "~1.26.23",
51
- "@xyo-network/xl1-protocol-lib": "~1.26.23"
48
+ "@xyo-network/xl1-protocol-lib": "~1.26.24",
49
+ "@xyo-network/xl1-schema": "~1.26.24"
52
50
  },
53
51
  "devDependencies": {
54
52
  "@opentelemetry/api": "^1.9.1",
@@ -119,8 +117,8 @@
119
117
  "vite": "^8.0.8",
120
118
  "vitest": "~4.1.4",
121
119
  "zod": "~4.3.6",
122
- "@xyo-network/xl1-network-model": "~1.26.23",
123
- "@xyo-network/xl1-protocol-model": "~1.26.23"
120
+ "@xyo-network/xl1-network-model": "~1.26.24",
121
+ "@xyo-network/xl1-protocol-model": "~1.26.24"
124
122
  },
125
123
  "peerDependencies": {
126
124
  "@opentelemetry/api": "^1",