-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add bytecode generation script and update deployment logic
- Loading branch information
Showing
4 changed files
with
28 additions
and
5 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,19 @@ | ||
import path from 'path' | ||
import fs from 'fs' | ||
|
||
console.log('Generating deweb contract bytecode...') | ||
function generateBytecode(src?: string, dst?: string): void { | ||
const wasmPath = src ?? path.join(__dirname, 'main.wasm') | ||
const wasmData = fs.readFileSync(wasmPath) | ||
|
||
const output = ` | ||
/* eslint-disable max-len */ | ||
export const DEWEB_SC_BYTECODE: Uint8Array = new Uint8Array([${[...wasmData]}]);\n | ||
` | ||
|
||
const outputDir = dst ?? path.join(__dirname, './deweb-sc-bytecode.ts') | ||
|
||
fs.writeFileSync(outputDir, output) | ||
} | ||
|
||
generateBytecode() |