@onflow/transport-grpc
Advanced tools
Comparing version 1.1.4 to 1.2.0-alpha.0
# @onflow/transport-grpc | ||
## 1.2.0-alpha.0 | ||
### Minor Changes | ||
- [#1420](https://github.com/onflow/fcl-js/pull/1420) [`c20bc344`](https://github.com/onflow/fcl-js/commit/c20bc34448a22966d349b0b1c4c0f742ae93a355) Thanks [@huyndo](https://github.com/huyndo)! - Add GetNetworkParameters interaction and a util to get chain ID | ||
### Patch Changes | ||
- Updated dependencies [[`5bec5576`](https://github.com/onflow/fcl-js/commit/5bec5576a79809d0684411736e3f4c02b8051c22)]: | ||
- @onflow/util-address@1.1.0-alpha.0 | ||
## 1.1.4 | ||
@@ -4,0 +15,0 @@ |
@@ -1473,2 +1473,54 @@ 'use strict'; | ||
function sendGetNetworkParameters(_x) { | ||
return _sendGetNetworkParameters.apply(this, arguments); | ||
} | ||
function _sendGetNetworkParameters() { | ||
_sendGetNetworkParameters = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(ix) { | ||
var context, | ||
opts, | ||
unary$1, | ||
req, | ||
res, | ||
ret, | ||
chainId, | ||
_args = arguments; | ||
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
context = _args.length > 1 && _args[1] !== undefined ? _args[1] : {}; | ||
opts = _args.length > 2 && _args[2] !== undefined ? _args[2] : {}; | ||
utilInvariant.invariant(opts.node, "SDK Send Get Network Parameters Error: opts.node must be defined."); | ||
utilInvariant.invariant(context.response, "SDK Send Get Network Parameters Error: context.response must be defined."); | ||
unary$1 = opts.unary || unary; | ||
_context.next = 7; | ||
return ix; | ||
case 7: | ||
ix = _context.sent; | ||
req = new protobuf.GetNetworkParametersRequest(); | ||
_context.next = 11; | ||
return unary$1(opts.node, protobuf.AccessAPI.GetNetworkParameters, req, context); | ||
case 11: | ||
res = _context.sent; | ||
ret = context.response(); | ||
ret.tag = ix.tag; | ||
chainId = res.getChainId(); | ||
ret.networkParameters = { | ||
chainId: chainId | ||
}; | ||
return _context.abrupt("return", ret); | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee); | ||
})); | ||
return _sendGetNetworkParameters.apply(this, arguments); | ||
} | ||
var send = /*#__PURE__*/function () { | ||
@@ -1493,3 +1545,3 @@ var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(ix) { | ||
_context.t0 = true; | ||
_context.next = _context.t0 === context.ix.isTransaction(ix) ? 10 : _context.t0 === context.ix.isGetTransactionStatus(ix) ? 11 : _context.t0 === context.ix.isGetTransaction(ix) ? 12 : _context.t0 === context.ix.isScript(ix) ? 13 : _context.t0 === context.ix.isGetAccount(ix) ? 14 : _context.t0 === context.ix.isGetEvents(ix) ? 15 : _context.t0 === context.ix.isGetBlock(ix) ? 16 : _context.t0 === context.ix.isGetBlockHeader(ix) ? 17 : _context.t0 === context.ix.isGetCollection(ix) ? 18 : _context.t0 === context.ix.isPing(ix) ? 19 : 20; | ||
_context.next = _context.t0 === context.ix.isTransaction(ix) ? 10 : _context.t0 === context.ix.isGetTransactionStatus(ix) ? 11 : _context.t0 === context.ix.isGetTransaction(ix) ? 12 : _context.t0 === context.ix.isScript(ix) ? 13 : _context.t0 === context.ix.isGetAccount(ix) ? 14 : _context.t0 === context.ix.isGetEvents(ix) ? 15 : _context.t0 === context.ix.isGetBlock(ix) ? 16 : _context.t0 === context.ix.isGetBlockHeader(ix) ? 17 : _context.t0 === context.ix.isGetCollection(ix) ? 18 : _context.t0 === context.ix.isPing(ix) ? 19 : _context.t0 === context.ix.isGetNetworkParameters(ix) ? 20 : 21; | ||
break; | ||
@@ -1528,5 +1580,8 @@ | ||
case 20: | ||
return _context.abrupt("return", opts.sendGetNetworkParameters ? opts.sendGetNetworkParameters(ix, context, opts) : sendGetNetworkParameters(ix, context, opts)); | ||
case 21: | ||
return _context.abrupt("return", ix); | ||
case 21: | ||
case 22: | ||
case "end": | ||
@@ -1551,2 +1606,3 @@ return _context.stop(); | ||
exports.sendGetEvents = sendGetEvents; | ||
exports.sendGetNetworkParameters = sendGetNetworkParameters; | ||
exports.sendGetTransaction = sendGetTransaction; | ||
@@ -1553,0 +1609,0 @@ exports.sendGetTransactionStatus = sendGetTransactionStatus; |
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator'; | ||
import _regeneratorRuntime from '@babel/runtime/regenerator'; | ||
import { invariant } from '@onflow/util-invariant'; | ||
import { ExecuteScriptAtBlockIDRequest, AccessAPI, ExecuteScriptAtBlockHeightRequest, ExecuteScriptAtLatestBlockRequest, GetAccountAtBlockHeightRequest, GetAccountAtLatestBlockRequest, GetBlockHeaderByIDRequest, GetLatestBlockHeaderRequest, GetBlockHeaderByHeightRequest, GetBlockByIDRequest, GetLatestBlockRequest, GetBlockByHeightRequest, GetCollectionByIDRequest, GetEventsForHeightRangeRequest, GetEventsForBlockIDsRequest, GetTransactionRequest, PingRequest, SendTransactionRequest, Transaction } from '@onflow/protobuf'; | ||
import { ExecuteScriptAtBlockIDRequest, AccessAPI, ExecuteScriptAtBlockHeightRequest, ExecuteScriptAtLatestBlockRequest, GetAccountAtBlockHeightRequest, GetAccountAtLatestBlockRequest, GetBlockHeaderByIDRequest, GetLatestBlockHeaderRequest, GetBlockHeaderByHeightRequest, GetBlockByIDRequest, GetLatestBlockRequest, GetBlockByHeightRequest, GetCollectionByIDRequest, GetEventsForHeightRangeRequest, GetEventsForBlockIDsRequest, GetTransactionRequest, PingRequest, SendTransactionRequest, Transaction, GetNetworkParametersRequest } from '@onflow/protobuf'; | ||
import { grpc } from '@improbable-eng/grpc-web'; | ||
@@ -1461,2 +1461,54 @@ import { NodeHttpTransport } from '@improbable-eng/grpc-web-node-http-transport'; | ||
function sendGetNetworkParameters(_x) { | ||
return _sendGetNetworkParameters.apply(this, arguments); | ||
} | ||
function _sendGetNetworkParameters() { | ||
_sendGetNetworkParameters = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(ix) { | ||
var context, | ||
opts, | ||
unary$1, | ||
req, | ||
res, | ||
ret, | ||
chainId, | ||
_args = arguments; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
context = _args.length > 1 && _args[1] !== undefined ? _args[1] : {}; | ||
opts = _args.length > 2 && _args[2] !== undefined ? _args[2] : {}; | ||
invariant(opts.node, "SDK Send Get Network Parameters Error: opts.node must be defined."); | ||
invariant(context.response, "SDK Send Get Network Parameters Error: context.response must be defined."); | ||
unary$1 = opts.unary || unary; | ||
_context.next = 7; | ||
return ix; | ||
case 7: | ||
ix = _context.sent; | ||
req = new GetNetworkParametersRequest(); | ||
_context.next = 11; | ||
return unary$1(opts.node, AccessAPI.GetNetworkParameters, req, context); | ||
case 11: | ||
res = _context.sent; | ||
ret = context.response(); | ||
ret.tag = ix.tag; | ||
chainId = res.getChainId(); | ||
ret.networkParameters = { | ||
chainId: chainId | ||
}; | ||
return _context.abrupt("return", ret); | ||
case 17: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee); | ||
})); | ||
return _sendGetNetworkParameters.apply(this, arguments); | ||
} | ||
var send = /*#__PURE__*/function () { | ||
@@ -1481,3 +1533,3 @@ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(ix) { | ||
_context.t0 = true; | ||
_context.next = _context.t0 === context.ix.isTransaction(ix) ? 10 : _context.t0 === context.ix.isGetTransactionStatus(ix) ? 11 : _context.t0 === context.ix.isGetTransaction(ix) ? 12 : _context.t0 === context.ix.isScript(ix) ? 13 : _context.t0 === context.ix.isGetAccount(ix) ? 14 : _context.t0 === context.ix.isGetEvents(ix) ? 15 : _context.t0 === context.ix.isGetBlock(ix) ? 16 : _context.t0 === context.ix.isGetBlockHeader(ix) ? 17 : _context.t0 === context.ix.isGetCollection(ix) ? 18 : _context.t0 === context.ix.isPing(ix) ? 19 : 20; | ||
_context.next = _context.t0 === context.ix.isTransaction(ix) ? 10 : _context.t0 === context.ix.isGetTransactionStatus(ix) ? 11 : _context.t0 === context.ix.isGetTransaction(ix) ? 12 : _context.t0 === context.ix.isScript(ix) ? 13 : _context.t0 === context.ix.isGetAccount(ix) ? 14 : _context.t0 === context.ix.isGetEvents(ix) ? 15 : _context.t0 === context.ix.isGetBlock(ix) ? 16 : _context.t0 === context.ix.isGetBlockHeader(ix) ? 17 : _context.t0 === context.ix.isGetCollection(ix) ? 18 : _context.t0 === context.ix.isPing(ix) ? 19 : _context.t0 === context.ix.isGetNetworkParameters(ix) ? 20 : 21; | ||
break; | ||
@@ -1516,5 +1568,8 @@ | ||
case 20: | ||
return _context.abrupt("return", opts.sendGetNetworkParameters ? opts.sendGetNetworkParameters(ix, context, opts) : sendGetNetworkParameters(ix, context, opts)); | ||
case 21: | ||
return _context.abrupt("return", ix); | ||
case 21: | ||
case 22: | ||
case "end": | ||
@@ -1532,3 +1587,3 @@ return _context.stop(); | ||
export { send, sendExecuteScript, sendGetAccount, sendGetBlock, sendGetBlockHeader, sendGetCollection, sendGetEvents, sendGetTransaction, sendGetTransactionStatus, sendPing, sendTransaction }; | ||
export { send, sendExecuteScript, sendGetAccount, sendGetBlock, sendGetBlockHeader, sendGetCollection, sendGetEvents, sendGetNetworkParameters, sendGetTransaction, sendGetTransactionStatus, sendPing, sendTransaction }; | ||
//# sourceMappingURL=sdk-send-grpc.module.js.map |
{ | ||
"name": "@onflow/transport-grpc", | ||
"version": "1.1.4", | ||
"version": "1.2.0-alpha.0", | ||
"description": "Flow SDK GRPC Transport Module", | ||
@@ -43,3 +43,3 @@ "license": "Apache-2.0", | ||
"@onflow/rlp": "^1.0.3", | ||
"@onflow/util-address": "^1.0.3", | ||
"@onflow/util-address": "^1.1.0-alpha.0", | ||
"@onflow/util-invariant": "^1.0.3", | ||
@@ -46,0 +46,0 @@ "@onflow/util-template": "^1.0.4" |
@@ -11,2 +11,3 @@ export {sendExecuteScript} from "./send-execute-script.js" | ||
export {sendTransaction} from "./send-transaction.js" | ||
export {sendGetNetworkParameters} from "./send-get-network-parameters.js" | ||
export {send} from "./send-grpc.js" |
@@ -12,2 +12,3 @@ import {invariant} from "@onflow/util-invariant" | ||
import {sendPing} from "./send-ping.js" | ||
import {sendGetNetworkParameters} from "./send-get-network-parameters.js" | ||
@@ -45,2 +46,4 @@ export const send = async (ix, context = {}, opts = {}) => { | ||
return opts.sendPing ? opts.sendPing(ix, context, opts) : sendPing(ix, context, opts) | ||
case context.ix.isGetNetworkParameters(ix): | ||
return opts.sendGetNetworkParameters ? opts.sendGetNetworkParameters(ix, context, opts) : sendGetNetworkParameters(ix, context, opts) | ||
default: | ||
@@ -47,0 +50,0 @@ return ix |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
3285467
34
10628
1