diff --git a/Cargo.lock b/Cargo.lock index 5477ac86..e53e386e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,39 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" + +[[package]] +name = "ahash" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" +dependencies = [ + "const-random", +] + [[package]] name = "aho-corasick" version = "0.7.15" @@ -28,9 +62,9 @@ version = "0.1.0" dependencies = [ "anchor-syn", "anyhow", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", ] [[package]] @@ -39,9 +73,9 @@ version = "0.1.0" dependencies = [ "anchor-syn", "anyhow", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", ] [[package]] @@ -50,10 +84,17 @@ version = "0.1.0" dependencies = [ "anchor-syn", "anyhow", - "clap", + "clap 3.0.0-beta.2", + "dirs", + "heck", + "serde", "serde_json", + "serde_yaml", + "serum-common", "shellexpand", - "syn", + "solana-sdk", + "syn 1.0.56", + "toml", ] [[package]] @@ -62,9 +103,9 @@ version = "0.1.0" dependencies = [ "anchor-syn", "anyhow", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", ] [[package]] @@ -73,10 +114,20 @@ version = "0.1.0" dependencies = [ "anyhow", "heck", - "proc-macro2", - "quote", + "proc-macro2 1.0.24", + "quote 1.0.8", "serde", - "syn", + "serde_json", + "syn 1.0.56", +] + +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +dependencies = [ + "winapi 0.3.9", ] [[package]] @@ -85,6 +136,24 @@ version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee67c11feeac938fae061b232e38e0b6d94f97a9df10e6271319325ac4c56a86" +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "assert_matches" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "695579f0f2520f3774bb40461e5adb066459d4e0af4d59d20175484fb8e9edf1" + [[package]] name = "atty" version = "0.2.14" @@ -93,7 +162,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -102,6 +171,45 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[package]] +name = "backtrace" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef5140344c85b01f9bbb4d4b7288a8aa4b3287ccef913a14bcc78a1063623598" +dependencies = [ + "addr2line", + "cfg-if 1.0.0", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "serde", +] + +[[package]] +name = "base32" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ce669cd6c8588f79e15cf450314f9638f967fc5770ff1c7c1deb0925ea7cfa" + +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + [[package]] name = "basic-program-0" version = "0.1.0" @@ -128,18 +236,54 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +[[package]] +name = "blake2b_simd" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" +dependencies = [ + "arrayref", + "arrayvec", + "constant_time_eq", +] + +[[package]] +name = "blake3" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9ff35b701f3914bdb8fad3368d822c766ef2858b2583198e41639b936f09d3f" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if 0.1.10", + "constant_time_eq", + "crypto-mac 0.8.0", + "digest 0.9.0", +] + [[package]] name = "block-buffer" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ - "block-padding", + "block-padding 0.1.5", "byte-tools", "byteorder", "generic-array 0.12.3", ] +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "block-padding 0.2.1", + "generic-array 0.14.4", +] + [[package]] name = "block-padding" version = "0.1.5" @@ -149,6 +293,12 @@ dependencies = [ "byte-tools", ] +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + [[package]] name = "borsh" version = "0.7.2" @@ -165,7 +315,7 @@ source = "git+https://github.com/project-serum/borsh?branch=serum#337732a185f052 dependencies = [ "borsh-derive-internal", "borsh-schema-derive-internal", - "syn", + "syn 1.0.56", ] [[package]] @@ -173,9 +323,9 @@ name = "borsh-derive-internal" version = "0.7.2" source = "git+https://github.com/project-serum/borsh?branch=serum#337732a185f052d5ee0424127b04b89d455ffa81" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", ] [[package]] @@ -183,9 +333,9 @@ name = "borsh-schema-derive-internal" version = "0.7.2" source = "git+https://github.com/project-serum/borsh?branch=serum#337732a185f052d5ee0424127b04b89d455ffa81" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", ] [[package]] @@ -194,6 +344,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" +[[package]] +name = "bumpalo" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" + [[package]] name = "bv" version = "0.11.1" @@ -216,6 +372,54 @@ version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +[[package]] +name = "bytes" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" +dependencies = [ + "byteorder", + "either", + "iovec", +] + +[[package]] +name = "bytes" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" + +[[package]] +name = "bzip2" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42b7c3cbf0fa9c1b82308d57191728ca0256cb821220f4e2fd410a72ade26e3b" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.9+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad3b39a260062fca31f7b0b12f207e8f2590a67d32ec7d59c20484b07ea7285e" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "cc" +version = "1.0.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450b8da92aa6f274e7c6437692f9f2ce6d701fb73bacfcf87897b3f89a4c20e" +dependencies = [ + "jobserver", + "num_cpus", +] + [[package]] name = "cfg-if" version = "0.1.10" @@ -228,6 +432,35 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "serde", + "time", + "winapi 0.3.9", +] + +[[package]] +name = "clap" +version = "2.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +dependencies = [ + "ansi_term", + "atty", + "bitflags", + "strsim 0.8.0", + "textwrap 0.11.0", + "unicode-width", + "vec_map", +] + [[package]] name = "clap" version = "3.0.0-beta.2" @@ -240,9 +473,9 @@ dependencies = [ "indexmap", "lazy_static", "os_str_bytes", - "strsim", + "strsim 0.10.0", "termcolor", - "textwrap", + "textwrap 0.12.1", "unicode-width", "vec_map", ] @@ -255,11 +488,86 @@ checksum = "370f715b81112975b1b69db93e0b56ea4cd4e5002ac43b2da8474106a54096a1" dependencies = [ "heck", "proc-macro-error", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", ] +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "console" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c0994e656bba7b922d8dd1245db90672ffb701e684e45be58f20719d69abc5a" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "regex", + "terminal_size", + "termios", + "unicode-width", + "winapi 0.3.9", + "winapi-util", +] + +[[package]] +name = "console" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cc80946b3480f421c2f17ed1cb841753a371c7c5104f51d507e13f532c856aa" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "regex", + "terminal_size", + "unicode-width", + "winapi 0.3.9", +] + +[[package]] +name = "const-random" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f590d95d011aa80b063ffe3253422ed5aa462af4e9867d43ce8337562bac77c4" +dependencies = [ + "const-random-macro", + "proc-macro-hack", +] + +[[package]] +name = "const-random-macro" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "615f6e27d000a2bffbc7f2f6a8669179378fa27ee4d0a509e985dfc0a7defb40" +dependencies = [ + "getrandom 0.2.0", + "lazy_static", + "proc-macro-hack", + "tiny-keccak", +] + +[[package]] +name = "const_fn" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826" + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + [[package]] name = "constraints-program" version = "0.1.0" @@ -270,6 +578,141 @@ dependencies = [ "solana-sdk", ] +[[package]] +name = "core-foundation" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" + +[[package]] +name = "crc32fast" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "crossbeam-channel" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" +dependencies = [ + "crossbeam-utils 0.7.2", + "maybe-uninit", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils 0.8.1", +] + +[[package]] +name = "crossbeam-deque" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" +dependencies = [ + "crossbeam-epoch 0.8.2", + "crossbeam-utils 0.7.2", + "maybe-uninit", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-epoch 0.9.1", + "crossbeam-utils 0.8.1", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +dependencies = [ + "autocfg", + "cfg-if 0.1.10", + "crossbeam-utils 0.7.2", + "lazy_static", + "maybe-uninit", + "memoffset 0.5.6", + "scopeguard", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d" +dependencies = [ + "cfg-if 1.0.0", + "const_fn", + "crossbeam-utils 0.8.1", + "lazy_static", + "memoffset 0.6.1", + "scopeguard", +] + +[[package]] +name = "crossbeam-queue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" +dependencies = [ + "cfg-if 0.1.10", + "crossbeam-utils 0.7.2", + "maybe-uninit", +] + +[[package]] +name = "crossbeam-utils" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +dependencies = [ + "autocfg", + "cfg-if 0.1.10", + "lazy_static", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d" +dependencies = [ + "autocfg", + "cfg-if 1.0.0", + "lazy_static", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "crypto-mac" version = "0.7.0" @@ -280,6 +723,16 @@ dependencies = [ "subtle 1.0.0", ] +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array 0.14.4", + "subtle 2.4.0", +] + [[package]] name = "curve25519-dalek" version = "2.1.0" @@ -287,12 +740,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d85653f070353a16313d0046f173f70d1aadd5b42600a14de626f0dfb3473a5" dependencies = [ "byteorder", - "digest", + "digest 0.8.1", "rand_core", "subtle 2.4.0", "zeroize", ] +[[package]] +name = "dashmap" +version = "3.11.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f260e2fc850179ef410018660006951c1b55b79e8087e87111a2c388994b9b5" +dependencies = [ + "ahash", + "cfg-if 0.1.10", + "num_cpus", +] + +[[package]] +name = "derivative" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaed5874effa6cde088c644ddcdcb4ffd1511391c5be4fdd7a5ccd02c7e4a183" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", +] + +[[package]] +name = "dialoguer" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4aa86af7b19b40ef9cbef761ed411a49f0afa06b7b6dcd3dfe2f96a3c546138" +dependencies = [ + "console 0.11.3", + "lazy_static", + "tempfile", +] + [[package]] name = "digest" version = "0.8.1" @@ -302,6 +788,33 @@ dependencies = [ "generic-array 0.12.3", ] +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "dir-diff" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2860407d7d7e2e004bb2128510ad9e8d669e76fa005ccf567977b5d71b8b4a0b" +dependencies = [ + "walkdir", +] + +[[package]] +name = "dirs" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "142995ed02755914747cc6ca76fc7e4583cd18578746716d0508ea6ed558b9ff" +dependencies = [ + "dirs-sys", +] + [[package]] name = "dirs-next" version = "2.0.0" @@ -312,6 +825,17 @@ dependencies = [ "dirs-sys-next", ] +[[package]] +name = "dirs-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" +dependencies = [ + "libc", + "redox_users", + "winapi 0.3.9", +] + [[package]] name = "dirs-sys-next" version = "0.1.1" @@ -320,7 +844,37 @@ checksum = "99de365f605554ae33f115102a02057d4fc18b01f3284d6870be0938743cfe7d" dependencies = [ "libc", "redox_users", - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "dtoa" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e" + +[[package]] +name = "ed25519" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37c66a534cbb46ab4ea03477eae19d5c22c01da8258030280b7bd9d8433fb6ef" +dependencies = [ + "serde", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "1.0.0-pre.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a8a37f4e8b35af971e6db5e3897e7a6344caa3f92f6544f88125a1f5f0035a" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand", + "serde", + "sha2", + "zeroize", ] [[package]] @@ -329,6 +883,21 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "encoding_rs" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801bbab217d7f79c0062f4f7205b5d4427c6d1a7bd7aafdd1475f7c59d62b283" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "env_logger" version = "0.8.2" @@ -342,6 +911,28 @@ dependencies = [ "termcolor", ] +[[package]] +name = "failure" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" +dependencies = [ + "backtrace", + "failure_derive", +] + +[[package]] +name = "failure_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", + "synstructure", +] + [[package]] name = "fake-simd" version = "0.1.2" @@ -354,6 +945,155 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" +[[package]] +name = "filetime" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c122a393ea57648015bf06fbd3d372378992e86b9ff5a7a497b076a28c79efe" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall", + "winapi 0.3.9", +] + +[[package]] +name = "flate2" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7411863d55df97a419aa64cb4d2f167103ea9d767e2c54a1868b7ac3f6b47129" +dependencies = [ + "cfg-if 1.0.0", + "crc32fast", + "libc", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "fs_extra" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "futures" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed" + +[[package]] +name = "futures-channel" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b7109687aa4e177ef6fe84553af6280ef2778bdb7783ba44c9dc3399110fe64" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748" + +[[package]] +name = "futures-io" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "611834ce18aaa1bd13c4b374f5d653e1027cf99b6b502584ff8c9a64413b30bb" + +[[package]] +name = "futures-macro" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77408a692f1f97bcc61dc001d752e00643408fbc922e4d634c655df50d595556" +dependencies = [ + "proc-macro-hack", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", +] + +[[package]] +name = "futures-sink" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f878195a49cee50e006b02b93cf7e0a95a38ac7b776b4c4d9cc1207cd20fcb3d" + +[[package]] +name = "futures-task" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c554eb5bf48b2426c4771ab68c6b14468b6e76cc90996f528c3338d761a4d0d" +dependencies = [ + "once_cell", +] + +[[package]] +name = "futures-util" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d304cff4a7b99cfb7986f7d43fbe93d175e72e704a8860787cc95e9ffd85cbd2" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-task", + "memchr", + "pin-project 1.0.2", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + [[package]] name = "generic-array" version = "0.12.3" @@ -374,6 +1114,16 @@ dependencies = [ "version_check", ] +[[package]] +name = "gethostname" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e692e296bfac1d2533ef168d0b60ff5897b8b70a4009276834014dd8924cc028" +dependencies = [ + "libc", + "winapi 0.3.9", +] + [[package]] name = "getrandom" version = "0.1.16" @@ -382,7 +1132,50 @@ checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "gimli" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" + +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + +[[package]] +name = "h2" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" +dependencies = [ + "bytes 0.5.6", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio 0.2.24", + "tokio-util", + "tracing", + "tracing-futures", ] [[package]] @@ -415,22 +1208,128 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" +[[package]] +name = "hidapi" +version = "1.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76c352a18370f7e7e47bcbfcbdc5432b8c80c705b5d751a25232c659fcf5c775" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "hmac" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" dependencies = [ - "crypto-mac", - "digest", + "crypto-mac 0.7.0", + "digest 0.8.1", ] +[[package]] +name = "hmac-drbg" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6e570451493f10f6581b48cdd530413b63ea9e780f544bfd3bdcaa0d89d1a7b" +dependencies = [ + "digest 0.8.1", + "generic-array 0.12.3", + "hmac", +] + +[[package]] +name = "http" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84129d298a6d57d246960ff8eb831ca4af3f96d29e2e28848dae275408658e26" +dependencies = [ + "bytes 0.5.6", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +dependencies = [ + "bytes 0.5.6", + "http", +] + +[[package]] +name = "httparse" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" + +[[package]] +name = "httpdate" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" + [[package]] name = "humantime" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a" +[[package]] +name = "hyper" +version = "0.13.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ad767baac13b44d4529fcf58ba2cd0995e36e7b435bc5b039de6f47e880dbf" +dependencies = [ + "bytes 0.5.6", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project 1.0.2", + "socket2", + "tokio 0.2.24", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37743cc83e8ee85eacfce90f2f4102030d9ff0a95244098d781e9bee4a90abb6" +dependencies = [ + "bytes 0.5.6", + "futures-util", + "hyper", + "log", + "rustls", + "tokio 0.2.24", + "tokio-rustls", + "webpki", +] + +[[package]] +name = "idna" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "indexmap" version = "1.6.1" @@ -441,6 +1340,51 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "indicatif" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7baab56125e25686df467fe470785512329883aab42696d661247aca2a2896e4" +dependencies = [ + "console 0.14.0", + "lazy_static", + "number_prefix", + "regex", +] + +[[package]] +name = "input_buffer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19a8a95243d5a0398cae618ec29477c6e3cb631152be5c19481f80bc71559754" +dependencies = [ + "bytes 0.5.6", +] + +[[package]] +name = "instant" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + +[[package]] +name = "ipnet" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" + [[package]] name = "itertools" version = "0.9.0" @@ -456,11 +1400,93 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +[[package]] +name = "jemalloc-ctl" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c502a5ff9dd2924f1ed32ba96e3b65735d837b4bfd978d3161b1702e66aca4b7" +dependencies = [ + "jemalloc-sys", + "libc", + "paste", +] + +[[package]] +name = "jemalloc-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45" +dependencies = [ + "cc", + "fs_extra", + "libc", +] + +[[package]] +name = "jemallocator" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69" +dependencies = [ + "jemalloc-sys", + "libc", +] + +[[package]] +name = "jobserver" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "jsonrpc-core" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0745a6379e3edc893c84ec203589790774e4247420033e71a76d3ab4687991fa" +dependencies = [ + "futures", + "log", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "keccak" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin", +] [[package]] name = "libc" @@ -468,6 +1494,56 @@ version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" +[[package]] +name = "libloading" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9367bdfa836b7e3cf895867f7a570283444da90562980ec2263d6e1569b16bc" +dependencies = [ + "cfg-if 1.0.0", + "winapi 0.3.9", +] + +[[package]] +name = "libsecp256k1" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc1e2c808481a63dc6da2074752fdd4336a3c8fcc68b83db6f1fd5224ae7962" +dependencies = [ + "arrayref", + "crunchy", + "digest 0.8.1", + "hmac-drbg", + "rand", + "sha2", + "subtle 2.4.0", + "typenum", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" + +[[package]] +name = "lock_api" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "lock_api" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.11" @@ -477,6 +1553,18 @@ dependencies = [ "cfg-if 0.1.10", ] +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" + +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + [[package]] name = "memchr" version = "2.3.4" @@ -492,15 +1580,152 @@ dependencies = [ "libc", ] +[[package]] +name = "memoffset" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memoffset" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "mime_guess" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "miniz_oxide" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d" +dependencies = [ + "adler", + "autocfg", +] + +[[package]] +name = "mio" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +dependencies = [ + "cfg-if 0.1.10", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow", + "net2", + "slab", + "winapi 0.2.8", +] + +[[package]] +name = "mio-uds" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +dependencies = [ + "iovec", + "libc", + "mio", +] + +[[package]] +name = "miow" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + +[[package]] +name = "native-tls" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "net2" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "nix" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2" +dependencies = [ + "bitflags", + "cc", + "cfg-if 1.0.0", + "libc", +] + [[package]] name = "num-derive" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", +] + +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", ] [[package]] @@ -512,18 +1737,226 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "226b45a5c2ac4dd696ed30fa6b94b057ad909c7b7fc2e0d0808192bced894066" +dependencies = [ + "derivative", + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c0fd9eba1d5db0994a239e09c1be402d35622277e35468ba891aa5e3188ce7e" +dependencies = [ + "proc-macro-crate", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", +] + +[[package]] +name = "number_prefix" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" + +[[package]] +name = "object" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" + +[[package]] +name = "once_cell" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" +dependencies = [ + "parking_lot 0.11.1", +] + [[package]] name = "opaque-debug" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "openssl" +version = "0.10.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "foreign-types", + "lazy_static", + "libc", + "openssl-sys", +] + +[[package]] +name = "openssl-probe" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" + +[[package]] +name = "openssl-sys" +version = "0.9.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "os_str_bytes" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afb2e1c3ee07430c2cf76151675e583e0f19985fa6efae47d6848a3e2c824f85" +[[package]] +name = "ouroboros" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc04551635026d3ac7bc646698ea1836a85ed2a26b7094fe1d15d8b14854c4a2" +dependencies = [ + "ouroboros_macro", + "stable_deref_trait", +] + +[[package]] +name = "ouroboros_macro" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cec33dfceabec83cd0e95a5ce9d20e76ab3a5cbfef59659b8c927f69b93ed8ae" +dependencies = [ + "Inflector", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", +] + +[[package]] +name = "parking_lot" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.6.2", + "rustc_version", +] + +[[package]] +name = "parking_lot" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.7.2", +] + +[[package]] +name = "parking_lot" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +dependencies = [ + "instant", + "lock_api 0.4.2", + "parking_lot_core 0.8.2", +] + +[[package]] +name = "parking_lot_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi", + "libc", + "redox_syscall", + "rustc_version", + "smallvec 0.6.13", + "winapi 0.3.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi", + "libc", + "redox_syscall", + "smallvec 1.6.0", + "winapi 0.3.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc", + "redox_syscall", + "smallvec 1.6.0", + "winapi 0.3.9", +] + +[[package]] +name = "paste" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" +dependencies = [ + "paste-impl", + "proc-macro-hack", +] + +[[package]] +name = "paste-impl" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" +dependencies = [ + "proc-macro-hack", +] + [[package]] name = "pbkdf2" version = "0.3.0" @@ -531,15 +1964,103 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" dependencies = [ "byteorder", - "crypto-mac", + "crypto-mac 0.7.0", ] +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + +[[package]] +name = "pin-project" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" +dependencies = [ + "pin-project-internal 0.4.27", +] + +[[package]] +name = "pin-project" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ccc2237c2c489783abd8c4c80e5450fc0e98644555b1364da68cc29aa151ca7" +dependencies = [ + "pin-project-internal 1.0.2", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" + +[[package]] +name = "pin-project-lite" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b063f57ec186e6140e2b8b6921e5f1bd89c7356dda5b33acc5401203ca6131c" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" + [[package]] name = "ppv-lite86" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -547,9 +2068,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", "version_check", ] @@ -559,18 +2080,48 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 1.0.24", + "quote 1.0.8", "version_check", ] +[[package]] +name = "proc-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + +[[package]] +name = "proc-macro-nested" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" + +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid 0.1.0", +] + [[package]] name = "proc-macro2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ - "unicode-xid", + "unicode-xid 0.2.1", +] + +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +dependencies = [ + "proc-macro2 0.4.30", ] [[package]] @@ -579,7 +2130,7 @@ version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" dependencies = [ - "proc-macro2", + "proc-macro2 1.0.24", ] [[package]] @@ -588,7 +2139,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", + "getrandom 0.1.16", "libc", "rand_chacha", "rand_core", @@ -611,7 +2162,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.16", ] [[package]] @@ -623,6 +2174,31 @@ dependencies = [ "rand_core", ] +[[package]] +name = "rayon" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" +dependencies = [ + "autocfg", + "crossbeam-deque 0.8.0", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" +dependencies = [ + "crossbeam-channel 0.5.0", + "crossbeam-deque 0.8.0", + "crossbeam-utils 0.8.1", + "lazy_static", + "num_cpus", +] + [[package]] name = "redox_syscall" version = "0.1.57" @@ -635,8 +2211,9 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" dependencies = [ - "getrandom", + "getrandom 0.1.16", "redox_syscall", + "rust-argon2", ] [[package]] @@ -657,13 +2234,121 @@ version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189" +[[package]] +name = "remove_dir_all" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc5b3ce5d5ea144bb04ebd093a9e14e9765bcfec866aecda9b6dec43b3d1e24" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "reqwest" +version = "0.10.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c" +dependencies = [ + "base64 0.13.0", + "bytes 0.5.6", + "encoding_rs", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "lazy_static", + "log", + "mime", + "mime_guess", + "percent-encoding", + "pin-project-lite 0.2.0", + "rustls", + "serde", + "serde_json", + "serde_urlencoded", + "tokio 0.2.24", + "tokio-rustls", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", +] + +[[package]] +name = "ring" +version = "0.16.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba5a8ec64ee89a76c98c549af81ff14813df09c3e6dc4766c3856da48597a0c" +dependencies = [ + "cc", + "lazy_static", + "libc", + "spin", + "untrusted", + "web-sys", + "winapi 0.3.9", +] + +[[package]] +name = "rpassword" +version = "4.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99371657d3c8e4d816fb6221db98fa408242b0b53bac08f8676a41f8554fe99f" +dependencies = [ + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "rust-argon2" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" +dependencies = [ + "base64 0.13.0", + "blake2b_simd", + "constant_time_eq", + "crossbeam-utils 0.8.1", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0", +] + +[[package]] +name = "rustls" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d1126dcf58e93cee7d098dbda643b5f92ed724f1f6a63007c1116eed6700c81" +dependencies = [ + "base64 0.12.3", + "log", + "ring", + "sct", + "webpki", ] [[package]] @@ -678,13 +2363,80 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +dependencies = [ + "lazy_static", + "winapi 0.3.9", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "sct" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "security-framework" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser", + "semver-parser 0.7.0", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser 0.10.1", ] [[package]] @@ -693,6 +2445,15 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +[[package]] +name = "semver-parser" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ef146c2ad5e5f4b037cd6ce2ebb775401729b19a82040c1beac9d36c7d1428" +dependencies = [ + "pest", +] + [[package]] name = "serde" version = "1.0.118" @@ -717,9 +2478,9 @@ version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", ] [[package]] @@ -733,16 +2494,82 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_yaml" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7baae0a99f1a324984bcdc5f0718384c1f69775f1c7eec8b859b71b443e3fd7" +dependencies = [ + "dtoa", + "linked-hash-map", + "serde", + "yaml-rust", +] + +[[package]] +name = "serum-common" +version = "0.1.0" +source = "git+https://github.com/project-serum/serum-dex#f7a62ea1adafb2201b4964eae105ff7519a4db20" +dependencies = [ + "anyhow", + "arrayref", + "bincode", + "borsh", + "bs58", + "rand", + "serde", + "serde_json", + "solana-client", + "solana-sdk", + "spl-token 2.0.8", +] + +[[package]] +name = "sha-1" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] + [[package]] name = "sha2" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" dependencies = [ - "block-buffer", - "digest", + "block-buffer 0.7.3", + "digest 0.8.1", "fake-simd", - "opaque-debug", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug 0.3.0", ] [[package]] @@ -754,6 +2581,154 @@ dependencies = [ "dirs-next", ] +[[package]] +name = "signature" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29f060a7d147e33490ec10da418795238fd7545bba241504d6b31a409f2e6210" + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" + +[[package]] +name = "smallvec" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" +dependencies = [ + "maybe-uninit", +] + +[[package]] +name = "smallvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a55ca5f3b68e41c979bf8c46a6f1da892ca4db8f94023ce0bd32407573b1ac0" + +[[package]] +name = "socket2" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "solana-account-decoder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f615679e600178987fc3d20f68f176c4af5db4b2f1dd52025795196f5a3fb1b" +dependencies = [ + "Inflector", + "base64 0.12.3", + "bincode", + "bs58", + "bv", + "lazy_static", + "serde", + "serde_derive", + "serde_json", + "solana-config-program", + "solana-sdk", + "solana-stake-program", + "solana-vote-program", + "spl-token 3.0.1", + "thiserror", + "zstd", +] + +[[package]] +name = "solana-clap-utils" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e657fd63ebd8c4d5db21ab10d054890ebfe6df9eacc3c161893752cc0c25e3dd" +dependencies = [ + "chrono", + "clap 2.33.3", + "rpassword", + "solana-remote-wallet", + "solana-sdk", + "thiserror", + "tiny-bip39", + "url", +] + +[[package]] +name = "solana-client" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f5ca241545e4c2367ae92084ee0109e284a1e05b39b8dcf978a5207ed88f29e" +dependencies = [ + "base64 0.13.0", + "bincode", + "bs58", + "clap 2.33.3", + "indicatif", + "jsonrpc-core", + "log", + "net2", + "rayon", + "reqwest", + "semver 0.11.0", + "serde", + "serde_derive", + "serde_json", + "solana-account-decoder", + "solana-clap-utils", + "solana-net-utils", + "solana-sdk", + "solana-transaction-status", + "solana-version", + "solana-vote-program", + "thiserror", + "tungstenite", + "url", +] + +[[package]] +name = "solana-config-program" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0fbe1d82bef9ac50413cd72a65e8547853f936d765ffd0a334b196f1acdc3f" +dependencies = [ + "bincode", + "chrono", + "log", + "serde", + "serde_derive", + "solana-sdk", +] + +[[package]] +name = "solana-crate-features" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd154192d2b458d6ebfe2343b26225880daaa771f5c43069c45a2b53369ba4d6" +dependencies = [ + "backtrace", + "bytes 0.4.12", + "cc", + "curve25519-dalek", + "ed25519-dalek", + "either", + "lazy_static", + "libc", + "rand_chacha", + "regex-syntax", + "reqwest", + "serde", + "syn 0.15.44", + "syn 1.0.56", + "tokio 0.1.22", + "winapi 0.3.9", +] + [[package]] name = "solana-frozen-abi" version = "1.5.0" @@ -781,10 +2756,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f616e1d66cfb1d5f35d4677af1e5592dc4da2141e718ddf42c926ad47d4727f" dependencies = [ "lazy_static", - "proc-macro2", - "quote", + "proc-macro2 1.0.24", + "quote 1.0.8", "rustc_version", - "syn", + "syn 1.0.56", ] [[package]] @@ -798,6 +2773,55 @@ dependencies = [ "log", ] +[[package]] +name = "solana-measure" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39228713bf50403f45d6b95c8e6c2bdabaa5dbf0c56a117139f587b646ae5c52" +dependencies = [ + "jemalloc-ctl", + "jemallocator", + "log", + "solana-metrics", + "solana-sdk", +] + +[[package]] +name = "solana-metrics" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60fb3d751091e53f3f2f88fdd70fb93617625b4ad0bcd82e6873c4bb3052de1c" +dependencies = [ + "env_logger", + "gethostname", + "lazy_static", + "log", + "reqwest", + "solana-sdk", +] + +[[package]] +name = "solana-net-utils" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08121e9069e056c2c4c53835ff05ea7642639094f39533f5979d0047614766c" +dependencies = [ + "bincode", + "bytes 0.4.12", + "clap 2.33.3", + "log", + "nix", + "rand", + "serde", + "serde_derive", + "socket2", + "solana-clap-utils", + "solana-logger", + "solana-version", + "tokio 0.1.22", + "url", +] + [[package]] name = "solana-program" version = "1.5.0" @@ -828,31 +2852,126 @@ dependencies = [ "thiserror", ] +[[package]] +name = "solana-rayon-threadlimit" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3e4ea131c14949da4a1856cd98972fd1f24baeb39e0aaacd726cc83ebb3683" +dependencies = [ + "lazy_static", + "num_cpus", +] + +[[package]] +name = "solana-remote-wallet" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb4851431ec03e4836dd8796a635b21d832b0924393ecd16afecc7760c666ac" +dependencies = [ + "base32", + "console 0.11.3", + "dialoguer", + "hidapi", + "log", + "num-derive", + "num-traits", + "parking_lot 0.10.2", + "semver 0.9.0", + "solana-sdk", + "thiserror", + "url", +] + +[[package]] +name = "solana-runtime" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a59d25d0f5bb22c6343a2be817efa481fbe0985a213f140ce205d55562d11a96" +dependencies = [ + "bincode", + "blake3", + "bv", + "byteorder", + "bzip2", + "crossbeam-channel 0.4.4", + "dashmap", + "dir-diff", + "flate2", + "fnv", + "fs_extra", + "itertools", + "lazy_static", + "libc", + "libloading", + "log", + "memmap2", + "num-derive", + "num-traits", + "num_cpus", + "ouroboros", + "rand", + "rayon", + "regex", + "rustc_version", + "serde", + "serde_derive", + "solana-config-program", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-logger", + "solana-measure", + "solana-metrics", + "solana-rayon-threadlimit", + "solana-sdk", + "solana-secp256k1-program", + "solana-stake-program", + "solana-vote-program", + "symlink", + "tar", + "tempfile", + "thiserror", + "zstd", +] + [[package]] name = "solana-sdk" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e37771fa6acdce54c456765d7d247536a4123b1afd0b96efbf164d38a5b08fa2" dependencies = [ + "assert_matches", "bincode", "bs58", "bv", + "byteorder", + "chrono", + "digest 0.9.0", + "ed25519-dalek", + "generic-array 0.14.4", "hex", "hmac", "itertools", "lazy_static", + "libsecp256k1", "log", + "memmap2", "num-derive", "num-traits", "pbkdf2", + "rand", + "rand_chacha", "rustc_version", "rustversion", "serde", "serde_bytes", "serde_derive", + "serde_json", "sha2", + "sha3", + "solana-crate-features", "solana-frozen-abi", "solana-frozen-abi-macro", + "solana-logger", "solana-program", "solana-sdk-macro", "thiserror", @@ -865,12 +2984,166 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "012a3f407ae5a2571c810592d72f86c87b4652aeeb8ed7e3082970af172d5ac6" dependencies = [ "bs58", - "proc-macro2", - "quote", + "proc-macro2 1.0.24", + "quote 1.0.8", "rustversion", - "syn", + "syn 1.0.56", ] +[[package]] +name = "solana-secp256k1-program" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ae342254431819ba2118aa34b50d7b37da296cde90d56af302d9d3df5473ef5" +dependencies = [ + "bincode", + "digest 0.9.0", + "libsecp256k1", + "rand", + "sha3", + "solana-logger", + "solana-sdk", +] + +[[package]] +name = "solana-stake-program" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b77f387a020aab9f69989172c043b59887a2380f70ae4899ea13ea918ec2412" +dependencies = [ + "bincode", + "log", + "num-derive", + "num-traits", + "rustc_version", + "serde", + "serde_derive", + "solana-config-program", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-metrics", + "solana-sdk", + "solana-vote-program", + "thiserror", +] + +[[package]] +name = "solana-transaction-status" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b29b8f38f217384dcaad6790018695cb37b1ed5eb16400cb36a8806b3e5d1b5c" +dependencies = [ + "Inflector", + "base64 0.12.3", + "bincode", + "bs58", + "lazy_static", + "serde", + "serde_derive", + "serde_json", + "solana-account-decoder", + "solana-runtime", + "solana-sdk", + "solana-stake-program", + "solana-vote-program", + "spl-memo", + "spl-token 3.0.1", + "thiserror", +] + +[[package]] +name = "solana-version" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "449dfdd4a87520f14f776b4265a61b7908379b1381e772016b6c2d2a4afa8b0b" +dependencies = [ + "log", + "rustc_version", + "serde", + "serde_derive", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-logger", + "solana-sdk", +] + +[[package]] +name = "solana-vote-program" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9831d3f343c6acc1a218381969a829f46b77f9e7c2f89241a615dc5c8c27a7d9" +dependencies = [ + "bincode", + "log", + "num-derive", + "num-traits", + "rustc_version", + "serde", + "serde_derive", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-logger", + "solana-metrics", + "solana-sdk", + "thiserror", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spl-memo" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb2b771f6146dec14ef5fbf498f9374652c54badc3befc8c40c1d426dd45d720" +dependencies = [ + "solana-program", +] + +[[package]] +name = "spl-token" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaa27ab75067c63b8804d9fff30bd2e8bfb5be448bea8067ed768381e70ca181" +dependencies = [ + "arrayref", + "num-derive", + "num-traits", + "num_enum", + "remove_dir_all", + "solana-sdk", + "thiserror", +] + +[[package]] +name = "spl-token" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9774eebb62ff1ff2f5eca112413e476143925a2f5a43cee98fc5d3a6c0eec5c" +dependencies = [ + "arrayref", + "num-derive", + "num-traits", + "num_enum", + "solana-program", + "thiserror", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + [[package]] name = "strsim" version = "0.10.0" @@ -889,15 +3162,70 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" +[[package]] +name = "symlink" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7973cce6668464ea31f176d85b13c7ab3bba2cb3b77a2ed26abd7801688010a" + +[[package]] +name = "syn" +version = "0.15.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "unicode-xid 0.1.0", +] + [[package]] name = "syn" version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9802ddde94170d186eeee5005b798d9c159fa970403f1be19976d0cfb939b72" dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", + "proc-macro2 1.0.24", + "quote 1.0.8", + "unicode-xid 0.2.1", +] + +[[package]] +name = "synstructure" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", + "unicode-xid 0.2.1", +] + +[[package]] +name = "tar" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "489997b7557e9a43e192c527face4feacc78bfbe6eed67fd55c4c9e381cba290" +dependencies = [ + "filetime", + "libc", + "redox_syscall", + "xattr", +] + +[[package]] +name = "tempfile" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "rand", + "redox_syscall", + "remove_dir_all", + "winapi 0.3.9", ] [[package]] @@ -909,6 +3237,34 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bd2d183bd3fac5f5fe38ddbeb4dc9aec4a39a9d7d59e7491d900302da01cbe1" +dependencies = [ + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "termios" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "411c5bf740737c7918b8b1fe232dca4dc9f8e754b8ad5e20966814001ed0ac6b" +dependencies = [ + "libc", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + [[package]] name = "textwrap" version = "0.12.1" @@ -933,9 +3289,9 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", ] [[package]] @@ -947,12 +3303,394 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "time" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi 0.3.9", +] + +[[package]] +name = "tiny-bip39" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0165e045cc2ae1660270ca65e1676dbaab60feb0f91b10f7d0665e9b47e31f2" +dependencies = [ + "failure", + "hmac", + "once_cell", + "pbkdf2", + "rand", + "rustc-hash", + "sha2", + "unicode-normalization", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinyvec" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf8dbc19eb42fba10e8feaaec282fb50e2c14b2726d6301dbfeed0f73306a6f" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" +dependencies = [ + "bytes 0.4.12", + "futures", + "mio", + "num_cpus", + "tokio-codec", + "tokio-current-thread", + "tokio-executor", + "tokio-fs", + "tokio-io", + "tokio-reactor", + "tokio-sync", + "tokio-tcp", + "tokio-threadpool", + "tokio-timer", + "tokio-udp", + "tokio-uds", +] + +[[package]] +name = "tokio" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "099837d3464c16a808060bb3f02263b412f6fafcb5d01c533d309985fbeebe48" +dependencies = [ + "bytes 0.5.6", + "fnv", + "futures-core", + "iovec", + "lazy_static", + "memchr", + "mio", + "num_cpus", + "pin-project-lite 0.1.11", + "slab", +] + +[[package]] +name = "tokio-codec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" +dependencies = [ + "bytes 0.4.12", + "futures", + "tokio-io", +] + +[[package]] +name = "tokio-current-thread" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" +dependencies = [ + "futures", + "tokio-executor", +] + +[[package]] +name = "tokio-executor" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" +dependencies = [ + "crossbeam-utils 0.7.2", + "futures", +] + +[[package]] +name = "tokio-fs" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4" +dependencies = [ + "futures", + "tokio-io", + "tokio-threadpool", +] + +[[package]] +name = "tokio-io" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" +dependencies = [ + "bytes 0.4.12", + "futures", + "log", +] + +[[package]] +name = "tokio-reactor" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" +dependencies = [ + "crossbeam-utils 0.7.2", + "futures", + "lazy_static", + "log", + "mio", + "num_cpus", + "parking_lot 0.9.0", + "slab", + "tokio-executor", + "tokio-io", + "tokio-sync", +] + +[[package]] +name = "tokio-rustls" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12831b255bcfa39dc0436b01e19fea231a37db570686c06ee72c423479f889a" +dependencies = [ + "futures-core", + "rustls", + "tokio 0.2.24", + "webpki", +] + +[[package]] +name = "tokio-sync" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" +dependencies = [ + "fnv", + "futures", +] + +[[package]] +name = "tokio-tcp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" +dependencies = [ + "bytes 0.4.12", + "futures", + "iovec", + "mio", + "tokio-io", + "tokio-reactor", +] + +[[package]] +name = "tokio-threadpool" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89" +dependencies = [ + "crossbeam-deque 0.7.3", + "crossbeam-queue", + "crossbeam-utils 0.7.2", + "futures", + "lazy_static", + "log", + "num_cpus", + "slab", + "tokio-executor", +] + +[[package]] +name = "tokio-timer" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" +dependencies = [ + "crossbeam-utils 0.7.2", + "futures", + "slab", + "tokio-executor", +] + +[[package]] +name = "tokio-udp" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" +dependencies = [ + "bytes 0.4.12", + "futures", + "log", + "mio", + "tokio-codec", + "tokio-io", + "tokio-reactor", +] + +[[package]] +name = "tokio-uds" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" +dependencies = [ + "bytes 0.4.12", + "futures", + "iovec", + "libc", + "log", + "mio", + "mio-uds", + "tokio-codec", + "tokio-io", + "tokio-reactor", +] + +[[package]] +name = "tokio-util" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +dependencies = [ + "bytes 0.5.6", + "futures-core", + "futures-sink", + "log", + "pin-project-lite 0.1.11", + "tokio 0.2.24", +] + +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + +[[package]] +name = "tower-service" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" + +[[package]] +name = "tracing" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3" +dependencies = [ + "cfg-if 1.0.0", + "log", + "pin-project-lite 0.2.0", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f50de3927f93d202783f4513cda820ab47ef17f624b03c096e86ef00c67e6b5f" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "tracing-futures" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" +dependencies = [ + "pin-project 0.4.27", + "tracing", +] + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + +[[package]] +name = "tungstenite" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfea31758bf674f990918962e8e5f07071a3161bd7c4138ed23e416e1ac4264e" +dependencies = [ + "base64 0.11.0", + "byteorder", + "bytes 0.5.6", + "http", + "httparse", + "input_buffer", + "log", + "native-tls", + "rand", + "sha-1", + "url", + "utf-8", +] + [[package]] name = "typenum" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +dependencies = [ + "matches", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.7.1" @@ -965,12 +3703,48 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", +] + +[[package]] +name = "utf-8" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" + +[[package]] +name = "vcpkg" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" + [[package]] name = "vec_map" version = "0.8.2" @@ -983,12 +3757,142 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" +[[package]] +name = "walkdir" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" +dependencies = [ + "same-file", + "winapi 0.3.9", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "wasm-bindgen" +version = "0.2.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" +dependencies = [ + "cfg-if 1.0.0", + "serde", + "serde_json", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fe9756085a84584ee9457a002b7cdfe0bfff169f45d2591d8be1345a6780e35" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" +dependencies = [ + "quote 1.0.8", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" + +[[package]] +name = "web-sys" +version = "0.3.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f50e1972865d6b1adb54167d1c8ed48606004c2c9d0ea5f1eeb34d95e863ef" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f" +dependencies = [ + "webpki", +] + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + [[package]] name = "winapi" version = "0.3.9" @@ -999,6 +3903,12 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1011,7 +3921,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1020,8 +3930,91 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "winreg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "xattr" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" +dependencies = [ + "libc", +] + +[[package]] +name = "yaml-rust" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "zeroize" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81a974bcdd357f0dca4d41677db03436324d45a4c9ed2d0b873a5a360ce41c36" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f369ddb18862aba61aa49bf31e74d29f0f162dec753063200e1dc084345d16" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.8", + "syn 1.0.56", + "synstructure", +] + +[[package]] +name = "zstd" +version = "0.5.4+zstd.1.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69996ebdb1ba8b1517f61387a883857818a66c8a295f487b1ffd8fd9d2c82910" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "2.0.6+zstd.1.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98aa931fb69ecee256d44589d19754e61851ae4769bf963b385119b1cc37a49e" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "1.4.18+zstd.1.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6e8778706838f43f771d80d37787cb2fe06dafe89dd3aebaf6721b9eaec81" +dependencies = [ + "cc", + "glob", + "itertools", + "libc", +] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 2e666340..50b336d0 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -17,3 +17,10 @@ syn = { version = "1.0.54", features = ["full", "extra-traits"] } anchor-syn = { path = "../syn", features = ["idl"] } serde_json = "1.0" shellexpand = "2.1.0" +serde_yaml = "0.8" +toml = "0.5.8" +serde = { version = "1.0", features = ["derive"] } +solana-sdk = "1.5.0" +serum-common = { git = "https://github.com/project-serum/serum-dex", features = ["client"] } +dirs = "3.0" +heck = "0.3.1" diff --git a/cli/src/config.rs b/cli/src/config.rs new file mode 100644 index 00000000..da0a0f99 --- /dev/null +++ b/cli/src/config.rs @@ -0,0 +1,158 @@ +use anchor_syn::idl::Idl; +use anyhow::{anyhow, Error, Result}; +use serde::{Deserialize, Serialize}; +use serum_common::client::Cluster; +use std::fs::{self, File}; +use std::io::prelude::*; +use std::path::Path; +use std::path::PathBuf; +use std::str::FromStr; + +#[derive(Default)] +pub struct Config { + cluster: Cluster, + wallet: WalletPath, +} + +impl Config { + // Searches all parent directories for an Anchor.toml file. + pub fn discover() -> Result)>> { + // Set to true if we ever see a Cargo.toml file when traversing the + // parent directories. + let mut cargo_toml = None; + + let _cwd = std::env::current_dir()?; + let mut cwd_opt = Some(_cwd.as_path()); + + while let Some(cwd) = cwd_opt { + let files = fs::read_dir(cwd)?; + // Cargo.toml file for this directory level. + let mut cargo_toml_level = None; + let mut anchor_toml = None; + for f in files { + let p = f?.path(); + if let Some(filename) = p.file_name() { + if filename.to_str() == Some("Cargo.toml") { + cargo_toml_level = Some(PathBuf::from(p)); + } else if filename.to_str() == Some("Anchor.toml") { + let mut cfg_file = File::open(&p)?; + let mut cfg_contents = String::new(); + cfg_file.read_to_string(&mut cfg_contents)?; + let cfg = cfg_contents.parse()?; + anchor_toml = Some((cfg, PathBuf::from(p))); + } + } + } + + if let Some((cfg, parent)) = anchor_toml { + return Ok(Some((cfg, parent, cargo_toml))); + } + + if cargo_toml.is_none() { + cargo_toml = cargo_toml_level; + } + + cwd_opt = cwd.parent(); + } + + Ok(None) + } +} + +// Pubkey serializes as a byte array so use this type a hack to serialize +// into base 58 strings. +#[derive(Serialize, Deserialize)] +struct _Config { + cluster: String, + wallet: String, +} + +impl ToString for Config { + fn to_string(&self) -> String { + let cfg = _Config { + cluster: format!("{}", self.cluster), + wallet: self.wallet.to_string(), + }; + + toml::to_string(&cfg).expect("Must be well formed") + } +} + +impl FromStr for Config { + type Err = Error; + + fn from_str(s: &str) -> Result { + let cfg: _Config = toml::from_str(s) + .map_err(|e| anyhow::format_err!("Unable to deserialize config: {}", e.to_string()))?; + + Ok(Config { + cluster: cfg.cluster.parse()?, + wallet: cfg.wallet.parse()?, + }) + } +} + +pub fn find_cargo_toml() -> Result> { + let _cwd = std::env::current_dir()?; + let mut cwd_opt = Some(_cwd.as_path()); + while let Some(cwd) = cwd_opt { + let files = fs::read_dir(cwd)?; + for f in files { + let p = f?.path(); + if let Some(filename) = p.file_name() { + if filename.to_str() == Some("Cargo.toml") { + return Ok(Some(PathBuf::from(p))); + } + } + } + cwd_opt = cwd.parent(); + } + Ok(None) +} + +pub fn read_all_programs() -> Result> { + let files = fs::read_dir("programs")?; + let mut r = vec![]; + for f in files { + let path = f?.path(); + let idl = anchor_syn::parser::file::parse(path.join("src/lib.rs"))?; + let lib_name = extract_lib_name(&path.join("Cargo.toml"))?; + r.push(Program { + lib_name, + path, + idl, + }); + } + Ok(r) +} + +pub fn extract_lib_name(path: impl AsRef) -> Result { + let mut toml = File::open(path)?; + let mut contents = String::new(); + toml.read_to_string(&mut contents)?; + + let cargo_toml: toml::Value = contents.parse()?; + + match cargo_toml { + toml::Value::Table(t) => match t.get("lib") { + None => Err(anyhow!("lib not found in Cargo.toml")), + Some(lib) => match lib + .get("name") + .ok_or(anyhow!("lib name not found in Cargo.toml"))? + { + toml::Value::String(n) => Ok(n.to_string()), + _ => Err(anyhow!("lib name must be a string")), + }, + }, + _ => Err(anyhow!("Invalid Cargo.toml")), + } +} + +#[derive(Debug)] +pub struct Program { + pub lib_name: String, + pub path: PathBuf, + pub idl: Idl, +} + +serum_common::home_path!(WalletPath, ".config/solana/id.json"); diff --git a/cli/src/main.rs b/cli/src/main.rs index efc541e0..3df9fd60 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,5 +1,18 @@ +use crate::config::{find_cargo_toml, read_all_programs, Config, Program}; +use anchor_syn::idl::Idl; use anyhow::Result; use clap::Clap; +use serde::{Deserialize, Serialize}; +use solana_sdk::pubkey::Pubkey; +use std::collections::HashMap; +use std::fs::{self, File}; +use std::io::prelude::*; +use std::path::{Path, PathBuf}; +use std::process::{Child, Stdio}; +use std::string::ToString; + +mod config; +mod template; #[derive(Debug, Clap)] pub struct Opts { @@ -9,6 +22,18 @@ pub struct Opts { #[derive(Debug, Clap)] pub enum Command { + /// Initializes a workspace. + Init { name: String }, + /// Builds a Solana program. + Build { + /// Output directory for the IDL. + #[clap(short, long)] + idl: Option, + }, + /// Runs integration tests against a localnetwork. + Test, + /// Creates a new program. + New { name: String }, /// Outputs an interface definition file. Idl { /// Path to the program's interface definition. @@ -18,40 +43,349 @@ pub enum Command { #[clap(short, long)] out: Option, }, - /// Generates a client module. - Gen { - /// Path to the program's interface definition. - #[clap(short, long, required_unless_present("idl"))] - file: Option, - /// Output file (stdout if not specified). - #[clap(short, long)] - out: Option, - #[clap(short, long)] - idl: Option, - }, } fn main() -> Result<()> { let opts = Opts::parse(); + match opts.command { - Command::Idl { file, out } => idl(file, out), - Command::Gen { file, out, idl } => gen(file, out, idl), + Command::Init { name } => init(name), + Command::Build { idl } => build(idl), + Command::Test => test(), + Command::New { name } => new(name), + Command::Idl { file, out } => { + if out.is_none() { + return idl(file, None); + } + idl(file, Some(&PathBuf::from(out.unwrap()))) + } } } -fn idl(file: String, out: Option) -> Result<()> { - let file = shellexpand::tilde(&file); - let idl = anchor_syn::parser::file::parse(&file)?; - let idl_json = serde_json::to_string_pretty(&idl)?; - if let Some(out) = out { - std::fs::write(out, idl_json)?; - return Ok(()); +fn init(name: String) -> Result<()> { + let cfg = Config::discover()?; + + if cfg.is_some() { + println!("Anchor workspace already initialized"); } - println!("{}", idl_json); + + fs::create_dir(name.clone())?; + std::env::set_current_dir(&name)?; + fs::create_dir("app")?; + + let cfg = Config::default(); + let toml = cfg.to_string(); + let mut file = File::create("Anchor.toml")?; + file.write_all(toml.as_bytes())?; + + // Build virtual manifest. + let mut virt_manifest = File::create("Cargo.toml")?; + virt_manifest.write_all(template::virtual_manifest().as_bytes())?; + + // Build the program. + fs::create_dir("programs")?; + + new_program(&name)?; + + // Build the test suite. + fs::create_dir("tests")?; + let mut mocha = File::create(&format!("tests/{}.js", name))?; + mocha.write_all(template::mocha(&name).as_bytes())?; + + println!("{} initialized", name); + Ok(()) } -fn gen(file: Option, out: Option, idl: Option) -> Result<()> { - // TODO. Generate clients in any language. +// Creates a new program crate in the `programs/` directory. +fn new(name: String) -> Result<()> { + match Config::discover()? { + None => { + println!("Not in anchor workspace."); + std::process::exit(1); + } + Some((_cfg, cfg_path, _inside_cargo)) => { + match cfg_path.parent() { + None => { + println!("Unable to make new program"); + } + Some(parent) => { + std::env::set_current_dir(&parent)?; + new_program(&name)?; + println!("Created new program."); + } + }; + } + } Ok(()) } + +// Creates a new program crate in the current directory with `name`. +fn new_program(name: &str) -> Result<()> { + fs::create_dir(&format!("programs/{}", name))?; + fs::create_dir(&format!("programs/{}/src/", name))?; + let mut cargo_toml = File::create(&format!("programs/{}/Cargo.toml", name))?; + cargo_toml.write_all(template::cargo_toml(&name).as_bytes())?; + let mut xargo_toml = File::create(&format!("programs/{}/Xargo.toml", name))?; + xargo_toml.write_all(template::xargo_toml(&name).as_bytes())?; + let mut lib_rs = File::create(&format!("programs/{}/src/lib.rs", name))?; + lib_rs.write_all(template::lib_rs(&name).as_bytes())?; + + Ok(()) +} + +fn build(idl: Option) -> Result<()> { + match Config::discover()? { + None => build_cwd(idl), + Some((cfg, cfg_path, inside_cargo)) => build_ws(cfg, cfg_path, inside_cargo, idl), + } +} + +// Runs the build inside a workspace. +// +// * Builds a single program if the current dir is within a Cargo subdirectory, +// e.g., `programs/my-program/src`. +// * Builds *all* programs if thje current dir is anywhere else in the workspace. +// +fn build_ws( + cfg: Config, + cfg_path: PathBuf, + cargo_toml: Option, + idl: Option, +) -> Result<()> { + let idl_out = match idl { + Some(idl) => Some(PathBuf::from(idl)), + None => { + let cfg_parent = match cfg_path.parent() { + None => return Err(anyhow::anyhow!("Invalid Anchor.toml")), + Some(parent) => parent, + }; + fs::create_dir_all(cfg_parent.join("target/idl"))?; + Some(cfg_parent.join("target/idl")) + } + }; + match cargo_toml { + None => build_all(cfg, cfg_path, idl_out), + Some(ct) => _build_cwd(ct, idl_out), + } +} + +fn build_all(_cfg: Config, cfg_path: PathBuf, idl_out: Option) -> Result<()> { + match cfg_path.parent() { + None => Err(anyhow::anyhow!( + "Invalid Anchor.toml at {}", + cfg_path.display() + )), + Some(parent) => { + let files = fs::read_dir(parent.join("programs"))?; + for f in files { + let p = f?.path(); + _build_cwd(p.join("Cargo.toml"), idl_out.clone())?; + } + Ok(()) + } + } +} + +fn build_cwd(idl_out: Option) -> Result<()> { + match find_cargo_toml()? { + None => { + println!("Cargo.toml not found"); + std::process::exit(1); + } + Some(cargo_toml) => _build_cwd(cargo_toml, idl_out.map(PathBuf::from)), + } +} + +// Runs the build command outside of a workspace. +fn _build_cwd(cargo_toml: PathBuf, idl_out: Option) -> Result<()> { + match cargo_toml.parent() { + None => return Err(anyhow::anyhow!("Unable to find parent")), + Some(p) => std::env::set_current_dir(&p)?, + }; + + let exit = std::process::Command::new("cargo") + .arg("build-bpf") + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) + .output() + .map_err(|e| anyhow::format_err!("{}", e.to_string()))?; + if !exit.status.success() { + std::process::exit(exit.status.code().unwrap_or(1)); + } + + // Always assume idl is located ar src/lib.rs. + let idl = extract_idl("src/lib.rs")?; + + let out = match idl_out { + None => PathBuf::from(".").join(&idl.name).with_extension("json"), + Some(o) => PathBuf::from(&o.join(&idl.name).with_extension("json")), + }; + + write_idl(&idl, Some(&out)) +} + +fn idl(file: String, out: Option<&Path>) -> Result<()> { + let idl = extract_idl(&file)?; + write_idl(&idl, out) +} + +fn extract_idl(file: &str) -> Result { + let file = shellexpand::tilde(file); + anchor_syn::parser::file::parse(&*file) +} + +fn write_idl(idl: &Idl, out: Option<&Path>) -> Result<()> { + let idl_json = serde_json::to_string_pretty(idl)?; + match out.as_ref() { + None => println!("{}", idl_json), + Some(out) => std::fs::write(out, idl_json)?, + }; + Ok(()) +} + +// Builds, deploys, and tests all workspace programs in a single command. +fn test() -> Result<()> { + // Switch directories to top level workspace. + set_workspace_dir_or_exit(); + + // Build everything. + build(None)?; + + // Switch again (todo: restore cwd in `build` command). + set_workspace_dir_or_exit(); + + // Bootup validator. + let mut validator_handle = start_test_validator()?; + + // Deploy all programs. + let programs = deploy_ws()?; + + // Store deployed program addresses in IDL metadata (for consumption by + // client + tests). + for (program, address) in programs { + // Add metadata to the IDL. + let mut idl = program.idl; + idl.metadata = Some(serde_json::to_value(IdlTestMetadata { + address: address.to_string(), + })?); + // Persist it. + let idl_out = PathBuf::from("target/idl") + .join(&idl.name) + .with_extension("json"); + write_idl(&idl, Some(&idl_out))?; + } + + // Run the tests. + if let Err(e) = std::process::Command::new("mocha") + .arg("tests/") + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) + .output() + { + validator_handle.kill()?; + return Err(anyhow::format_err!("{}", e.to_string())); + } + validator_handle.kill()?; + + Ok(()) +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct IdlTestMetadata { + address: String, +} + +fn start_test_validator() -> Result { + fs::create_dir_all(".anchor")?; + let test_ledger_filename = ".anchor/test-ledger"; + let test_ledger_log_filename = ".anchor/test-ledger-log.txt"; + + if Path::new(test_ledger_filename).exists() { + std::fs::remove_dir_all(test_ledger_filename)?; + } + if Path::new(test_ledger_log_filename).exists() { + std::fs::remove_file(test_ledger_log_filename)?; + } + + // Start a validator for testing. + let test_validator_stdout = File::create(test_ledger_log_filename)?; + let test_validator_stderr = test_validator_stdout.try_clone()?; + let validator_handle = std::process::Command::new("solana-test-validator") + .arg("--ledger") + .arg(test_ledger_filename) + .stdout(Stdio::from(test_validator_stdout)) + .stderr(Stdio::from(test_validator_stderr)) + .spawn() + .map_err(|e| anyhow::format_err!("{}", e.to_string()))?; + + // TODO: do something more sensible than sleeping. + std::thread::sleep(std::time::Duration::from_millis(2000)); + + Ok(validator_handle) +} + +fn deploy_ws() -> Result> { + let mut programs = vec![]; + println!("Deploying workspace to http://localhost:8899..."); + for program in read_all_programs()? { + let binary_path = format!( + "target/bpfel-unknown-unknown/release/{}.so", + program.lib_name + ); + println!("Deploying {}...", binary_path); + let exit = std::process::Command::new("solana") + .arg("deploy") + .arg(&binary_path) + .arg("--url") + .arg("http://localhost:8899") // TODO: specify network via cli. + .arg("--keypair") + .arg(".anchor/test-ledger/faucet-keypair.json") // TODO: specify wallet. + .output() + .expect("Must deploy"); + if !exit.status.success() { + println!("There was a problem deploying."); + std::process::exit(exit.status.code().unwrap_or(1)); + } + let stdout: DeployStdout = serde_json::from_str(std::str::from_utf8(&exit.stdout)?)?; + programs.push((program, stdout.program_id.parse()?)); + } + println!("Deploy success!"); + Ok(programs) +} + +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DeployStdout { + program_id: String, +} + +fn set_workspace_dir_or_exit() { + let d = match Config::discover() { + Err(_) => { + println!("Not in anchor workspace."); + std::process::exit(1); + } + Ok(d) => d, + }; + match d { + None => { + println!("Not in anchor workspace."); + std::process::exit(1); + } + Some((_cfg, cfg_path, _inside_cargo)) => { + match cfg_path.parent() { + None => { + println!("Unable to make new program"); + } + Some(parent) => match std::env::set_current_dir(&parent) { + Err(_) => { + println!("Not in anchor workspace."); + std::process::exit(1); + } + Ok(_) => {} + }, + }; + } + } +} diff --git a/cli/src/template.rs b/cli/src/template.rs new file mode 100644 index 00000000..8e52b5b4 --- /dev/null +++ b/cli/src/template.rs @@ -0,0 +1,83 @@ +use heck::CamelCase; +use heck::SnakeCase; + +pub fn virtual_manifest() -> String { + r#"[workspace] +members = [ + "programs/*" +] +"# + .to_string() +} + +pub fn cargo_toml(name: &str) -> String { + format!( + r#"[package] +name = "{0}" +version = "0.1.0" +description = "Created with Anchor" +edition = "2018" + +[lib] +crate-type = ["cdylib"] +name = "{1}" + +[dependencies] +borsh = {{ git = "https://github.com/project-serum/borsh", branch = "serum", features = ["serum-program"] }} +solana-program = "1.4.3" +solana-sdk = {{ version = "1.3.14", default-features = false, features = ["program"] }} +# anchor = {{ git = "https://github.com/project-serum/anchor", features = ["derive"] }} +anchor = {{ path = "/home/armaniferrante/Documents/code/src/github.com/project-serum/anchor", features = ["derive"] }} +"#, + name, + name.to_snake_case(), + ) +} + +pub fn xargo_toml(name: &str) -> String { + r#"[target.bpfel-unknown-unknown.dependencies.std] +features = []"# + .to_string() +} + +pub fn lib_rs(name: &str) -> String { + format!( + r#"#![feature(proc_macro_hygiene)] + +use anchor::prelude::*; + +#[program] +mod {} {{ + use super::*; + pub fn initialize(ctx: Context) -> ProgramResult {{ + Ok(()) + }} +}} + +#[derive(Accounts)] +pub struct Initialize {{}}"#, + name.to_snake_case(), + ) +} + +pub fn mocha(name: &str) -> String { + format!( + r#"const anchor = require('@project-serum/anchor'); + +describe('{}', () => {{ + + // Configure the client to use the local cluster. + anchor.setProvider(anchor.Provider.local()); + + it('Is initialized!', async () => {{ + // Add your test here. + const program = anchor.workspace.{}; + const tx = await program.rpc.initialize(); + console.log("Your transaction signature", tx); + }}); +}}); +"#, + name, + name.to_camel_case(), + ) +} diff --git a/docs/src/.vuepress/config.js b/docs/src/.vuepress/config.js index e15a1a54..305f8af5 100755 --- a/docs/src/.vuepress/config.js +++ b/docs/src/.vuepress/config.js @@ -42,13 +42,19 @@ module.exports = { title: "Getting Started", children: [ "/getting-started/introduction", - "/getting-started/installation", + "/getting-started/installation", + "/getting-started/quick-start", ], }, { collapsable: false, title: "Tutorials", - children: ["/tutorials/tutorial-0", "/tutorials/tutorial-1"], + children: [ + "/tutorials/tutorial-0", + "/tutorials/tutorial-1", + "/tutorials/tutorial-2", + "/tutorials/tutorial-3", + ], }, ], diff --git a/docs/src/getting-started/installation.md b/docs/src/getting-started/installation.md index db13d053..9a16f9ef 100644 --- a/docs/src/getting-started/installation.md +++ b/docs/src/getting-started/installation.md @@ -1,32 +1,44 @@ -# Install +# Installing Dependencies -To get started, make sure to setup all the prerequisite tools on your local machine. +To get started, make sure to setup all the prerequisite tools on your local machine +(an installer has not yet been developed). ## Install Rust +For an introduction to Rust, see the excellent Rust [book](https://doc.rust-lang.org/book/). + ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env rustup component add rustfmt ``` -For an introduction to Rust, see the excellent Rust [book](https://doc.rust-lang.org/book/). +## Install Solana + +See the solana [docs](https://docs.solana.com/cli/install-solana-cli-tools) for installation instructions. On macOS and Linux, + +```bash +sh -c "$(curl -sSfL https://release.solana.com/v1.5.0/install)" +``` + +## Install Mocha + +Program integration tests are run using [Mocha](https://mochajs.org/). + +```bash +npm install -g mocha +``` ## Install Anchor -For now, we can use Cargo. +For now, we can use Cargo to install the CLI. ```bash cargo install --git https://github.com/project-serum/anchor anchor-cli ``` -## Install Solana +To install the JavaScript package. ```bash -curl -sSf https://raw.githubusercontent.com/solana-labs/solana/v1.4.14/install/solana-install-init.sh | sh -s - v1.4.14 -export PATH="/home/ubuntu/.local/share/solana/install/active_release/bin:$PATH" +npm install -g @project-serum/anchor ``` - -## Setup a Localnet - -The easiest way to run a local cluster is to run the docker container provided by Solana. Instructions can be found [here](https://solana-labs.github.io/solana-web3.js/). (Note: `solana-test-validator` is the new, preferred way to run a local validator, though I haven't tested it yet). diff --git a/docs/src/getting-started/introduction.md b/docs/src/getting-started/introduction.md index b8cdb5df..fc74de9f 100644 --- a/docs/src/getting-started/introduction.md +++ b/docs/src/getting-started/introduction.md @@ -1,21 +1,17 @@ # Introduction -Anchor is a framework for Solana's [Sealevel](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192) runtime, exposing a safer and more convenient programming model to the Solana developer by providing a +Anchor is a framework for Solana's [Sealevel](https://medium.com/solana-labs/sealevel-parallel-processing-thousands-of-smart-contracts-d814b378192) runtime, exposing a more convenient programming model by providing several different developer tools. -- Rust Crate for writing Solana programs +- Rust crates and DSL for writing Solana programs - CLI for extracting an [IDL](https://en.wikipedia.org/wiki/Interface_description_language) from source - TypeScript package for generating clients from IDL +- Workspace management for developing complete applications -If you're familiar with developing in Ethereum's [Solidity](https://docs.soliditylang.org/en/v0.7.4/) and [web3.js](https://github.com/ethereum/web3.js) or Parity's [Ink!](https://github.com/paritytech/ink), then the experience will be familiar. Although the DSL syntax and semantics are targeted at Solana, the high level flow of writing RPC request handlers, emitting an IDL, and generating clients from IDL is the same. +If you're familiar with developing in Ethereum's [Solidity](https://docs.soliditylang.org/en/v0.7.4/), [Truffle](https://www.trufflesuite.com/), [web3.js](https://github.com/ethereum/web3.js) or Parity's [Ink!](https://github.com/paritytech/ink), then the experience will be familiar. Although the DSL syntax and semantics are targeted at Solana, the high level flow of writing RPC request handlers, emitting an IDL, and generating clients from IDL is the same. -Here, we'll walkthrough a tutorial demonstrating how to use Anchor. To skip the tutorial and jump straight to a full example, go [here](https://github.com/project-serum/anchor/tree/master/examples/basic/src/lib.rs). +Here, we'll walkthrough several tutorials demonstrating how to use Anchor. To skip the tutorials and jump straight to a full example, checkout the +[quickstart](./quick-start.md) or go [here](https://github.com/project-serum/anchor/tree/master/examples/basic/src/lib.rs). For an introduction to Solana, see the [docs](https://docs.solana.com/developing/programming-model/overview). -## Contributing - -It would be great to have clients generated for languages other than TypeScript. If you're -interested in developing a client generator, feel free to reach out, or go ahead and just -do it :P. - -## Note - -Anchor is in active development, so all APIs are subject to change. If you have feedback, please reach out by [filing an issue](https://github.com/project-serum/anchor/issues/new). This documentation is a work in progress and is expected to change dramatically as features continue to be built out. If you have any problems, consult the [source](https://github.com/project-serum/anchor) or feel free to ask questions on the [Serum Discord](https://discord.com/channels/739225212658122886/752530209848295555). +::: tip NOTE +Anchor is in active development, so all APIs are subject to change. If you are one of the early developers to try it out and have feedback, please reach out by [filing an issue](https://github.com/project-serum/anchor/issues/new). This documentation is a work in progress and is expected to change dramatically as features continue to be built out. If you have any problems, consult the [source](https://github.com/project-serum/anchor) or feel free to ask questions on the [Serum Discord](https://discord.com/channels/739225212658122886/752530209848295555). +::: diff --git a/docs/src/getting-started/quick-start.md b/docs/src/getting-started/quick-start.md new file mode 100644 index 00000000..25106b12 --- /dev/null +++ b/docs/src/getting-started/quick-start.md @@ -0,0 +1,52 @@ +# Quick Start + +The quick start provides a whirlwind tour through creating, deploying, and testing a project +using Anchor, targeted at developers who are familiar with blockchain development. For an in depth +guide of Anchor from the ground up, see the subequent tutorials. + +## Initialize a project + +Anchor follows the principle of "Convention is better than configuration". +To initialize your project workspace, run + +```bash +anchor init my-project && cd my-project +``` + +Your repo will be laid out with the following structure + +* `Anchor.toml`: Anchor configuration file. +* `programs/`: Directory for Solana program crates. +* `app/`: Directory for your application frontend. +* `tests/`: Directory for TypeScript integration tests. + +## Build + +To build your program targeting Solana's BPF runtime and emit an IDL that can be +consumed by clients, run + +```bash +anchor build +``` + +## Test + +It's [recommended](https://www.parity.io/paritys-checklist-for-secure-smart-contract-development/) +to test your program using integration tests in a language other +than Rust to make sure that bugs related to syntax misunderstandings +are coverable with tests and not just replicated in tests. + +``` +anchor test +``` + +You just built a program, deployed it to a local network, and +ran integration tests in one command. It's that easy. ;) + +## Deploy + +To deploy all programs in your workspace, run + +``` +anchor deploy +``` diff --git a/docs/src/tutorials/tutorial-0.md b/docs/src/tutorials/tutorial-0.md index 99290608..797d1d78 100644 --- a/docs/src/tutorials/tutorial-0.md +++ b/docs/src/tutorials/tutorial-0.md @@ -4,7 +4,7 @@ Here, we introduce a minimal example demonstrating the Anchor workflow and core elements. This tutorial assumes all [prerequisites](./prerequisites.md) are installed and a local network is running. -## Clone the repo +## Clone the Repo To get started, clone the repo. @@ -12,71 +12,52 @@ To get started, clone the repo. git clone https://github.com/project-serum/anchor ``` -And change directories to the [example](https://github.com/project-serum/anchor/tree/master/examples/basic-0). +And change directories to the [example](https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-0). ```bash cd anchor/examples/tutorial/basic-0 ``` -## Defining a program +## Defining a Program We define the minimum viable program as follows. <<< @/../examples/tutorial/basic-0/program/src/lib.rs -There are a couple of syntax elements to point out here. - -### `#[program]` - -First, notice that a program is defined with the `#[program]` attribute, where each +* `#[program]` First, notice that a program is defined with the `#[program]` attribute, where each inner method defines an RPC request handler, or, in Solana parlance, an "instruction" handler. These handlers are the entrypoints to your program that clients may invoke, as we will see soon. -### `Context` - -The first parameter of _every_ RPC handler is the `Context` struct, which is a simple +* `Context` The first parameter of _every_ RPC handler is the `Context` struct, which is a simple container for the currently executing `program_id` generic over `Accounts`--here, the `Initialize` struct. -### `#[derive(Accounts)]` - -The `Accounts` derive macro marks a struct containing all the accounts that must be +* `#[derive(Accounts)]` The `Accounts` derive macro marks a struct containing all the accounts that must be specified for a given instruction. To understand Accounts on Solana, see the [docs](https://docs.solana.com/developing/programming-model/accounts). In subsequent tutorials, we'll demonstrate how an `Accounts` struct can be used to specify constraints on accounts given to your program. Since this example doesn't touch any accounts, we skip this (important) detail. -## Building a program +## Building and Emitting an IDL -This program can be built in same way as any other Solana program. - -```bash -cargo build-bpf -``` - -## Deploying a program - -Similarly, we can deploy the program using the `solana deploy` command. - -```bash -solana deploy /anchor/target/deploy/basic_program_0.so -``` - -Making sure to susbstitute paths to match your local filesystem. Now, save the address -the program was deployed with. It will be useful later. - -## Emmiting an IDL - -After creating a program, one can use the Anchor CLI to emit an IDL, from which clients +After creating a program, one can use the `anchor` CLI to build and emit an IDL, from which clients can be generated. ```bash -anchor idl -f src/lib.rs -o idl.js +anchor build ``` -Inspecting the contents of `idl.js` one should see +::: details +The `build` command is a convenience combining two steps. + +1) `cargo build-bpf` +2) `anchor idl -f src/lib.rs -o basic.json`. +::: + +Once run, you should see your build artifacts, as usual, in your `target/` directory. Additionally, +a `basic.json` file is created. Inspecting its contents you should see ```json { @@ -92,7 +73,23 @@ Inspecting the contents of `idl.js` one should see } ``` -For experienced Ethereum developers, this is analogous to an `abi.json` file. +From which a client can be generated. Note that this file is created by parsing the `src/lib.rs` +file in your program's crate. + +::: tip +If you've developed on Ethereum, the IDL is analogous to the `abi.json`. +::: + +## Deploying a program + +Once built, we can deploy the program using the `solana deploy` command. + +```bash +solana deploy /anchor/target/deploy/basic_program_0.so +``` + +Making sure to susbstitute paths to match your local filesystem. Now, save the address +the program was deployed with. It will be useful later. ## Generating a Client diff --git a/docs/src/tutorials/tutorial-2.md b/docs/src/tutorials/tutorial-2.md new file mode 100644 index 00000000..e7c3491c --- /dev/null +++ b/docs/src/tutorials/tutorial-2.md @@ -0,0 +1 @@ +# Tutorial 2: Constraints and Access Control diff --git a/docs/src/tutorials/tutorial-3.md b/docs/src/tutorials/tutorial-3.md new file mode 100644 index 00000000..817e1b68 --- /dev/null +++ b/docs/src/tutorials/tutorial-3.md @@ -0,0 +1 @@ +# Tutorial 3: Workspaces diff --git a/examples/basic/idl.json b/examples/basic/example.json similarity index 100% rename from examples/basic/idl.json rename to examples/basic/example.json diff --git a/examples/tutorial/basic-0/app/client.js b/examples/tutorial/basic-0/app/client.js index e675e436..607d0cbe 100644 --- a/examples/tutorial/basic-0/app/client.js +++ b/examples/tutorial/basic-0/app/client.js @@ -1,5 +1,3 @@ -// TODO: replace path once the package is published. -// // Before running this script, make sure to run `yarn && yarn build` inside // the `ts` directory. const anchor = require('../../../../ts'); diff --git a/examples/tutorial/basic-1/app/client.js b/examples/tutorial/basic-1/app/client.js new file mode 100644 index 00000000..607d0cbe --- /dev/null +++ b/examples/tutorial/basic-1/app/client.js @@ -0,0 +1,25 @@ +// Before running this script, make sure to run `yarn && yarn build` inside +// the `ts` directory. +const anchor = require('../../../../ts'); +const fs = require('fs'); + +// Configure the local cluster. +anchor.setProvider(anchor.Provider.local()); + +// #region main +async function main() { + // Read the generated IDL. + const idl = JSON.parse(fs.readFileSync('../idl.json', 'utf8')); + + // Address of the deployed program. + const programId = new anchor.web3.PublicKey(''); + + // Generate the program client from IDL. + const program = new anchor.Program(idl, programId); + + // Execute the RPC. + await program.rpc.initialize(); +} +// #endregion main + +main(); diff --git a/syn/Cargo.toml b/syn/Cargo.toml index 21af157f..aa04aa73 100644 --- a/syn/Cargo.toml +++ b/syn/Cargo.toml @@ -15,3 +15,4 @@ syn = { version = "1.0.54", features = ["full", "extra-traits", "parsing"] } anyhow = "1.0.32" heck = "0.3.1" serde = { version = "1.0.118", features = ["derive"] } +serde_json = "1.0" diff --git a/syn/src/idl.rs b/syn/src/idl.rs index 59b49a2a..b3519286 100644 --- a/syn/src/idl.rs +++ b/syn/src/idl.rs @@ -9,6 +9,8 @@ pub struct Idl { pub accounts: Vec, #[serde(skip_serializing_if = "Vec::is_empty", default)] pub types: Vec, + #[serde(skip_serializing_if = "Option::is_none", default)] + pub metadata: Option, } #[derive(Debug, Serialize, Deserialize)] diff --git a/syn/src/parser/anchor.rs b/syn/src/parser/anchor.rs index 6e467856..6f68f38e 100644 --- a/syn/src/parser/anchor.rs +++ b/syn/src/parser/anchor.rs @@ -2,7 +2,6 @@ use crate::{ AccountsStruct, Constraint, ConstraintBelongsTo, ConstraintLiteral, ConstraintOwner, ConstraintSigner, Field, ProgramAccountTy, Ty, }; -use quote::quote; pub fn parse(strct: &syn::ItemStruct) -> AccountsStruct { let fields = match &strct.fields { diff --git a/syn/src/parser/file.rs b/syn/src/parser/file.rs index 5faa4297..adadc930 100644 --- a/syn/src/parser/file.rs +++ b/syn/src/parser/file.rs @@ -3,17 +3,17 @@ use crate::parser::anchor; use crate::parser::program; use crate::AccountsStruct; use anyhow::Result; +use heck::MixedCase; use quote::ToTokens; use std::collections::{HashMap, HashSet}; use std::fs::File; use std::io::Read; -use heck::MixedCase; -use heck::CamelCase; +use std::path::Path; static DERIVE_NAME: &'static str = "Accounts"; // Parse an entire interface file. -pub fn parse(filename: &str) -> Result { +pub fn parse(filename: impl AsRef) -> Result { let mut file = File::open(&filename)?; let mut src = String::new(); @@ -91,6 +91,7 @@ pub fn parse(filename: &str) -> Result { instructions, types, accounts, + metadata: None, }) } @@ -164,12 +165,7 @@ fn parse_ty_defs(f: &syn::File) -> Result> { let mut tts = proc_macro2::TokenStream::new(); f.ty.to_tokens(&mut tts); Ok(IdlField { - name: f - .ident - .as_ref() - .unwrap() - .to_string() - .to_mixed_case(), + name: f.ident.as_ref().unwrap().to_string().to_mixed_case(), ty: tts.to_string().parse()?, }) }) diff --git a/ts/package.json b/ts/package.json index e97bc5be..82e0fea6 100644 --- a/ts/package.json +++ b/ts/package.json @@ -28,7 +28,8 @@ "@types/bn.js": "^4.11.6", "bn.js": "^5.1.2", "buffer-layout": "^1.2.0", - "camelcase": "^5.3.1" + "camelcase": "^5.3.1", + "find": "^0.3.0" }, "devDependencies": { "@commitlint/cli": "^8.2.0", diff --git a/ts/src/index.ts b/ts/src/index.ts index a2dea853..ce782139 100644 --- a/ts/src/index.ts +++ b/ts/src/index.ts @@ -3,6 +3,7 @@ import * as web3 from "@solana/web3.js"; import { Provider } from "@project-serum/common"; import { Program } from "./program"; import Coder from "./coder"; +import workspace from './workspace'; let _provider: Provider | null = null; @@ -14,4 +15,4 @@ function getProvider(): Provider { return _provider; } -export { Program, Coder, setProvider, getProvider, Provider, BN, web3 }; +export { workspace, Program, Coder, setProvider, getProvider, Provider, BN, web3 }; diff --git a/ts/src/workspace.ts b/ts/src/workspace.ts new file mode 100644 index 00000000..f11ed4d0 --- /dev/null +++ b/ts/src/workspace.ts @@ -0,0 +1,57 @@ +import camelCase from "camelcase"; +import { Program } from './program'; + +let _populatedWorkspace = false; + +// Workspace program discovery only works for node environments. +export default new Proxy({} as any, { + get( + workspaceCache: { [key: string]: Program }, + programName: string + ) { + const find = require('find'); + const fs = require('fs'); + const process = require('process'); + + if (typeof window !== 'undefined') { + throw new Error( + '`anchor.workspace` is not available in the browser' + ); + } + + if (!_populatedWorkspace) { + const path = require('path'); + + let projectRoot = process.cwd(); + while (!fs.existsSync(path.join(projectRoot, 'Anchor.toml'))) { + const parentDir = path.dirname(projectRoot); + if (parentDir === projectRoot) { + projectRoot = undefined; + } + projectRoot = parentDir; + } + + + if (projectRoot === undefined) { + throw new Error( + 'Could not find workspace root. Perhaps set the `OASIS_WORKSPACE` env var?' + ); + } + + find + .fileSync(/target\/idl\/.*\.json/, projectRoot) + .reduce((programs: any, path: string) => { + const idlStr = fs.readFileSync(path); + const idl = JSON.parse(idlStr); + const name = camelCase(idl.name, { pascalCase: true }); + programs[name] = new Program(idl, idl.metadata.address); + return programs; + }, workspaceCache); + + _populatedWorkspace = true; + } + + return workspaceCache[programName]; + }, + } +); diff --git a/ts/test/integration/basic.spec.ts b/ts/test/integration/basic.spec.ts index 0775e026..eed89eb5 100644 --- a/ts/test/integration/basic.spec.ts +++ b/ts/test/integration/basic.spec.ts @@ -10,6 +10,10 @@ const WORKSPACE = { }; describe('Constraints program tests', () => { + it('Parses a workspace', async () => { + + }); + it('Runs against a localnetwork', async () => { // Configure the local cluster. anchor.setProvider(WORKSPACE.provider); diff --git a/ts/yarn.lock b/ts/yarn.lock index b3c01264..c343319b 100644 --- a/ts/yarn.lock +++ b/ts/yarn.lock @@ -2515,6 +2515,13 @@ find-versions@^3.2.0: dependencies: semver-regex "^2.0.0" +find@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/find/-/find-0.3.0.tgz#4082e8fc8d8320f1a382b5e4f521b9bc50775cb8" + integrity sha512-iSd+O4OEYV/I36Zl8MdYJO0xD82wH528SaCieTVHhclgiYNe9y+yPKSwK+A7/WsmHL1EZ+pYUJBXWTL5qofksw== + dependencies: + traverse-chain "~0.1.0" + flat-cache@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" @@ -5667,6 +5674,11 @@ tr46@^2.0.2: dependencies: punycode "^2.1.1" +traverse-chain@~0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/traverse-chain/-/traverse-chain-0.1.0.tgz#61dbc2d53b69ff6091a12a168fd7d433107e40f1" + integrity sha1-YdvC1Ttp/2CRoSoWj9fUMxB+QPE= + trim-newlines@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-2.0.0.tgz#b403d0b91be50c331dfc4b82eeceb22c3de16d20"