-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #156 from fleet-sdk/add-testnet-compiler-opt
Add `network` compiler flag
- Loading branch information
Showing
8 changed files
with
174 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@fleet-sdk/compiler": patch | ||
--- | ||
|
||
Add `network` flag to compiler options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@fleet-sdk/core": patch | ||
--- | ||
|
||
Override ErgoTree encoding network from constructor params |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@fleet-sdk/core": patch | ||
--- | ||
|
||
Add `ErgoTree.encode()` method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
import { ErgoTree } from "@fleet-sdk/core"; | ||
import { ErgoTree, type Network } from "@fleet-sdk/core"; | ||
import { hex } from "@fleet-sdk/crypto"; | ||
import type { ErgoTree as SigmaErgoTree, Value as SigmaValue } from "sigmastate-js/main"; | ||
import { ContractTemplate } from "./contractTemplate"; | ||
|
||
export class CompilerOutput extends ErgoTree { | ||
private readonly _tree: SigmaErgoTree; | ||
private _template?: ContractTemplate; | ||
readonly #tree: SigmaErgoTree; | ||
#template?: ContractTemplate; | ||
|
||
constructor(tree: SigmaErgoTree) { | ||
super(hex.decode(tree.toHex())); | ||
this._tree = tree; | ||
constructor(tree: SigmaErgoTree, network?: Network) { | ||
super(hex.decode(tree.toHex()), network); | ||
this.#tree = tree; | ||
} | ||
|
||
get template(): ContractTemplate { | ||
if (!this._template) { | ||
const templateBytes = hex.decode(this._tree.templateHex()); | ||
this._template = new ContractTemplate(templateBytes); | ||
if (!this.#template) { | ||
const templateBytes = hex.decode(this.#tree.templateHex()); | ||
this.#template = new ContractTemplate(templateBytes); | ||
} | ||
|
||
return this._template; | ||
return this.#template; | ||
} | ||
|
||
get constants(): SigmaValue[] { | ||
return this._tree.constants(); | ||
return this.#tree.constants(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters