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

Commit

Permalink
fixing type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
harrysolovay committed May 1, 2023
1 parent fcf05b9 commit 5336294
Show file tree
Hide file tree
Showing 25 changed files with 19 additions and 24 deletions.
2 changes: 1 addition & 1 deletion _tasks/generate_artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { hex } from "../crypto/mod.ts"
import * as $ from "../deps/scale.ts"
import { emptyDir } from "../deps/std/fs.ts"
import * as path from "../deps/std/path.ts"
import { devUser } from "../devnets/mod.ts"
import dprintConfig from "../dprint.json" assert { type: "json" }
import { devUser } from "../nets/mod.ts"
import { compress } from "../util/compression.ts"

export const DEV_USER_COUNT = 100_000
Expand Down
2 changes: 1 addition & 1 deletion cli/bin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CapiBinary, resolveBinary } from "../devnets/binary.ts"
import { CapiBinary, resolveBinary } from "../nets/mod.ts"

export default async function(
binary: string,
Expand Down
4 changes: 2 additions & 2 deletions cli/resolveConfig.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as flags from "../deps/std/flags.ts"
import * as path from "../deps/std/path.ts"
import { NetConfig } from "../devnets/mod.ts"
import { Net } from "../nets/mod.ts"

export async function resolveConfig(...args: string[]): Promise<Record<string, NetConfig>> {
export async function resolveConfig(...args: string[]): Promise<Record<string, Net>> {
const { nets: netsPathRaw } = flags.parse(args, {
string: ["nets"],
default: { nets: "./nets.ts" },
Expand Down
10 changes: 3 additions & 7 deletions cli/serve.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import * as flags from "../deps/std/flags.ts"
import { blue, gray, yellow } from "../deps/std/fmt/colors.ts"
import { serve } from "../deps/std/http.ts"
import { createTempDir } from "../devnets/createTempDir.ts"
import { createDevnetsHandler } from "../devnets/mod.ts"
import { createCorsHandler } from "../server/corsHandler.ts"
import { createErrorHandler } from "../server/errorHandler.ts"
import { createCodegenHandler } from "../server/mod.ts"
import { InMemoryCache } from "../util/cache/memory.ts"
import { FsCache } from "../util/cache/mod.ts"
import { createDevnetsHandler, createTempDir } from "../nets/mod.ts"
import { createCodegenHandler, createCorsHandler, createErrorHandler } from "../server/mod.ts"
import { FsCache, InMemoryCache } from "../util/cache/mod.ts"
import { gracefulExit } from "../util/mod.ts"
import { resolveConfig } from "./resolveConfig.ts"

Expand Down
3 changes: 1 addition & 2 deletions cli/sync.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as flags from "../deps/std/flags.ts"
import { blue, gray } from "../deps/std/fmt/colors.ts"
import { assertEquals } from "../deps/std/testing/asserts.ts"
import { createTempDir } from "../devnets/createTempDir.ts"
import { syncConfig } from "../devnets/mod.ts"
import { createTempDir, syncConfig } from "../nets/mod.ts"
import { normalizePackageName } from "../util/mod.ts"
import { resolveConfig } from "./resolveConfig.ts"

Expand Down
20 changes: 10 additions & 10 deletions examples/nfts.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
MintSettings,
MintType,
PalletNftsEvent,
rococoDevWestmint,
RuntimeEvent,
westmint,
} from "@capi/rococo-dev-westmint"
import { assertEquals } from "asserts"
import { $, createDevUsers, Rune } from "capi"
Expand All @@ -23,7 +23,7 @@ import { signature } from "capi/patterns/signature/statemint.ts"
const { alexa, billy } = await createDevUsers()

/// Create a collection and get the resulting events.
const createEvents = await westmint.Nfts
const createEvents = await rococoDevWestmint.Nfts
.create({
config: CollectionConfig({
settings: DefaultCollectionSetting.AllOff,
Expand Down Expand Up @@ -58,7 +58,7 @@ console.log("Collection id:", collection)
const item = 46

/// Mint an item to the collection.
await westmint.Nfts
await rococoDevWestmint.Nfts
.mint({
collection,
item,
Expand All @@ -70,7 +70,7 @@ await westmint.Nfts
.finalized()
.run()

const owner = westmint.Nfts.Item
const owner = rococoDevWestmint.Nfts.Item
.value([collection, item])
.unhandle(undefined)
.access("owner")
Expand All @@ -88,12 +88,12 @@ assertEquals(initialOwner, alexa.publicKey)
/// 2. Prevent further minting.
/// 3. Lock the collection to prevent changes.
const price = 1000000n
await westmint.Utility
await rococoDevWestmint.Utility
.batchAll({
calls: Rune.array([
westmint.Nfts.setPrice({ collection, item, price }),
westmint.Nfts.setCollectionMaxSupply({ collection, maxSupply: 1 }),
westmint.Nfts.lockCollection({ collection, lockSettings: 8n }), /// TODO: enum helper
rococoDevWestmint.Nfts.setPrice({ collection, item, price }),
rococoDevWestmint.Nfts.setCollectionMaxSupply({ collection, maxSupply: 1 }),
rococoDevWestmint.Nfts.lockCollection({ collection, lockSettings: 8n }), /// TODO: enum helper
]),
})
.signed(signature({ sender: alexa }))
Expand All @@ -103,7 +103,7 @@ await westmint.Utility
.run()

/// Retrieve the price of the NFT.
const bidPrice = await westmint.Nfts.ItemPriceOf
const bidPrice = await rococoDevWestmint.Nfts.ItemPriceOf
.value([collection, item])
.unhandle(undefined)
.access(0)
Expand All @@ -114,7 +114,7 @@ console.log(bidPrice)
assertEquals(price, bidPrice)

/// Buy the NFT as Billy.
await westmint.Nfts
await rococoDevWestmint.Nfts
.buyItem({ collection, item, bidPrice })
.signed(signature({ sender: billy }))
.sent()
Expand Down
2 changes: 1 addition & 1 deletion mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ export { BitSequence } from "./deps/scale.ts"
// moderate --exclude main.ts nets.ts server util

export * from "./crypto/mod.ts"
export * from "./devnets/mod.ts"
export * from "./fluent/mod.ts"
export * from "./frame_metadata/mod.ts"
export * from "./nets/mod.ts"
export * from "./rpc/mod.ts"
export * from "./rune/mod.ts"
export * from "./scale_info/mod.ts"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5336294

Please sign in to comment.