magic_ext_tezos 0.2.3 copy "magic_ext_tezos: ^0.2.3" to clipboard
magic_ext_tezos: ^0.2.3 copied to clipboard

A Magic extension to enable interaction with Tezos on Flutter.

example/example.dart

import 'package:flutter/material.dart';
import 'package:magic_ext_tezos/magic_ext_tezos.dart';
import 'package:magic_sdk/magic_sdk.dart';
import 'package:tezart/tezart.dart';

class _TezosPageState extends State<TezosPage> {
  final tezosSigner = Magic.instance.tezos;
  final client = TezartClient('https://ithacanet.smartpy.io/');

  @override
  void initState() {
    super.initState();
    tezosSigner.init();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
          child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
        /// get public address
        ElevatedButton(
          onPressed: () async {
            String? address = tezosSigner.address;
            print(address);
          },
          child: const Text('Public Key'),
        ),

        /// send Transaction
        ElevatedButton(
          onPressed: () async {
            final operationsList = await client.transferOperation(
              source: Keystore.fromRemoteSigner(tezosSigner),
              destination: tezosSigner.address,
              amount: 10001,
            );
            await operationsList.executeAndMonitor();
          },
          child: const Text('send Transaction'),
        ),

        /// Get balance
        ElevatedButton(
          onPressed: () async {
            final balance =
                await client.getBalance(address: tezosSigner.address);
            print('balance for ${tezosSigner.address}, $balance');
          },
          child: const Text('get balance'),
        ),
      ])),
    );
  }
}
0
likes
0
points
83
downloads

Publisher

verified publishermagic.link

Weekly Downloads

A Magic extension to enable interaction with Tezos on Flutter.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

blockchain_signer, flutter, json_annotation, magic_sdk

More

Packages that depend on magic_ext_tezos