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

chore: import map pattern imports in examples to align with node equivalent #1018

Closed
wants to merge 4 commits into from
Closed
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
3 changes: 2 additions & 1 deletion _tasks/dnt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const allFiles = []
for await (
const { path } of fs.walkSync(".", {
exts: [".ts"],
skip: [/\.test\.ts$/, /^(target|_tasks|examples)\//],
skip: [/\.test\.ts$/, /^(target|_tasks)\//],
includeDirs: false,
})
) allFiles.push(`./${path}`)
Expand Down Expand Up @@ -63,6 +63,7 @@ await Promise.all([
}),
),
},
importMap: "./_tasks/dnt_import_map.json",
compilerOptions: {
importHelpers: true,
sourceMap: true,
Expand Down
5 changes: 5 additions & 0 deletions _tasks/dnt_import_map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"asserts": "../deps/std/testing/asserts.ts"
}
}
2 changes: 1 addition & 1 deletion examples/blocks.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { $eventRecord, metadata, polkadot } from "@capi/polkadot"
import { $, $extrinsic, known, Rune } from "capi"
import { babeBlockAuthor } from "capi/patterns/consensus/mod.ts"
import { babeBlockAuthor } from "capi/patterns/consensus"

/// Reference the latest block hash.
const blockHash = polkadot.blockHash()
Expand Down
2 changes: 1 addition & 1 deletion examples/dev/storage_sizes.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import { polkadotDev } from "@capi/polkadot-dev"
import { $ } from "capi"
import { storageSizes } from "capi/patterns/storage_sizes.ts"
import { storageSizes } from "capi/patterns/storage_sizes"

/// Use the storageSizes factory to produce a Rune. Then execute it.
const sizes = await storageSizes(polkadotDev).run()
Expand Down
4 changes: 2 additions & 2 deletions examples/ink/deploy.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import { contractsDev } from "@capi/contracts-dev"
import { $, createDevUsers, hex, Sr25519, ss58 } from "capi"
import { InkMetadataRune } from "capi/patterns/ink/mod.ts"
import { signature } from "capi/patterns/signature/polkadot.ts"
import { InkMetadataRune } from "capi/patterns/ink"
import { signature } from "capi/patterns/signature/polkadot"

/// Initialize an `InkMetadataRune` with the raw Ink metadata text.
const metadata = InkMetadataRune.fromMetadataText(
Expand Down
4 changes: 2 additions & 2 deletions examples/ink/interact.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import { contractsDev } from "@capi/contracts-dev"
import { assert } from "asserts"
import { $, createDevUsers, hex } from "capi"
import { InkMetadataRune } from "capi/patterns/ink/mod.ts"
import { signature } from "capi/patterns/signature/polkadot.ts"
import { InkMetadataRune } from "capi/patterns/ink"
import { signature } from "capi/patterns/signature/polkadot"

/// Get two test users. Alexa will deploy, Billy will be the recipient of an erc20
/// token transfer.
Expand Down
4 changes: 2 additions & 2 deletions examples/misc/identity.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import { polkadotDev } from "@capi/polkadot-dev"
import { $, createDevUsers } from "capi"
import { IdentityInfoTranscoders } from "capi/patterns/identity.ts"
import { signature } from "capi/patterns/signature/polkadot.ts"
import { IdentityInfoTranscoders } from "capi/patterns/identity"
import { signature } from "capi/patterns/signature/polkadot"

const { alexa } = await createDevUsers()

Expand Down
2 changes: 1 addition & 1 deletion examples/misc/indices.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { polkadotDev } from "@capi/polkadot-dev"
import { assertEquals } from "asserts"
import { createDevUsers } from "capi"
import { signature } from "capi/patterns/signature/polkadot.ts"
import { signature } from "capi/patterns/signature/polkadot"

const { alexa } = await createDevUsers()

Expand Down
4 changes: 2 additions & 2 deletions examples/multisig/basic.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import { polkadotDev } from "@capi/polkadot-dev"
import { assert } from "asserts"
import { $, createDevUsers } from "capi"
import { MultisigRune } from "capi/patterns/multisig/mod.ts"
import { signature } from "capi/patterns/signature/polkadot.ts"
import { MultisigRune } from "capi/patterns/multisig"
import { signature } from "capi/patterns/signature/polkadot"

const { alexa, billy, carol, david } = await createDevUsers()

Expand Down
6 changes: 3 additions & 3 deletions examples/multisig/stash.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import { MultiAddress, polkadotDev } from "@capi/polkadot-dev"
import { assert } from "asserts"
import { createDevUsers } from "capi"
import { MultisigRune } from "capi/patterns/multisig/mod.ts"
import { filterPureCreatedEvents } from "capi/patterns/proxy/mod.ts"
import { signature } from "capi/patterns/signature/polkadot.ts"
import { MultisigRune } from "capi/patterns/multisig"
import { filterPureCreatedEvents } from "capi/patterns/proxy"
import { signature } from "capi/patterns/signature/polkadot"

const { alexa, billy, carol } = await createDevUsers()

Expand Down
4 changes: 2 additions & 2 deletions examples/multisig/virtual.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import { MultiAddress, polkadotDev } from "@capi/polkadot-dev"
import { assert } from "asserts"
import { $, createDevUsers, Rune, Sr25519 } from "capi"
import { VirtualMultisigRune } from "capi/patterns/multisig/mod.ts"
import { signature } from "capi/patterns/signature/polkadot.ts"
import { VirtualMultisigRune } from "capi/patterns/multisig"
import { signature } from "capi/patterns/signature/polkadot"
import { parse } from "../../deps/std/flags.ts"

const { alexa, billy, carol, david } = await createDevUsers()
Expand Down
4 changes: 2 additions & 2 deletions examples/nfts.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import {
} from "@capi/rococo-dev-westmint"
import { assertEquals } from "asserts"
import { $, createDevUsers, Rune } from "capi"
import { DefaultCollectionSetting, DefaultItemSetting } from "capi/patterns/nfts.ts"
import { signature } from "capi/patterns/signature/statemint.ts"
import { DefaultCollectionSetting, DefaultItemSetting } from "capi/patterns/nfts"
import { signature } from "capi/patterns/signature/statemint"

/// Create two dev users. Alexa will mint and list the NFT. Billy will purchase it.
const { alexa, billy } = await createDevUsers()
Expand Down
2 changes: 1 addition & 1 deletion examples/sign/ed25519.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { MultiAddress, westendDev } from "@capi/westend-dev"
import { assert } from "asserts"
import { createDevUsers, ExtrinsicSender } from "capi"
import { signature } from "capi/patterns/signature/polkadot.ts"
import { signature } from "capi/patterns/signature/polkadot"
import * as ed from "../../deps/ed25519.ts"

const { alexa, billy } = await createDevUsers()
Expand Down
2 changes: 1 addition & 1 deletion examples/sign/offline.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { $runtimeCall, westendDev } from "@capi/westend-dev"
import { $, createDevUsers, SignedExtrinsicRune } from "capi"
import { signature } from "capi/patterns/signature/polkadot.ts"
import { signature } from "capi/patterns/signature/polkadot"

const { alexa, billy } = await createDevUsers()

Expand Down
4 changes: 2 additions & 2 deletions examples/sign/pjs.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import { polkadotDev } from "@capi/polkadot-dev"
import { createDevUsers, ss58 } from "capi"
import { pjsSender, PjsSigner } from "capi/patterns/compat/pjs_sender.ts"
import { signature } from "capi/patterns/signature/polkadot.ts"
import { pjsSender, PjsSigner } from "capi/patterns/compat/pjs_sender"
import { signature } from "capi/patterns/signature/polkadot"
import { createPair } from "https://deno.land/x/[email protected]/keyring/mod.ts"
import { TypeRegistry } from "https://deno.land/x/[email protected]/types/mod.ts"

Expand Down
2 changes: 1 addition & 1 deletion examples/tx/balances_transfer.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { westendDev } from "@capi/westend-dev"
import { assert } from "asserts"
import { createDevUsers } from "capi"
import { signature } from "capi/patterns/signature/polkadot.ts"
import { signature } from "capi/patterns/signature/polkadot"

/// Create two dev users. Alexa will send the funds to Billy.
const { alexa, billy } = await createDevUsers()
Expand Down
2 changes: 1 addition & 1 deletion examples/tx/handle_errors.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { contractsDev } from "@capi/contracts-dev"
import { assertInstanceOf } from "asserts"
import { createDevUsers, ExtrinsicError } from "capi"
import { signature } from "capi/patterns/signature/polkadot.ts"
import { signature } from "capi/patterns/signature/polkadot"

const { alexa, billy } = await createDevUsers()

Expand Down
2 changes: 1 addition & 1 deletion examples/tx/utility_batch.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { westendDev } from "@capi/westend-dev"
import { assert } from "asserts"
import { createDevUsers, Rune } from "capi"
import { signature } from "capi/patterns/signature/polkadot.ts"
import { signature } from "capi/patterns/signature/polkadot"

/// Create four dev users, one of whom will be the batch sender. The other
/// three will be recipients of balance transfers described in the batch.
Expand Down
2 changes: 1 addition & 1 deletion examples/xcm/asset_teleportation.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from "@capi/rococo-dev-westmint"
import { assert } from "asserts"
import { createDevUsers, Rune } from "capi"
import { signature } from "capi/patterns/signature/polkadot.ts"
import { signature } from "capi/patterns/signature/polkadot"

const { alexa } = await createDevUsers()

Expand Down
4 changes: 2 additions & 2 deletions examples/xcm/reserve_transfer.eg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import {
import { rococoDevXcmTrappist } from "@capi/rococo-dev-xcm-trappist"
import { assert, assertNotEquals } from "asserts"
import { $, alice as root, createDevUsers, Rune, ValueRune } from "capi"
import { $siblId } from "capi/patterns/para_id.ts"
import { signature } from "capi/patterns/signature/statemint.ts"
import { $siblId } from "capi/patterns/para_id"
import { signature } from "capi/patterns/signature/statemint"
import { retry } from "../../deps/std/async.ts"

const { alexa, billy } = await createDevUsers()
Expand Down
12 changes: 11 additions & 1 deletion import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@
"examples/": {
"asserts": "./deps/std/testing/asserts.ts",
"capi": "./mod.ts",
"capi/patterns/": "./patterns/"
"capi/patterns/compat/pjs_sender": "./patterns/compat/pjs_sender.ts",
"capi/patterns/consensus": "./patterns/consensus/mod.ts",
"capi/patterns/identity": "./patterns/identity.ts",
"capi/patterns/ink": "./patterns/ink/mod.ts",
"capi/patterns/multisig": "./patterns/multisig/mod.ts",
"capi/patterns/nfts": "./patterns/nfts.ts",
"capi/patterns/para_id": "./patterns/para_id.ts",
"capi/patterns/proxy": "./patterns/proxy/mod.ts",
"capi/patterns/signature/polkadot": "./patterns/signature/polkadot.ts",
"capi/patterns/signature/statemint": "./patterns/signature/statemint.ts",
"capi/patterns/storage_sizes": "./patterns/storage_sizes.ts"
},
"http://localhost:4646/": {
"http://localhost:4646/capi/": "./"
Expand Down
1 change: 1 addition & 0 deletions words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ chelios
chev
childstate
codegen
compat
concat
deno
denoland
Expand Down