From c9ad6436532b407562872d56874a58c9763fabca Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 12 Jun 2019 01:01:22 +0100 Subject: [PATCH] Add gRPC protobufs to SDK --- zcash-client-sdk-js/package-lock.json | 697 +++++++++- zcash-client-sdk-js/package.json | 3 + zcash-client-sdk-js/src/compact_formats.proto | 48 + zcash-client-sdk-js/src/compact_formats_pb.js | 1173 +++++++++++++++++ zcash-client-sdk-js/src/service.proto | 49 + .../src/service_grpc_web_pb.js | 366 +++++ zcash-client-sdk-js/src/service_pb.js | 1105 ++++++++++++++++ 7 files changed, 3439 insertions(+), 2 deletions(-) create mode 100644 zcash-client-sdk-js/src/compact_formats.proto create mode 100644 zcash-client-sdk-js/src/compact_formats_pb.js create mode 100644 zcash-client-sdk-js/src/service.proto create mode 100644 zcash-client-sdk-js/src/service_grpc_web_pb.js create mode 100644 zcash-client-sdk-js/src/service_pb.js diff --git a/zcash-client-sdk-js/package-lock.json b/zcash-client-sdk-js/package-lock.json index cd24228..7e18b74 100644 --- a/zcash-client-sdk-js/package-lock.json +++ b/zcash-client-sdk-js/package-lock.json @@ -228,6 +228,12 @@ "integrity": "sha512-aUjdRFISbuFOl0EIZc+9e4FfZp0bDZgAdOOf30bJmw8VM9v84SHyVyxDfbWxpGYbdZD/9XoKxfHVNmxPkhwyGw==", "dev": true }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, "anymatch": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", @@ -279,6 +285,16 @@ "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", "dev": true }, + "ascli": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ascli/-/ascli-1.0.1.tgz", + "integrity": "sha1-vPpZdKYvGOgcq660lzKrSoj5Brw=", + "dev": true, + "requires": { + "colour": "~0.7.1", + "optjs": "~3.2.2" + } + }, "asn1.js": { "version": "4.10.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", @@ -571,6 +587,15 @@ "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", "dev": true }, + "bytebuffer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/bytebuffer/-/bytebuffer-5.0.1.tgz", + "integrity": "sha1-WC7qSxqHO20CCkjVjfhfC7ps/d0=", + "dev": true, + "requires": { + "long": "~3" + } + }, "cacache": { "version": "11.3.2", "resolved": "https://registry.npmjs.org/cacache/-/cacache-11.3.2.tgz", @@ -610,6 +635,12 @@ "unset-value": "^1.0.0" } }, + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + }, "chokidar": { "version": "2.1.6", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.6.tgz", @@ -678,6 +709,23 @@ } } }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, "collection-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", @@ -688,6 +736,12 @@ "object-visit": "^1.0.0" } }, + "colour": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/colour/-/colour-0.7.1.tgz", + "integrity": "sha1-nLFpkX7F0SwHNtPoaFdG3xyt93g=", + "dev": true + }, "commander": { "version": "2.20.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", @@ -842,6 +896,12 @@ "ms": "2.0.0" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, "decode-uri-component": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", @@ -1843,12 +1903,512 @@ } } }, + "google-protobuf": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.8.0.tgz", + "integrity": "sha512-tx39PTc//HaIT7K/baUF/8JYLGDozEi1e4xwPP1qSx3InP78cNpbSJpxiDsDMwj77qNOndVBDXnn7oi9zKxZew==", + "dev": true + }, "graceful-fs": { "version": "4.1.15", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==", "dev": true }, + "grpc": { + "version": "1.21.1", + "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.21.1.tgz", + "integrity": "sha512-PFsZQazf62nP05a0xm23mlImMuw5oVlqF/0zakmsdqJgvbABe+d6VThY2PfhqJmWEL/FhQ6QNYsxS5EAM6++7g==", + "dev": true, + "requires": { + "lodash.camelcase": "^4.3.0", + "lodash.clone": "^4.5.0", + "nan": "^2.13.2", + "node-pre-gyp": "^0.13.0", + "protobufjs": "^5.0.3" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "dev": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "bundled": true, + "dev": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.1.1", + "bundled": true, + "dev": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "deep-extend": { + "version": "0.6.0", + "bundled": true, + "dev": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "dev": true + }, + "fs-minipass": { + "version": "1.2.5", + "bundled": true, + "dev": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true + }, + "iconv-lite": { + "version": "0.4.23", + "bundled": true, + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore-walk": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true + }, + "minipass": { + "version": "2.3.5", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + } + } + }, + "needle": { + "version": "2.3.1", + "bundled": true, + "dev": true, + "requires": { + "debug": "^4.1.0", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "bundled": true, + "dev": true + } + } + }, + "node-pre-gyp": { + "version": "0.13.0", + "bundled": true, + "dev": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.1", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.0.6", + "bundled": true, + "dev": true + }, + "npm-packlist": { + "version": "1.4.1", + "bundled": true, + "dev": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "dev": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "rc": { + "version": "1.2.8", + "bundled": true, + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.6.3", + "bundled": true, + "dev": true, + "requires": { + "glob": "^7.1.3" + }, + "dependencies": { + "glob": { + "version": "7.1.4", + "bundled": true, + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true, + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "dev": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "dev": true + }, + "semver": { + "version": "5.7.0", + "bundled": true, + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true + }, + "tar": { + "version": "4.4.8", + "bundled": true, + "dev": true, + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.3.4", + "minizlib": "^1.1.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "wide-align": { + "version": "1.1.3", + "bundled": true, + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "3.0.3", + "bundled": true, + "dev": true + } + } + }, + "grpc-web": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grpc-web/-/grpc-web-1.0.4.tgz", + "integrity": "sha512-CjIA05C1G9n0/aT5YrQ8SAYNh5foHZRVK+1yN81Ez9vpNQCmrvXCWQBOHlQK7tJg3EqC5m8F99XQRfAi+K8CyA==", + "dev": true + }, "has-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", @@ -1958,6 +2518,12 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, "is-accessor-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", @@ -2044,6 +2610,15 @@ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, "is-glob": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", @@ -2133,6 +2708,15 @@ "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "dev": true }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, "loader-runner": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz", @@ -2160,6 +2744,24 @@ "path-exists": "^3.0.0" } }, + "lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=", + "dev": true + }, + "lodash.clone": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clone/-/lodash.clone-4.5.0.tgz", + "integrity": "sha1-GVhwRQ9aExkkeN9Lw9I9LeoZB7Y=", + "dev": true + }, + "long": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", + "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", + "dev": true + }, "lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -2359,8 +2961,7 @@ "version": "2.14.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "dev": true, - "optional": true + "dev": true }, "nanomatch": { "version": "1.2.13", @@ -2432,6 +3033,12 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -2496,12 +3103,27 @@ "wrappy": "1" } }, + "optjs": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/optjs/-/optjs-3.2.2.tgz", + "integrity": "sha1-aabOicRCpEQDFBrS+bNwvVu29O4=", + "dev": true + }, "os-browserify": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", "dev": true }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "dev": true, + "requires": { + "lcid": "^1.0.0" + } + }, "p-limit": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz", @@ -2639,6 +3261,18 @@ "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", "dev": true }, + "protobufjs": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-5.0.3.tgz", + "integrity": "sha512-55Kcx1MhPZX0zTbVosMQEO5R6/rikNXd9b6RQK4KSPcrSIIwoXTtebIczUrXlwaSrbz4x8XUVThGPob1n8I4QA==", + "dev": true, + "requires": { + "ascli": "~1", + "bytebuffer": "~5", + "glob": "^7.0.5", + "yargs": "^3.10.0" + } + }, "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -3134,6 +3768,17 @@ "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", "dev": true }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -3143,6 +3788,15 @@ "safe-buffer": "~5.1.0" } }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, "tapable": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", @@ -3502,6 +4156,12 @@ } } }, + "window-size": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz", + "integrity": "sha1-+OGqHuWlPsW/FR/6CXQqatdpeHY=", + "dev": true + }, "worker-farm": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz", @@ -3511,6 +4171,16 @@ "errno": "~0.1.7" } }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -3535,6 +4205,29 @@ "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", "dev": true }, + "yargs": { + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", + "integrity": "sha1-AwiOnr+edWtpdRYR0qXvWRSCyZU=", + "dev": true, + "requires": { + "camelcase": "^2.0.1", + "cliui": "^3.0.3", + "decamelize": "^1.1.1", + "os-locale": "^1.4.0", + "string-width": "^1.0.1", + "window-size": "^0.1.4", + "y18n": "^3.2.0" + }, + "dependencies": { + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + } + } + }, "zcash-client-backend-wasm": { "version": "file:../zcash-client-backend-wasm/pkg" } diff --git a/zcash-client-sdk-js/package.json b/zcash-client-sdk-js/package.json index d9b0cd1..57cbbe0 100644 --- a/zcash-client-sdk-js/package.json +++ b/zcash-client-sdk-js/package.json @@ -12,6 +12,9 @@ "author": "Jack Grigg ", "license": "MIT", "devDependencies": { + "google-protobuf": "3.8.0", + "grpc": "1.21.1", + "grpc-web": "1.0.4", "webpack": "4.33.0" }, "dependencies": { diff --git a/zcash-client-sdk-js/src/compact_formats.proto b/zcash-client-sdk-js/src/compact_formats.proto new file mode 100644 index 0000000..7e1bc54 --- /dev/null +++ b/zcash-client-sdk-js/src/compact_formats.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; +package cash.z.wallet.sdk.rpc; +option go_package = "walletrpc"; + +// Remember that proto3 fields are all optional. A field that is not present will be set to its zero value. +// bytes fields of hashes are in canonical little-endian format. + +// CompactBlock is a packaging of ONLY the data from a block that's needed to: +// 1. Detect a payment to your shielded Sapling address +// 2. Detect a spend of your shielded Sapling notes +// 3. Update your witnesses to generate new Sapling spend proofs. +message CompactBlock { + uint32 protoVersion = 1; // the version of this wire format, for storage + uint64 height = 2; // the height of this block + bytes hash = 3; + bytes prevHash = 4; + uint32 time = 5; + bytes header = 6; // (hash, prevHash, and time) OR (full header) + repeated CompactTx vtx = 7; // compact transactions from this block +} + +message CompactTx { + // Index and hash will allow the receiver to call out to chain + // explorers or other data structures to retrieve more information + // about this transaction. + uint64 index = 1; + bytes hash = 2; + + // The transaction fee: present if server can provide. In the case of a + // stateless server and a transaction with transparent inputs, this will be + // unset because the calculation requires reference to prior transactions. + // in a pure-Sapling context, the fee will be calculable as: + // valueBalance + (sum(vPubNew) - sum(vPubOld) - sum(tOut)) + uint32 fee = 3; + + repeated CompactSpend spends = 4; + repeated CompactOutput outputs = 5; +} + +message CompactSpend { + bytes nf = 1; +} + +message CompactOutput { + bytes cmu = 1; + bytes epk = 2; + bytes ciphertext = 3; +} diff --git a/zcash-client-sdk-js/src/compact_formats_pb.js b/zcash-client-sdk-js/src/compact_formats_pb.js new file mode 100644 index 0000000..25a0320 --- /dev/null +++ b/zcash-client-sdk-js/src/compact_formats_pb.js @@ -0,0 +1,1173 @@ +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.cash.z.wallet.sdk.rpc.CompactBlock', null, global); +goog.exportSymbol('proto.cash.z.wallet.sdk.rpc.CompactOutput', null, global); +goog.exportSymbol('proto.cash.z.wallet.sdk.rpc.CompactSpend', null, global); +goog.exportSymbol('proto.cash.z.wallet.sdk.rpc.CompactTx', null, global); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.cash.z.wallet.sdk.rpc.CompactBlock.repeatedFields_, null); +}; +goog.inherits(proto.cash.z.wallet.sdk.rpc.CompactBlock, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.cash.z.wallet.sdk.rpc.CompactBlock.displayName = 'proto.cash.z.wallet.sdk.rpc.CompactBlock'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.repeatedFields_ = [7]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.toObject = function(opt_includeInstance) { + return proto.cash.z.wallet.sdk.rpc.CompactBlock.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.cash.z.wallet.sdk.rpc.CompactBlock} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.toObject = function(includeInstance, msg) { + var f, obj = { + protoversion: jspb.Message.getFieldWithDefault(msg, 1, 0), + height: jspb.Message.getFieldWithDefault(msg, 2, 0), + hash: msg.getHash_asB64(), + prevhash: msg.getPrevhash_asB64(), + time: jspb.Message.getFieldWithDefault(msg, 5, 0), + header: msg.getHeader_asB64(), + vtxList: jspb.Message.toObjectList(msg.getVtxList(), + proto.cash.z.wallet.sdk.rpc.CompactTx.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.cash.z.wallet.sdk.rpc.CompactBlock} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cash.z.wallet.sdk.rpc.CompactBlock; + return proto.cash.z.wallet.sdk.rpc.CompactBlock.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.cash.z.wallet.sdk.rpc.CompactBlock} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cash.z.wallet.sdk.rpc.CompactBlock} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setProtoversion(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + case 4: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPrevhash(value); + break; + case 5: + var value = /** @type {number} */ (reader.readUint32()); + msg.setTime(value); + break; + case 6: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHeader(value); + break; + case 7: + var value = new proto.cash.z.wallet.sdk.rpc.CompactTx; + reader.readMessage(value,proto.cash.z.wallet.sdk.rpc.CompactTx.deserializeBinaryFromReader); + msg.addVtx(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cash.z.wallet.sdk.rpc.CompactBlock.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.cash.z.wallet.sdk.rpc.CompactBlock} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getProtoversion(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getPrevhash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 4, + f + ); + } + f = message.getTime(); + if (f !== 0) { + writer.writeUint32( + 5, + f + ); + } + f = message.getHeader_asU8(); + if (f.length > 0) { + writer.writeBytes( + 6, + f + ); + } + f = message.getVtxList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 7, + f, + proto.cash.z.wallet.sdk.rpc.CompactTx.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint32 protoVersion = 1; + * @return {number} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.getProtoversion = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.setProtoversion = function(value) { + jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint64 height = 2; + * @return {number} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** @param {number} value */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.setHeight = function(value) { + jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional bytes hash = 3; + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.getHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes hash = 3; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes hash = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.setHash = function(value) { + jspb.Message.setProto3BytesField(this, 3, value); +}; + + +/** + * optional bytes prevHash = 4; + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.getPrevhash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * optional bytes prevHash = 4; + * This is a type-conversion wrapper around `getPrevhash()` + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.getPrevhash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPrevhash())); +}; + + +/** + * optional bytes prevHash = 4; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPrevhash()` + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.getPrevhash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPrevhash())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.setPrevhash = function(value) { + jspb.Message.setProto3BytesField(this, 4, value); +}; + + +/** + * optional uint32 time = 5; + * @return {number} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.getTime = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); +}; + + +/** @param {number} value */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.setTime = function(value) { + jspb.Message.setProto3IntField(this, 5, value); +}; + + +/** + * optional bytes header = 6; + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.getHeader = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * optional bytes header = 6; + * This is a type-conversion wrapper around `getHeader()` + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.getHeader_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHeader())); +}; + + +/** + * optional bytes header = 6; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHeader()` + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.getHeader_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHeader())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.setHeader = function(value) { + jspb.Message.setProto3BytesField(this, 6, value); +}; + + +/** + * repeated CompactTx vtx = 7; + * @return {!Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.getVtxList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.cash.z.wallet.sdk.rpc.CompactTx, 7)); +}; + + +/** @param {!Array} value */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.setVtxList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 7, value); +}; + + +/** + * @param {!proto.cash.z.wallet.sdk.rpc.CompactTx=} opt_value + * @param {number=} opt_index + * @return {!proto.cash.z.wallet.sdk.rpc.CompactTx} + */ +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.addVtx = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 7, opt_value, proto.cash.z.wallet.sdk.rpc.CompactTx, opt_index); +}; + + +proto.cash.z.wallet.sdk.rpc.CompactBlock.prototype.clearVtxList = function() { + this.setVtxList([]); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.cash.z.wallet.sdk.rpc.CompactTx = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.cash.z.wallet.sdk.rpc.CompactTx.repeatedFields_, null); +}; +goog.inherits(proto.cash.z.wallet.sdk.rpc.CompactTx, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.cash.z.wallet.sdk.rpc.CompactTx.displayName = 'proto.cash.z.wallet.sdk.rpc.CompactTx'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.repeatedFields_ = [4,5]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.toObject = function(opt_includeInstance) { + return proto.cash.z.wallet.sdk.rpc.CompactTx.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.cash.z.wallet.sdk.rpc.CompactTx} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.toObject = function(includeInstance, msg) { + var f, obj = { + index: jspb.Message.getFieldWithDefault(msg, 1, 0), + hash: msg.getHash_asB64(), + fee: jspb.Message.getFieldWithDefault(msg, 3, 0), + spendsList: jspb.Message.toObjectList(msg.getSpendsList(), + proto.cash.z.wallet.sdk.rpc.CompactSpend.toObject, includeInstance), + outputsList: jspb.Message.toObjectList(msg.getOutputsList(), + proto.cash.z.wallet.sdk.rpc.CompactOutput.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.cash.z.wallet.sdk.rpc.CompactTx} + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cash.z.wallet.sdk.rpc.CompactTx; + return proto.cash.z.wallet.sdk.rpc.CompactTx.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.cash.z.wallet.sdk.rpc.CompactTx} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cash.z.wallet.sdk.rpc.CompactTx} + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setIndex(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint32()); + msg.setFee(value); + break; + case 4: + var value = new proto.cash.z.wallet.sdk.rpc.CompactSpend; + reader.readMessage(value,proto.cash.z.wallet.sdk.rpc.CompactSpend.deserializeBinaryFromReader); + msg.addSpends(value); + break; + case 5: + var value = new proto.cash.z.wallet.sdk.rpc.CompactOutput; + reader.readMessage(value,proto.cash.z.wallet.sdk.rpc.CompactOutput.deserializeBinaryFromReader); + msg.addOutputs(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cash.z.wallet.sdk.rpc.CompactTx.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.cash.z.wallet.sdk.rpc.CompactTx} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getIndex(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getFee(); + if (f !== 0) { + writer.writeUint32( + 3, + f + ); + } + f = message.getSpendsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.cash.z.wallet.sdk.rpc.CompactSpend.serializeBinaryToWriter + ); + } + f = message.getOutputsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 5, + f, + proto.cash.z.wallet.sdk.rpc.CompactOutput.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint64 index = 1; + * @return {number} + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.setIndex = function(value) { + jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes hash = 2; + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.getHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes hash = 2; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes hash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.setHash = function(value) { + jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional uint32 fee = 3; + * @return {number} + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.getFee = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** @param {number} value */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.setFee = function(value) { + jspb.Message.setProto3IntField(this, 3, value); +}; + + +/** + * repeated CompactSpend spends = 4; + * @return {!Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.getSpendsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.cash.z.wallet.sdk.rpc.CompactSpend, 4)); +}; + + +/** @param {!Array} value */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.setSpendsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.cash.z.wallet.sdk.rpc.CompactSpend=} opt_value + * @param {number=} opt_index + * @return {!proto.cash.z.wallet.sdk.rpc.CompactSpend} + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.addSpends = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.cash.z.wallet.sdk.rpc.CompactSpend, opt_index); +}; + + +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.clearSpendsList = function() { + this.setSpendsList([]); +}; + + +/** + * repeated CompactOutput outputs = 5; + * @return {!Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.getOutputsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.cash.z.wallet.sdk.rpc.CompactOutput, 5)); +}; + + +/** @param {!Array} value */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.setOutputsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 5, value); +}; + + +/** + * @param {!proto.cash.z.wallet.sdk.rpc.CompactOutput=} opt_value + * @param {number=} opt_index + * @return {!proto.cash.z.wallet.sdk.rpc.CompactOutput} + */ +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.addOutputs = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.cash.z.wallet.sdk.rpc.CompactOutput, opt_index); +}; + + +proto.cash.z.wallet.sdk.rpc.CompactTx.prototype.clearOutputsList = function() { + this.setOutputsList([]); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.cash.z.wallet.sdk.rpc.CompactSpend = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cash.z.wallet.sdk.rpc.CompactSpend, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.cash.z.wallet.sdk.rpc.CompactSpend.displayName = 'proto.cash.z.wallet.sdk.rpc.CompactSpend'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.cash.z.wallet.sdk.rpc.CompactSpend.prototype.toObject = function(opt_includeInstance) { + return proto.cash.z.wallet.sdk.rpc.CompactSpend.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.cash.z.wallet.sdk.rpc.CompactSpend} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.CompactSpend.toObject = function(includeInstance, msg) { + var f, obj = { + nf: msg.getNf_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.cash.z.wallet.sdk.rpc.CompactSpend} + */ +proto.cash.z.wallet.sdk.rpc.CompactSpend.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cash.z.wallet.sdk.rpc.CompactSpend; + return proto.cash.z.wallet.sdk.rpc.CompactSpend.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.cash.z.wallet.sdk.rpc.CompactSpend} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cash.z.wallet.sdk.rpc.CompactSpend} + */ +proto.cash.z.wallet.sdk.rpc.CompactSpend.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setNf(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactSpend.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cash.z.wallet.sdk.rpc.CompactSpend.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.cash.z.wallet.sdk.rpc.CompactSpend} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.CompactSpend.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getNf_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes nf = 1; + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactSpend.prototype.getNf = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes nf = 1; + * This is a type-conversion wrapper around `getNf()` + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactSpend.prototype.getNf_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getNf())); +}; + + +/** + * optional bytes nf = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getNf()` + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactSpend.prototype.getNf_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getNf())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.cash.z.wallet.sdk.rpc.CompactSpend.prototype.setNf = function(value) { + jspb.Message.setProto3BytesField(this, 1, value); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cash.z.wallet.sdk.rpc.CompactOutput, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.cash.z.wallet.sdk.rpc.CompactOutput.displayName = 'proto.cash.z.wallet.sdk.rpc.CompactOutput'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.prototype.toObject = function(opt_includeInstance) { + return proto.cash.z.wallet.sdk.rpc.CompactOutput.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.cash.z.wallet.sdk.rpc.CompactOutput} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.toObject = function(includeInstance, msg) { + var f, obj = { + cmu: msg.getCmu_asB64(), + epk: msg.getEpk_asB64(), + ciphertext: msg.getCiphertext_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.cash.z.wallet.sdk.rpc.CompactOutput} + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cash.z.wallet.sdk.rpc.CompactOutput; + return proto.cash.z.wallet.sdk.rpc.CompactOutput.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.cash.z.wallet.sdk.rpc.CompactOutput} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cash.z.wallet.sdk.rpc.CompactOutput} + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCmu(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setEpk(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCiphertext(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cash.z.wallet.sdk.rpc.CompactOutput.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.cash.z.wallet.sdk.rpc.CompactOutput} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCmu_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getEpk_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getCiphertext_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } +}; + + +/** + * optional bytes cmu = 1; + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.prototype.getCmu = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes cmu = 1; + * This is a type-conversion wrapper around `getCmu()` + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.prototype.getCmu_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCmu())); +}; + + +/** + * optional bytes cmu = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCmu()` + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.prototype.getCmu_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCmu())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.prototype.setCmu = function(value) { + jspb.Message.setProto3BytesField(this, 1, value); +}; + + +/** + * optional bytes epk = 2; + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.prototype.getEpk = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes epk = 2; + * This is a type-conversion wrapper around `getEpk()` + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.prototype.getEpk_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getEpk())); +}; + + +/** + * optional bytes epk = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getEpk()` + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.prototype.getEpk_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getEpk())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.prototype.setEpk = function(value) { + jspb.Message.setProto3BytesField(this, 2, value); +}; + + +/** + * optional bytes ciphertext = 3; + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.prototype.getCiphertext = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes ciphertext = 3; + * This is a type-conversion wrapper around `getCiphertext()` + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.prototype.getCiphertext_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCiphertext())); +}; + + +/** + * optional bytes ciphertext = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCiphertext()` + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.prototype.getCiphertext_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCiphertext())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.cash.z.wallet.sdk.rpc.CompactOutput.prototype.setCiphertext = function(value) { + jspb.Message.setProto3BytesField(this, 3, value); +}; + + +goog.object.extend(exports, proto.cash.z.wallet.sdk.rpc); diff --git a/zcash-client-sdk-js/src/service.proto b/zcash-client-sdk-js/src/service.proto new file mode 100644 index 0000000..2ae46d2 --- /dev/null +++ b/zcash-client-sdk-js/src/service.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; +package cash.z.wallet.sdk.rpc; +option go_package = "walletrpc"; + +import "compact_formats.proto"; + +// A BlockID message contains identifiers to select a block: a height or a +// hash. If the hash is present it takes precedence. +message BlockID { + uint64 height = 1; + bytes hash = 2; +} + +// BlockRange technically allows ranging from hash to hash etc but this is not +// currently intended for support, though there is no reason you couldn't do +// it. Further permutations are left as an exercise. +message BlockRange { + BlockID start = 1; + BlockID end = 2; +} + +// A TxFilter contains the information needed to identify a particular +// transaction: either a block and an index, or a direct transaction hash. +message TxFilter { + BlockID block = 1; + uint64 index = 2; + bytes hash = 3; +} + +// RawTransaction contains the complete transaction data. +message RawTransaction { + bytes data = 1; +} + +message SendResponse { + int32 errorCode = 1; + string errorMessage = 2; +} + +// Empty placeholder. Someday we may want to specify e.g. a particular chain fork. +message ChainSpec {} + +service CompactTxStreamer { + rpc GetLatestBlock(ChainSpec) returns (BlockID) {} + rpc GetBlock(BlockID) returns (CompactBlock) {} + rpc GetBlockRange(BlockRange) returns (stream CompactBlock) {} + rpc GetTransaction(TxFilter) returns (RawTransaction) {} + rpc SendTransaction(RawTransaction) returns (SendResponse) {} +} diff --git a/zcash-client-sdk-js/src/service_grpc_web_pb.js b/zcash-client-sdk-js/src/service_grpc_web_pb.js new file mode 100644 index 0000000..ec06c2c --- /dev/null +++ b/zcash-client-sdk-js/src/service_grpc_web_pb.js @@ -0,0 +1,366 @@ +/** + * @fileoverview gRPC-Web generated client stub for cash.z.wallet.sdk.rpc + * @enhanceable + * @public + */ + +// GENERATED CODE -- DO NOT EDIT! + + + +const grpc = {}; +grpc.web = require('grpc-web'); + + +var compact_formats_pb = require('./compact_formats_pb.js') +const proto = {}; +proto.cash = {}; +proto.cash.z = {}; +proto.cash.z.wallet = {}; +proto.cash.z.wallet.sdk = {}; +proto.cash.z.wallet.sdk.rpc = require('./service_pb.js'); + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?Object} options + * @constructor + * @struct + * @final + */ +proto.cash.z.wallet.sdk.rpc.CompactTxStreamerClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options['format'] = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname; + + /** + * @private @const {?Object} The credentials to be used to connect + * to the server + */ + this.credentials_ = credentials; + + /** + * @private @const {?Object} Options for the client + */ + this.options_ = options; +}; + + +/** + * @param {string} hostname + * @param {?Object} credentials + * @param {?Object} options + * @constructor + * @struct + * @final + */ +proto.cash.z.wallet.sdk.rpc.CompactTxStreamerPromiseClient = + function(hostname, credentials, options) { + if (!options) options = {}; + options['format'] = 'text'; + + /** + * @private @const {!grpc.web.GrpcWebClientBase} The client + */ + this.client_ = new grpc.web.GrpcWebClientBase(options); + + /** + * @private @const {string} The hostname + */ + this.hostname_ = hostname; + + /** + * @private @const {?Object} The credentials to be used to connect + * to the server + */ + this.credentials_ = credentials; + + /** + * @private @const {?Object} Options for the client + */ + this.options_ = options; +}; + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.cash.z.wallet.sdk.rpc.ChainSpec, + * !proto.cash.z.wallet.sdk.rpc.BlockID>} + */ +const methodInfo_CompactTxStreamer_GetLatestBlock = new grpc.web.AbstractClientBase.MethodInfo( + proto.cash.z.wallet.sdk.rpc.BlockID, + /** @param {!proto.cash.z.wallet.sdk.rpc.ChainSpec} request */ + function(request) { + return request.serializeBinary(); + }, + proto.cash.z.wallet.sdk.rpc.BlockID.deserializeBinary +); + + +/** + * @param {!proto.cash.z.wallet.sdk.rpc.ChainSpec} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.cash.z.wallet.sdk.rpc.BlockID)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.cash.z.wallet.sdk.rpc.CompactTxStreamerClient.prototype.getLatestBlock = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock', + request, + metadata || {}, + methodInfo_CompactTxStreamer_GetLatestBlock, + callback); +}; + + +/** + * @param {!proto.cash.z.wallet.sdk.rpc.ChainSpec} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.cash.z.wallet.sdk.rpc.CompactTxStreamerPromiseClient.prototype.getLatestBlock = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetLatestBlock', + request, + metadata || {}, + methodInfo_CompactTxStreamer_GetLatestBlock); +}; + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.cash.z.wallet.sdk.rpc.BlockID, + * !proto.cash.z.wallet.sdk.rpc.CompactBlock>} + */ +const methodInfo_CompactTxStreamer_GetBlock = new grpc.web.AbstractClientBase.MethodInfo( + compact_formats_pb.CompactBlock, + /** @param {!proto.cash.z.wallet.sdk.rpc.BlockID} request */ + function(request) { + return request.serializeBinary(); + }, + compact_formats_pb.CompactBlock.deserializeBinary +); + + +/** + * @param {!proto.cash.z.wallet.sdk.rpc.BlockID} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.cash.z.wallet.sdk.rpc.CompactBlock)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.cash.z.wallet.sdk.rpc.CompactTxStreamerClient.prototype.getBlock = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock', + request, + metadata || {}, + methodInfo_CompactTxStreamer_GetBlock, + callback); +}; + + +/** + * @param {!proto.cash.z.wallet.sdk.rpc.BlockID} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.cash.z.wallet.sdk.rpc.CompactTxStreamerPromiseClient.prototype.getBlock = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlock', + request, + metadata || {}, + methodInfo_CompactTxStreamer_GetBlock); +}; + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.cash.z.wallet.sdk.rpc.BlockRange, + * !proto.cash.z.wallet.sdk.rpc.CompactBlock>} + */ +const methodInfo_CompactTxStreamer_GetBlockRange = new grpc.web.AbstractClientBase.MethodInfo( + compact_formats_pb.CompactBlock, + /** @param {!proto.cash.z.wallet.sdk.rpc.BlockRange} request */ + function(request) { + return request.serializeBinary(); + }, + compact_formats_pb.CompactBlock.deserializeBinary +); + + +/** + * @param {!proto.cash.z.wallet.sdk.rpc.BlockRange} request The request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.cash.z.wallet.sdk.rpc.CompactTxStreamerClient.prototype.getBlockRange = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange', + request, + metadata || {}, + methodInfo_CompactTxStreamer_GetBlockRange); +}; + + +/** + * @param {!proto.cash.z.wallet.sdk.rpc.BlockRange} request The request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.cash.z.wallet.sdk.rpc.CompactTxStreamerPromiseClient.prototype.getBlockRange = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetBlockRange', + request, + metadata || {}, + methodInfo_CompactTxStreamer_GetBlockRange); +}; + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.cash.z.wallet.sdk.rpc.TxFilter, + * !proto.cash.z.wallet.sdk.rpc.RawTransaction>} + */ +const methodInfo_CompactTxStreamer_GetTransaction = new grpc.web.AbstractClientBase.MethodInfo( + proto.cash.z.wallet.sdk.rpc.RawTransaction, + /** @param {!proto.cash.z.wallet.sdk.rpc.TxFilter} request */ + function(request) { + return request.serializeBinary(); + }, + proto.cash.z.wallet.sdk.rpc.RawTransaction.deserializeBinary +); + + +/** + * @param {!proto.cash.z.wallet.sdk.rpc.TxFilter} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.cash.z.wallet.sdk.rpc.RawTransaction)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.cash.z.wallet.sdk.rpc.CompactTxStreamerClient.prototype.getTransaction = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction', + request, + metadata || {}, + methodInfo_CompactTxStreamer_GetTransaction, + callback); +}; + + +/** + * @param {!proto.cash.z.wallet.sdk.rpc.TxFilter} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.cash.z.wallet.sdk.rpc.CompactTxStreamerPromiseClient.prototype.getTransaction = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetTransaction', + request, + metadata || {}, + methodInfo_CompactTxStreamer_GetTransaction); +}; + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.cash.z.wallet.sdk.rpc.RawTransaction, + * !proto.cash.z.wallet.sdk.rpc.SendResponse>} + */ +const methodInfo_CompactTxStreamer_SendTransaction = new grpc.web.AbstractClientBase.MethodInfo( + proto.cash.z.wallet.sdk.rpc.SendResponse, + /** @param {!proto.cash.z.wallet.sdk.rpc.RawTransaction} request */ + function(request) { + return request.serializeBinary(); + }, + proto.cash.z.wallet.sdk.rpc.SendResponse.deserializeBinary +); + + +/** + * @param {!proto.cash.z.wallet.sdk.rpc.RawTransaction} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.cash.z.wallet.sdk.rpc.SendResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.cash.z.wallet.sdk.rpc.CompactTxStreamerClient.prototype.sendTransaction = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction', + request, + metadata || {}, + methodInfo_CompactTxStreamer_SendTransaction, + callback); +}; + + +/** + * @param {!proto.cash.z.wallet.sdk.rpc.RawTransaction} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.cash.z.wallet.sdk.rpc.CompactTxStreamerPromiseClient.prototype.sendTransaction = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/cash.z.wallet.sdk.rpc.CompactTxStreamer/SendTransaction', + request, + metadata || {}, + methodInfo_CompactTxStreamer_SendTransaction); +}; + + +module.exports = proto.cash.z.wallet.sdk.rpc; + diff --git a/zcash-client-sdk-js/src/service_pb.js b/zcash-client-sdk-js/src/service_pb.js new file mode 100644 index 0000000..53a25f7 --- /dev/null +++ b/zcash-client-sdk-js/src/service_pb.js @@ -0,0 +1,1105 @@ +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +var compact_formats_pb = require('./compact_formats_pb.js'); +goog.exportSymbol('proto.cash.z.wallet.sdk.rpc.BlockID', null, global); +goog.exportSymbol('proto.cash.z.wallet.sdk.rpc.BlockRange', null, global); +goog.exportSymbol('proto.cash.z.wallet.sdk.rpc.ChainSpec', null, global); +goog.exportSymbol('proto.cash.z.wallet.sdk.rpc.RawTransaction', null, global); +goog.exportSymbol('proto.cash.z.wallet.sdk.rpc.SendResponse', null, global); +goog.exportSymbol('proto.cash.z.wallet.sdk.rpc.TxFilter', null, global); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.cash.z.wallet.sdk.rpc.BlockID = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cash.z.wallet.sdk.rpc.BlockID, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.cash.z.wallet.sdk.rpc.BlockID.displayName = 'proto.cash.z.wallet.sdk.rpc.BlockID'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.cash.z.wallet.sdk.rpc.BlockID.prototype.toObject = function(opt_includeInstance) { + return proto.cash.z.wallet.sdk.rpc.BlockID.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.cash.z.wallet.sdk.rpc.BlockID} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.BlockID.toObject = function(includeInstance, msg) { + var f, obj = { + height: jspb.Message.getFieldWithDefault(msg, 1, 0), + hash: msg.getHash_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.cash.z.wallet.sdk.rpc.BlockID} + */ +proto.cash.z.wallet.sdk.rpc.BlockID.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cash.z.wallet.sdk.rpc.BlockID; + return proto.cash.z.wallet.sdk.rpc.BlockID.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.cash.z.wallet.sdk.rpc.BlockID} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cash.z.wallet.sdk.rpc.BlockID} + */ +proto.cash.z.wallet.sdk.rpc.BlockID.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint64()); + msg.setHeight(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.BlockID.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cash.z.wallet.sdk.rpc.BlockID.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.cash.z.wallet.sdk.rpc.BlockID} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.BlockID.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHeight(); + if (f !== 0) { + writer.writeUint64( + 1, + f + ); + } + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional uint64 height = 1; + * @return {number} + */ +proto.cash.z.wallet.sdk.rpc.BlockID.prototype.getHeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.cash.z.wallet.sdk.rpc.BlockID.prototype.setHeight = function(value) { + jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional bytes hash = 2; + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.BlockID.prototype.getHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes hash = 2; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.BlockID.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes hash = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.BlockID.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.cash.z.wallet.sdk.rpc.BlockID.prototype.setHash = function(value) { + jspb.Message.setProto3BytesField(this, 2, value); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.cash.z.wallet.sdk.rpc.BlockRange = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cash.z.wallet.sdk.rpc.BlockRange, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.cash.z.wallet.sdk.rpc.BlockRange.displayName = 'proto.cash.z.wallet.sdk.rpc.BlockRange'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.cash.z.wallet.sdk.rpc.BlockRange.prototype.toObject = function(opt_includeInstance) { + return proto.cash.z.wallet.sdk.rpc.BlockRange.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.cash.z.wallet.sdk.rpc.BlockRange} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.BlockRange.toObject = function(includeInstance, msg) { + var f, obj = { + start: (f = msg.getStart()) && proto.cash.z.wallet.sdk.rpc.BlockID.toObject(includeInstance, f), + end: (f = msg.getEnd()) && proto.cash.z.wallet.sdk.rpc.BlockID.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.cash.z.wallet.sdk.rpc.BlockRange} + */ +proto.cash.z.wallet.sdk.rpc.BlockRange.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cash.z.wallet.sdk.rpc.BlockRange; + return proto.cash.z.wallet.sdk.rpc.BlockRange.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.cash.z.wallet.sdk.rpc.BlockRange} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cash.z.wallet.sdk.rpc.BlockRange} + */ +proto.cash.z.wallet.sdk.rpc.BlockRange.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.cash.z.wallet.sdk.rpc.BlockID; + reader.readMessage(value,proto.cash.z.wallet.sdk.rpc.BlockID.deserializeBinaryFromReader); + msg.setStart(value); + break; + case 2: + var value = new proto.cash.z.wallet.sdk.rpc.BlockID; + reader.readMessage(value,proto.cash.z.wallet.sdk.rpc.BlockID.deserializeBinaryFromReader); + msg.setEnd(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.BlockRange.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cash.z.wallet.sdk.rpc.BlockRange.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.cash.z.wallet.sdk.rpc.BlockRange} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.BlockRange.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getStart(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.cash.z.wallet.sdk.rpc.BlockID.serializeBinaryToWriter + ); + } + f = message.getEnd(); + if (f != null) { + writer.writeMessage( + 2, + f, + proto.cash.z.wallet.sdk.rpc.BlockID.serializeBinaryToWriter + ); + } +}; + + +/** + * optional BlockID start = 1; + * @return {?proto.cash.z.wallet.sdk.rpc.BlockID} + */ +proto.cash.z.wallet.sdk.rpc.BlockRange.prototype.getStart = function() { + return /** @type{?proto.cash.z.wallet.sdk.rpc.BlockID} */ ( + jspb.Message.getWrapperField(this, proto.cash.z.wallet.sdk.rpc.BlockID, 1)); +}; + + +/** @param {?proto.cash.z.wallet.sdk.rpc.BlockID|undefined} value */ +proto.cash.z.wallet.sdk.rpc.BlockRange.prototype.setStart = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +proto.cash.z.wallet.sdk.rpc.BlockRange.prototype.clearStart = function() { + this.setStart(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {!boolean} + */ +proto.cash.z.wallet.sdk.rpc.BlockRange.prototype.hasStart = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional BlockID end = 2; + * @return {?proto.cash.z.wallet.sdk.rpc.BlockID} + */ +proto.cash.z.wallet.sdk.rpc.BlockRange.prototype.getEnd = function() { + return /** @type{?proto.cash.z.wallet.sdk.rpc.BlockID} */ ( + jspb.Message.getWrapperField(this, proto.cash.z.wallet.sdk.rpc.BlockID, 2)); +}; + + +/** @param {?proto.cash.z.wallet.sdk.rpc.BlockID|undefined} value */ +proto.cash.z.wallet.sdk.rpc.BlockRange.prototype.setEnd = function(value) { + jspb.Message.setWrapperField(this, 2, value); +}; + + +proto.cash.z.wallet.sdk.rpc.BlockRange.prototype.clearEnd = function() { + this.setEnd(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {!boolean} + */ +proto.cash.z.wallet.sdk.rpc.BlockRange.prototype.hasEnd = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.cash.z.wallet.sdk.rpc.TxFilter = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cash.z.wallet.sdk.rpc.TxFilter, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.cash.z.wallet.sdk.rpc.TxFilter.displayName = 'proto.cash.z.wallet.sdk.rpc.TxFilter'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.cash.z.wallet.sdk.rpc.TxFilter.prototype.toObject = function(opt_includeInstance) { + return proto.cash.z.wallet.sdk.rpc.TxFilter.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.cash.z.wallet.sdk.rpc.TxFilter} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.TxFilter.toObject = function(includeInstance, msg) { + var f, obj = { + block: (f = msg.getBlock()) && proto.cash.z.wallet.sdk.rpc.BlockID.toObject(includeInstance, f), + index: jspb.Message.getFieldWithDefault(msg, 2, 0), + hash: msg.getHash_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.cash.z.wallet.sdk.rpc.TxFilter} + */ +proto.cash.z.wallet.sdk.rpc.TxFilter.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cash.z.wallet.sdk.rpc.TxFilter; + return proto.cash.z.wallet.sdk.rpc.TxFilter.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.cash.z.wallet.sdk.rpc.TxFilter} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cash.z.wallet.sdk.rpc.TxFilter} + */ +proto.cash.z.wallet.sdk.rpc.TxFilter.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.cash.z.wallet.sdk.rpc.BlockID; + reader.readMessage(value,proto.cash.z.wallet.sdk.rpc.BlockID.deserializeBinaryFromReader); + msg.setBlock(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint64()); + msg.setIndex(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.TxFilter.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cash.z.wallet.sdk.rpc.TxFilter.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.cash.z.wallet.sdk.rpc.TxFilter} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.TxFilter.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBlock(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.cash.z.wallet.sdk.rpc.BlockID.serializeBinaryToWriter + ); + } + f = message.getIndex(); + if (f !== 0) { + writer.writeUint64( + 2, + f + ); + } + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } +}; + + +/** + * optional BlockID block = 1; + * @return {?proto.cash.z.wallet.sdk.rpc.BlockID} + */ +proto.cash.z.wallet.sdk.rpc.TxFilter.prototype.getBlock = function() { + return /** @type{?proto.cash.z.wallet.sdk.rpc.BlockID} */ ( + jspb.Message.getWrapperField(this, proto.cash.z.wallet.sdk.rpc.BlockID, 1)); +}; + + +/** @param {?proto.cash.z.wallet.sdk.rpc.BlockID|undefined} value */ +proto.cash.z.wallet.sdk.rpc.TxFilter.prototype.setBlock = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +proto.cash.z.wallet.sdk.rpc.TxFilter.prototype.clearBlock = function() { + this.setBlock(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {!boolean} + */ +proto.cash.z.wallet.sdk.rpc.TxFilter.prototype.hasBlock = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional uint64 index = 2; + * @return {number} + */ +proto.cash.z.wallet.sdk.rpc.TxFilter.prototype.getIndex = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** @param {number} value */ +proto.cash.z.wallet.sdk.rpc.TxFilter.prototype.setIndex = function(value) { + jspb.Message.setProto3IntField(this, 2, value); +}; + + +/** + * optional bytes hash = 3; + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.TxFilter.prototype.getHash = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes hash = 3; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.TxFilter.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes hash = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.TxFilter.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.cash.z.wallet.sdk.rpc.TxFilter.prototype.setHash = function(value) { + jspb.Message.setProto3BytesField(this, 3, value); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.cash.z.wallet.sdk.rpc.RawTransaction = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cash.z.wallet.sdk.rpc.RawTransaction, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.cash.z.wallet.sdk.rpc.RawTransaction.displayName = 'proto.cash.z.wallet.sdk.rpc.RawTransaction'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.cash.z.wallet.sdk.rpc.RawTransaction.prototype.toObject = function(opt_includeInstance) { + return proto.cash.z.wallet.sdk.rpc.RawTransaction.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.cash.z.wallet.sdk.rpc.RawTransaction} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.RawTransaction.toObject = function(includeInstance, msg) { + var f, obj = { + data: msg.getData_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.cash.z.wallet.sdk.rpc.RawTransaction} + */ +proto.cash.z.wallet.sdk.rpc.RawTransaction.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cash.z.wallet.sdk.rpc.RawTransaction; + return proto.cash.z.wallet.sdk.rpc.RawTransaction.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.cash.z.wallet.sdk.rpc.RawTransaction} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cash.z.wallet.sdk.rpc.RawTransaction} + */ +proto.cash.z.wallet.sdk.rpc.RawTransaction.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.RawTransaction.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cash.z.wallet.sdk.rpc.RawTransaction.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.cash.z.wallet.sdk.rpc.RawTransaction} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.RawTransaction.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getData_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } +}; + + +/** + * optional bytes data = 1; + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.RawTransaction.prototype.getData = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes data = 1; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.RawTransaction.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.RawTransaction.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.cash.z.wallet.sdk.rpc.RawTransaction.prototype.setData = function(value) { + jspb.Message.setProto3BytesField(this, 1, value); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.cash.z.wallet.sdk.rpc.SendResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cash.z.wallet.sdk.rpc.SendResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.cash.z.wallet.sdk.rpc.SendResponse.displayName = 'proto.cash.z.wallet.sdk.rpc.SendResponse'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.cash.z.wallet.sdk.rpc.SendResponse.prototype.toObject = function(opt_includeInstance) { + return proto.cash.z.wallet.sdk.rpc.SendResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.cash.z.wallet.sdk.rpc.SendResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.SendResponse.toObject = function(includeInstance, msg) { + var f, obj = { + errorcode: jspb.Message.getFieldWithDefault(msg, 1, 0), + errormessage: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.cash.z.wallet.sdk.rpc.SendResponse} + */ +proto.cash.z.wallet.sdk.rpc.SendResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cash.z.wallet.sdk.rpc.SendResponse; + return proto.cash.z.wallet.sdk.rpc.SendResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.cash.z.wallet.sdk.rpc.SendResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cash.z.wallet.sdk.rpc.SendResponse} + */ +proto.cash.z.wallet.sdk.rpc.SendResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setErrorcode(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setErrormessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.SendResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cash.z.wallet.sdk.rpc.SendResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.cash.z.wallet.sdk.rpc.SendResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.SendResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getErrorcode(); + if (f !== 0) { + writer.writeInt32( + 1, + f + ); + } + f = message.getErrormessage(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional int32 errorCode = 1; + * @return {number} + */ +proto.cash.z.wallet.sdk.rpc.SendResponse.prototype.getErrorcode = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.cash.z.wallet.sdk.rpc.SendResponse.prototype.setErrorcode = function(value) { + jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional string errorMessage = 2; + * @return {string} + */ +proto.cash.z.wallet.sdk.rpc.SendResponse.prototype.getErrormessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** @param {string} value */ +proto.cash.z.wallet.sdk.rpc.SendResponse.prototype.setErrormessage = function(value) { + jspb.Message.setProto3StringField(this, 2, value); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.cash.z.wallet.sdk.rpc.ChainSpec = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cash.z.wallet.sdk.rpc.ChainSpec, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.cash.z.wallet.sdk.rpc.ChainSpec.displayName = 'proto.cash.z.wallet.sdk.rpc.ChainSpec'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.cash.z.wallet.sdk.rpc.ChainSpec.prototype.toObject = function(opt_includeInstance) { + return proto.cash.z.wallet.sdk.rpc.ChainSpec.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.cash.z.wallet.sdk.rpc.ChainSpec} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.ChainSpec.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.cash.z.wallet.sdk.rpc.ChainSpec} + */ +proto.cash.z.wallet.sdk.rpc.ChainSpec.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cash.z.wallet.sdk.rpc.ChainSpec; + return proto.cash.z.wallet.sdk.rpc.ChainSpec.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.cash.z.wallet.sdk.rpc.ChainSpec} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cash.z.wallet.sdk.rpc.ChainSpec} + */ +proto.cash.z.wallet.sdk.rpc.ChainSpec.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.cash.z.wallet.sdk.rpc.ChainSpec.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cash.z.wallet.sdk.rpc.ChainSpec.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.cash.z.wallet.sdk.rpc.ChainSpec} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cash.z.wallet.sdk.rpc.ChainSpec.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + +goog.object.extend(exports, proto.cash.z.wallet.sdk.rpc);