Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

chore: use wat-the-crypto #394

Merged
merged 1 commit into from
Nov 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions _tasks/build_wasm.ts

This file was deleted.

4 changes: 4 additions & 0 deletions _tasks/dnt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ await Promise.all([
entryPoints: ["mod.ts"],
outDir,
mappings: {
"https://deno.land/x/[email protected]/mod.ts": {
name: "wat-the-crypto",
version: "^0.0.1",
},
"https://deno.land/x/[email protected]/mod.ts": {
name: "scale-codec",
version: "^0.9.1",
Expand Down
1 change: 0 additions & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"run:browser": "deno task run test_util/ctx.ts -- deno task run _tasks/run_browser.ts",
"debug": "deno task run --inspect-brk",
"download:frame_metadata": "deno task run _tasks/download_frame_metadata.ts",
"build:wasm": "deno task run _tasks/build_wasm.ts",
"udd": "deno task star && deno task run https://deno.land/x/[email protected]/main.ts _star.ts",
"dnt": "deno task run _tasks/dnt.ts",
"star": "deno task run _tasks/star.ts && deno cache --no-check=remote _star.ts",
Expand Down
1 change: 1 addition & 0 deletions deps/wat_the_crypto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "https://deno.land/x/[email protected]/mod.ts"
5 changes: 2 additions & 3 deletions frame_metadata/Extrinsic.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as $ from "../deps/scale.ts"
import { assert } from "../deps/std/testing/asserts.ts"
import * as H from "../hashers/mod.ts"
import * as ss58 from "../ss58/mod.ts"
import { Hex, hex } from "../util/mod.ts"
import { hashers, Hex, hex } from "../util/mod.ts"
import { $null, DeriveCodec } from "./Codec.ts"
import { Metadata } from "./Metadata.ts"

Expand Down Expand Up @@ -136,7 +135,7 @@ export function $extrinsic(props: ExtrinsicCodecProps): $.Codec<Extrinsic> {
const callEncoded = toSignEncoded.subarray(0, callEnd)
const extraEncoded = toSignEncoded.subarray(callEnd, extraEnd)
const toSign = toSignEncoded.length > 256
? H.Blake2_256.hash(toSignEncoded)
? hashers.Blake2_256.hash(toSignEncoded)
: toSignEncoded
const sig = props.sign(toSign)
if (sig instanceof Promise) {
Expand Down
8 changes: 4 additions & 4 deletions frame_metadata/Key.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as $ from "../deps/scale.ts"
import * as H from "../hashers/mod.ts"
import { hashers } from "../util/mod.ts"
import { DeriveCodec } from "./Codec.ts"
import * as M from "./Metadata.ts"

Expand All @@ -26,13 +26,13 @@ export function $storageKey(props: StorageKeyProps): $.Codec<unknown[]> {
} else {
keyCodecs = []
}
const palletHash = H.Twox128.hash(new TextEncoder().encode(props.pallet.name))
const entryHash = H.Twox128.hash(new TextEncoder().encode(props.storageEntry.name))
const palletHash = hashers.Twox128.hash(new TextEncoder().encode(props.pallet.name))
const entryHash = hashers.Twox128.hash(new TextEncoder().encode(props.storageEntry.name))
const $keys = [...Array(keyCodecs.length + 1).keys()].reduce(
(keys, i) => {
keys[i] = $.tuple(
...keyCodecs.slice(0, i).map(($key, i) =>
H[(props.storageEntry as M.MapStorageEntryType).hashers[i]!].$hash($key)
hashers[(props.storageEntry as M.MapStorageEntryType).hashers[i]!].$hash($key)
),
)
return keys
Expand Down
53 changes: 0 additions & 53 deletions hashers/blake2b.test.ts

This file was deleted.

120 changes: 0 additions & 120 deletions hashers/blake2b.ts

This file was deleted.

39 changes: 0 additions & 39 deletions hashers/blake2b.wasm.ts

This file was deleted.

Loading