loadContractCodeForWasmId method
Loads the contract source code (including source code - wasm bytes) for a given wasm id.
Implementation
Future<XdrContractCodeEntry?> loadContractCodeForWasmId(String wasmId) async {
XdrLedgerKey ledgerKey = XdrLedgerKey(XdrLedgerEntryType.CONTRACT_CODE);
ledgerKey.contractCode =
XdrLedgerKeyContractCode(XdrHash(Util.hexToBytes(wasmId)));
GetLedgerEntriesResponse ledgerEntriesResponse =
await getLedgerEntries([ledgerKey.toBase64EncodedXdrString()]);
if (ledgerEntriesResponse.entries != null &&
ledgerEntriesResponse.entries!.length > 0) {
return ledgerEntriesResponse.entries![0].ledgerEntryDataXdr.contractCode;
}
return null;
}