diff --git a/.vscode/settings.json b/.vscode/settings.json index d68158381..737a584f1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,7 +10,6 @@ }, "deno.codeLens.testArgs": ["-A", "-L=info"], "deno.config": "./deno.jsonc", - "deno.importMap": "./import_map.json", "deno.suggest.imports.hosts": { "https://deno.land": true, "https://x.nest.land": true, diff --git a/codegen/FrameCodegen.ts b/codegen/FrameCodegen.ts index e52a9fd06..999dc390f 100644 --- a/codegen/FrameCodegen.ts +++ b/codegen/FrameCodegen.ts @@ -1,3 +1,4 @@ +import { hex } from "../crypto/mod.ts" import * as $ from "../deps/scale.ts" import { FrameMetadata } from "../frame_metadata/mod.ts" import { CodecCodegen } from "./CodecCodegen.ts" @@ -66,6 +67,7 @@ export * as types from "./types/mod.js" ` import { chain, ${isTypes ? this.chainName : ""} } from "./chain.js" import * as C from "./capi.js" +import * as _codecs from "./codecs.js" import * as t from "./types/mod.js" ${ @@ -89,6 +91,16 @@ export ${isTypes ? `namespace ${pallet.name}` : `const ${pallet.name} =`} { ).join("\n\n") } + ${ + Object.values(pallet.constants).map((constant) => + isTypes + ? `export const ${constant.name}: ${this.typeCodegen.native(constant.codec)}` + : `${constant.name}: ${ + this.codecCodegen.print(constant.codec) + }.decode(C.hex.decode(${JSON.stringify(hex.encode(constant.value))})),` + ).join("\n\n") + } + ${ new $.CodecVisitor() .add($.taggedUnion, (_, _tagKey: string, variants) => diff --git a/fluent/StorageRune.ts b/fluent/StorageRune.ts index 3a8a2e737..8e2129620 100644 --- a/fluent/StorageRune.ts +++ b/fluent/StorageRune.ts @@ -53,6 +53,12 @@ export class StorageRune< .rehandle(null, () => Rune.constant(undefined)) } + default() { + return this.$value + .decoded(this.into(ValueRune).access("default").unhandle(undefined)) + .rehandle(undefined) + } + entryPageRaw( ...[count, partialKey, start, blockHash]: RunicArgs