Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/sigmastate-js-0.6.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fleet-sdk/mock-chain": minor
---

Support sigmastate-js 0.6.0 by replacing removed `AvlTree$.fromDigest()` with `AvlTree` constructor
2 changes: 1 addition & 1 deletion packages/mock-chain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@fleet-sdk/wallet": "workspace:^",
"diff": "^8.0.3",
"picocolors": "^1.1.1",
"sigmastate-js": "0.4.6"
"sigmastate-js": ">=0.4.6"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only 0.6.0 version available in npm registry is 0.6.0-snapshot.d6573ab7c, please set the version to this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better if I update the whole repo to that version? Would be great if fleet supports the newer ergotree versions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that would be great! But Fleet has it's own lightweight serializer implementation, so new types need to be implemented by hand.

In regards to sigmastate-js as a dependency, it's only user in three places;

  1. top-level package.json dev dependency just to have it available in tests;
  2. compiler package; and
  3. mock-chain package.

Sorry for the delay.

},
"engines": {
"node": ">=18"
Expand Down
4 changes: 2 additions & 2 deletions packages/mock-chain/src/objectMocking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { SAFE_MIN_BOX_VALUE } from "@fleet-sdk/core";
import { hex } from "@fleet-sdk/crypto";
import { blake2b256, randomBytes } from "@fleet-sdk/crypto";
import { serializeBox } from "@fleet-sdk/serializer";
import { AvlTree$, type BlockchainStateContext, GroupElement$ } from "sigmastate-js/main";
import { AvlTree, type BlockchainStateContext, GroupElement$ } from "sigmastate-js/main";

type MockBoxOptions = Partial<Omit<Box<bigint>, "boxId">> & {
ergoTree: string;
Expand Down Expand Up @@ -105,7 +105,7 @@ export function mockBlockchainStateContext(options?: BlockchainContextMockingOpt
(h) => ({
...h,
ADProofsRoot: h.adProofsRoot,
stateRoot: AvlTree$.fromDigest(h.stateRoot),
stateRoot: new AvlTree(h.stateRoot, false, false, false, 32, undefined),
timestamp: BigInt(h.timestamp),
nBits: BigInt(h.nBits),
extensionRoot: h.extensionHash,
Expand Down
4 changes: 0 additions & 4 deletions packages/mock-chain/src/sigmastate.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ declare module "sigmastate-js/main" {
static fromPointHex(value: HexString): GroupElement;
}

export declare class AvlTree$ {
static fromDigest(value: HexString): AvlTree;
}

export declare class SigmaProp {}

export declare class SigmaProp$ {
Expand Down
Loading