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

chore: move unstable patterns into patterns/unstable #1085

Merged
merged 5 commits into from
Jun 15, 2023
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
3 changes: 1 addition & 2 deletions examples/blocks.eg.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/**
* @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.
*/

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()
Expand Down
1 change: 0 additions & 1 deletion examples/dev/dev_users.eg.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
3 changes: 0 additions & 3 deletions examples/dev/metadata.eg.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions examples/dev/storage_sizes.eg.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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())
Expand Down
1 change: 0 additions & 1 deletion examples/dynamic.eg.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 5 additions & 5 deletions examples/ink/deploy.eg.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
6 changes: 3 additions & 3 deletions examples/ink/interact.eg.ts
Original file line number Diff line number Diff line change
@@ -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()

Expand Down
8 changes: 4 additions & 4 deletions examples/misc/identity.eg.ts
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
1 change: 0 additions & 1 deletion examples/misc/indices.eg.ts
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand Down
1 change: 0 additions & 1 deletion examples/multisig/basic.eg.ts
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand Down
3 changes: 1 addition & 2 deletions examples/multisig/stash.eg.ts
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand All @@ -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()
Expand Down
3 changes: 1 addition & 2 deletions examples/multisig/virtual.eg.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -20,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()
Expand Down
3 changes: 1 addition & 2 deletions examples/nfts.eg.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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()

Expand Down
1 change: 0 additions & 1 deletion examples/paginate.eg.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @title Paginate
* @stability unstable
* @description Read pages (either of keys or entries) from storage maps.
*/

Expand Down
1 change: 0 additions & 1 deletion examples/raw_rpc/call.eg.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @title Raw RPC Call Usage
* @stability nearing
* @description Interact directly with the RPC node's call methods.
*/

Expand Down
1 change: 0 additions & 1 deletion examples/raw_rpc/subscription.eg.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @title Raw RPC Subscription Usage
* @stability nearing
* @description Interact directly with the RPC node's subscription methods.
*/

Expand Down
1 change: 0 additions & 1 deletion examples/read/account_info.eg.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @title Read a Map Value
* @stability nearing
* @description Read the value (an `AccountInfo`) from the system account map.
*/

Expand Down
1 change: 0 additions & 1 deletion examples/read/era_reward_points.eg.ts
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
1 change: 0 additions & 1 deletion examples/read/now.eg.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @title Current Agreed-Upon Time
* @stability nearing
* @description Read the current timestamp as agreed upon by validators.
*/

Expand Down
1 change: 0 additions & 1 deletion examples/read/para_heads.eg.ts
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
1 change: 0 additions & 1 deletion examples/rune/collections.eg.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @title Rune Collections
* @stability nearing
* @description Parallelize resolution and collect results.
*/

Expand Down
1 change: 0 additions & 1 deletion examples/rune/intro.eg.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 0 additions & 1 deletion examples/rune/subclassing.eg.ts
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand Down
1 change: 0 additions & 1 deletion examples/rune/u_track.eg.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 0 additions & 1 deletion examples/sign/ed25519.eg.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @title Ed25519 Signatures
* @stability nearing
* @description Utilize an Ed25519 library for signing.
*/

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 @@ -2,7 +2,7 @@
* @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"
Expand Down
1 change: 0 additions & 1 deletion examples/sign/pjs.eg.ts
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand Down
1 change: 0 additions & 1 deletion examples/smoldot/fetch_chainspec.eg.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 3 additions & 1 deletion examples/smoldot/smoldot.eg.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
1 change: 0 additions & 1 deletion examples/tx/balances_transfer.eg.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @title Balance Transfer
* @stability nearing
* @description Transfer some funds from one user to another.
*/

Expand Down
1 change: 0 additions & 1 deletion examples/tx/handle_errors.eg.ts
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand Down
1 change: 0 additions & 1 deletion examples/tx/utility_batch.eg.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @title Batch Transaction
* @stability nearing
* @description Sign and submit multiple calls within a single extrinsic.
*/

Expand Down
1 change: 0 additions & 1 deletion examples/tx/weights_and_estimates.eg.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @title Weights & Estimates
* @stability nearing
* @description Get the timepoint and estimate the fee of a tx.
*/

Expand Down
1 change: 0 additions & 1 deletion examples/watch.eg.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 0 additions & 1 deletion examples/xcm/asset_teleportation.eg.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 0 additions & 1 deletion examples/xcm/reserve_transfer.eg.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
13 changes: 7 additions & 6 deletions import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
"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/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"
},
"http://localhost:4646/": {
"http://localhost:4646/capi/": "./"
Expand Down
1 change: 0 additions & 1 deletion patterns/multisig/mod.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from "./multisigAccountId.ts"
export * from "./MultisigRune.ts"
export * from "./VirtualMultisigRune.ts"
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Rune,
RunicArgs,
ValueRune,
} from "../../mod.ts"
} from "../../../mod.ts"
import { preRuntimeDigest } from "./preRuntimeDigest.ts"

export function babeBlockAuthor<C extends AddressPrefixChain, U, X>(
Expand Down
Original file line number Diff line number Diff line change
@@ -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<C extends Chain, U, X>(
chain: ChainRune<C, U>,
Expand Down
Loading