Skip to content

Commit

Permalink
[Substrate.io Migration] Tutorials -> Build a Parachain -> Acquire a …
Browse files Browse the repository at this point in the history
…TestNet Slot (#28)

* fix: adding prepare substrate relay chain

* fiox: formatting error

* fix: description

* fix: paraphrasing

* fix: vale warning

* fix: formatting

* fix: adding conclusion to the tutorial

* fix: formatting

* fix: formatting

* git: adding intro and build the parachain template section

* fix: adding wip

* fix: updating prepare relay chain output and commands

* fix: adding build a parachain complete process

* fix: vale suggestion

* fix: adding acquire a slot on testnet wip

* fix: adding admin account example

* fix: typos

* fix: typo

* fix: typo

* fix: formatting

* fix: formatting

* fix: typo and adding abs route to build a local blockchain tutorial

* fix: paraphrasing

* fix: updating deprecated route

* fix: paraphrasing

* fix: formatting

* fix: chain specs decoupled from substrate website

* Update tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain.md

Co-authored-by: 0xLucca <95830307+0xLucca@users.noreply.github.com>

* fix: typo

* fix: removing redundant commands on terminal elements

* fix: adding disclaimer for chain spec generation

* fix: removing redundant commands on terminal elements

* fix: removing unnecessary info

* fix: addin small clarification about sudo txs

* fix: clarification about sudo changes

* Update tutorials/polkadot-sdk/build-a-parachain/connect-a-parachain.md

Co-authored-by: 0xLucca <95830307+0xLucca@users.noreply.github.com>

* fix: adding missing terminal output

* fix: adding image to register with the local relay chain process, step 6

* Apply suggestions from code review

Co-authored-by: Erin Shaben <eshaben@icloud.com>

* fix: moving terminal outputs to code snippets

* fix: adding clarification over resetting bc state

* fix: replacing Polkadot.Js by Polkadot.js

* fix: update acquire-a-testnet-slot to paseo and coretime docs

* fix: adding hook to further tutorials

* clean up formatting and grammar

* fix snippet

* fix typo

* update .pages file

* Merge remote-tracking branch 'origin/master' into nhussein11/tutorials-substrate-acquire-a-testnet-slot

* Update tutorials/polkadot-sdk/build-a-parachain/acquire-a-testnet-slot.md

Co-authored-by: Dawn Kelly <83190195+dawnkelly09@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Dawn Kelly <83190195+dawnkelly09@users.noreply.github.com>

* Update tutorials/polkadot-sdk/build-a-parachain/prepare-relay-chain.md

Co-authored-by: Dawn Kelly <83190195+dawnkelly09@users.noreply.github.com>

* fix: decoupling from substrate documentation

* fix: adding missed colons

---------

Co-authored-by: 0xLucca <95830307+0xLucca@users.noreply.github.com>
Co-authored-by: Erin Shaben <eshaben@icloud.com>
Co-authored-by: Dawn Kelly <83190195+dawnkelly09@users.noreply.github.com>
  • Loading branch information
4 people authored Oct 3, 2024
1 parent f37b35f commit 3355278
Show file tree
Hide file tree
Showing 38 changed files with 472 additions and 248 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import {
AssetTransferApi,
constructApiPromise,
} from "@substrate/asset-transfer-api";
} from '@substrate/asset-transfer-api';

async function main() {
const { api, specName, safeXcmVersion } = await constructApiPromise(
"wss://wss.api.moonbeam.network"
'wss://wss.api.moonbeam.network',
);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);

let callInfo;
try {
callInfo = await assetApi.createTransferTransaction(
"2004",
"0xF977814e90dA44bFA03b6295A0616a897441aceC",
'2004',
'0xF977814e90dA44bFA03b6295A0616a897441aceC',
[],
["1000000000000000000"],
['1000000000000000000'],
{
format: "call",
format: 'call',
keepAlive: true,
}
},
);

console.log(`Call data:\n${JSON.stringify(callInfo, null, 4)}`);
Expand All @@ -28,7 +28,7 @@ async function main() {
throw Error(e as string);
}

const decoded = assetApi.decodeExtrinsic(callInfo.tx, "call");
const decoded = assetApi.decodeExtrinsic(callInfo.tx, 'call');
console.log(`\nDecoded tx:\n${JSON.stringify(JSON.parse(decoded), null, 4)}`);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import {
AssetTransferApi,
constructApiPromise,
} from "@substrate/asset-transfer-api";
} from '@substrate/asset-transfer-api';

async function main() {
const { api, specName, safeXcmVersion } = await constructApiPromise(
"wss://moonriver.public.blastapi.io"
'wss://moonriver.public.blastapi.io',
);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
let callInfo;
try {
callInfo = await assetApi.createTransferTransaction(
"2001",
"0xc4db7bcb733e117c0b34ac96354b10d47e84a006b9e7e66a229d174e8ff2a063",
["vMOVR", "72145018963825376852137222787619937732"],
["1000000", "10000000000"],
'2001',
'0xc4db7bcb733e117c0b34ac96354b10d47e84a006b9e7e66a229d174e8ff2a063',
['vMOVR', '72145018963825376852137222787619937732'],
['1000000', '10000000000'],
{
format: "call",
format: 'call',
xcmVersion: safeXcmVersion,
}
},
);

console.log(`Call data:\n${JSON.stringify(callInfo, null, 4)}`);
Expand All @@ -27,7 +27,7 @@ async function main() {
throw Error(e as string);
}

const decoded = assetApi.decodeExtrinsic(callInfo.tx, "call");
const decoded = assetApi.decodeExtrinsic(callInfo.tx, 'call');
console.log(`\nDecoded tx:\n${JSON.stringify(JSON.parse(decoded), null, 4)}`);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import {
AssetTransferApi,
constructApiPromise,
} from "@substrate/asset-transfer-api";
} from '@substrate/asset-transfer-api';

async function main() {
const { api, specName, safeXcmVersion } = await constructApiPromise(
"wss://westend-rpc.polkadot.io"
'wss://westend-rpc.polkadot.io',
);
const assetApi = new AssetTransferApi(api, specName, safeXcmVersion);
let callInfo;
try {
callInfo = await assetApi.createTransferTransaction(
"1000",
"5EWNeodpcQ6iYibJ3jmWVe85nsok1EDG8Kk3aFg8ZzpfY1qX",
["WND"],
["1000000000000"],
'1000',
'5EWNeodpcQ6iYibJ3jmWVe85nsok1EDG8Kk3aFg8ZzpfY1qX',
['WND'],
['1000000000000'],
{
format: "call",
format: 'call',
xcmVersion: safeXcmVersion,
}
},
);

console.log(`Call data:\n${JSON.stringify(callInfo, null, 4)}`);
Expand All @@ -27,7 +27,7 @@ async function main() {
throw Error(e as string);
}

const decoded = assetApi.decodeExtrinsic(callInfo.tx, "call");
const decoded = assetApi.decodeExtrinsic(callInfo.tx, 'call');
console.log(`\nDecoded tx:\n${JSON.stringify(JSON.parse(decoded), null, 4)}`);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
AssetTransferApi,
constructApiPromise,
} from "@substrate/asset-transfer-api";
} from '@substrate/asset-transfer-api';

async function main() {
const { api, specName, safeXcmVersion } = await constructApiPromise(
"INSERT_WEBSOCKET_URL"
'INSERT_WEBSOCKET_URL',
);

const assetsApi = new AssetTransferApi(api, specName, safeXcmVersion);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
AssetTransferApi,
constructApiPromise,
} from "@substrate/asset-transfer-api";
} from '@substrate/asset-transfer-api';

async function main() {
const { api, specName, safeXcmVersion } = await constructApiPromise(
"wss://westend-rpc.polkadot.io"
'wss://westend-rpc.polkadot.io',
);
const assetsApi = new AssetTransferApi(api, specName, safeXcmVersion);

Expand All @@ -15,12 +15,12 @@ async function main() {
[
`{"parents":"0","interior":{"X2":[{"PalletInstance":"50"},{"GeneralIndex":"1984"}]}}`,
],
["1000000000000"],
"0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b",
['1000000000000'],
'0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b',
{
format: "call",
format: 'call',
xcmVersion: 2,
}
},
);

console.log(`Call data:\n${JSON.stringify(callInfo, null, 4)}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import {
AssetTransferApi,
constructApiPromise,
} from "@substrate/asset-transfer-api";
} from '@substrate/asset-transfer-api';

async function main() {
const { api, specName, safeXcmVersion } = await constructApiPromise(
"wss://wss.api.moonbeam.network"
'wss://wss.api.moonbeam.network',
);
const assetsApi = new AssetTransferApi(api, specName, safeXcmVersion);

let callInfo;
try {
callInfo = await assetsApi.createTransferTransaction(
"2004",
"0xF977814e90dA44bFA03b6295A0616a897441aceC",
'2004',
'0xF977814e90dA44bFA03b6295A0616a897441aceC',
[],
["1000000000000000000"],
['1000000000000000000'],
{
format: "call",
format: 'call',
keepAlive: true,
}
},
);

console.log(`Call data:\n${JSON.stringify(callInfo, null, 4)}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import {
AssetTransferApi,
constructApiPromise,
} from "@substrate/asset-transfer-api";
} from '@substrate/asset-transfer-api';

async function main() {
const { api, specName, safeXcmVersion } = await constructApiPromise(
"wss://wss.api.moonbeam.network"
'wss://wss.api.moonbeam.network',
);
const assetsApi = new AssetTransferApi(api, specName, safeXcmVersion);

const encodedExt = "0x0a03f977814e90da44bfa03b6295a0616a897441acec821a0600";
const encodedExt = '0x0a03f977814e90da44bfa03b6295a0616a897441acec821a0600';

try {
const decodedExt = assetsApi.decodeExtrinsic(encodedExt, "call");
const decodedExt = assetsApi.decodeExtrinsic(encodedExt, 'call');
console.log(
`Decoded tx:\n ${JSON.stringify(JSON.parse(decodedExt), null, 4)}`
`Decoded tx:\n ${JSON.stringify(JSON.parse(decodedExt), null, 4)}`,
);
} catch (e) {
console.error(e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {
AssetTransferApi,
constructApiPromise,
} from "@substrate/asset-transfer-api";
} from '@substrate/asset-transfer-api';

async function main() {
const { api, specName, safeXcmVersion } = await constructApiPromise(
"wss://wss.api.moonbeam.network"
'wss://wss.api.moonbeam.network',
);
const assetsApi = new AssetTransferApi(api, specName, safeXcmVersion);

const encodedExt = "0x0a03f977814e90da44bfa03b6295a0616a897441acec821a0600";
const encodedExt = '0x0a03f977814e90da44bfa03b6295a0616a897441acec821a0600';

try {
const decodedExt = await assetsApi.fetchFeeInfo(encodedExt, "call");
const decodedExt = await assetsApi.fetchFeeInfo(encodedExt, 'call');
console.log(`Fee info:\n${JSON.stringify(decodedExt, null, 4)}`);
} catch (e) {
console.error(e);
Expand All @@ -22,4 +22,4 @@ async function main() {

main()
.catch((err) => console.error(err))
.finally(() => process.exit());
.finally(() => process.exit());
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type Format = "payload" | "call" | "submittable";
export type Format = 'payload' | 'call' | 'submittable';
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
[
[
[
{
"sender": 1000,
"recipient": 2500
}
[
{
"sender": 1000,
"recipient": 2500
}
],
{
"maxCapacity": 8,
"maxTotalSize": 8192,
"maxMessageSize": 1048576,
"msgCount": 0,
"totalSize": 0,
"mqcHead": null,
"senderDeposit": 0,
"recipientDeposit": 0
}
],
{
"maxCapacity": 8,
"maxTotalSize": 8192,
"maxMessageSize": 1048576,
"msgCount": 0,
"totalSize": 0,
"mqcHead": null,
"senderDeposit": 0,
"recipientDeposit": 0
}
],
[
[
{
"sender": 2500,
"recipient": 1000
}
],
{
"maxCapacity": 8,
"maxTotalSize": 8192,
"maxMessageSize": 1048576,
"msgCount": 0,
"totalSize": 0,
"mqcHead": null,
"senderDeposit": 0,
"recipientDeposit": 0
}
]
[
{
"sender": 2500,
"recipient": 1000
}
],
{
"maxCapacity": 8,
"maxTotalSize": 8192,
"maxMessageSize": 1048576,
"msgCount": 0,
"totalSize": 0,
"mqcHead": null,
"senderDeposit": 0,
"recipientDeposit": 0
}
]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"...": "...",
"relay_chain": "paseo",
"para_id": 4508,
"genesis": {
"runtime": {
"...": {},
"parachainInfo": {
"parachainId": 4508
},
"session": {
"keys": [
[
"5HErbKmL5JmUKDVsH1aGyXTGZb4i9iaNsFhSgkNDr8qp2Dvj",
"5HErbKmL5JmUKDVsH1aGyXTGZb4i9iaNsFhSgkNDr8qp2Dvj",
{
"aura": "5HErbKmL5JmUKDVsH1aGyXTGZb4i9iaNsFhSgkNDr8qp2Dvj"
}
]
]
}
},
"...": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div id="termynal" data-termynal>
<span data-ty="input"><span class="file-path"></span>./target/release/parachain-template-node build-spec --chain plain-parachain-chainspec.json --disable-default-bootnode --raw > raw-parachain-chainspec.json</span>
<span data-ty="progress">2024-09-10 14:34:58 Building chain spec</span>
<span data-ty="progress">2024-09-10 14:34:59 assembling new collators for new session 0 at #0</span>
<span data-ty="progress">2024-09-10 14:34:59 assembling new collators for new session 1 at #0</span>
<span data-ty="input"><span class="file-path"></span></span>
</div>
<br />
<span data-ty="progress">2024-09-11 09:48:15 Building chain spec</span>
<span data-ty="progress">2024-09-11 09:48:15 assembling new collators for new session 0 at #0</span>
<span data-ty="progress">2024-09-11 09:48:15 assembling new collators for new session 1 at #0</span>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
parameter_types! {
pub const ParaDeposit: Balance = 40 * UNITS;
}

impl paras_registrar::Config for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type OnSwap = (Crowdloan, Slots);
type ParaDeposit = ParaDeposit;
type DataDepositPerByte = DataDepositPerByte;
type WeightInfo = weights::runtime_common_paras_registrar::WeightInfo<Runtime>;
}
Loading

0 comments on commit 3355278

Please sign in to comment.