Skip to content

Instantly share code, notes, and snippets.

@Mleekko
Last active February 6, 2024 19:35
Show Gist options
  • Save Mleekko/b41c79702726f71ee20f9b43fe123121 to your computer and use it in GitHub Desktop.
Save Mleekko/b41c79702726f71ee20f9b43fe123121 to your computer and use it in GitHub Desktop.
ManifestBuilder from string
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