From 6f42e661e29fcb124420e7c3f9156d1f326fdb41 Mon Sep 17 00:00:00 2001 From: Matias Volpe Date: Mon, 27 Feb 2023 13:28:01 -0300 Subject: [PATCH] test: remove xcm zombienet example --- examples/xcm_asset_teleportation.ts | 80 ----------------------------- 1 file changed, 80 deletions(-) delete mode 100644 examples/xcm_asset_teleportation.ts diff --git a/examples/xcm_asset_teleportation.ts b/examples/xcm_asset_teleportation.ts deleted file mode 100644 index 01107e1c2..000000000 --- a/examples/xcm_asset_teleportation.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { alice, Rune } from "capi" -import { types, XcmPallet } from "zombienet/statemine.toml/alice/@latest/mod.ts" -import { Event as XcmPalletEvent } from "zombienet/statemine.toml/alice/@latest/types/pallet_xcm/pallet.ts" -import { RuntimeEvent as AliceRuntimeEvent } from "zombienet/statemine.toml/alice/@latest/types/rococo_runtime/mod.ts" -import { chain, System } from "zombienet/statemine.toml/collator/@latest/mod.ts" -import { Event as ParachainSystemEvent } from "zombienet/statemine.toml/collator/@latest/types/cumulus_pallet_parachain_system/pallet.ts" -import { RuntimeEvent as CollatorRuntimeEvent } from "zombienet/statemine.toml/collator/@latest/types/statemine_runtime.ts" - -const { - VersionedMultiAssets, - VersionedMultiLocation, - v1: { - junction: { Junction }, - multilocation: { Junctions }, - multiasset: { AssetId, Fungibility }, - }, - v0: { junction: { NetworkId } }, - v2: { WeightLimit }, -} = types.xcm - -class CannotFindAttemptError extends Error { - override readonly name = "CannotFindAttemptError" -} - -const initiatedEvent = XcmPallet - .limitedTeleportAssets({ - dest: VersionedMultiLocation.V1(Rune.rec({ - parents: 0, - interior: Junctions.X1(Junction.Parachain(1000)), - })), - beneficiary: VersionedMultiLocation.V1(Rune.rec({ - parents: 0, - interior: Junctions.X1(Junction.AccountId32({ - id: alice.publicKey, - network: NetworkId.Any(), - })), - })), - assets: VersionedMultiAssets.V1(Rune.array([Rune.rec({ - id: AssetId.Concrete(Rune.rec({ - parents: 0, - interior: Junctions.Here(), - })), - fun: Fungibility.Fungible(500_000_000_000_000n), - })])), - feeAssetItem: 0, - weightLimit: WeightLimit.Unlimited(), - }) - .signed({ sender: alice }) - .sent() - .dbgStatus("Teleportation status:") - .finalizedEvents() - .map((events) => - events.find((e) => - AliceRuntimeEvent.isXcmPallet(e.event) - && XcmPalletEvent.isAttempted(e.event.value) - ) ?? new CannotFindAttemptError() - ) - .unhandle(CannotFindAttemptError) - .dbg("Initiated event:") - -const processedEvent = System.Events - .entry([], chain.latestBlock.hash) - .map((events) => - events?.find((e) => - CollatorRuntimeEvent.isParachainSystem(e.event) - && ParachainSystemEvent.isDownwardMessagesProcessed(e.event.value) - ) - ) - .filter((event) => !!event) - .dbg("Processed events:") - -// TODO: have the recipient associate the downward message with the sender -await logAliceBalance() - .chain(() => Rune.tuple([initiatedEvent, processedEvent])) - .chain(() => logAliceBalance()) - .run() - -function logAliceBalance() { - return System.Account.entry([alice.publicKey]).access("data", "free").dbg("Alice balance:") -}