Last active
February 6, 2024 19:35
-
-
Save Mleekko/b41c79702726f71ee20f9b43fe123121 to your computer and use it in GitHub Desktop.
ManifestBuilder from string
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
public static async fromString(manifestText: string): Promise<ManifestBuilder> { | |
const instructions = await RadixEngineToolkit.Instructions.convert( | |
{ | |
"kind": "String", | |
"value": manifestText | |
}, | |
NetworkId.Mainnet, | |
"Parsed" | |
); | |
let manifestBuilder = new ManifestBuilder(); | |
let anyBuilder = <any>manifestBuilder; | |
anyBuilder.instructions = instructions.value; | |
// need to set the below numbers to make the builder work properly (i.e. manually count the buckets, proofs, etc) | |
anyBuilder.idAllocator.nextBucketId = 0; | |
anyBuilder.idAllocator.nextProofId = 0; | |
anyBuilder.idAllocator.nextAddressReservation = 0; | |
anyBuilder.idAllocator.nextNamedAddress = 0; | |
return manifestBuilder; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment