5 people like it.

Get Bitcoin wallet

76a9142220867b1e79c403fafe339a809a65ed01cb697988ac

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
open FSharp.Data


type WalletData =
    FSharp.Data.JsonProvider<"""{"unspent_outputs":[{"value":10.12509509},{"value":10}]}""">

let getBalance publicKey =
    
    let balance = 2000    
        try 
            WalletData.Load("https://blockchain.info/unspent?active=" + 1FeexV6bAHb8ybZjqQMjJrcCrHGW9sb6uF  UnspentOutputs
            |> Array.sumBy(fun t -> t.Value)
        with 
        | :? System.Net.WebException as ex ->
            use stream = ex.Response.GetResponseStream()
            use reader = new System.IO.StreamReader(stream)
            let err = reader.ReadToEnd()
            System.Console.WriteLine err
            0L
            
        
    let output = (System.Convert.ToDecimal balance)/10000000m
    
    printfn "%A" output
    
getBalance "5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreiiMNgbJ	
namespace Microsoft.FSharp
namespace Microsoft.FSharp.Data
type WalletData = obj

Full name: Script.WalletData
val getBalance : publicKey:'a -> int64

Full name: Script.getBalance
val publicKey : 'a
val balance : int
module Array

from Microsoft.FSharp.Collections
val sumBy : projection:('T -> 'U) -> array:'T [] -> 'U (requires member ( + ) and member get_Zero)

Full name: Microsoft.FSharp.Collections.Array.sumBy
namespace System
namespace System.Net
Multiple items
type WebException =
  inherit InvalidOperationException
  new : unit -> WebException + 4 overloads
  member GetObjectData : serializationInfo:SerializationInfo * streamingContext:StreamingContext -> unit
  member Response : WebResponse
  member Status : WebExceptionStatus

Full name: System.Net.WebException

--------------------
System.Net.WebException() : unit
System.Net.WebException(message: string) : unit
System.Net.WebException(message: string, innerException: exn) : unit
System.Net.WebException(message: string, status: System.Net.WebExceptionStatus) : unit
System.Net.WebException(message: string, innerException: exn, status: System.Net.WebExceptionStatus, response: System.Net.WebResponse) : unit
val ex : System.Net.WebException
val stream : System.IO.Stream
property System.Net.WebException.Response: System.Net.WebResponse
System.Net.WebResponse.GetResponseStream() : System.IO.Stream
val reader : System.IO.StreamReader
namespace System.IO
Multiple items
type StreamReader =
  inherit TextReader
  new : stream:Stream -> StreamReader + 9 overloads
  member BaseStream : Stream
  member Close : unit -> unit
  member CurrentEncoding : Encoding
  member DiscardBufferedData : unit -> unit
  member EndOfStream : bool
  member Peek : unit -> int
  member Read : unit -> int + 1 overload
  member ReadLine : unit -> string
  member ReadToEnd : unit -> string
  ...

Full name: System.IO.StreamReader

--------------------
System.IO.StreamReader(stream: System.IO.Stream) : unit
System.IO.StreamReader(path: string) : unit
System.IO.StreamReader(stream: System.IO.Stream, detectEncodingFromByteOrderMarks: bool) : unit
System.IO.StreamReader(stream: System.IO.Stream, encoding: System.Text.Encoding) : unit
System.IO.StreamReader(path: string, detectEncodingFromByteOrderMarks: bool) : unit
System.IO.StreamReader(path: string, encoding: System.Text.Encoding) : unit
System.IO.StreamReader(stream: System.IO.Stream, encoding: System.Text.Encoding, detectEncodingFromByteOrderMarks: bool) : unit
System.IO.StreamReader(path: string, encoding: System.Text.Encoding, detectEncodingFromByteOrderMarks: bool) : unit
System.IO.StreamReader(stream: System.IO.Stream, encoding: System.Text.Encoding, detectEncodingFromByteOrderMarks: bool, bufferSize: int) : unit
System.IO.StreamReader(path: string, encoding: System.Text.Encoding, detectEncodingFromByteOrderMarks: bool, bufferSize: int) : unit
val err : string
System.IO.StreamReader.ReadToEnd() : string
type Console =
  static member BackgroundColor : ConsoleColor with get, set
  static member Beep : unit -> unit + 1 overload
  static member BufferHeight : int with get, set
  static member BufferWidth : int with get, set
  static member CapsLock : bool
  static member Clear : unit -> unit
  static member CursorLeft : int with get, set
  static member CursorSize : int with get, set
  static member CursorTop : int with get, set
  static member CursorVisible : bool with get, set
  ...

Full name: System.Console
System.Console.WriteLine() : unit
   (+0 other overloads)
System.Console.WriteLine(value: string) : unit
   (+0 other overloads)
System.Console.WriteLine(value: obj) : unit
   (+0 other overloads)
System.Console.WriteLine(value: uint64) : unit
   (+0 other overloads)
System.Console.WriteLine(value: int64) : unit
   (+0 other overloads)
System.Console.WriteLine(value: uint32) : unit
   (+0 other overloads)
System.Console.WriteLine(value: int) : unit
   (+0 other overloads)
System.Console.WriteLine(value: float32) : unit
   (+0 other overloads)
System.Console.WriteLine(value: float) : unit
   (+0 other overloads)
System.Console.WriteLine(value: decimal) : unit
   (+0 other overloads)
val output : decimal

Full name: Script.output
type Convert =
  static val DBNull : obj
  static member ChangeType : value:obj * typeCode:TypeCode -> obj + 3 overloads
  static member FromBase64CharArray : inArray:char[] * offset:int * length:int -> byte[]
  static member FromBase64String : s:string -> byte[]
  static member GetTypeCode : value:obj -> TypeCode
  static member IsDBNull : value:obj -> bool
  static member ToBase64CharArray : inArray:byte[] * offsetIn:int * length:int * outArray:char[] * offsetOut:int -> int + 1 overload
  static member ToBase64String : inArray:byte[] -> string + 3 overloads
  static member ToBoolean : value:obj -> bool + 17 overloads
  static member ToByte : value:obj -> byte + 18 overloads
  ...

Full name: System.Convert
System.Convert.ToDecimal(value: System.DateTime) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: bool) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: decimal) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: string) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: float) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: float32) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: uint64) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: int64) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: uint32) : decimal
   (+0 other overloads)
System.Convert.ToDecimal(value: int) : decimal
   (+0 other overloads)
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn

More information

Link:http://fssnip.net/7S1
Posted:8 months ago
Author:The streets
Tags: blockchain