From 325eddc40cef8aa74b1c66b4d8797797c7cb79fd Mon Sep 17 00:00:00 2001 From: Harry Solovay Date: Thu, 15 Jun 2023 12:13:40 -0400 Subject: [PATCH 1/5] refactor with unstable dir for patterns --- examples/blocks.eg.ts | 3 +-- examples/dev/dev_users.eg.ts | 1 - examples/dev/metadata.eg.ts | 3 --- examples/dev/storage_sizes.eg.ts | 3 +-- examples/dynamic.eg.ts | 1 - examples/ink/deploy.eg.ts | 10 +++++----- examples/ink/interact.eg.ts | 6 +++--- examples/misc/identity.eg.ts | 8 ++++---- examples/misc/indices.eg.ts | 1 - examples/multisig/basic.eg.ts | 1 - examples/multisig/stash.eg.ts | 3 +-- examples/multisig/virtual.eg.ts | 1 - examples/nfts.eg.ts | 3 +-- examples/paginate.eg.ts | 1 - examples/raw_rpc/call.eg.ts | 1 - examples/raw_rpc/subscription.eg.ts | 1 - examples/read/account_info.eg.ts | 1 - examples/read/era_reward_points.eg.ts | 1 - examples/read/now.eg.ts | 1 - examples/read/para_heads.eg.ts | 1 - examples/rune/collections.eg.ts | 1 - examples/rune/intro.eg.ts | 1 - examples/rune/subclassing.eg.ts | 1 - examples/rune/u_track.eg.ts | 1 - examples/sign/ed25519.eg.ts | 1 - examples/sign/offline.eg.ts | 1 - examples/sign/pjs.eg.ts | 1 - examples/smoldot/fetch_chainspec.eg.ts | 1 - examples/smoldot/smoldot.eg.ts | 4 +++- examples/tx/balances_transfer.eg.ts | 1 - examples/tx/handle_errors.eg.ts | 1 - examples/tx/utility_batch.eg.ts | 1 - examples/tx/weights_and_estimates.eg.ts | 1 - examples/watch.eg.ts | 1 - examples/xcm/asset_teleportation.eg.ts | 1 - examples/xcm/reserve_transfer.eg.ts | 1 - import_map.json | 12 ++++++------ patterns/multisig/VirtualMultisigRune.ts | 2 +- patterns/{ => unstable}/consensus/babeBlockAuthor.ts | 2 +- patterns/{ => unstable}/consensus/mod.ts | 0 .../{ => unstable}/consensus/preRuntimeDigest.ts | 2 +- patterns/{ => unstable}/identity.ts | 4 ++-- patterns/{ => unstable}/ink/InkMetadata.test.ts | 0 patterns/{ => unstable}/ink/InkMetadata.ts | 4 ++-- patterns/{ => unstable}/ink/InkMetadataRune.ts | 4 ++-- patterns/{ => unstable}/ink/InkRune.ts | 2 +- patterns/{ => unstable}/ink/codecs.ts | 2 +- patterns/{ => unstable}/ink/events.ts | 2 +- patterns/{ => unstable}/ink/mod.ts | 0 patterns/{ => unstable}/nfts.ts | 0 patterns/{ => unstable}/proxy/events.ts | 2 +- patterns/{ => unstable}/proxy/mod.ts | 0 .../{ => unstable}/proxy/replaceDelegateCalls.ts | 2 +- patterns/{ => unstable}/storage_sizes.ts | 4 ++-- 54 files changed, 41 insertions(+), 73 deletions(-) rename patterns/{ => unstable}/consensus/babeBlockAuthor.ts (98%) rename patterns/{ => unstable}/consensus/mod.ts (100%) rename patterns/{ => unstable}/consensus/preRuntimeDigest.ts (98%) rename patterns/{ => unstable}/identity.ts (97%) rename patterns/{ => unstable}/ink/InkMetadata.test.ts (100%) rename patterns/{ => unstable}/ink/InkMetadata.ts (96%) rename patterns/{ => unstable}/ink/InkMetadataRune.ts (98%) rename patterns/{ => unstable}/ink/InkRune.ts (99%) rename patterns/{ => unstable}/ink/codecs.ts (98%) rename patterns/{ => unstable}/ink/events.ts (97%) rename patterns/{ => unstable}/ink/mod.ts (100%) rename patterns/{ => unstable}/nfts.ts (100%) rename patterns/{ => unstable}/proxy/events.ts (89%) rename patterns/{ => unstable}/proxy/mod.ts (100%) rename patterns/{ => unstable}/proxy/replaceDelegateCalls.ts (94%) rename patterns/{ => unstable}/storage_sizes.ts (86%) diff --git a/examples/blocks.eg.ts b/examples/blocks.eg.ts index 5a91dd573..d1b5608df 100644 --- a/examples/blocks.eg.ts +++ b/examples/blocks.eg.ts @@ -1,6 +1,5 @@ /** * @title Blocks - * @stability nearing * @description Utilize Capi's fluent API to turn a block reference (in this * case the retrieved latest finalized block hash) into a block. Then access * various pieces of data pertaining to that block. @@ -8,7 +7,7 @@ import { $eventRecord, metadata, polkadot } from "@capi/polkadot" import { $, $extrinsic, known, Rune, Scope } from "capi" -import { babeBlockAuthor } from "capi/patterns/consensus" +import { babeBlockAuthor } from "capi/patterns/unstable/consensus" /// Reference the latest block hash. const blockHash = polkadot.blockHash() diff --git a/examples/dev/dev_users.eg.ts b/examples/dev/dev_users.eg.ts index d535d1449..33e66de6c 100644 --- a/examples/dev/dev_users.eg.ts +++ b/examples/dev/dev_users.eg.ts @@ -1,6 +1,5 @@ /** * @title Create Dev Users - * @stability nearing * @description When developing against a dev chain, the `createDevUsers` utility * provides `Sr25519` instances, which correspond to dev users who are pre-seeded with * funds. This simplifies signing extrinsics for submission to the given dev chain. diff --git a/examples/dev/metadata.eg.ts b/examples/dev/metadata.eg.ts index fc0c7e6fd..fc290a69e 100644 --- a/examples/dev/metadata.eg.ts +++ b/examples/dev/metadata.eg.ts @@ -1,8 +1,5 @@ /** * @title Retrieve Chain Metadata - * @stability unstable – We'll likely restructure the metadata such that we can use its - * type signature within a type utility to produce constraints over calls and events. - * Tracked in [881](https://github.com/paritytech/capi/issues/811). * @description The chain's metadata (formally-termed "FRAME Metadata") describes all * of its runtime properties, including storage, constants, callables, their types and * even plain-text descriptions. This metadata serves as the basis off of which we diff --git a/examples/dev/storage_sizes.eg.ts b/examples/dev/storage_sizes.eg.ts index d1889d38b..0d665c06a 100644 --- a/examples/dev/storage_sizes.eg.ts +++ b/examples/dev/storage_sizes.eg.ts @@ -1,6 +1,5 @@ /** * @title Determine Storage Sizes of Dev Chains - * @stability experiment * @description The `storageSizes` pattern produces a record––keyed by pallet * name––of storage sizes, keyed by storage name. It is unlikely that we'll ever * stabilize this pattern, as we don't want to abuse rpc nodes. That being said, @@ -9,7 +8,7 @@ import { polkadotDev } from "@capi/polkadot-dev" import { $, Scope } from "capi" -import { storageSizes } from "capi/patterns/storage_sizes" +import { storageSizes } from "capi/patterns/unstable/storage_sizes" /// Use the storageSizes factory to produce a Rune. Then execute it. const sizes = await storageSizes(polkadotDev).run(new Scope()) diff --git a/examples/dynamic.eg.ts b/examples/dynamic.eg.ts index 2a24356ba..38d07108c 100644 --- a/examples/dynamic.eg.ts +++ b/examples/dynamic.eg.ts @@ -1,6 +1,5 @@ /** * @title Dynamic Usage - * @stability nearing * @description You may want to write code whose target chain is unknown before * runtime. A common example of this is block explorers. Use cases such as this * are "dynamic" in that they require one to read the chain's metadata at runtime diff --git a/examples/ink/deploy.eg.ts b/examples/ink/deploy.eg.ts index 3446020ee..0670d9261 100644 --- a/examples/ink/deploy.eg.ts +++ b/examples/ink/deploy.eg.ts @@ -1,15 +1,15 @@ /** * @title Deploy an Ink Smart Contract - * @stability unstable – We intend to work on an Ink provider (for static codegen) - * in the near future. This work will likely entail large changes to the current ink patterns. - * @description Deploying an Ink contract (instantiating) to a production contracts-enabled parachain - * is much the same as any other extrinsic submission. + * @description Deploying an Ink contract (instantiating) to a production contracts-enabled + * parachain is much the same as any other extrinsic submission. + * @note we intend to work on an Ink provider (for static codegen) in the near future. + * This work will likely entail large changes to the current ink patterns. */ import { contractsDev } from "@capi/contracts-dev" import { $, createDevUsers, hex, Scope, Sr25519, ss58 } from "capi" -import { InkMetadataRune } from "capi/patterns/ink" import { signature } from "capi/patterns/signature/polkadot" +import { InkMetadataRune } from "capi/patterns/unstable/ink" /// Initialize an `InkMetadataRune` with the raw Ink metadata text. const metadata = InkMetadataRune.fromMetadataText( diff --git a/examples/ink/interact.eg.ts b/examples/ink/interact.eg.ts index 95c72f9e3..08cf51e9f 100644 --- a/examples/ink/interact.eg.ts +++ b/examples/ink/interact.eg.ts @@ -1,16 +1,16 @@ /** * @title Interact With An Ink Smart Contract - * @stability unstable – We intend to work on an Ink provider (for static codegen) - * in the near future. This work will likely entail large changes to the current ink patterns. * @description The Ink patterns simplify the reading of contract instance state and events, * as well as the submission of transactions. + * @note we intend to work on an Ink provider (for static codegen) in the near future. + * This work will likely entail large changes to the current ink patterns. */ import { contractsDev } from "@capi/contracts-dev" import { assert } from "asserts" import { $, createDevUsers, hex, Scope } from "capi" -import { InkMetadataRune } from "capi/patterns/ink" import { signature } from "capi/patterns/signature/polkadot" +import { InkMetadataRune } from "capi/patterns/unstable/ink" const scope = new Scope() diff --git a/examples/misc/identity.eg.ts b/examples/misc/identity.eg.ts index bbbbbc001..5046760f3 100644 --- a/examples/misc/identity.eg.ts +++ b/examples/misc/identity.eg.ts @@ -1,15 +1,15 @@ /** * @title Utilize The Identity Pallet With Fields - * @stability experiment it's unclear how useful the identity info transcoding - * is (or the identity pallet for that matter). We may decide we do not wish to - * maintain this utility. For now however, it's a good way to stress-test Rune. * @description Set a user's identity, potentially with metadata of arbitrary user-defined shape. + * @note It's unclear how useful the identity info transcoding is (or the identity pallet + * for that matter). We may decide we do not wish to maintain this utility. For now + * however, it's a good way to stress-test Rune. */ import { polkadotDev } from "@capi/polkadot-dev" import { $, createDevUsers, is, Scope } from "capi" -import { IdentityInfoTranscoders } from "capi/patterns/identity" import { signature } from "capi/patterns/signature/polkadot" +import { IdentityInfoTranscoders } from "capi/patterns/unstable/identity" const { alexa } = await createDevUsers() const scope = new Scope() diff --git a/examples/misc/indices.eg.ts b/examples/misc/indices.eg.ts index 0bb506fbc..a104cc05c 100644 --- a/examples/misc/indices.eg.ts +++ b/examples/misc/indices.eg.ts @@ -1,6 +1,5 @@ /** * @title Reserve an Index - * @stability nearing * @description Reserve an index using the indices pallet. Then retrieve * the user's account id using the index. */ diff --git a/examples/multisig/basic.eg.ts b/examples/multisig/basic.eg.ts index ce94b99c0..bb214ee8c 100644 --- a/examples/multisig/basic.eg.ts +++ b/examples/multisig/basic.eg.ts @@ -1,6 +1,5 @@ /** * @title Multisig Transfer - * @stability unstable * @description Create a multisig account and ratify a vote to execute a transfer from * that multisig. */ diff --git a/examples/multisig/stash.eg.ts b/examples/multisig/stash.eg.ts index 18b3310a0..cd16babff 100644 --- a/examples/multisig/stash.eg.ts +++ b/examples/multisig/stash.eg.ts @@ -1,6 +1,5 @@ /** * @title Multisig Administration of Pure Proxy Stash - * @stability unstable * @description Administrate a stash account (pure proxy) through a multisig with * three signatories. */ @@ -9,8 +8,8 @@ import { MultiAddress, polkadotDev } from "@capi/polkadot-dev" import { assert } from "asserts" import { createDevUsers, is, Scope } from "capi" import { MultisigRune } from "capi/patterns/multisig" -import { filterPureCreatedEvents } from "capi/patterns/proxy" import { signature } from "capi/patterns/signature/polkadot" +import { filterPureCreatedEvents } from "capi/patterns/unstable/proxy" const { alexa, billy, carol } = await createDevUsers() const scope = new Scope() diff --git a/examples/multisig/virtual.eg.ts b/examples/multisig/virtual.eg.ts index b7f507f39..8b2b2a44b 100644 --- a/examples/multisig/virtual.eg.ts +++ b/examples/multisig/virtual.eg.ts @@ -1,6 +1,5 @@ /** * @title Virtual Multisig - * @stability unstable * @description Virtual multisigs simulate an editable multisig. The onchain correlates include: * * 1. Pure proxies for/administrated by each of the members. diff --git a/examples/nfts.eg.ts b/examples/nfts.eg.ts index 1669f7fb5..a6da90e22 100644 --- a/examples/nfts.eg.ts +++ b/examples/nfts.eg.ts @@ -1,6 +1,5 @@ /** * @title NFTs - * @stability unstable * @description An example using the upcoming NFTs pallet to create an NFT collection, * mint, list and purchase an NFT, as well as lock the collection and NFT as to prevent. * @test_skip @@ -16,8 +15,8 @@ import { } from "@capi/rococo-dev-westmint" import { assertEquals } from "asserts" import { $, createDevUsers, is, Rune, Scope } from "capi" -import { DefaultCollectionSetting, DefaultItemSetting } from "capi/patterns/nfts" import { signature } from "capi/patterns/signature/statemint" +import { DefaultCollectionSetting, DefaultItemSetting } from "capi/patterns/unstable/nfts" const scope = new Scope() diff --git a/examples/paginate.eg.ts b/examples/paginate.eg.ts index 2c0d60698..38254a001 100644 --- a/examples/paginate.eg.ts +++ b/examples/paginate.eg.ts @@ -1,6 +1,5 @@ /** * @title Paginate - * @stability unstable * @description Read pages (either of keys or entries) from storage maps. */ diff --git a/examples/raw_rpc/call.eg.ts b/examples/raw_rpc/call.eg.ts index d2bc01bbf..807d47f87 100644 --- a/examples/raw_rpc/call.eg.ts +++ b/examples/raw_rpc/call.eg.ts @@ -1,6 +1,5 @@ /** * @title Raw RPC Call Usage - * @stability nearing * @description Interact directly with the RPC node's call methods. */ diff --git a/examples/raw_rpc/subscription.eg.ts b/examples/raw_rpc/subscription.eg.ts index 656115d69..8d35a08c4 100644 --- a/examples/raw_rpc/subscription.eg.ts +++ b/examples/raw_rpc/subscription.eg.ts @@ -1,6 +1,5 @@ /** * @title Raw RPC Subscription Usage - * @stability nearing * @description Interact directly with the RPC node's subscription methods. */ diff --git a/examples/read/account_info.eg.ts b/examples/read/account_info.eg.ts index 3df1be8b5..7140a544c 100644 --- a/examples/read/account_info.eg.ts +++ b/examples/read/account_info.eg.ts @@ -1,6 +1,5 @@ /** * @title Read a Map Value - * @stability nearing * @description Read the value (an `AccountInfo`) from the system account map. */ diff --git a/examples/read/era_reward_points.eg.ts b/examples/read/era_reward_points.eg.ts index 982f4c194..8197db693 100644 --- a/examples/read/era_reward_points.eg.ts +++ b/examples/read/era_reward_points.eg.ts @@ -1,6 +1,5 @@ /** * @title Read The Era Reward Points - * @stability nearing * @description Model a derived read, in which one piece of storage (the staking * active era index)is used as the key to another piece of storage (the corresponding * reward points). diff --git a/examples/read/now.eg.ts b/examples/read/now.eg.ts index 78fdd3f64..b2874a2d0 100644 --- a/examples/read/now.eg.ts +++ b/examples/read/now.eg.ts @@ -1,6 +1,5 @@ /** * @title Current Agreed-Upon Time - * @stability nearing * @description Read the current timestamp as agreed upon by validators. */ diff --git a/examples/read/para_heads.eg.ts b/examples/read/para_heads.eg.ts index fe8b92ffa..9c8d493b0 100644 --- a/examples/read/para_heads.eg.ts +++ b/examples/read/para_heads.eg.ts @@ -1,6 +1,5 @@ /** * @title Derived-Read a List - * @stability nearing * @description Model a derived read, in which a list in storage (parachain ids) * is retrieved and its elements used to key to another piece of storage * (the corresponding parachain heads). diff --git a/examples/rune/collections.eg.ts b/examples/rune/collections.eg.ts index 982ce4871..629d4b395 100644 --- a/examples/rune/collections.eg.ts +++ b/examples/rune/collections.eg.ts @@ -1,6 +1,5 @@ /** * @title Rune Collections - * @stability nearing * @description Parallelize resolution and collect results. */ diff --git a/examples/rune/intro.eg.ts b/examples/rune/intro.eg.ts index b7378d090..4ff99825d 100644 --- a/examples/rune/intro.eg.ts +++ b/examples/rune/intro.eg.ts @@ -1,6 +1,5 @@ /** * @title Rune Intro - * @stability nearing * @description Runes are our units of composition in Capi. A Rune can be thought of * as an interaction *component*. It is a lazy description of our data requirements. * Runes can model storage retrievals, conditional transaction pipelines and more. diff --git a/examples/rune/subclassing.eg.ts b/examples/rune/subclassing.eg.ts index 06b03f371..a8f8a05b5 100644 --- a/examples/rune/subclassing.eg.ts +++ b/examples/rune/subclassing.eg.ts @@ -1,6 +1,5 @@ /** * @title Rune Subclassing - * @stability nearing * @description Define a subclass (set of type-specific utilities), from which * any compatibly-typed Rune can adopt the subclass-defined fluent API. */ diff --git a/examples/rune/u_track.eg.ts b/examples/rune/u_track.eg.ts index 8b68f8101..1b4d8048d 100644 --- a/examples/rune/u_track.eg.ts +++ b/examples/rune/u_track.eg.ts @@ -1,6 +1,5 @@ /** * @title Rune U Track - * @stability nearing * @description The `U` track allows for values such as errors and empty options * to be moved in and out of your purview. This can drastically simplify branching, * such as error recovery. diff --git a/examples/sign/ed25519.eg.ts b/examples/sign/ed25519.eg.ts index ffd8387ec..812885d26 100644 --- a/examples/sign/ed25519.eg.ts +++ b/examples/sign/ed25519.eg.ts @@ -1,6 +1,5 @@ /** * @title Ed25519 Signatures - * @stability nearing * @description Utilize an Ed25519 library for signing. */ diff --git a/examples/sign/offline.eg.ts b/examples/sign/offline.eg.ts index 7ef4234d0..62cc7d65e 100644 --- a/examples/sign/offline.eg.ts +++ b/examples/sign/offline.eg.ts @@ -1,6 +1,5 @@ /** * @title Offline Signing - * @stability nearing * @description Create and sign an extrinsic, then serialize it into a hex for later use. * Finally, rehydrate the extrinsic and submit it. */ diff --git a/examples/sign/pjs.eg.ts b/examples/sign/pjs.eg.ts index f8076e055..2ccb1b4e1 100644 --- a/examples/sign/pjs.eg.ts +++ b/examples/sign/pjs.eg.ts @@ -1,6 +1,5 @@ /** * @title Polkadot-JS Signature Compatibility - * @stability nearing * @description Utilize a Polkadot-JS signer (such as from a browser wallet * extension) to sign a Capi extrinsic. */ diff --git a/examples/smoldot/fetch_chainspec.eg.ts b/examples/smoldot/fetch_chainspec.eg.ts index cb0833154..1e0f11871 100644 --- a/examples/smoldot/fetch_chainspec.eg.ts +++ b/examples/smoldot/fetch_chainspec.eg.ts @@ -1,6 +1,5 @@ /** * @title Fetch Chainspec - * @stability nearing * @description Connecting with Smoldot requires a chainspec, which needs to be * initially fetched from a wss server. This chain spec can be saved and used to * connect to the chain in the future. diff --git a/examples/smoldot/smoldot.eg.ts b/examples/smoldot/smoldot.eg.ts index 3861a4414..369ed04c8 100644 --- a/examples/smoldot/smoldot.eg.ts +++ b/examples/smoldot/smoldot.eg.ts @@ -1,9 +1,11 @@ /** * @title Smoldot Connection - * @stability nearing * @description Smoldot enables users to run a tiny node in their browser, * such that they can connect directly to the network(s) without going through * a centralized intermediary. This is the future of unstoppable applications. + * @note we'll soon rework all of Capi to be smoldot-first, at which point + * every example will be a smoldot example. The API may change. + * See https://github.com/paritytech/capi/issues/1077 */ import { PolkadotRune } from "@capi/polkadot" diff --git a/examples/tx/balances_transfer.eg.ts b/examples/tx/balances_transfer.eg.ts index 5f4c40aae..923fd3408 100644 --- a/examples/tx/balances_transfer.eg.ts +++ b/examples/tx/balances_transfer.eg.ts @@ -1,6 +1,5 @@ /** * @title Balance Transfer - * @stability nearing * @description Transfer some funds from one user to another. */ diff --git a/examples/tx/handle_errors.eg.ts b/examples/tx/handle_errors.eg.ts index 5e66e137d..68b8c0ba2 100644 --- a/examples/tx/handle_errors.eg.ts +++ b/examples/tx/handle_errors.eg.ts @@ -1,6 +1,5 @@ /** * @title Decode and Unhandle Dispatch Errors - * @stability unstable * @description The `unhandleFailed` method of `ExtrinsicEventsRune` enables * easy decoding (and handling) of dispatch errors. */ diff --git a/examples/tx/utility_batch.eg.ts b/examples/tx/utility_batch.eg.ts index 665b902f2..bb13dad02 100644 --- a/examples/tx/utility_batch.eg.ts +++ b/examples/tx/utility_batch.eg.ts @@ -1,6 +1,5 @@ /** * @title Batch Transaction - * @stability nearing * @description Sign and submit multiple calls within a single extrinsic. */ diff --git a/examples/tx/weights_and_estimates.eg.ts b/examples/tx/weights_and_estimates.eg.ts index 4153271b7..84b0000be 100644 --- a/examples/tx/weights_and_estimates.eg.ts +++ b/examples/tx/weights_and_estimates.eg.ts @@ -1,6 +1,5 @@ /** * @title Weights & Estimates - * @stability nearing * @description Get the timepoint and estimate the fee of a tx. */ diff --git a/examples/watch.eg.ts b/examples/watch.eg.ts index 96e31b2e1..a2bad0084 100644 --- a/examples/watch.eg.ts +++ b/examples/watch.eg.ts @@ -1,6 +1,5 @@ /** * @title Watch - * @stability unstable * @description Capi allows you to model your data requirements as Runes and * then utilize `watch`, which produces an async generator, the pulls of which * produce promises resolving to subsequent states. diff --git a/examples/xcm/asset_teleportation.eg.ts b/examples/xcm/asset_teleportation.eg.ts index e16a0e643..030de2d5b 100644 --- a/examples/xcm/asset_teleportation.eg.ts +++ b/examples/xcm/asset_teleportation.eg.ts @@ -1,6 +1,5 @@ /** * @title XCM Asset Teleportation - * @stability nearing * @description Initialize a limited asset teleportation from a relaychain to a * parachain and listen for the processed event on the parachain. Finally, read * the new balance of the user to whom the asset was transferred. diff --git a/examples/xcm/reserve_transfer.eg.ts b/examples/xcm/reserve_transfer.eg.ts index 113557454..6f5b8478a 100644 --- a/examples/xcm/reserve_transfer.eg.ts +++ b/examples/xcm/reserve_transfer.eg.ts @@ -1,6 +1,5 @@ /** * @title XCM Reserve Asset Transfer - * @stability unstable * @description Perform an XCM reserve asset transfer, in which two chains, which * do not trust one another, rely on a third chain to store assets and facilitate * the exchange. diff --git a/import_map.json b/import_map.json index 1544a924f..fca7e348b 100644 --- a/import_map.json +++ b/import_map.json @@ -7,16 +7,16 @@ "asserts": "./deps/std/testing/asserts.ts", "capi": "./mod.ts", "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" + "capi/patterns/unstable/consensus": "./patterns/unstable/consensus/mod.ts", + "capi/patterns/unstable/identity": "./patterns/unstable/identity.ts", + "capi/patterns/unstable/ink": "./patterns/unstable/ink/mod.ts", + "capi/patterns/unstable/nfts": "./patterns/unstable/nfts.ts", + "capi/patterns/unstable/proxy": "./patterns/unstable/proxy/mod.ts", + "capi/patterns/unstable/storage_sizes": "./patterns/unstable/storage_sizes.ts" }, "http://localhost:4646/": { "http://localhost:4646/capi/": "./" diff --git a/patterns/multisig/VirtualMultisigRune.ts b/patterns/multisig/VirtualMultisigRune.ts index 7749156f7..0bb4ee7f1 100644 --- a/patterns/multisig/VirtualMultisigRune.ts +++ b/patterns/multisig/VirtualMultisigRune.ts @@ -14,7 +14,7 @@ import { SignatureDataFactory, ValueRune, } from "../../mod.ts" -import { filterPureCreatedEvents, replaceDelegateCalls } from "../proxy/mod.ts" +import { filterPureCreatedEvents, replaceDelegateCalls } from "../unstable/proxy/mod.ts" import { MultisigRune } from "./MultisigRune.ts" export interface VirtualMultisig { diff --git a/patterns/consensus/babeBlockAuthor.ts b/patterns/unstable/consensus/babeBlockAuthor.ts similarity index 98% rename from patterns/consensus/babeBlockAuthor.ts rename to patterns/unstable/consensus/babeBlockAuthor.ts index 6043f1cbb..7cf1245e1 100644 --- a/patterns/consensus/babeBlockAuthor.ts +++ b/patterns/unstable/consensus/babeBlockAuthor.ts @@ -7,7 +7,7 @@ import { Rune, RunicArgs, ValueRune, -} from "../../mod.ts" +} from "../../../mod.ts" import { preRuntimeDigest } from "./preRuntimeDigest.ts" export function babeBlockAuthor( diff --git a/patterns/consensus/mod.ts b/patterns/unstable/consensus/mod.ts similarity index 100% rename from patterns/consensus/mod.ts rename to patterns/unstable/consensus/mod.ts diff --git a/patterns/consensus/preRuntimeDigest.ts b/patterns/unstable/consensus/preRuntimeDigest.ts similarity index 98% rename from patterns/consensus/preRuntimeDigest.ts rename to patterns/unstable/consensus/preRuntimeDigest.ts index ac4c767f8..ada5cffb2 100644 --- a/patterns/consensus/preRuntimeDigest.ts +++ b/patterns/unstable/consensus/preRuntimeDigest.ts @@ -1,5 +1,5 @@ import { $digestItem, DigestItem } from "@capi/polkadot" -import { Chain, ChainRune, hex, is, RunicArgs, ValueRune } from "../../mod.ts" +import { Chain, ChainRune, hex, is, RunicArgs, ValueRune } from "../../../mod.ts" export function preRuntimeDigest( chain: ChainRune, diff --git a/patterns/identity.ts b/patterns/unstable/identity.ts similarity index 97% rename from patterns/identity.ts rename to patterns/unstable/identity.ts index 3f870a5fa..6c4e36640 100644 --- a/patterns/identity.ts +++ b/patterns/unstable/identity.ts @@ -1,6 +1,6 @@ import { Data, type IdentityInfo } from "@capi/polkadot-dev" -import * as $ from "../deps/scale.ts" -import { is, Rune, RunicArgs } from "../mod.ts" +import * as $ from "../../deps/scale.ts" +import { is, Rune, RunicArgs } from "../../mod.ts" export interface NarrowIdentityInfo> { additional: A diff --git a/patterns/ink/InkMetadata.test.ts b/patterns/unstable/ink/InkMetadata.test.ts similarity index 100% rename from patterns/ink/InkMetadata.test.ts rename to patterns/unstable/ink/InkMetadata.test.ts diff --git a/patterns/ink/InkMetadata.ts b/patterns/unstable/ink/InkMetadata.ts similarity index 96% rename from patterns/ink/InkMetadata.ts rename to patterns/unstable/ink/InkMetadata.ts index 45249e02d..e4b971a21 100644 --- a/patterns/ink/InkMetadata.ts +++ b/patterns/unstable/ink/InkMetadata.ts @@ -1,5 +1,5 @@ -import { unreachable } from "../../deps/std/testing/asserts.ts" -import { Ty } from "../../scale_info/raw/Ty.ts" +import { unreachable } from "../../../deps/std/testing/asserts.ts" +import { Ty } from "../../../scale_info/raw/Ty.ts" export interface InkMetadata { source: Source diff --git a/patterns/ink/InkMetadataRune.ts b/patterns/unstable/ink/InkMetadataRune.ts similarity index 98% rename from patterns/ink/InkMetadataRune.ts rename to patterns/unstable/ink/InkMetadataRune.ts index ee9c4ad4e..84e7cdd2d 100644 --- a/patterns/ink/InkMetadataRune.ts +++ b/patterns/unstable/ink/InkMetadataRune.ts @@ -10,9 +10,9 @@ import { Rune, RunicArgs, Ss58Rune, + transformTys, ValueRune, -} from "../../mod.ts" -import { transformTys } from "../../scale_info/mod.ts" +} from "../../../mod.ts" import { $contractsApiInstantiateArgs, $contractsApiInstantiateResult, Weight } from "./codecs.ts" import { Callable, InkMetadata, parse } from "./InkMetadata.ts" import { InkRune } from "./InkRune.ts" diff --git a/patterns/ink/InkRune.ts b/patterns/unstable/ink/InkRune.ts similarity index 99% rename from patterns/ink/InkRune.ts rename to patterns/unstable/ink/InkRune.ts index 3636993c0..63efcc638 100644 --- a/patterns/ink/InkRune.ts +++ b/patterns/unstable/ink/InkRune.ts @@ -10,7 +10,7 @@ import { Rune, RunicArgs, ValueRune, -} from "../../mod.ts" +} from "../../../mod.ts" import { $contractsApiCallArgs, $contractsApiCallResult, Weight } from "./codecs.ts" import { isContractEmitted } from "./events.ts" import { InkMetadataRune } from "./InkMetadataRune.ts" diff --git a/patterns/ink/codecs.ts b/patterns/unstable/ink/codecs.ts similarity index 98% rename from patterns/ink/codecs.ts rename to patterns/unstable/ink/codecs.ts index df796736d..7fda8c332 100644 --- a/patterns/ink/codecs.ts +++ b/patterns/unstable/ink/codecs.ts @@ -1,6 +1,6 @@ // TODO: delete this file and use codegen directly -import { $ } from "../../mod.ts" +import { $ } from "../../../mod.ts" const $balanceCodec = $.u128 diff --git a/patterns/ink/events.ts b/patterns/unstable/ink/events.ts similarity index 97% rename from patterns/ink/events.ts rename to patterns/unstable/ink/events.ts index c14148d93..0dd8b5cee 100644 --- a/patterns/ink/events.ts +++ b/patterns/unstable/ink/events.ts @@ -1,4 +1,4 @@ -import { AccountIdRune, ApplyExtrinsicEventPhase, Event, Rune, RunicArgs } from "../../mod.ts" +import { AccountIdRune, ApplyExtrinsicEventPhase, Event, Rune, RunicArgs } from "../../../mod.ts" export interface ContractsRuntimeEvent extends Event< diff --git a/patterns/ink/mod.ts b/patterns/unstable/ink/mod.ts similarity index 100% rename from patterns/ink/mod.ts rename to patterns/unstable/ink/mod.ts diff --git a/patterns/nfts.ts b/patterns/unstable/nfts.ts similarity index 100% rename from patterns/nfts.ts rename to patterns/unstable/nfts.ts diff --git a/patterns/proxy/events.ts b/patterns/unstable/proxy/events.ts similarity index 89% rename from patterns/proxy/events.ts rename to patterns/unstable/proxy/events.ts index c31fe3df4..2f1439812 100644 --- a/patterns/proxy/events.ts +++ b/patterns/unstable/proxy/events.ts @@ -1,5 +1,5 @@ import { PalletProxyEvent, RuntimeEvent } from "@capi/polkadot" -import { Rune, RunicArgs } from "../../mod.ts" +import { Rune, RunicArgs } from "../../../mod.ts" export function filterPureCreatedEvents(...[events]: RunicArgs) { return Rune.resolve(events).map((events) => diff --git a/patterns/proxy/mod.ts b/patterns/unstable/proxy/mod.ts similarity index 100% rename from patterns/proxy/mod.ts rename to patterns/unstable/proxy/mod.ts diff --git a/patterns/proxy/replaceDelegateCalls.ts b/patterns/unstable/proxy/replaceDelegateCalls.ts similarity index 94% rename from patterns/proxy/replaceDelegateCalls.ts rename to patterns/unstable/proxy/replaceDelegateCalls.ts index c8a77fa5a..aca2920ef 100644 --- a/patterns/proxy/replaceDelegateCalls.ts +++ b/patterns/unstable/proxy/replaceDelegateCalls.ts @@ -1,5 +1,5 @@ import { MultiAddress } from "@capi/polkadot" -import { Chain, ChainRune, Rune, RunicArgs } from "../../mod.ts" +import { Chain, ChainRune, Rune, RunicArgs } from "../../../mod.ts" // TODO: constrain export function replaceDelegateCalls( diff --git a/patterns/storage_sizes.ts b/patterns/unstable/storage_sizes.ts similarity index 86% rename from patterns/storage_sizes.ts rename to patterns/unstable/storage_sizes.ts index 1ec36e39c..bbcf035a8 100644 --- a/patterns/storage_sizes.ts +++ b/patterns/unstable/storage_sizes.ts @@ -1,5 +1,5 @@ -import { mapEntries } from "../deps/std/collections/map_entries.ts" -import { Chain, ChainRune, MetaRune, Rune, RunicArgs, ValueRune } from "../mod.ts" +import { mapEntries } from "../../deps/std/collections/map_entries.ts" +import { Chain, ChainRune, MetaRune, Rune, RunicArgs, ValueRune } from "../../mod.ts" export function storageSizes( chain: ChainRune, From 583b6fe88da692178eca25caa1d7aec4ce95a2ac Mon Sep 17 00:00:00 2001 From: Harry Solovay Date: Thu, 15 Jun 2023 14:21:10 -0400 Subject: [PATCH 2/5] move virtual multisig pattern into unstable dir --- examples/multisig/virtual.eg.ts | 2 +- import_map.json | 1 + patterns/multisig/mod.ts | 1 - patterns/{ => unstable}/multisig/VirtualMultisigRune.ts | 8 ++++---- patterns/unstable/multisig/mod.ts | 1 + 5 files changed, 7 insertions(+), 6 deletions(-) rename patterns/{ => unstable}/multisig/VirtualMultisigRune.ts (98%) create mode 100644 patterns/unstable/multisig/mod.ts diff --git a/examples/multisig/virtual.eg.ts b/examples/multisig/virtual.eg.ts index 8b2b2a44b..26ca01c34 100644 --- a/examples/multisig/virtual.eg.ts +++ b/examples/multisig/virtual.eg.ts @@ -19,8 +19,8 @@ import { MultiAddress, polkadotDev } from "@capi/polkadot-dev" import { assert } from "asserts" import { $, createDevUsers, is, Rune, Scope, Sr25519 } from "capi" -import { VirtualMultisigRune } from "capi/patterns/multisig" import { signature } from "capi/patterns/signature/polkadot" +import { VirtualMultisigRune } from "capi/patterns/unstable/multisig" import { parse } from "../../deps/std/flags.ts" const { alexa, billy, carol, david } = await createDevUsers() diff --git a/import_map.json b/import_map.json index fca7e348b..12f7e883d 100644 --- a/import_map.json +++ b/import_map.json @@ -14,6 +14,7 @@ "capi/patterns/unstable/consensus": "./patterns/unstable/consensus/mod.ts", "capi/patterns/unstable/identity": "./patterns/unstable/identity.ts", "capi/patterns/unstable/ink": "./patterns/unstable/ink/mod.ts", + "capi/patterns/unstable/multisig": "./patterns/unstable/multisig/mod.ts", "capi/patterns/unstable/nfts": "./patterns/unstable/nfts.ts", "capi/patterns/unstable/proxy": "./patterns/unstable/proxy/mod.ts", "capi/patterns/unstable/storage_sizes": "./patterns/unstable/storage_sizes.ts" diff --git a/patterns/multisig/mod.ts b/patterns/multisig/mod.ts index 6093509da..be22e1225 100644 --- a/patterns/multisig/mod.ts +++ b/patterns/multisig/mod.ts @@ -1,3 +1,2 @@ export * from "./multisigAccountId.ts" export * from "./MultisigRune.ts" -export * from "./VirtualMultisigRune.ts" diff --git a/patterns/multisig/VirtualMultisigRune.ts b/patterns/unstable/multisig/VirtualMultisigRune.ts similarity index 98% rename from patterns/multisig/VirtualMultisigRune.ts rename to patterns/unstable/multisig/VirtualMultisigRune.ts index 0bb4ee7f1..e1aca004e 100644 --- a/patterns/multisig/VirtualMultisigRune.ts +++ b/patterns/unstable/multisig/VirtualMultisigRune.ts @@ -1,5 +1,5 @@ import { MultiAddress } from "@capi/polkadot" -import { equals } from "../../deps/std/bytes.ts" +import { equals } from "../../../deps/std/bytes.ts" import { $, Chain, @@ -13,9 +13,9 @@ import { RunicArgs, SignatureDataFactory, ValueRune, -} from "../../mod.ts" -import { filterPureCreatedEvents, replaceDelegateCalls } from "../unstable/proxy/mod.ts" -import { MultisigRune } from "./MultisigRune.ts" +} from "../../../mod.ts" +import { MultisigRune } from "../../multisig/MultisigRune.ts" +import { filterPureCreatedEvents, replaceDelegateCalls } from "../proxy/mod.ts" export interface VirtualMultisig { members: [Uint8Array, Uint8Array][] diff --git a/patterns/unstable/multisig/mod.ts b/patterns/unstable/multisig/mod.ts new file mode 100644 index 000000000..06f335cda --- /dev/null +++ b/patterns/unstable/multisig/mod.ts @@ -0,0 +1 @@ +export * from "./VirtualMultisigRune.ts" From 695606b56dfa9fabb5fd7475f535df66c33bad29 Mon Sep 17 00:00:00 2001 From: Harry Solovay Date: Thu, 15 Jun 2023 14:23:26 -0400 Subject: [PATCH 3/5] Update examples/ink/deploy.eg.ts Co-authored-by: T6 --- examples/ink/deploy.eg.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ink/deploy.eg.ts b/examples/ink/deploy.eg.ts index 0670d9261..8eadbfe46 100644 --- a/examples/ink/deploy.eg.ts +++ b/examples/ink/deploy.eg.ts @@ -2,7 +2,7 @@ * @title Deploy an Ink Smart Contract * @description Deploying an Ink contract (instantiating) to a production contracts-enabled * parachain is much the same as any other extrinsic submission. - * @note we intend to work on an Ink provider (for static codegen) in the near future. + * @note We intend to work on an Ink provider (for static codegen) in the near future. * This work will likely entail large changes to the current ink patterns. */ From effc0e640d5a4127ece1c9e49ad6dc833437d30f Mon Sep 17 00:00:00 2001 From: Harry Solovay Date: Thu, 15 Jun 2023 14:23:32 -0400 Subject: [PATCH 4/5] Update examples/smoldot/smoldot.eg.ts Co-authored-by: T6 --- examples/smoldot/smoldot.eg.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/smoldot/smoldot.eg.ts b/examples/smoldot/smoldot.eg.ts index 369ed04c8..24f16e5e9 100644 --- a/examples/smoldot/smoldot.eg.ts +++ b/examples/smoldot/smoldot.eg.ts @@ -3,7 +3,7 @@ * @description Smoldot enables users to run a tiny node in their browser, * such that they can connect directly to the network(s) without going through * a centralized intermediary. This is the future of unstoppable applications. - * @note we'll soon rework all of Capi to be smoldot-first, at which point + * @note We'll soon rework all of Capi to be smoldot-first, at which point * every example will be a smoldot example. The API may change. * See https://github.com/paritytech/capi/issues/1077 */ From cc222f56fa83e0bb94841ca391e1ada3c8fd787c Mon Sep 17 00:00:00 2001 From: Harry Solovay Date: Thu, 15 Jun 2023 14:23:46 -0400 Subject: [PATCH 5/5] typo --- examples/sign/offline.eg.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/sign/offline.eg.ts b/examples/sign/offline.eg.ts index 62cc7d65e..cb6fc22b6 100644 --- a/examples/sign/offline.eg.ts +++ b/examples/sign/offline.eg.ts @@ -1,7 +1,8 @@ /** * @title Offline Signing + * @stability nearing * @description Create and sign an extrinsic, then serialize it into a hex for later use. - * Finally, rehydrate the extrinsic and submit it. + * Finally, hydrate the extrinsic and submit it. */ import { $runtimeCall, westendDev } from "@capi/westend-dev"