Skip to content

Commit

Permalink
fix: bind the runtime class to the host functions
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Rusev <[email protected]>
  • Loading branch information
arrusev committed Nov 6, 2023
1 parent 2770120 commit 9f092dc
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions packages/accounts/src/local-view-execution/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,19 +319,19 @@ export class Runtime {

private getHostImports() {
return {
register_len: this.getRegisterLength,
read_register: this.readFromRegister,
current_account_id: this.getCurrentAccountId,
input: this.inputMethodArgs,
block_index: this.getBlockHeight,
block_timestamp: this.getBlockTimestamp,
sha256: this.sha256,
value_return: this.returnValue,
abort: this.abort,
log_utf8: this.appendToLog,
log_utf16: this.appendToLog,
storage_read: this.readStorage,
storage_has_key: this.hasStorageKey,
register_len: this.getRegisterLength.bind(this),
read_register: this.readFromRegister.bind(this),
current_account_id: this.getCurrentAccountId.bind(this),
input: this.inputMethodArgs.bind(this),
block_index: this.getBlockHeight.bind(this),
block_timestamp: this.getBlockTimestamp.bind(this),
sha256: this.sha256.bind(this),
value_return: this.returnValue.bind(this),
abort: this.abort.bind(this),
log_utf8: this.appendToLog.bind(this),
log_utf16: this.appendToLog.bind(this),
storage_read: this.readStorage.bind(this),
storage_has_key: this.hasStorageKey.bind(this),
panic: () => this.panic('explicit guest panic'),
panic_utf8: (len: bigint, ptr: bigint) => this.panic(this.readUTF8CStr(len, ptr)),
// Not implemented
Expand Down

0 comments on commit 9f092dc

Please sign in to comment.