Skip to content

Instantly share code, notes, and snippets.

@kianenigma
Last active September 24, 2025 07:45
Show Gist options
  • Select an option

  • Save kianenigma/cb1436ee95aaca6e2585a0a50469380a to your computer and use it in GitHub Desktop.

Select an option

Save kianenigma/cb1436ee95aaca6e2585a0a50469380a to your computer and use it in GitHub Desktop.
export async function RcTICheck(): Promise<void> {
const rcApi = await getApi("wss://paseo-rpc.n.dwellir.com");
const ahApi = await getApi("wss://asset-hub-paseo-rpc.n.dwellir.com");
let rcSent = new BN(0);
let ahReceived = new BN(0);
{
const start = await rcApi.query.rcMigrator.migrationStartBlock() as Option<BlockNumber>;
const startHash = await rcApi.rpc.chain.getBlockHash(start.unwrap());
const end = await rcApi.query.rcMigrator.migrationEndBlock() as Option<BlockNumber>;
const endHash = await rcApi.rpc.chain.getBlockHash(end.unwrap());
const startStage = await rcApi.query.rcMigrator.rcMigrationStage.at(startHash);
const endStage = await rcApi.query.rcMigrator.rcMigrationStage.at(endHash);
const preTI = await rcApi.query.balances.totalIssuance.at(startHash);
const postTI = await rcApi.query.balances.totalIssuance.at(endHash);
console.log(`RC: migrationStartBlock stage: ${startStage}, migrationEndBlock stage: ${endStage}`);
console.log(`RC: migrationStartBlock: ${start}, migrationEndBlock: ${end}), duration in blocks: ${end.unwrap().toNumber() - start.unwrap().toNumber()}`);
console.log(`RC: totalIssuance at start: ${preTI}`);
console.log(`RC: totalIssuance at end: ${postTI}`);
console.log(`RC: migrated TI: ${(preTI.sub(postTI))}`);
rcSent = new BN(preTI).sub(new BN(postTI));
}
{
const start = await ahApi.query.ahMigrator.migrationStartBlock() as Option<BlockNumber>;
const startHash = await ahApi.rpc.chain.getBlockHash(start.unwrap());
const end = await ahApi.query.ahMigrator.migrationEndBlock() as Option<BlockNumber>;
const endHash = await ahApi.rpc.chain.getBlockHash(end.unwrap());
const preTI = await ahApi.query.balances.totalIssuance.at(startHash);
const postTI = await ahApi.query.balances.totalIssuance.at(endHash);
const startStage = await ahApi.query.ahMigrator.ahMigrationStage.at(startHash);
const endStage = await ahApi.query.ahMigrator.ahMigrationStage.at(endHash);
console.log(`AH: migrationStartBlock stage: ${startStage}, migrationEndBlock stage: ${endStage}`);
console.log(`AH: migrationStartBlock: ${start}, migrationEndBlock: ${end}), duration in blocks: ${end.unwrap().toNumber() - start.unwrap().toNumber()}`);
console.log(`AH: totalIssuance at end: ${postTI}`);
console.log(`AH: totalIssuance at start: ${preTI}`);
console.log(`AH: Received TI: ${(postTI.sub(preTI))}`);
ahReceived = new BN(postTI).sub(new BN(preTI));
}
console.log(`RC sent: ${rcSent}, AH received: ${ahReceived}, difference: ${rcSent.sub(ahReceived)}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment