Coder Social home page Coder Social logo

eurus-app-transaction's Introduction

apiHandler

A dart library that connects to interact with the Ethereum blockchain. It connects to an Ethereum node to send transactions, interact with smart contracts and much more!

Features

  • Connect to an Ethereum node with the rpc-api, call common methods
  • Send signed Ethereum transactions
  • Generate private keys, setup new Ethereum addresses
  • Call functions on smart contracts and listen for contract events

TODO

  • Code generation based on smart contract ABI for easier interaction
  • Encode all supported solidity types, although only (u)fixed, which are not commonly used, are not supported at the moment.

Usage

Credentials and Wallets

In order to send transactions on the Ethereum network, some credentials are required. The library supports raw private keys and v3 wallet files.

Only support rinkeby testnet now

import 'package:transaction/web3dart.dart';
// You can setup private keys first
web3dart.initEthClient(privateKey:'d1bdc683fbeb9fa0b4ceb26adb39eaffb21b16891ea28e4cf1bc3118fdd39295');

Sending transactions

Of course, this library supports creating, signing and sending Ethereum transactions:

import 'package:web3dart/web3dart.dart';
/// send ETH Token Transaction
web3dart.sendETHFromMainnet(amount: EtherAmount.fromUnitAndValue(EtherUnit.finney, 1),toAddress:'0xA3B4dE5E90A18512BD82c1A640AC99b39ef2258A');

/// send ERC20 Token Transaction
/// if usdt Decimals is 18 than 1000000000000000000 = 1 amount  for example: BigInt.from(1000000000000000000)
web3dart.sendERC20FromMainnet(contractAddress: '0x7e0480ca9fd50eb7a3855cf53c347a1b4d6a2ff5',amount: BigInt.from(1000000000000000000),toAddress:'0xA3B4dE5E90A18512BD82c1A640AC99b39ef2258A');

get TopErc20CoinPrice()

import 'package:transaction/model/coinPrice.dart';
import 'package:transaction/transaction.dart';
import 'dart:async';

/// getTopErc20CoinPrice
CoinPriceList coinPrice = await transaction.getTopErc20CoinPrice();
    print("result:$coinPrice");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.