For the complete documentation index, see llms.txt. This page is also available as Markdown.

05. Parking

Secure Parking

Parking allows users to secure their tokens to keep them immovable even during private key compromise.

Overview

Purpose: Park tokens and secure them.

Key Features:

  • Park tokens to secure GSX amount

  • Unpark tokens (with unfreezing period)

  • Withdraw unfrozen tokens

  • Query parked amounts and get rewards

Location: src/packages/parking/


Blockchain Interactions

Parking uses Polkadot.js API to interact with the blockchain through extrinsics and queries.

API Instance Configuration:

  • Uses Polkadot.js API instance (api)

  • Requires signer for transactions

Park Tokens

Lock tokens by submitting a parking extrinsic.

Extrinsic: api.tx.parking.park(amount)

Parameters:

  • amount: Amount of tokens to park (in smallest unit, typically 10^decimals)

Implementation:


Unpark Tokens

Request to unlock parked tokens (starts unfreezing period).

Extrinsic: api.tx.parking.unpark(amount)

Parameters:

  • amount: Amount of tokens to unpark (in smallest unit)

Implementation:


Withdraw Unfrozen Tokens

Withdraw tokens that have completed the unfreezing period.

Extrinsic: api.tx.parking.unfreeze(account)

Parameters:

  • account: SS58-355 encoded account address

Implementation:


Query Account Balance

Check account balance for fee estimation and validation.

Query: api.query.system.account(address)

Parameters:

  • address: SS58-355 encoded account address

Response:

Implementation:

Usage:


Complete Implementation Example


Integration with UI Components

The parking functionality is integrated into the main application through:

  • Parking Page: src/routes/gsx-parking.tsx

  • Components: src/packages/parking/components/

  • Hooks: src/packages/parking/hooks/

Last updated

Was this helpful?