add more SDK calls
export jsonrpc.Decode add dep as dependencies manager
This commit is contained in:
parent
c0a12af3ae
commit
e90b6dfcc7
6 changed files with 763 additions and 76 deletions
407
Gopkg.lock
generated
Normal file
407
Gopkg.lock
generated
Normal file
|
@ -0,0 +1,407 @@
|
|||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:56332df3c4eb6fe335d7ef19996fcffd71711aaf1749aaf8a39a0593fbbcfbd5"
|
||||
name = "github.com/btcsuite/btcd"
|
||||
packages = [
|
||||
"btcec",
|
||||
"btcjson",
|
||||
"chaincfg",
|
||||
"chaincfg/chainhash",
|
||||
"rpcclient",
|
||||
"wire",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "ed77733ec07dfc8a513741138419b8d9d3de9d2d"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:30d4a548e09bca4a0c77317c58e7407e2a65c15325e944f9c08a7b7992f8a59e"
|
||||
name = "github.com/btcsuite/btclog"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "84c8d2346e9fc8c7b947e243b9c24e6df9fd206a"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:d0a31b77988b04afbfa2c5ee38567a7a35d5a95de2266a644a7bc8d5c898e68d"
|
||||
name = "github.com/btcsuite/btcutil"
|
||||
packages = [
|
||||
".",
|
||||
"base58",
|
||||
"bech32",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "bf1e1be935893b7c8ac9f020195f6b0dfd1f14e0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:1e6b2f7aa98b082c30a1303c29a702c369b2ec6d86b74a599bc8bbe2333db299"
|
||||
name = "github.com/btcsuite/go-socks"
|
||||
packages = ["socks"]
|
||||
pruneopts = "UT"
|
||||
revision = "4720035b7bfd2a9bb130b1c184f8bbe41b6f0d0f"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:0b2242fd2f4f51fb491e97e204464f75da680897a0db10ec7554c87b71b5afc3"
|
||||
name = "github.com/btcsuite/websocket"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "31079b6807923eb23992c421b114992b95131b55"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
|
||||
name = "github.com/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
pruneopts = "UT"
|
||||
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:af43bdaaf86655a2343f113e9b293bbc16b12099eaeb223982bbe4d4c22ba14d"
|
||||
name = "github.com/fatih/structs"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "4966fc68f5b7593aafa6cbbba2d65ec6e1416047"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:aacef5f5e45685f2aeda5534d0a750dee6859de7e9088cdd06192787bb01ae6d"
|
||||
name = "github.com/go-errors/errors"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "a6af135bd4e28680facf08a3d206b454abc877a4"
|
||||
version = "v1.0.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8b4bb15de2e698d359eeec15c42453567c98972a70c8619946050360ec02ec32"
|
||||
name = "github.com/go-ini/ini"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "6ed8d5f64cd79a498d1f3fab5880cc376ce41bbe"
|
||||
version = "v1.41.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:9d6dc4d6de69b330d0de86494d6db90c09848c003d5db748f40c925f865c8534"
|
||||
name = "github.com/golang/protobuf"
|
||||
packages = [
|
||||
"jsonpb",
|
||||
"proto",
|
||||
"ptypes",
|
||||
"ptypes/any",
|
||||
"ptypes/duration",
|
||||
"ptypes/struct",
|
||||
"ptypes/timestamp",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:c79fb010be38a59d657c48c6ba1d003a8aa651fa56b579d959d74573b7dff8e1"
|
||||
name = "github.com/gorilla/context"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "08b5f424b9271eedf6f9f0ce86cb9396ed337a42"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e73f5b0152105f18bc131fba127d9949305c8693f8a762588a82a48f61756f5f"
|
||||
name = "github.com/gorilla/mux"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "e3702bed27f0d39777b0b37b664b6280e8ef8fbf"
|
||||
version = "v1.6.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a66fce629a0e374ac46a776c32a536fdd01d05d56163bac4fab2e0f633d4d79b"
|
||||
name = "github.com/gorilla/rpc"
|
||||
packages = [
|
||||
"v2",
|
||||
"v2/json",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "22c016f3df3febe0c1f6727598b6389507e03a18"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:0a69a1c0db3591fcefb47f115b224592c8dfa4368b7ba9fae509d5e16cdc95c8"
|
||||
name = "github.com/konsorten/go-windows-terminal-sequences"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "5c8c8bd35d3832f5d134ae1e1e375b69a4d25242"
|
||||
version = "v1.0.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:65bb92382468ce7a1ee218b5f352cd0927d358569be7521dd7cb42e74589a308"
|
||||
name = "github.com/lbryio/errors.go"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "ad03d3cc6a5c27c94bbe3412cf7de0eae1a9bd7c"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:13289e2a34c842227d5891f1df2dcd7e42d5620d8b13ae0135a9d74e43711bee"
|
||||
name = "github.com/lbryio/ozzo-validation"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "d1008ad1fd04ceb5faedaf34881df0c504382706"
|
||||
version = "v3.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:44168348d9531e608ec7a06e5a2ad32c7b0cbef0d44b974361085f6e7ef962c6"
|
||||
name = "github.com/lbryio/types"
|
||||
packages = ["go"]
|
||||
pruneopts = "UT"
|
||||
revision = "594241d24e0025d769d2cb58168536b6963d51cf"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:0d8aaa52efbc9771152ba515e54937341206a96cebe82db29ba45906db43d231"
|
||||
name = "github.com/lyoshenka/bencode"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "b7abd7672df533e627eddbf3a5a529786e8bda7f"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:53bc4cd4914cd7cd52139990d5170d6dc99067ae31c56530621b18b35fc30318"
|
||||
name = "github.com/mitchellh/mapstructure"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "3536a929edddb9a5b34bd6861dc4a9647cb459fe"
|
||||
version = "v1.1.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:1c9958664ac11d29b4af0334fc9cc1a7f0a5bc7d500e735db6517bb8592a5722"
|
||||
name = "github.com/nlopes/slack"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "f243c7602fdf906248fc1f165284daa4e4d2d09e"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:b450e7e26884b4aea569d00db31e6309a236ebbcec07e8ad1d869a37be66ee37"
|
||||
name = "github.com/sebdah/goldie"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "8784dd1ab561dcf43d141f6678e9e41f3d0dff55"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:d917313f309bda80d27274d53985bc65651f81a5b66b820749ac7f8ef061fd04"
|
||||
name = "github.com/sergi/go-diff"
|
||||
packages = ["diffmatchpatch"]
|
||||
pruneopts = "UT"
|
||||
revision = "1744e2970ca51c86172c8190fadad617561ed6e7"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:81e02c4edb639c80559c0650f9401d3e2dcc3256d1fa215382bb7c83c1db9126"
|
||||
name = "github.com/shopspring/decimal"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "cd690d0c9e2447b1ef2a129a6b7b49077da89b8e"
|
||||
version = "1.1.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:87c2e02fb01c27060ccc5ba7c5a407cc91147726f8f40b70cceeedbc52b1f3a8"
|
||||
name = "github.com/sirupsen/logrus"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "e1e72e9de974bd926e5c56f83753fba2df402ce5"
|
||||
version = "v1.3.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:08d65904057412fc0270fc4812a1c90c594186819243160dc779a402d4b6d0bc"
|
||||
name = "github.com/spf13/cast"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "8c9545af88b134710ab1cd196795e7f2388358d7"
|
||||
version = "v1.3.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:3c1a69cdae3501bf75e76d0d86dc6f2b0a7421bc205c0cb7b96b19eed464a34d"
|
||||
name = "github.com/uber-go/atomic"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "1ea20fb1cbb1cc08cbd0d913a96dead89aa18289"
|
||||
version = "v1.3.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:564b31f09a21367ada5b019d8413afe99cf770775606f94c7bef42b2ef79dfdf"
|
||||
name = "github.com/ybbus/jsonrpc"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "dd866631e904a5df2067d934985c5def68f391ac"
|
||||
version = "v2.1.2"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:d061ca5246742c0da8f1672d06efb1737b8f427f3a2585ff9df0a29edcbe7be0"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = [
|
||||
"ripemd160",
|
||||
"sha3",
|
||||
"ssh/terminal",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "ff983b9c42bc9fbf91556e191cc8efb585c16908"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:4d6864e17d6867318cdaaa7790d655a7c9a1571429d2ce1f58a114bf7aba8d2b"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"context",
|
||||
"http/httpguts",
|
||||
"http2",
|
||||
"http2/hpack",
|
||||
"idna",
|
||||
"internal/timeseries",
|
||||
"trace",
|
||||
"websocket",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "915654e7eabcea33ae277abbecf52f0d8b7a9fdc"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:43cde116ff48f299eddb7e6515677e6d0a2c915854bb05a333877f07c3bb3033"
|
||||
name = "golang.org/x/sys"
|
||||
packages = [
|
||||
"unix",
|
||||
"windows",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "11f53e03133963fb11ae0588e08b5e0b85be8be5"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18"
|
||||
name = "golang.org/x/text"
|
||||
packages = [
|
||||
"collate",
|
||||
"collate/build",
|
||||
"internal/colltab",
|
||||
"internal/gen",
|
||||
"internal/tag",
|
||||
"internal/triegen",
|
||||
"internal/ucd",
|
||||
"language",
|
||||
"secure/bidirule",
|
||||
"transform",
|
||||
"unicode/bidi",
|
||||
"unicode/cldr",
|
||||
"unicode/norm",
|
||||
"unicode/rangetable",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:9fdc2b55e8e0fafe4b41884091e51e77344f7dc511c5acedcfd98200003bff90"
|
||||
name = "golang.org/x/time"
|
||||
packages = ["rate"]
|
||||
pruneopts = "UT"
|
||||
revision = "85acf8d2951cb2a3bde7632f9ff273ef0379bcbd"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:077c1c599507b3b3e9156d17d36e1e61928ee9b53a5b420f10f28ebd4a0b275c"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = ["googleapis/rpc/status"]
|
||||
pruneopts = "UT"
|
||||
revision = "db91494dd46c1fdcbbde05e5ff5eb56df8f7d79a"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:9ab5a33d8cb5c120602a34d2e985ce17956a4e8c2edce7e6961568f95e40c09a"
|
||||
name = "google.golang.org/grpc"
|
||||
packages = [
|
||||
".",
|
||||
"balancer",
|
||||
"balancer/base",
|
||||
"balancer/roundrobin",
|
||||
"binarylog/grpc_binarylog_v1",
|
||||
"codes",
|
||||
"connectivity",
|
||||
"credentials",
|
||||
"credentials/internal",
|
||||
"encoding",
|
||||
"encoding/proto",
|
||||
"grpclog",
|
||||
"internal",
|
||||
"internal/backoff",
|
||||
"internal/binarylog",
|
||||
"internal/channelz",
|
||||
"internal/envconfig",
|
||||
"internal/grpcrand",
|
||||
"internal/grpcsync",
|
||||
"internal/syscall",
|
||||
"internal/transport",
|
||||
"keepalive",
|
||||
"metadata",
|
||||
"naming",
|
||||
"peer",
|
||||
"resolver",
|
||||
"resolver/dns",
|
||||
"resolver/passthrough",
|
||||
"stats",
|
||||
"status",
|
||||
"tap",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "a02b0774206b209466313a0b525d2c738fe407eb"
|
||||
version = "v1.18.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:dd20e35bfb19aa3392cd17867fc1f95ffda2b0b6e6d9a330cd08c0892193d63f"
|
||||
name = "gopkg.in/nullbio/null.v6"
|
||||
packages = ["convert"]
|
||||
pruneopts = "UT"
|
||||
revision = "40264a2e6b7972d183906cf17663983c23231c82"
|
||||
version = "v6.3"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
input-imports = [
|
||||
"github.com/btcsuite/btcd/chaincfg",
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash",
|
||||
"github.com/btcsuite/btcd/rpcclient",
|
||||
"github.com/btcsuite/btcutil",
|
||||
"github.com/btcsuite/btcutil/base58",
|
||||
"github.com/davecgh/go-spew/spew",
|
||||
"github.com/fatih/structs",
|
||||
"github.com/go-errors/errors",
|
||||
"github.com/go-ini/ini",
|
||||
"github.com/golang/protobuf/jsonpb",
|
||||
"github.com/golang/protobuf/proto",
|
||||
"github.com/gorilla/mux",
|
||||
"github.com/gorilla/rpc/v2",
|
||||
"github.com/gorilla/rpc/v2/json",
|
||||
"github.com/lbryio/errors.go",
|
||||
"github.com/lbryio/ozzo-validation",
|
||||
"github.com/lbryio/types/go",
|
||||
"github.com/lyoshenka/bencode",
|
||||
"github.com/mitchellh/mapstructure",
|
||||
"github.com/nlopes/slack",
|
||||
"github.com/sebdah/goldie",
|
||||
"github.com/sergi/go-diff/diffmatchpatch",
|
||||
"github.com/shopspring/decimal",
|
||||
"github.com/sirupsen/logrus",
|
||||
"github.com/spf13/cast",
|
||||
"github.com/uber-go/atomic",
|
||||
"github.com/ybbus/jsonrpc",
|
||||
"golang.org/x/crypto/ripemd160",
|
||||
"golang.org/x/crypto/sha3",
|
||||
"golang.org/x/net/context",
|
||||
"golang.org/x/time/rate",
|
||||
"google.golang.org/grpc",
|
||||
"gopkg.in/nullbio/null.v6/convert",
|
||||
]
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
138
Gopkg.toml
Normal file
138
Gopkg.toml
Normal file
|
@ -0,0 +1,138 @@
|
|||
# Gopkg.toml example
|
||||
#
|
||||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
|
||||
# for detailed Gopkg.toml documentation.
|
||||
#
|
||||
# required = ["github.com/user/thing/cmd/thing"]
|
||||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project"
|
||||
# version = "1.0.0"
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project2"
|
||||
# branch = "dev"
|
||||
# source = "github.com/myfork/project2"
|
||||
#
|
||||
# [[override]]
|
||||
# name = "github.com/x/y"
|
||||
# version = "2.4.0"
|
||||
#
|
||||
# [prune]
|
||||
# non-go = false
|
||||
# go-tests = true
|
||||
# unused-packages = true
|
||||
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/btcsuite/btcd"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/btcsuite/btcutil"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/davecgh/go-spew"
|
||||
version = "1.1.1"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/fatih/structs"
|
||||
version = "1.1.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/go-errors/errors"
|
||||
version = "1.0.1"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/go-ini/ini"
|
||||
version = "1.41.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/golang/protobuf"
|
||||
version = "1.2.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/gorilla/mux"
|
||||
version = "1.6.2"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/gorilla/rpc"
|
||||
version = "1.1.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/lbryio/errors.go"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/lbryio/ozzo-validation"
|
||||
version = "3.1.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/lbryio/types"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/lyoshenka/bencode"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/mitchellh/mapstructure"
|
||||
version = "1.1.2"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/nlopes/slack"
|
||||
revision = "f243c7602fdf906248fc1f165284daa4e4d2d09e"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/sebdah/goldie"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/sergi/go-diff"
|
||||
version = "1.0.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/shopspring/decimal"
|
||||
version = "1.1.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/sirupsen/logrus"
|
||||
version = "1.3.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/spf13/cast"
|
||||
version = "1.3.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/uber-go/atomic"
|
||||
version = "1.3.2"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/ybbus/jsonrpc"
|
||||
version = "2.1.2"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/crypto"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/net"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/time"
|
||||
|
||||
[[constraint]]
|
||||
name = "google.golang.org/grpc"
|
||||
version = "1.18.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "gopkg.in/nullbio/null.v6"
|
||||
version = "6.3.0"
|
||||
|
||||
[prune]
|
||||
go-tests = true
|
||||
unused-packages = true
|
|
@ -12,6 +12,7 @@ import (
|
|||
|
||||
"github.com/lbryio/lbry.go/extras/errors"
|
||||
|
||||
"github.com/fatih/structs"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/shopspring/decimal"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
@ -49,7 +50,7 @@ func NewClientAndWait(address string) *Client {
|
|||
}
|
||||
}
|
||||
|
||||
func decode(data interface{}, targetStruct interface{}) error {
|
||||
func Decode(data interface{}, targetStruct interface{}) error {
|
||||
config := &mapstructure.DecoderConfig{
|
||||
Metadata: nil,
|
||||
Result: targetStruct,
|
||||
|
@ -125,7 +126,7 @@ func (d *Client) call(response interface{}, command string, params map[string]in
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return decode(result, response)
|
||||
return Decode(result, response)
|
||||
}
|
||||
|
||||
func (d *Client) SetRPCTimeout(timeout time.Duration) {
|
||||
|
@ -269,7 +270,7 @@ func (d *Client) BlobGet(blobHash string, encoding *string, timeout *uint) (*Blo
|
|||
}
|
||||
|
||||
response := new(BlobGetResponse)
|
||||
return response, decode(rawResponse, response)
|
||||
return response, Decode(rawResponse, response)
|
||||
}
|
||||
|
||||
func (d *Client) StreamAvailability(url string, search_timeout *uint64, blob_timeout *uint64) (*StreamAvailabilityResponse, error) {
|
||||
|
@ -337,51 +338,6 @@ func (d *Client) ChannelNew(name string, amount float64) (*ChannelNewResponse, e
|
|||
})
|
||||
}
|
||||
|
||||
func (d *Client) ChannelList() (*ChannelListResponse, error) {
|
||||
response := new(ChannelListResponse)
|
||||
return response, d.call(response, "channel_list", map[string]interface{}{})
|
||||
}
|
||||
|
||||
type PublishOptions struct {
|
||||
Fee *Fee
|
||||
Title *string
|
||||
Description *string
|
||||
Author *string
|
||||
Language *string
|
||||
License *string
|
||||
LicenseURL *string
|
||||
Thumbnail *string
|
||||
Preview *string
|
||||
NSFW *bool
|
||||
ChannelName *string
|
||||
ChannelID *string
|
||||
ClaimAddress *string
|
||||
ChangeAddress *string
|
||||
}
|
||||
|
||||
func (d *Client) Publish(name, filePath string, bid float64, options PublishOptions) (*PublishResponse, error) {
|
||||
response := new(PublishResponse)
|
||||
return response, d.call(response, "publish", map[string]interface{}{
|
||||
"name": name,
|
||||
"file_path": filePath,
|
||||
"bid": bid,
|
||||
"fee": options.Fee,
|
||||
"title": options.Title,
|
||||
"description": options.Description,
|
||||
"author": options.Author,
|
||||
"language": options.Language,
|
||||
"license": options.License,
|
||||
"license_url": options.LicenseURL,
|
||||
"thumbnail": options.Thumbnail,
|
||||
"preview": options.Preview,
|
||||
"nsfw": options.NSFW,
|
||||
"channel_name": options.ChannelName,
|
||||
"channel_id": options.ChannelID,
|
||||
"claim_address": options.ClaimAddress,
|
||||
"change_address": options.ChangeAddress,
|
||||
})
|
||||
}
|
||||
|
||||
func (d *Client) BlobAnnounce(blobHash, sdHash, streamHash *string) (*BlobAnnounceResponse, error) {
|
||||
response := new(BlobAnnounceResponse)
|
||||
return response, d.call(response, "blob_announce", map[string]interface{}{
|
||||
|
@ -508,3 +464,61 @@ func (d *Client) AccountFund(fromAccount string, toAccount string, amount string
|
|||
"outputs": outputs,
|
||||
})
|
||||
}
|
||||
|
||||
func (d *Client) AddressUnused(account *string) (*AddressUnusedResponse, error) {
|
||||
response := new(AddressUnusedResponse)
|
||||
return response, d.call(response, "address_unused", map[string]interface{}{
|
||||
"account_id": account,
|
||||
})
|
||||
}
|
||||
|
||||
func (d *Client) ChannelList(account *string, page uint64, pageSize uint64) (*ChannelListResponse, error) {
|
||||
response := new(ChannelListResponse)
|
||||
return response, d.call(response, "channel_list", map[string]interface{}{
|
||||
"account_id": account,
|
||||
"page": page,
|
||||
"page_size": pageSize,
|
||||
})
|
||||
}
|
||||
|
||||
type Metadata struct {
|
||||
Fee *Fee `json:"fee,omitempty"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Author string `json:"author"`
|
||||
Language string `json:"language"`
|
||||
License string `json:"license"`
|
||||
LicenseURL *string `json:"license_url,omitempty"`
|
||||
Thumbnail *string `json:"thumbnail,omitempty"`
|
||||
Preview *string `json:"preview,omitempty"`
|
||||
NSFW bool `json:"nsfw"`
|
||||
Sources *struct {
|
||||
LBRYSDHash string `json:"lbry_sd_hash"`
|
||||
} `json:"sources,omitempty"`
|
||||
}
|
||||
type PublishOptions struct {
|
||||
*Metadata `json:"metadata"`
|
||||
ChannelName *string `json:"channel_name,omitempty"`
|
||||
ChannelID *string `json:"channel_id,omitempty"`
|
||||
ChannelAccountID *string `json:"channel_account_id,omitempty"`
|
||||
AccountID *string `json:"account_id,omitempty"`
|
||||
ClaimAddress *string `json:"claim_address,omitempty"`
|
||||
ChangeAddress *string `json:"change_address,omitempty"`
|
||||
}
|
||||
|
||||
func (d *Client) Publish(name, filePath string, bid float64, options PublishOptions) (*PublishResponse, error) {
|
||||
response := new(PublishResponse)
|
||||
args := struct {
|
||||
Name string `json:"name"`
|
||||
FilePath string `json:"file_path,omitempty"`
|
||||
Bid string `json:"bid"`
|
||||
*PublishOptions `json:",flatten"`
|
||||
}{
|
||||
Name: name,
|
||||
FilePath: filePath,
|
||||
Bid: fmt.Sprintf("%.1f", bid),
|
||||
PublishOptions: &options,
|
||||
}
|
||||
structs.DefaultTagName = "json"
|
||||
return response, d.call(response, "publish", structs.Map(args))
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@ import (
|
|||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/lbryio/lbry.go/extras/util"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
|
@ -47,3 +50,59 @@ func TestClient_AccountFund(t *testing.T) {
|
|||
}
|
||||
log.Infof("%+v", *got)
|
||||
}
|
||||
|
||||
func TestClient_AddressUnused(t *testing.T) {
|
||||
d := NewClient("")
|
||||
got, err := d.AddressUnused(nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
log.Infof("%s", *got)
|
||||
}
|
||||
|
||||
func TestClient_ChannelList(t *testing.T) {
|
||||
d := NewClient("")
|
||||
got, err := d.ChannelList(nil, 0, 50)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
log.Infof("%+v", *got)
|
||||
}
|
||||
|
||||
func TestClient_Publish(t *testing.T) {
|
||||
d := NewClient("")
|
||||
addressResponse, err := d.AddressUnused(nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
address := string(*addressResponse)
|
||||
got, err := d.Publish("test", "/home/niko/test.txt", 13.37, PublishOptions{
|
||||
Metadata: &Metadata{
|
||||
Fee: &Fee{
|
||||
Currency: "LBC",
|
||||
Amount: decimal.NewFromFloat(1.0),
|
||||
Address: &address,
|
||||
},
|
||||
Title: "This is a Test Title",
|
||||
Description: "My Special Description",
|
||||
Author: "Niko",
|
||||
Language: "en",
|
||||
License: "FREEEEE",
|
||||
LicenseURL: nil,
|
||||
Thumbnail: util.PtrToString("https://scrn.storni.info/2019-01-18_16-37-39-098537783.png"),
|
||||
Preview: nil,
|
||||
NSFW: false,
|
||||
Sources: nil,
|
||||
},
|
||||
ChannelName: nil,
|
||||
ChannelID: nil,
|
||||
ChannelAccountID: nil,
|
||||
AccountID: nil,
|
||||
ClaimAddress: &address,
|
||||
ChangeAddress: &address,
|
||||
})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
log.Infof("%+v", *got)
|
||||
}
|
||||
|
|
|
@ -338,14 +338,6 @@ type ChannelListResponse []ChannelListSingleResponse
|
|||
|
||||
type WalletListResponse []string
|
||||
|
||||
type PublishResponse struct {
|
||||
ClaimID string `json:"claim_id"`
|
||||
Fee decimal.Decimal `json:"fee"`
|
||||
Nout int `json:"nout"`
|
||||
Tx string `json:"tx"`
|
||||
Txid string `json:"txid"`
|
||||
}
|
||||
|
||||
type BlobAnnounceResponse bool
|
||||
|
||||
type WalletPrefillAddressesResponse struct {
|
||||
|
@ -375,6 +367,9 @@ type NumClaimsInChannelResponse map[string]struct {
|
|||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
//============================================
|
||||
// NEW SDK
|
||||
//============================================
|
||||
type Account struct {
|
||||
AddressGenerator struct {
|
||||
Change struct {
|
||||
|
@ -404,27 +399,45 @@ type AccountListResponse struct {
|
|||
}
|
||||
type AccountBalanceResponse string
|
||||
|
||||
type Transaction struct {
|
||||
Address string `json:"address"`
|
||||
Amount string `json:"amount"`
|
||||
ClaimID string `json:"claim_id"`
|
||||
Confirmations int64 `json:"confirmations"`
|
||||
Height int64 `json:"height"`
|
||||
IsChange bool `json:"is_change"`
|
||||
IsMine bool `json:"is_mine"`
|
||||
Name string `json:"name"`
|
||||
Nout uint64 `json:"nout"`
|
||||
PermanentUrl string `json:"permanent_url"`
|
||||
Txid string `json:"txid"`
|
||||
Type string `json:"type"`
|
||||
Value *lbryschema.Claim `json:"value"`
|
||||
}
|
||||
|
||||
type AccountFundResponse struct {
|
||||
Height int64 `json:"height"`
|
||||
Hex string `json:"hex"`
|
||||
Inputs []struct {
|
||||
Address string `json:"address"`
|
||||
Amount string `json:"amount"`
|
||||
Confirmations int64 `json:"confirmations"`
|
||||
Height int64 `json:"height"`
|
||||
IsChange bool `json:"is_change"`
|
||||
IsMine bool `json:"is_mine"`
|
||||
Nout uint64 `json:"nout"`
|
||||
Txid string `json:"txid"`
|
||||
} `json:"inputs"`
|
||||
Outputs []struct {
|
||||
Address string `json:"address"`
|
||||
Amount string `json:"amount"`
|
||||
Confirmations int64 `json:"confirmations"`
|
||||
Height int64 `json:"height"`
|
||||
Nout uint64 `json:"nout"`
|
||||
Txid string `json:"txid"`
|
||||
} `json:"outputs"`
|
||||
Height int64 `json:"height"`
|
||||
Hex string `json:"hex"`
|
||||
Inputs []Transaction `json:"inputs"`
|
||||
Outputs []Transaction `json:"outputs"`
|
||||
TotalFee string `json:"total_fee"`
|
||||
TotalOutput string `json:"total_output"`
|
||||
Txid string `json:"txid"`
|
||||
}
|
||||
|
||||
type AddressUnusedResponse string
|
||||
|
||||
type PublishResponse struct {
|
||||
ClaimAddress string `json:"claim_address"`
|
||||
ClaimID string `json:"claim_id"`
|
||||
Output Transaction `json:"output"`
|
||||
Success bool `json:"success"`
|
||||
Tx struct {
|
||||
Height int64 `json:"height"`
|
||||
Hex string `json:"hex"`
|
||||
Inputs []Transaction `json:"inputs"`
|
||||
Outputs []Transaction `json:"inputs"`
|
||||
} `json:"tx"`
|
||||
TotalFee string `json:"total_fee"`
|
||||
TotalOutput string `json:"total_output"`
|
||||
Txid string `json:"txid"`
|
||||
|
|
56
extras/util/pointer.go
Normal file
56
extras/util/pointer.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
// mostly copied from github.com/AlekSi/pointer
|
||||
// Provides helpers to get pointers to values of build-in types.
|
||||
|
||||
package util
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/lbryio/lbry.go/extras/null"
|
||||
)
|
||||
|
||||
func PtrToBool(b bool) *bool { return &b }
|
||||
func PtrToByte(b byte) *byte { return &b }
|
||||
func PtrToComplex128(c complex128) *complex128 { return &c }
|
||||
func PtrToComplex64(c complex64) *complex64 { return &c }
|
||||
func PtrToError(e error) *error { return &e }
|
||||
func PtrToFloat32(f float32) *float32 { return &f }
|
||||
func PtrToFloat64(f float64) *float64 { return &f }
|
||||
func PtrToInt(i int) *int { return &i }
|
||||
func PtrToInt16(i int16) *int16 { return &i }
|
||||
func PtrToInt32(i int32) *int32 { return &i }
|
||||
func PtrToInt64(i int64) *int64 { return &i }
|
||||
func PtrToInt8(i int8) *int8 { return &i }
|
||||
func PtrToRune(r rune) *rune { return &r }
|
||||
func PtrToString(s string) *string { return &s }
|
||||
func PtrToTime(t time.Time) *time.Time { return &t }
|
||||
func PtrToUint(u uint) *uint { return &u }
|
||||
func PtrToUint16(u uint16) *uint16 { return &u }
|
||||
func PtrToUint32(u uint32) *uint32 { return &u }
|
||||
func PtrToUint64(u uint64) *uint64 { return &u }
|
||||
func PtrToUint8(u uint8) *uint8 { return &u }
|
||||
func PtrToUintptr(u uintptr) *uintptr { return &u }
|
||||
|
||||
func PtrToNullString(s string) *null.String { n := null.StringFrom(s); return &n }
|
||||
func PtrToNullUint64(u uint64) *null.Uint64 { n := null.Uint64From(u); return &n }
|
||||
|
||||
func StrFromPtr(ptr *string) string {
|
||||
if ptr == nil {
|
||||
return ""
|
||||
}
|
||||
return *ptr
|
||||
}
|
||||
|
||||
func StrFromNull(str null.String) string {
|
||||
if !str.Valid {
|
||||
return ""
|
||||
}
|
||||
return str.String
|
||||
}
|
||||
|
||||
func NullStringFrom(s string) null.String {
|
||||
if s == "" {
|
||||
return null.String{}
|
||||
}
|
||||
return null.StringFrom(s)
|
||||
}
|
Loading…
Add table
Reference in a new issue