Created
September 21, 2020 00:31
-
-
Save mattlockyer/c23042ce3fa9214e9531e4cbd320cbf0 to your computer and use it in GitHub Desktop.
Check a NEAR contract hash using near-api-js
This file contains hidden or 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
import * as nearlib from 'near-api-js' | |
const contractBytes = await fetch('./contract.wasm').then((r) => r.arrayBuffer()) | |
const hash = await crypto.subtle.digest('SHA-256', contractBytes) | |
const hash58 = nearlib.utils.serialize.base_encode(hash) | |
console.log(hash58) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment