web3_universal_polkadot 0.1.1 copy "web3_universal_polkadot: ^0.1.1" to clipboard
web3_universal_polkadot: ^0.1.1 copied to clipboard

Polkadot/Substrate blockchain extension for Web3 Universal SDK.

dart_web3_polkadot #

License: MIT

A Substrate-compatible extension for the Dart Web3 ecosystem. Enable interaction with Polkadot, Kusama, and the entire Parachain ecosystem using a unified Dart API.

🚀 Features #

  • SS58 Addressing: Multi-chain address formatting with support for different network prefixes.
  • SCALE Codec: highly efficient Simple Concatenated Aggregate Little-Endian encoding.
  • Metadata V14+: Dynamically parse Substrate metadata to discover pallet methods and constants.
  • SR25519 & Ed25519: Full support for standard Substrate signature schemes.

Usage Flow #

sequenceDiagram
    participant A as Application
    participant C as PolkadotClient
    participant M as Metadata Registry
    participant S as SCALE Codec
    participant N as Substrate Node
    A->>C: call(balances.transfer)
    C->>M: lookup(metadata)
    M-->>C: type definitions
    C->>S: encode(params)
    S-->>C: extrinsic bytes
    C->>N: author_submitExtrinsic
    N-->>A: system.ExtrinsicSuccess

🏗️ Architecture #

graph LR
    User[User Logic] --> Substrate[Polkadot Client]
    Substrate --> Metadata[Metadata Registry]
    
    subgraph Codec [Serialization]
        SCALE[SCALE Encoder]
    end
    
    Metadata --> SCALE
    SCALE --> Node[Polkadot/Substrate Node]

📚 Technical Reference #

Core Classes #

Class Responsibility
PolkadotClient The core client for Substrate-based JSON-RPC.
Keyring Manages multiple accounts and encryption types (sr25519).
ScaleCodec Low-level utility for binary serialization.
Registry Holds types and method definitions for a specific parachain.

🛡️ Security Considerations #

  • Metadata Integrity: Substrate updates can change underlying types. Always fetch the latest metadata from the node before encoding transactions.
  • Existential Deposit: Be aware of the Existential Deposit (ED) requirement; sending an amount that leaves a balance below ED will result in account reaper/deletion.
  • Multi-sig Complexity: Substrate multisig uses a "call hash" approach. Ensure the UI handles the 2-step approval process correctly.

💻 Usage #

Connecting and Querying Balance #

import 'package:dart_web3_polkadot/dart_web3_polkadot.dart';

void main() async {
  final dot = PolkadotClient(url: 'wss://rpc.polkadot.io');
  await dot.init();

  final balance = await dot.queryBalance('AddressSS58...');
  print('DOT Balance: $balance');
}

📦 Installation #

dependencies:
  dart_web3_polkadot: ^0.1.0
0
likes
150
points
6
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Polkadot/Substrate blockchain extension for Web3 Universal SDK.

Homepage
Repository (GitHub)
View/report issues

Topics

#web3 #polkadot #substrate #blockchain

License

MIT (license)

Dependencies

web3_universal_core, web3_universal_crypto, web3_universal_signer

More

Packages that depend on web3_universal_polkadot