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

chore: simplify import mapping #431

Merged
merged 2 commits into from
Nov 23, 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
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"deno.codeLens.testArgs": ["--no-check=remote", "-A", "-L=info"],
"deno.config": "./deno.jsonc",
"deno.importMap": "./import_map_cache.json",
"deno.importMap": "./import_map.json",
"deno.suggest.imports.hosts": {
"https://deno.land": true,
"https://x.nest.land": true,
Expand Down
7 changes: 4 additions & 3 deletions deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"noUncheckedIndexedAccess": true,
"useUnknownInCatchVariables": true
},
"importMap": "import_map.json",
"lint": {
"files": {
"exclude": ["target", "codegen/_output"],
Expand All @@ -27,15 +28,15 @@
},
"include": ["."],
"tasks": {
"run": "deno run -A --no-lock --import-map=import_map_cache.json",
"run": "deno run -A --no-lock",
"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",
"udd": "deno task star && deno task run https://deno.land/x/[email protected]/main.ts target/star.ts",
"dnt": "deno task run _tasks/dnt.ts",
"star": "deno task run _tasks/star.ts && deno cache --check --no-lock --import-map=import_map_cache.json target/star.ts",
"star": "deno task run _tasks/star.ts && deno cache --check --no-lock target/star.ts",
"lint": "deno lint",
"codegen": "deno task run cache.ts --no-lock --import-map=import_map_localhost.json examples/mod.ts",
"codegen": "deno task run cache.ts --no-lock examples/mod.ts",
"test": "deno task run test_util/ctx.ts -- deno test -A --no-lock -L=info --ignore=target --parallel",
"test:update": "deno task test -- -- --update",
"mdbook:watch": "mdbook watch -o",
Expand Down
6 changes: 3 additions & 3 deletions examples/balance.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as T from "#capi/test_util/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as T from "http://localhost:5646/@local/test_util/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

import { System } from "#capi/proxy/dev:polkadot/@v0.9.31/pallets/mod.ts"
import { System } from "http://localhost:5646/@local/proxy/dev:polkadot/@v0.9.31/pallets/mod.ts"

const root = System.Account.entry(T.alice.publicKey).read()

Expand Down
13 changes: 8 additions & 5 deletions examples/batch.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import * as C from "#capi/mod.ts"
import * as T from "#capi/test_util/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as T from "http://localhost:5646/@local/test_util/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

import { extrinsic } from "#capi/proxy/dev:westend/@v0.9.31/mod.ts"
import { Balances, Utility } from "#capi/proxy/dev:westend/@v0.9.31/pallets/mod.ts"
import { extrinsic } from "http://localhost:5646/@local/proxy/dev:westend/@v0.9.31/mod.ts"
import {
Balances,
Utility,
} from "http://localhost:5646/@local/proxy/dev:westend/@v0.9.31/pallets/mod.ts"

// TODO: uncomment these lines / use env upon solving `count` in zones
// const getBalances = C.Z.ls(
Expand Down
4 changes: 2 additions & 2 deletions examples/derived.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as C from "#capi/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

const ids = C.entryRead(C.polkadot)("Paras", "Parachains", [])
.access("value")
Expand Down
6 changes: 3 additions & 3 deletions examples/fee_estimate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as T from "#capi/test_util/mod.ts"
import * as T from "http://localhost:5646/@local/test_util/mod.ts"

import { extrinsic } from "#capi/proxy/dev:westend/@v0.9.31/mod.ts"
import { Balances } from "#capi/proxy/dev:westend/@v0.9.31/pallets/mod.ts"
import { extrinsic } from "http://localhost:5646/@local/proxy/dev:westend/@v0.9.31/mod.ts"
import { Balances } from "http://localhost:5646/@local/proxy/dev:westend/@v0.9.31/pallets/mod.ts"

const tx = extrinsic({
sender: T.alice.address,
Expand Down
4 changes: 2 additions & 2 deletions examples/first_ten_keys.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as U from "#capi/util/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

import { System } from "#capi/proxy/dev:polkadot/@v0.9.31/pallets/mod.ts"
import { System } from "http://localhost:5646/@local/proxy/dev:polkadot/@v0.9.31/pallets/mod.ts"

const root = System.Account.keys().readPage(10)

Expand Down
6 changes: 3 additions & 3 deletions examples/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as C from "#capi/mod.ts"
import * as T from "#capi/test_util/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as T from "http://localhost:5646/@local/test_util/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

const root = C.metadata(T.polkadot)()

Expand Down
14 changes: 9 additions & 5 deletions examples/multisig_transfer.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import * as C from "#capi/mod.ts"
import * as T from "#capi/test_util/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as T from "http://localhost:5646/@local/test_util/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

import { extrinsic } from "#capi/proxy/dev:polkadot/@v0.9.31/mod.ts"
import { Balances, Multisig, System } from "#capi/proxy/dev:polkadot/@v0.9.31/pallets/mod.ts"
import { extrinsic } from "http://localhost:5646/@local/proxy/dev:polkadot/@v0.9.31/mod.ts"
import {
Balances,
Multisig,
System,
} from "http://localhost:5646/@local/proxy/dev:polkadot/@v0.9.31/pallets/mod.ts"

// FIXME: remove this check once the Zones .bind(env) fix is merged
const hostname = Deno.env.get("TEST_CTX_HOSTNAME")
Expand Down
6 changes: 3 additions & 3 deletions examples/polkadot_js_signer.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createTestPairs } from "https://deno.land/x/[email protected]/keyring/mod.ts"
import { TypeRegistry } from "https://deno.land/x/[email protected]/types/mod.ts"

import * as C from "#capi/mod.ts"
import * as T from "#capi/test_util/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as T from "http://localhost:5646/@local/test_util/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

const root = C.extrinsic(T.westend)({
sender: T.alice.address,
Expand Down
2 changes: 1 addition & 1 deletion examples/raw_rpc_client_call.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as T from "#capi/test_util/mod.ts"
import * as T from "http://localhost:5646/@local/test_util/mod.ts"

const client = await T.westend.client

Expand Down
4 changes: 2 additions & 2 deletions examples/raw_rpc_client_subscription.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertNotInstanceOf } from "#capi/deps/std/testing/asserts.ts"
import * as T from "#capi/test_util/mod.ts"
import { assertNotInstanceOf } from "http://localhost:5646/@local/deps/std/testing/asserts.ts"
import * as T from "http://localhost:5646/@local/test_util/mod.ts"

const client = await T.polkadot.client

Expand Down
6 changes: 3 additions & 3 deletions examples/read_block.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as C from "#capi/mod.ts"
import * as T from "#capi/test_util/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as T from "http://localhost:5646/@local/test_util/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

const extrinsicsRaw = C.chain.getBlock(C.polkadot)()
.access("block")
Expand Down
6 changes: 3 additions & 3 deletions examples/read_bonded.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as C from "#capi/mod.ts"
import * as T from "#capi/test_util/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as T from "http://localhost:5646/@local/test_util/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

const aliceBonded = C.entryRead(T.polkadot)("Staking", "Bonded", [T.aliceStash.publicKey])

Expand Down
4 changes: 2 additions & 2 deletions examples/read_era_rewards.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as C from "#capi/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

const idx = C.entryRead(C.westend)("Staking", "ActiveEra", [])
.access("value")
Expand Down
4 changes: 2 additions & 2 deletions examples/read_events.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as C from "#capi/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

const root = C.entryRead(C.polkadot)("System", "Events", [])

Expand Down
4 changes: 2 additions & 2 deletions examples/rpc_call.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as C from "#capi/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

const root = C.rpcCall<[], string[]>("rpc_methods")(C.polkadot)()

Expand Down
6 changes: 3 additions & 3 deletions examples/rpc_subscription.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as C from "#capi/mod.ts"
import * as T from "#capi/test_util/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as T from "http://localhost:5646/@local/test_util/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

const root = C.chain.subscribeNewHeads(T.polkadot)([], (ctx) => {
let i = 0
Expand Down
6 changes: 3 additions & 3 deletions examples/ticker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as C from "#capi/mod.ts"
import * as T from "#capi/test_util/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as T from "http://localhost:5646/@local/test_util/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

const root = C.entryWatch(T.polkadot)("Timestamp", "Now", [], (ctx) => {
let i = 0
Expand Down
10 changes: 5 additions & 5 deletions examples/transfer.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as C from "#capi/mod.ts"
import * as T from "#capi/test_util/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as T from "http://localhost:5646/@local/test_util/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

import { extrinsic } from "#capi/proxy/dev:westend/@v0.9.31/mod.ts"
import { Balances } from "#capi/proxy/dev:westend/@v0.9.31/pallets/mod.ts"
import { extrinsic } from "http://localhost:5646/@local/proxy/dev:westend/@v0.9.31/mod.ts"
import { Balances } from "http://localhost:5646/@local/proxy/dev:westend/@v0.9.31/pallets/mod.ts"

const tx = extrinsic({
sender: T.alice.address,
Expand Down
4 changes: 2 additions & 2 deletions examples/watch_blocks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as C from "#capi/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

const extrinsicsDecoded = C.extrinsicsDecoded(C.polkadot)

Expand Down
4 changes: 2 additions & 2 deletions examples/watch_events.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as C from "#capi/mod.ts"
import * as U from "#capi/util/mod.ts"
import * as C from "http://localhost:5646/@local/mod.ts"
import * as U from "http://localhost:5646/@local/util/mod.ts"

const root = C.entryWatch(C.rococo)("System", "Events", [], (ctx) => {
let i = 0
Expand Down
12 changes: 12 additions & 0 deletions import_map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"scopes": {
"examples/": {
"http://localhost:5646/@local/": "./",
"http://localhost:5646/@local/proxy/": "http://localhost:5646/@local/proxy/"
},
"http://localhost:5646/@local/": {
"http://localhost:5646/@local/": "./",
"http://localhost:5646/@local/proxy/": "http://localhost:5646/@local/proxy/"
}
}
}
11 changes: 0 additions & 11 deletions import_map_cache.json

This file was deleted.

7 changes: 0 additions & 7 deletions import_map_localhost.json

This file was deleted.