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

chore: use $.lenPrefixed from scale v0.6.1 #289

Merged
merged 1 commit into from
Oct 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
4 changes: 2 additions & 2 deletions _tasks/dnt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ await Promise.all([
}],
outDir,
mappings: {
"https://deno.land/x/[email protected].0/mod.ts": {
"https://deno.land/x/[email protected].1/mod.ts": {
name: "parity-scale-codec",
version: "^0.6.0",
version: "^0.6.1",
},
"deps/smoldot_phantom.ts": {
name: "@substrate/smoldot-light",
Expand Down
4 changes: 2 additions & 2 deletions codegen/codecVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function createCodecVisitor(
getContent: () => [
"\n",
[
"import { ChainError, BitSequence, Era, $, $era, $null, $lenPrefixed } from",
"import { ChainError, BitSequence, Era, $, $era, $null } from",
S.string(importSource),
],
[`import type * as t from "./mod.ts"`],
Expand Down Expand Up @@ -169,7 +169,7 @@ export function createCodecVisitor(
return addCodecDecl(ty, "$era");
},
lenPrefixedWrapper(ty, inner) {
return addCodecDecl(ty, ["$lenPrefixed(", this.visit(inner), ")"]);
return addCodecDecl(ty, ["$.lenPrefixed(", this.visit(inner), ")"]);
},
circular(ty) {
return ["$.deferred(() =>", getName(getRawCodecPath(ty)), ")"];
Expand Down
2 changes: 1 addition & 1 deletion deps/scale.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/x/[email protected].0/mod.ts";
export * from "https://deno.land/x/[email protected].1/mod.ts";
3 changes: 1 addition & 2 deletions frame_metadata/Codec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as $ from "../deps/scale.ts";
import { $lenPrefixed } from "../util/$lenPrefixed.ts";
import { $era } from "./Era.ts";
import type * as M from "./mod.ts";
import { TyVisitor } from "./TyVisitor.ts";
Expand Down Expand Up @@ -104,7 +103,7 @@ export function DeriveCodec(tys: M.Ty[]): DeriveCodec {
return $era;
},
lenPrefixedWrapper(_ty, inner) {
return $lenPrefixed(this.visit(inner));
return $.lenPrefixed(this.visit(inner));
},
circular(ty) {
return $.deferred(() => this.cache[ty.id]!);
Expand Down
3 changes: 1 addition & 2 deletions frame_metadata/Extrinsic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ 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 { $lenPrefixed } from "../util/$lenPrefixed.ts";
import { hex } from "../util/mod.ts";
import { $null, DeriveCodec } from "./Codec.ts";
import { Metadata } from "./Metadata.ts";
Expand Down Expand Up @@ -166,7 +165,7 @@ export function $extrinsic(props: ExtrinsicCodecProps): $.Codec<Extrinsic> {
},
});

return $lenPrefixed($baseExtrinsic);
return $.lenPrefixed($baseExtrinsic);

function findExtrinsicTypeParam(name: string) {
return metadata.extrinsic.ty.params.find((x) => x.name === name)?.ty;
Expand Down
1 change: 0 additions & 1 deletion mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export * as M from "./frame_metadata/mod.ts";
export { $era, $null, ChainError, type Era } from "./frame_metadata/mod.ts";
export { kusama, moonbeam, polkadot, rococo, westend } from "./known/mod.ts"; // TODO: get rid of this!
export {
$lenPrefixed,
type CreateWatchHandler,
hex,
mapCreateWatchHandler,
Expand Down
23 changes: 0 additions & 23 deletions util/$lenPrefixed.ts

This file was deleted.

1 change: 0 additions & 1 deletion util/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from "./$lenPrefixed.ts";
export * from "./branded.ts";
export * from "./error.ts";
export * as hex from "./hex.ts";
Expand Down