Skip to content

Commit 1e0b29a

Browse files
committed
Use You instead of We
1 parent bf8abea commit 1e0b29a

File tree

1 file changed

+19
-19
lines changed
  • .snippets/code/develop/interoperability/best-practices-for-teleporting-assets

1 file changed

+19
-19
lines changed

.snippets/code/develop/interoperability/best-practices-for-teleporting-assets/dry-run-example.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const tx = mythApi.tx.PolkadotXcm.limited_teleport_assets({
6565
await dryRun(tx.decodedCall);
6666

6767
async function dryRun(call: Transaction<any, any, any, any>['decodedCall']) {
68-
// Dry run the teleport locally so we know we can for example withdraw
68+
// Dry run the teleport locally so you know you can for example withdraw
6969
// the necessary funds and pay for delivery fees.
7070
console.log('Dry running teleport on Mythos...')
7171
const localDryRunResult = await mythApi.apis.DryRunApi.dry_run_call(
@@ -77,28 +77,28 @@ async function dryRun(call: Transaction<any, any, any, any>['decodedCall']) {
7777
// The first condition is whether or not the runtime API was successful,
7878
// the second is whether or not the underlying dry-run was successful.
7979
if (localDryRunResult.success && localDryRunResult.value.execution_result.success) {
80-
// We are interested in the message to Asset Hub that results from our call.
81-
// We filter for it here.
80+
// You are interested in the message to Asset Hub that results from your call.
81+
// You filter for it here.
8282
const [_, messages] =
8383
localDryRunResult.value.forwarded_xcms.find(
8484
([location, _]) =>
85-
// We happen to know the latest version in Mythos is V5 because of the descriptors.
85+
// You happen to know the latest version in Mythos is V5 because of the descriptors.
8686
location.type === 'V5' &&
8787
location.value.parents === 1 &&
8888
location.value.interior.type === 'X1' &&
8989
location.value.interior.value.type === 'Parachain' &&
9090
location.value.interior.value.value === ASSET_HUB_PARA_ID
9191
)!;
92-
// There could be multiple messages to Asset Hub, we know it's only one
93-
// so we take the first one.
92+
// There could be multiple messages to Asset Hub, you know it's only one
93+
// so you take the first one.
9494
const messageToAh = messages[0];
9595

96-
// We connect to Asset Hub to dry run this message there.
96+
// You connect to Asset Hub to dry run this message there.
9797
const assetHubClient = createClient(getWsProvider(ASSET_HUB_WS_URL));
9898
const ahApi = assetHubClient.getTypedApi(ah);
9999

100-
// We need to ensure it's V4 because V5 is not supported by Asset Hub at the time of writing.
101-
// We get the supported versions directly from the descriptors.
100+
// You need to ensure it's V4 because V5 is not supported by Asset Hub at the time of writing.
101+
// You get the supported versions directly from the descriptors.
102102
if (messageToAh.type === 'V4') {
103103
console.log('Dry running on Asset Hub...');
104104
const remoteDryRunResult =
@@ -114,18 +114,18 @@ async function dryRun(call: Transaction<any, any, any, any>['decodedCall']) {
114114
// Success! Let's go ahead with the teleport.
115115
console.log('Success!');
116116
} else {
117-
// It probably failed because our account doesn't exist on Asset Hub and
118-
// we don't have DOT for the existential deposit.
119-
// We should solve that problem and try again.
120-
// We will later improve errors so that we know exactly what went wrong and can act accordingly.
117+
// It probably failed because your account doesn't exist on Asset Hub and
118+
// You don't have DOT for the existential deposit.
119+
// You should solve that problem and try again.
120+
// You will later improve errors so that you know exactly what went wrong and can act accordingly.
121121
// See https://github.com/paritytech/polkadot-sdk/issues/6119.
122122
console.log('Failure :( Going to try again.');
123123

124-
// We're manually building an XCM here since we want to use the `ExchangeAsset` instruction
124+
// You're manually building an XCM here since you want to use the `ExchangeAsset` instruction
125125
// to swap some of the MYTH for DOT to cover the existential deposit.
126126
// This is executed via `PolkadotXcm.execute()` on Mythos and will send a message to Asset Hub.
127127
const xcm = XcmVersionedXcm.V4([
128-
// We withdraw some MYTH from our account on Mythos.
128+
// You withdraw some MYTH from your account on Mythos.
129129
XcmV4Instruction.WithdrawAsset([
130130
{ id: { parents: 0, interior: XcmV3Junctions.Here() }, fun: XcmV3MultiassetFungibility.Fungible(100n * MYTH_UNITS) },
131131
]),
@@ -139,19 +139,19 @@ async function dryRun(call: Transaction<any, any, any, any>['decodedCall']) {
139139
assets: XcmV4AssetAssetFilter.Wild(XcmV4AssetWildAsset.AllCounted(1)),
140140
dest: { parents: 1, interior: XcmV3Junctions.X1(XcmV3Junction.Parachain(ASSET_HUB_PARA_ID)) },
141141
xcm: [
142-
// We pay fees with MYTH on Asset Hub.
142+
// You pay fees with MYTH on Asset Hub.
143143
// This is possible because Asset Hub allows paying fees with any asset that has a liquidity pool.
144144
XcmV4Instruction.BuyExecution({
145145
fees: { id: { parents: 1, interior: XcmV3Junctions.X1(XcmV3Junction.Parachain(MYTHOS_PARA_ID)) }, fun: XcmV3MultiassetFungibility.Fungible(50n * MYTH_UNITS) },
146146
weight_limit: XcmV3WeightLimit.Unlimited(),
147147
}),
148-
// We explicitly swap our MYTH for 0.01 DOT to cover ED.
148+
// You explicitly swap your MYTH for 0.01 DOT to cover ED.
149149
XcmV4Instruction.ExchangeAsset({
150150
give: XcmV4AssetAssetFilter.Wild(XcmV4AssetWildAsset.AllCounted(1)),
151151
want: [{ id: { parents: 1, interior: XcmV3Junctions.Here() }, fun: XcmV3MultiassetFungibility.Fungible(1n * DOT_CENTS) }],
152152
maximal: false,
153153
}),
154-
// We deposit all our MYTH and our 0.01 DOT into the beneficiary account.
154+
// You deposit all your MYTH and your 0.01 DOT into the beneficiary account.
155155
XcmV4Instruction.DepositAsset({
156156
assets: XcmV4AssetAssetFilter.Wild(XcmV4AssetWildAsset.AllCounted(2)),
157157
beneficiary: {
@@ -171,7 +171,7 @@ async function dryRun(call: Transaction<any, any, any, any>['decodedCall']) {
171171
max_weight: { ref_time: 4_000_000_000n, proof_size: 300_000n }
172172
});
173173

174-
// We try the dry run again.
174+
// You try the dry run again.
175175
dryRun(tx.decodedCall);
176176
}
177177
}

0 commit comments

Comments
 (0)