ghost-portal/packages/page-js/src/snippets/consts-examples.ts
Jaco b82cae49ff
Align tsconfig to allow moduleResolution: nodenext (#9152)
* Align tsconfig to allow moduleResolution: nodenext

* Fix bounty

* Additional from tsc --noEmit check
2023-03-12 10:53:21 +02:00

23 lines
821 B
TypeScript

// Copyright 2017-2023 @polkadot/app-js authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Snippet } from '../types.js';
// We must fix this :(
/* eslint-disable sort-keys */
export const constsStakingParameters: Snippet = {
value: 'constsStakingParameters',
text: 'Get staking parameters',
label: { color: 'green', children: 'Consts', size: 'tiny' },
code: `// Get SRML staking parameters as consts
// 'parameter_types' were added to substrate with spec_version: 101.
// This example will throw an error if used with versions before that.
const bondingDuration = api.consts.staking.bondingDuration;
const sessionsPerEra = api.consts.staking.sessionsPerEra;
console.log('Staking bonding duration: ' + bondingDuration);
console.log('Staking sessions per era: ' + sessionsPerEra);`
};