Skip to content

Commit

Permalink
Update src/soroban/server.ts
Browse files Browse the repository at this point in the history
Co-authored-by: George <[email protected]>
  • Loading branch information
BlaineHeffron and Shaptic committed May 13, 2024
1 parent 9ae8398 commit 5dc77a6
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/soroban/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,21 +303,9 @@ export class Server {
*/
public async getContractWasmByHash(
wasmHash: Buffer | string,
format: "hex" | "base64" = "hex"
format: undefined | "hex" | "base64" = undefined
): Promise<Buffer> {
let wasmHashBuffer: Buffer;

if (typeof wasmHash === "string") {
if (format === "hex") {
wasmHashBuffer = Buffer.from(wasmHash, "hex");
} else if (format === "base64") {
wasmHashBuffer = Buffer.from(wasmHash, "base64");
} else {
throw new TypeError("Invalid format. Supported formats: 'hex' or 'base64'" );
}
} else {
wasmHashBuffer = wasmHash;
}
const wasmHashBuffer = Buffer.from(wasmHash, format);

const ledgerKeyWasmHash = xdr.LedgerKey.contractCode(
new xdr.LedgerKeyContractCode({
Expand Down

0 comments on commit 5dc77a6

Please sign in to comment.