Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@onflow/transport-grpc

Package Overview
Dependencies
Maintainers
13
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onflow/transport-grpc - npm Package Compare versions

Comparing version 1.3.2-event-streaming.1 to 1.4.0-alpha.5

43

CHANGELOG.md
# @onflow/transport-grpc
## 1.3.2-event-streaming.1
## 1.4.0-alpha.5
### Minor Changes
- [#1855](https://github.com/onflow/fcl-js/pull/1855) [`80db8166`](https://github.com/onflow/fcl-js/commit/80db816620d7643c35a0fca7149c15de92f7bc88) Thanks [@jribbink](https://github.com/jribbink)! - Add GetNodeVersionInfo SDK Interaction
### Patch Changes
- Add subscribeEvents export to FCL & fix build
- Updated dependencies [[`80db8166`](https://github.com/onflow/fcl-js/commit/80db816620d7643c35a0fca7149c15de92f7bc88)]:
- @onflow/protobuf@1.3.0-alpha.0
- Updated dependencies []:
- @onflow/util-invariant@1.2.2-event-streaming.1
- @onflow/util-template@1.2.2-event-streaming.1
- @onflow/util-address@1.2.2-event-streaming.1
- @onflow/rlp@1.2.2-event-streaming.1
## 1.3.2-alpha.4
## 1.3.2-event-streaming.0
### Patch Changes
- [#1832](https://github.com/onflow/fcl-js/pull/1832) [`037dc2f9`](https://github.com/onflow/fcl-js/commit/037dc2f9db9c22185e3c048c65e23e0efa70085f) Thanks [@jribbink](https://github.com/jribbink)! - Update access modifiers to support Cadence 1.0
## 1.3.2-alpha.3
### Patch Changes
- [#1827](https://github.com/onflow/fcl-js/pull/1827) [`e74c4a60`](https://github.com/onflow/fcl-js/commit/e74c4a60f38f366874aa1391ca1c890a7ad3a42a) Thanks [@nialexsan](https://github.com/nialexsan)! - pin versions
- Updated dependencies [[`e74c4a60`](https://github.com/onflow/fcl-js/commit/e74c4a60f38f366874aa1391ca1c890a7ad3a42a)]:
- @onflow/util-invariant@1.2.2-alpha.2
- @onflow/util-template@1.2.2-alpha.2
- @onflow/util-address@1.2.2-alpha.2
- @onflow/rlp@1.2.2-alpha.2
## 1.3.2-alpha.2
### Patch Changes
- [#1794](https://github.com/onflow/fcl-js/pull/1794) [`acf90a78`](https://github.com/onflow/fcl-js/commit/acf90a7841f843227d5d9edb450ef08322c77c4d) Thanks [@jribbink](https://github.com/jribbink)! - Deprecate @onflow/transport-grpc & add "not implemented" error for subscribeEvents
- Updated dependencies [[`0d09d838`](https://github.com/onflow/fcl-js/commit/0d09d8386c2fc472833df7152467d477f36dddc4)]:
- @onflow/util-invariant@1.2.2-event-streaming.0
- @onflow/util-template@1.2.2-event-streaming.0
- @onflow/util-address@1.2.2-event-streaming.0
- @onflow/rlp@1.2.2-event-streaming.0
- @onflow/util-invariant@1.2.2-alpha.1
- @onflow/util-template@1.2.2-alpha.1
- @onflow/util-address@1.2.2-alpha.1
- @onflow/rlp@1.2.2-alpha.1

@@ -25,0 +44,0 @@ ## 1.3.1

@@ -10,3 +10,24 @@ 'use strict';

var utilAddress = require('@onflow/util-address');
var logger = require('@onflow/util-logger');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var logger__namespace = /*#__PURE__*/_interopNamespace(logger);
grpcWeb.grpc.setDefaultTransport(grpcWebNodeHttpTransport.NodeHttpTransport());

@@ -90,3 +111,3 @@ async function unary(host, method, request, context) {

const u8ToHex$7 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$8 = (u8, context) => context.Buffer.from(u8).toString("hex");
const paddedHexBuffer$1 = (hex, pad, context) => context.Buffer.from(hex.padStart(pad * 2, 0), "hex");

@@ -131,3 +152,3 @@ const addressBuffer$1 = (addr, context) => paddedHexBuffer$1(addr, 8, context);

ret.account = {
address: utilAddress.withPrefix(u8ToHex$7(account.getAddress_asU8(), context)),
address: utilAddress.withPrefix(u8ToHex$8(account.getAddress_asU8(), context)),
balance: account.getBalance(),

@@ -138,3 +159,3 @@ code: context.Buffer.from(account.getCode_asU8() || new UInt8Array()).toString("utf8"),

index: publicKey.getIndex(),
publicKey: u8ToHex$7(publicKey.getPublicKey_asU8(), context),
publicKey: u8ToHex$8(publicKey.getPublicKey_asU8(), context),
signAlgo: publicKey.getSignAlgo(),

@@ -167,3 +188,3 @@ signAlgoString: SignatureAlgorithmNames[publicKey.getSignAlgo()],

const u8ToHex$6 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$7 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$6 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -198,4 +219,4 @@ async function sendGetBlockHeaderByIDRequest(ix, context, opts) {

ret.blockHeader = {
id: u8ToHex$6(blockHeader.getId_asU8(), context),
parentId: u8ToHex$6(blockHeader.getParentId_asU8(), context),
id: u8ToHex$7(blockHeader.getId_asU8(), context),
parentId: u8ToHex$7(blockHeader.getParentId_asU8(), context),
height: blockHeader.getHeight(),

@@ -224,3 +245,3 @@ timestamp: blockHeader.getTimestamp().toDate().toISOString()

const u8ToHex$5 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$6 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$5 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -257,13 +278,13 @@ async function sendGetBlockByIDRequest(ix, context, opts) {

ret.block = {
id: u8ToHex$5(block.getId_asU8(), context),
parentId: u8ToHex$5(block.getParentId_asU8(), context),
id: u8ToHex$6(block.getId_asU8(), context),
parentId: u8ToHex$6(block.getParentId_asU8(), context),
height: block.getHeight(),
timestamp: block.getTimestamp().toDate().toISOString(),
collectionGuarantees: collectionGuarantees.map(collectionGuarantee => ({
collectionId: u8ToHex$5(collectionGuarantee.getCollectionId_asU8(), context),
signerIds: collectionGuarantee.getSignerIdsList_asU8().map(id => u8ToHex$5(id, context))
collectionId: u8ToHex$6(collectionGuarantee.getCollectionId_asU8(), context),
signerIds: collectionGuarantee.getSignerIdsList_asU8().map(id => u8ToHex$6(id, context))
})),
blockSeals: blockSeals.map(blockSeal => ({
blockId: u8ToHex$5(blockSeal.getBlockId_asU8(), context),
executionReceiptId: u8ToHex$5(blockSeal.getExecutionReceiptId_asU8(), context)
blockId: u8ToHex$6(blockSeal.getBlockId_asU8(), context),
executionReceiptId: u8ToHex$6(blockSeal.getExecutionReceiptId_asU8(), context)
}))

@@ -291,3 +312,3 @@ };

const u8ToHex$4 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$5 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$4 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -309,4 +330,4 @@ async function sendGetCollection(ix) {

ret.collection = {
id: u8ToHex$4(collection.getId_asU8(), context),
transactionIds: collection.getTransactionIdsList().map(x => u8ToHex$4(x, context))
id: u8ToHex$5(collection.getId_asU8(), context),
transactionIds: collection.getTransactionIdsList().map(x => u8ToHex$5(x, context))
};

@@ -316,3 +337,3 @@ return ret;

const u8ToHex$3 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$4 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$3 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -341,3 +362,3 @@ async function sendGetEventsForHeightRangeRequest(ix, context, opts) {

ret.events = results.reduce((blocks, result) => {
const blockId = u8ToHex$3(result.getBlockId_asU8(), context);
const blockId = u8ToHex$4(result.getBlockId_asU8(), context);
const blockHeight = result.getBlockHeight();

@@ -352,3 +373,3 @@ const blockTimestamp = result.getBlockTimestamp().toDate().toISOString();

type: event.getType(),
transactionId: u8ToHex$3(event.getTransactionId_asU8(), context),
transactionId: u8ToHex$4(event.getTransactionId_asU8(), context),
transactionIndex: event.getTransactionIndex(),

@@ -380,3 +401,3 @@ eventIndex: event.getEventIndex(),

const u8ToHex$2 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$3 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$2 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -397,3 +418,3 @@ async function sendGetTransaction(ix) {

const unwrapKey = key => ({
address: u8ToHex$2(key.getAddress_asU8(), context),
address: u8ToHex$3(key.getAddress_asU8(), context),
keyId: key.getKeyId(),

@@ -403,5 +424,5 @@ sequenceNumber: key.getSequenceNumber()

const unwrapSignature = sig => ({
address: u8ToHex$2(sig.getAddress_asU8(), context),
address: u8ToHex$3(sig.getAddress_asU8(), context),
keyId: sig.getKeyId(),
signature: u8ToHex$2(sig.getSignature_asU8(), context)
signature: u8ToHex$3(sig.getSignature_asU8(), context)
});

@@ -412,7 +433,7 @@ let transaction = res.getTransaction();

args: transaction.getArgumentsList().map(arg => JSON.parse(context.Buffer.from(arg).toString("utf8"))),
referenceBlockId: u8ToHex$2(transaction.getReferenceBlockId_asU8(), context),
referenceBlockId: u8ToHex$3(transaction.getReferenceBlockId_asU8(), context),
gasLimit: transaction.getGasLimit(),
proposalKey: unwrapKey(transaction.getProposalKey()),
payer: u8ToHex$2(transaction.getPayer_asU8(), context),
authorizers: transaction.getAuthorizersList().map(x => u8ToHex$2(x, context)),
payer: u8ToHex$3(transaction.getPayer_asU8(), context),
authorizers: transaction.getAuthorizersList().map(x => u8ToHex$3(x, context)),
payloadSignatures: transaction.getPayloadSignaturesList().map(unwrapSignature),

@@ -432,4 +453,4 @@ envelopeSignatures: transaction.getEnvelopeSignaturesList().map(unwrapSignature)

};
const u8ToHex$1 = (u8, context) => context.Buffer.from(u8).toString("hex");
const nonEmptyU8ToHex = (u8, context) => !u8.reduce((empty, b) => empty && !b, true) ? u8ToHex$1(u8, context) : null;
const u8ToHex$2 = (u8, context) => context.Buffer.from(u8).toString("hex");
const nonEmptyU8ToHex = (u8, context) => !u8.reduce((empty, b) => empty && !b, true) ? u8ToHex$2(u8, context) : null;
const hexBuffer$1 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -458,3 +479,3 @@ async function sendGetTransactionStatus(ix) {

type: event.getType(),
transactionId: u8ToHex$1(event.getTransactionId_asU8(), context),
transactionId: u8ToHex$2(event.getTransactionId_asU8(), context),
transactionIndex: event.getTransactionIndex(),

@@ -482,3 +503,3 @@ eventIndex: event.getEventIndex(),

const u8ToHex = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$1 = (u8, context) => context.Buffer.from(u8).toString("hex");
const paddedHexBuffer = (hex, pad, context) => context.Buffer.from(hex.padStart(pad * 2, 0), "hex");

@@ -559,3 +580,3 @@ const scriptBuffer = (script, context) => context.Buffer.from(script, "utf8");

ret.tag = ix.tag;
ret.transactionId = u8ToHex(res.getId_asU8(), context);
ret.transactionId = u8ToHex$1(res.getId_asU8(), context);
if (typeof window !== "undefined" && typeof CustomEvent !== "undefined") {

@@ -590,2 +611,26 @@ window.dispatchEvent(new CustomEvent("FLOW::TX", {

const u8ToHex = (u8, context) => context.Buffer.from(u8).toString("hex");
async function sendGetNodeVersionInfo(ix) {
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
utilInvariant.invariant(opts.node, `SDK Send Get Node Version Info Error: opts.node must be defined.`);
utilInvariant.invariant(context.response, `SDK Send Get Node Version Info Error: context.response must be defined.`);
const unary$1 = opts.unary || unary;
ix = await ix;
const req = new protobuf.GetNodeVersionInfoRequest();
const res = await unary$1(opts.node, protobuf.AccessAPI.GetNodeVersionInfo, req, context);
let ret = context.response();
ret.tag = ix.tag;
let nodeVersionInfo = res.getInfo();
ret.nodeVersionInfo = {
semver: nodeVersionInfo.getSemver(),
commit: nodeVersionInfo.getCommit(),
sporkId: u8ToHex(nodeVersionInfo.getSporkId_asU8(), context),
protocolVersion: parseInt(nodeVersionInfo.getProtocolVersion()),
sporkRootBlockHeight: parseInt(nodeVersionInfo.getSporkRootBlockHeight()),
nodeRootBlockHeight: parseInt(nodeVersionInfo.getNodeRootBlockHeight())
};
return ret;
}
const send = async function (ix) {

@@ -622,2 +667,6 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

return opts.sendGetNetworkParameters ? opts.sendGetNetworkParameters(ix, context, opts) : sendGetNetworkParameters(ix, context, opts);
case context.ix.isSubscribeEvents?.(ix):
if (opts.sendSubscribeEvents) return opts.sendSubscribeEvents(ix, context, opts);else throw new Error(`SDK Send Error: subscribeEvents is not supported by this transport.`);
case context.ix.isGetNodeVersionInfo?.(ix):
return opts.sendGetNodeVersionInfo ? opts.sendGetNodeVersionInfo(ix, context, opts) : sendGetNodeVersionInfo(ix, context, opts);
default:

@@ -628,2 +677,8 @@ return ix;

logger__namespace.log.deprecate({
pkg: "transport-grpc",
msg: `@onflow/transport-grpc is deprecated, please use @onflow/transport-http instead or simply remove the \`sdk.transport\` config option within the FCL/JS-SDK.`,
transition: "https://github.com/onflow/fcl-js/tree/master/packages/transport-grpc/README.md"
});
exports.send = send;

@@ -637,2 +692,3 @@ exports.sendExecuteScript = sendExecuteScript;

exports.sendGetNetworkParameters = sendGetNetworkParameters;
exports.sendGetNodeVersionInfo = sendGetNodeVersionInfo;
exports.sendGetTransaction = sendGetTransaction;

@@ -639,0 +695,0 @@ exports.sendGetTransactionStatus = sendGetTransactionStatus;

import { invariant } from '@onflow/util-invariant';
import { ExecuteScriptAtBlockIDRequest, AccessAPI, ExecuteScriptAtBlockHeightRequest, ExecuteScriptAtLatestBlockRequest, GetAccountAtBlockHeightRequest, GetAccountAtLatestBlockRequest, GetBlockHeaderByIDRequest, GetBlockHeaderByHeightRequest, GetLatestBlockHeaderRequest, GetBlockByIDRequest, GetBlockByHeightRequest, GetLatestBlockRequest, GetCollectionByIDRequest, GetEventsForHeightRangeRequest, GetEventsForBlockIDsRequest, GetTransactionRequest, PingRequest, Transaction, SendTransactionRequest, GetNetworkParametersRequest } from '@onflow/protobuf';
import { ExecuteScriptAtBlockIDRequest, AccessAPI, ExecuteScriptAtBlockHeightRequest, ExecuteScriptAtLatestBlockRequest, GetAccountAtBlockHeightRequest, GetAccountAtLatestBlockRequest, GetBlockHeaderByIDRequest, GetBlockHeaderByHeightRequest, GetLatestBlockHeaderRequest, GetBlockByIDRequest, GetBlockByHeightRequest, GetLatestBlockRequest, GetCollectionByIDRequest, GetEventsForHeightRangeRequest, GetEventsForBlockIDsRequest, GetTransactionRequest, PingRequest, Transaction, SendTransactionRequest, GetNetworkParametersRequest, GetNodeVersionInfoRequest } from '@onflow/protobuf';
import { grpc } from '@improbable-eng/grpc-web';
import { NodeHttpTransport } from '@improbable-eng/grpc-web-node-http-transport';
import { sansPrefix, withPrefix } from '@onflow/util-address';
import * as logger from '@onflow/util-logger';

@@ -85,3 +86,3 @@ grpc.setDefaultTransport(NodeHttpTransport());

const u8ToHex$7 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$8 = (u8, context) => context.Buffer.from(u8).toString("hex");
const paddedHexBuffer$1 = (hex, pad, context) => context.Buffer.from(hex.padStart(pad * 2, 0), "hex");

@@ -126,3 +127,3 @@ const addressBuffer$1 = (addr, context) => paddedHexBuffer$1(addr, 8, context);

ret.account = {
address: withPrefix(u8ToHex$7(account.getAddress_asU8(), context)),
address: withPrefix(u8ToHex$8(account.getAddress_asU8(), context)),
balance: account.getBalance(),

@@ -133,3 +134,3 @@ code: context.Buffer.from(account.getCode_asU8() || new UInt8Array()).toString("utf8"),

index: publicKey.getIndex(),
publicKey: u8ToHex$7(publicKey.getPublicKey_asU8(), context),
publicKey: u8ToHex$8(publicKey.getPublicKey_asU8(), context),
signAlgo: publicKey.getSignAlgo(),

@@ -162,3 +163,3 @@ signAlgoString: SignatureAlgorithmNames[publicKey.getSignAlgo()],

const u8ToHex$6 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$7 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$6 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -193,4 +194,4 @@ async function sendGetBlockHeaderByIDRequest(ix, context, opts) {

ret.blockHeader = {
id: u8ToHex$6(blockHeader.getId_asU8(), context),
parentId: u8ToHex$6(blockHeader.getParentId_asU8(), context),
id: u8ToHex$7(blockHeader.getId_asU8(), context),
parentId: u8ToHex$7(blockHeader.getParentId_asU8(), context),
height: blockHeader.getHeight(),

@@ -219,3 +220,3 @@ timestamp: blockHeader.getTimestamp().toDate().toISOString()

const u8ToHex$5 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$6 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$5 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -252,13 +253,13 @@ async function sendGetBlockByIDRequest(ix, context, opts) {

ret.block = {
id: u8ToHex$5(block.getId_asU8(), context),
parentId: u8ToHex$5(block.getParentId_asU8(), context),
id: u8ToHex$6(block.getId_asU8(), context),
parentId: u8ToHex$6(block.getParentId_asU8(), context),
height: block.getHeight(),
timestamp: block.getTimestamp().toDate().toISOString(),
collectionGuarantees: collectionGuarantees.map(collectionGuarantee => ({
collectionId: u8ToHex$5(collectionGuarantee.getCollectionId_asU8(), context),
signerIds: collectionGuarantee.getSignerIdsList_asU8().map(id => u8ToHex$5(id, context))
collectionId: u8ToHex$6(collectionGuarantee.getCollectionId_asU8(), context),
signerIds: collectionGuarantee.getSignerIdsList_asU8().map(id => u8ToHex$6(id, context))
})),
blockSeals: blockSeals.map(blockSeal => ({
blockId: u8ToHex$5(blockSeal.getBlockId_asU8(), context),
executionReceiptId: u8ToHex$5(blockSeal.getExecutionReceiptId_asU8(), context)
blockId: u8ToHex$6(blockSeal.getBlockId_asU8(), context),
executionReceiptId: u8ToHex$6(blockSeal.getExecutionReceiptId_asU8(), context)
}))

@@ -286,3 +287,3 @@ };

const u8ToHex$4 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$5 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$4 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -304,4 +305,4 @@ async function sendGetCollection(ix) {

ret.collection = {
id: u8ToHex$4(collection.getId_asU8(), context),
transactionIds: collection.getTransactionIdsList().map(x => u8ToHex$4(x, context))
id: u8ToHex$5(collection.getId_asU8(), context),
transactionIds: collection.getTransactionIdsList().map(x => u8ToHex$5(x, context))
};

@@ -311,3 +312,3 @@ return ret;

const u8ToHex$3 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$4 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$3 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -336,3 +337,3 @@ async function sendGetEventsForHeightRangeRequest(ix, context, opts) {

ret.events = results.reduce((blocks, result) => {
const blockId = u8ToHex$3(result.getBlockId_asU8(), context);
const blockId = u8ToHex$4(result.getBlockId_asU8(), context);
const blockHeight = result.getBlockHeight();

@@ -347,3 +348,3 @@ const blockTimestamp = result.getBlockTimestamp().toDate().toISOString();

type: event.getType(),
transactionId: u8ToHex$3(event.getTransactionId_asU8(), context),
transactionId: u8ToHex$4(event.getTransactionId_asU8(), context),
transactionIndex: event.getTransactionIndex(),

@@ -375,3 +376,3 @@ eventIndex: event.getEventIndex(),

const u8ToHex$2 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$3 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$2 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -392,3 +393,3 @@ async function sendGetTransaction(ix) {

const unwrapKey = key => ({
address: u8ToHex$2(key.getAddress_asU8(), context),
address: u8ToHex$3(key.getAddress_asU8(), context),
keyId: key.getKeyId(),

@@ -398,5 +399,5 @@ sequenceNumber: key.getSequenceNumber()

const unwrapSignature = sig => ({
address: u8ToHex$2(sig.getAddress_asU8(), context),
address: u8ToHex$3(sig.getAddress_asU8(), context),
keyId: sig.getKeyId(),
signature: u8ToHex$2(sig.getSignature_asU8(), context)
signature: u8ToHex$3(sig.getSignature_asU8(), context)
});

@@ -407,7 +408,7 @@ let transaction = res.getTransaction();

args: transaction.getArgumentsList().map(arg => JSON.parse(context.Buffer.from(arg).toString("utf8"))),
referenceBlockId: u8ToHex$2(transaction.getReferenceBlockId_asU8(), context),
referenceBlockId: u8ToHex$3(transaction.getReferenceBlockId_asU8(), context),
gasLimit: transaction.getGasLimit(),
proposalKey: unwrapKey(transaction.getProposalKey()),
payer: u8ToHex$2(transaction.getPayer_asU8(), context),
authorizers: transaction.getAuthorizersList().map(x => u8ToHex$2(x, context)),
payer: u8ToHex$3(transaction.getPayer_asU8(), context),
authorizers: transaction.getAuthorizersList().map(x => u8ToHex$3(x, context)),
payloadSignatures: transaction.getPayloadSignaturesList().map(unwrapSignature),

@@ -427,4 +428,4 @@ envelopeSignatures: transaction.getEnvelopeSignaturesList().map(unwrapSignature)

};
const u8ToHex$1 = (u8, context) => context.Buffer.from(u8).toString("hex");
const nonEmptyU8ToHex = (u8, context) => !u8.reduce((empty, b) => empty && !b, true) ? u8ToHex$1(u8, context) : null;
const u8ToHex$2 = (u8, context) => context.Buffer.from(u8).toString("hex");
const nonEmptyU8ToHex = (u8, context) => !u8.reduce((empty, b) => empty && !b, true) ? u8ToHex$2(u8, context) : null;
const hexBuffer$1 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -453,3 +454,3 @@ async function sendGetTransactionStatus(ix) {

type: event.getType(),
transactionId: u8ToHex$1(event.getTransactionId_asU8(), context),
transactionId: u8ToHex$2(event.getTransactionId_asU8(), context),
transactionIndex: event.getTransactionIndex(),

@@ -477,3 +478,3 @@ eventIndex: event.getEventIndex(),

const u8ToHex = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$1 = (u8, context) => context.Buffer.from(u8).toString("hex");
const paddedHexBuffer = (hex, pad, context) => context.Buffer.from(hex.padStart(pad * 2, 0), "hex");

@@ -554,3 +555,3 @@ const scriptBuffer = (script, context) => context.Buffer.from(script, "utf8");

ret.tag = ix.tag;
ret.transactionId = u8ToHex(res.getId_asU8(), context);
ret.transactionId = u8ToHex$1(res.getId_asU8(), context);
if (typeof window !== "undefined" && typeof CustomEvent !== "undefined") {

@@ -585,2 +586,26 @@ window.dispatchEvent(new CustomEvent("FLOW::TX", {

const u8ToHex = (u8, context) => context.Buffer.from(u8).toString("hex");
async function sendGetNodeVersionInfo(ix) {
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
invariant(opts.node, `SDK Send Get Node Version Info Error: opts.node must be defined.`);
invariant(context.response, `SDK Send Get Node Version Info Error: context.response must be defined.`);
const unary$1 = opts.unary || unary;
ix = await ix;
const req = new GetNodeVersionInfoRequest();
const res = await unary$1(opts.node, AccessAPI.GetNodeVersionInfo, req, context);
let ret = context.response();
ret.tag = ix.tag;
let nodeVersionInfo = res.getInfo();
ret.nodeVersionInfo = {
semver: nodeVersionInfo.getSemver(),
commit: nodeVersionInfo.getCommit(),
sporkId: u8ToHex(nodeVersionInfo.getSporkId_asU8(), context),
protocolVersion: parseInt(nodeVersionInfo.getProtocolVersion()),
sporkRootBlockHeight: parseInt(nodeVersionInfo.getSporkRootBlockHeight()),
nodeRootBlockHeight: parseInt(nodeVersionInfo.getNodeRootBlockHeight())
};
return ret;
}
const send = async function (ix) {

@@ -617,2 +642,6 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

return opts.sendGetNetworkParameters ? opts.sendGetNetworkParameters(ix, context, opts) : sendGetNetworkParameters(ix, context, opts);
case context.ix.isSubscribeEvents?.(ix):
if (opts.sendSubscribeEvents) return opts.sendSubscribeEvents(ix, context, opts);else throw new Error(`SDK Send Error: subscribeEvents is not supported by this transport.`);
case context.ix.isGetNodeVersionInfo?.(ix):
return opts.sendGetNodeVersionInfo ? opts.sendGetNodeVersionInfo(ix, context, opts) : sendGetNodeVersionInfo(ix, context, opts);
default:

@@ -623,3 +652,9 @@ return ix;

export { send, sendExecuteScript, sendGetAccount, sendGetBlock, sendGetBlockHeader, sendGetCollection, sendGetEvents, sendGetNetworkParameters, sendGetTransaction, sendGetTransactionStatus, sendPing, sendTransaction };
logger.log.deprecate({
pkg: "transport-grpc",
msg: `@onflow/transport-grpc is deprecated, please use @onflow/transport-http instead or simply remove the \`sdk.transport\` config option within the FCL/JS-SDK.`,
transition: "https://github.com/onflow/fcl-js/tree/master/packages/transport-grpc/README.md"
});
export { send, sendExecuteScript, sendGetAccount, sendGetBlock, sendGetBlockHeader, sendGetCollection, sendGetEvents, sendGetNetworkParameters, sendGetNodeVersionInfo, sendGetTransaction, sendGetTransactionStatus, sendPing, sendTransaction };
//# sourceMappingURL=sdk-send-grpc.module.js.map
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@onflow/util-invariant'), require('@onflow/protobuf'), require('@improbable-eng/grpc-web'), require('@improbable-eng/grpc-web-node-http-transport'), require('@onflow/util-address')) :
typeof define === 'function' && define.amd ? define(['exports', '@onflow/util-invariant', '@onflow/protobuf', '@improbable-eng/grpc-web', '@improbable-eng/grpc-web-node-http-transport', '@onflow/util-address'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["onflowTransport-grpc"] = {}, global.utilInvariant, global.protobuf, global.grpcWeb, global.grpcWebNodeHttpTransport, global.utilAddress));
})(this, (function (exports, utilInvariant, protobuf, grpcWeb, grpcWebNodeHttpTransport, utilAddress) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@onflow/util-invariant'), require('@onflow/protobuf'), require('@improbable-eng/grpc-web'), require('@improbable-eng/grpc-web-node-http-transport'), require('@onflow/util-address'), require('@onflow/util-logger')) :
typeof define === 'function' && define.amd ? define(['exports', '@onflow/util-invariant', '@onflow/protobuf', '@improbable-eng/grpc-web', '@improbable-eng/grpc-web-node-http-transport', '@onflow/util-address', '@onflow/util-logger'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["onflowTransport-grpc"] = {}, global.utilInvariant, global.protobuf, global.grpcWeb, global.grpcWebNodeHttpTransport, global.utilAddress, global.logger));
})(this, (function (exports, utilInvariant, protobuf, grpcWeb, grpcWebNodeHttpTransport, utilAddress, logger) { 'use strict';
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var logger__namespace = /*#__PURE__*/_interopNamespace(logger);
grpcWeb.grpc.setDefaultTransport(grpcWebNodeHttpTransport.NodeHttpTransport());

@@ -85,3 +105,3 @@ async function unary(host, method, request, context) {

const u8ToHex$7 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$8 = (u8, context) => context.Buffer.from(u8).toString("hex");
const paddedHexBuffer$1 = (hex, pad, context) => context.Buffer.from(hex.padStart(pad * 2, 0), "hex");

@@ -126,3 +146,3 @@ const addressBuffer$1 = (addr, context) => paddedHexBuffer$1(addr, 8, context);

ret.account = {
address: utilAddress.withPrefix(u8ToHex$7(account.getAddress_asU8(), context)),
address: utilAddress.withPrefix(u8ToHex$8(account.getAddress_asU8(), context)),
balance: account.getBalance(),

@@ -133,3 +153,3 @@ code: context.Buffer.from(account.getCode_asU8() || new UInt8Array()).toString("utf8"),

index: publicKey.getIndex(),
publicKey: u8ToHex$7(publicKey.getPublicKey_asU8(), context),
publicKey: u8ToHex$8(publicKey.getPublicKey_asU8(), context),
signAlgo: publicKey.getSignAlgo(),

@@ -162,3 +182,3 @@ signAlgoString: SignatureAlgorithmNames[publicKey.getSignAlgo()],

const u8ToHex$6 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$7 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$6 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -193,4 +213,4 @@ async function sendGetBlockHeaderByIDRequest(ix, context, opts) {

ret.blockHeader = {
id: u8ToHex$6(blockHeader.getId_asU8(), context),
parentId: u8ToHex$6(blockHeader.getParentId_asU8(), context),
id: u8ToHex$7(blockHeader.getId_asU8(), context),
parentId: u8ToHex$7(blockHeader.getParentId_asU8(), context),
height: blockHeader.getHeight(),

@@ -219,3 +239,3 @@ timestamp: blockHeader.getTimestamp().toDate().toISOString()

const u8ToHex$5 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$6 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$5 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -252,13 +272,13 @@ async function sendGetBlockByIDRequest(ix, context, opts) {

ret.block = {
id: u8ToHex$5(block.getId_asU8(), context),
parentId: u8ToHex$5(block.getParentId_asU8(), context),
id: u8ToHex$6(block.getId_asU8(), context),
parentId: u8ToHex$6(block.getParentId_asU8(), context),
height: block.getHeight(),
timestamp: block.getTimestamp().toDate().toISOString(),
collectionGuarantees: collectionGuarantees.map(collectionGuarantee => ({
collectionId: u8ToHex$5(collectionGuarantee.getCollectionId_asU8(), context),
signerIds: collectionGuarantee.getSignerIdsList_asU8().map(id => u8ToHex$5(id, context))
collectionId: u8ToHex$6(collectionGuarantee.getCollectionId_asU8(), context),
signerIds: collectionGuarantee.getSignerIdsList_asU8().map(id => u8ToHex$6(id, context))
})),
blockSeals: blockSeals.map(blockSeal => ({
blockId: u8ToHex$5(blockSeal.getBlockId_asU8(), context),
executionReceiptId: u8ToHex$5(blockSeal.getExecutionReceiptId_asU8(), context)
blockId: u8ToHex$6(blockSeal.getBlockId_asU8(), context),
executionReceiptId: u8ToHex$6(blockSeal.getExecutionReceiptId_asU8(), context)
}))

@@ -286,3 +306,3 @@ };

const u8ToHex$4 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$5 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$4 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -304,4 +324,4 @@ async function sendGetCollection(ix) {

ret.collection = {
id: u8ToHex$4(collection.getId_asU8(), context),
transactionIds: collection.getTransactionIdsList().map(x => u8ToHex$4(x, context))
id: u8ToHex$5(collection.getId_asU8(), context),
transactionIds: collection.getTransactionIdsList().map(x => u8ToHex$5(x, context))
};

@@ -311,3 +331,3 @@ return ret;

const u8ToHex$3 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$4 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$3 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -336,3 +356,3 @@ async function sendGetEventsForHeightRangeRequest(ix, context, opts) {

ret.events = results.reduce((blocks, result) => {
const blockId = u8ToHex$3(result.getBlockId_asU8(), context);
const blockId = u8ToHex$4(result.getBlockId_asU8(), context);
const blockHeight = result.getBlockHeight();

@@ -347,3 +367,3 @@ const blockTimestamp = result.getBlockTimestamp().toDate().toISOString();

type: event.getType(),
transactionId: u8ToHex$3(event.getTransactionId_asU8(), context),
transactionId: u8ToHex$4(event.getTransactionId_asU8(), context),
transactionIndex: event.getTransactionIndex(),

@@ -375,3 +395,3 @@ eventIndex: event.getEventIndex(),

const u8ToHex$2 = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$3 = (u8, context) => context.Buffer.from(u8).toString("hex");
const hexBuffer$2 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -392,3 +412,3 @@ async function sendGetTransaction(ix) {

const unwrapKey = key => ({
address: u8ToHex$2(key.getAddress_asU8(), context),
address: u8ToHex$3(key.getAddress_asU8(), context),
keyId: key.getKeyId(),

@@ -398,5 +418,5 @@ sequenceNumber: key.getSequenceNumber()

const unwrapSignature = sig => ({
address: u8ToHex$2(sig.getAddress_asU8(), context),
address: u8ToHex$3(sig.getAddress_asU8(), context),
keyId: sig.getKeyId(),
signature: u8ToHex$2(sig.getSignature_asU8(), context)
signature: u8ToHex$3(sig.getSignature_asU8(), context)
});

@@ -407,7 +427,7 @@ let transaction = res.getTransaction();

args: transaction.getArgumentsList().map(arg => JSON.parse(context.Buffer.from(arg).toString("utf8"))),
referenceBlockId: u8ToHex$2(transaction.getReferenceBlockId_asU8(), context),
referenceBlockId: u8ToHex$3(transaction.getReferenceBlockId_asU8(), context),
gasLimit: transaction.getGasLimit(),
proposalKey: unwrapKey(transaction.getProposalKey()),
payer: u8ToHex$2(transaction.getPayer_asU8(), context),
authorizers: transaction.getAuthorizersList().map(x => u8ToHex$2(x, context)),
payer: u8ToHex$3(transaction.getPayer_asU8(), context),
authorizers: transaction.getAuthorizersList().map(x => u8ToHex$3(x, context)),
payloadSignatures: transaction.getPayloadSignaturesList().map(unwrapSignature),

@@ -427,4 +447,4 @@ envelopeSignatures: transaction.getEnvelopeSignaturesList().map(unwrapSignature)

};
const u8ToHex$1 = (u8, context) => context.Buffer.from(u8).toString("hex");
const nonEmptyU8ToHex = (u8, context) => !u8.reduce((empty, b) => empty && !b, true) ? u8ToHex$1(u8, context) : null;
const u8ToHex$2 = (u8, context) => context.Buffer.from(u8).toString("hex");
const nonEmptyU8ToHex = (u8, context) => !u8.reduce((empty, b) => empty && !b, true) ? u8ToHex$2(u8, context) : null;
const hexBuffer$1 = (hex, context) => context.Buffer.from(hex, "hex");

@@ -453,3 +473,3 @@ async function sendGetTransactionStatus(ix) {

type: event.getType(),
transactionId: u8ToHex$1(event.getTransactionId_asU8(), context),
transactionId: u8ToHex$2(event.getTransactionId_asU8(), context),
transactionIndex: event.getTransactionIndex(),

@@ -477,3 +497,3 @@ eventIndex: event.getEventIndex(),

const u8ToHex = (u8, context) => context.Buffer.from(u8).toString("hex");
const u8ToHex$1 = (u8, context) => context.Buffer.from(u8).toString("hex");
const paddedHexBuffer = (hex, pad, context) => context.Buffer.from(hex.padStart(pad * 2, 0), "hex");

@@ -554,3 +574,3 @@ const scriptBuffer = (script, context) => context.Buffer.from(script, "utf8");

ret.tag = ix.tag;
ret.transactionId = u8ToHex(res.getId_asU8(), context);
ret.transactionId = u8ToHex$1(res.getId_asU8(), context);
if (typeof window !== "undefined" && typeof CustomEvent !== "undefined") {

@@ -585,2 +605,26 @@ window.dispatchEvent(new CustomEvent("FLOW::TX", {

const u8ToHex = (u8, context) => context.Buffer.from(u8).toString("hex");
async function sendGetNodeVersionInfo(ix) {
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
utilInvariant.invariant(opts.node, `SDK Send Get Node Version Info Error: opts.node must be defined.`);
utilInvariant.invariant(context.response, `SDK Send Get Node Version Info Error: context.response must be defined.`);
const unary$1 = opts.unary || unary;
ix = await ix;
const req = new protobuf.GetNodeVersionInfoRequest();
const res = await unary$1(opts.node, protobuf.AccessAPI.GetNodeVersionInfo, req, context);
let ret = context.response();
ret.tag = ix.tag;
let nodeVersionInfo = res.getInfo();
ret.nodeVersionInfo = {
semver: nodeVersionInfo.getSemver(),
commit: nodeVersionInfo.getCommit(),
sporkId: u8ToHex(nodeVersionInfo.getSporkId_asU8(), context),
protocolVersion: parseInt(nodeVersionInfo.getProtocolVersion()),
sporkRootBlockHeight: parseInt(nodeVersionInfo.getSporkRootBlockHeight()),
nodeRootBlockHeight: parseInt(nodeVersionInfo.getNodeRootBlockHeight())
};
return ret;
}
const send = async function (ix) {

@@ -617,2 +661,6 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

return opts.sendGetNetworkParameters ? opts.sendGetNetworkParameters(ix, context, opts) : sendGetNetworkParameters(ix, context, opts);
case context.ix.isSubscribeEvents?.(ix):
if (opts.sendSubscribeEvents) return opts.sendSubscribeEvents(ix, context, opts);else throw new Error(`SDK Send Error: subscribeEvents is not supported by this transport.`);
case context.ix.isGetNodeVersionInfo?.(ix):
return opts.sendGetNodeVersionInfo ? opts.sendGetNodeVersionInfo(ix, context, opts) : sendGetNodeVersionInfo(ix, context, opts);
default:

@@ -623,2 +671,8 @@ return ix;

logger__namespace.log.deprecate({
pkg: "transport-grpc",
msg: `@onflow/transport-grpc is deprecated, please use @onflow/transport-http instead or simply remove the \`sdk.transport\` config option within the FCL/JS-SDK.`,
transition: "https://github.com/onflow/fcl-js/tree/master/packages/transport-grpc/README.md"
});
exports.send = send;

@@ -632,2 +686,3 @@ exports.sendExecuteScript = sendExecuteScript;

exports.sendGetNetworkParameters = sendGetNetworkParameters;
exports.sendGetNodeVersionInfo = sendGetNodeVersionInfo;
exports.sendGetTransaction = sendGetTransaction;

@@ -634,0 +689,0 @@ exports.sendGetTransactionStatus = sendGetTransactionStatus;

{
"name": "@onflow/transport-grpc",
"version": "1.3.2-event-streaming.1",
"version": "1.4.0-alpha.5",
"description": "Flow SDK GRPC Transport Module",

@@ -16,4 +16,4 @@ "license": "Apache-2.0",

"devDependencies": {
"@onflow/fcl-bundle": "^1.4.2-event-streaming.1",
"@onflow/sdk": "^1.4.0-event-streaming.1",
"@onflow/fcl-bundle": "1.4.2-alpha.2",
"@onflow/sdk": "1.4.0-alpha.8",
"jest": "^29.5.0"

@@ -35,10 +35,10 @@ },

"@babel/runtime": "^7.18.6",
"@improbable-eng/grpc-web": "^0.14.0",
"@improbable-eng/grpc-web-node-http-transport": "^0.14.0",
"@onflow/protobuf": "^1.2.2",
"@onflow/rlp": "^1.2.2-event-streaming.1",
"@onflow/util-address": "^1.2.2-event-streaming.1",
"@onflow/util-invariant": "^1.2.2-event-streaming.1",
"@onflow/util-template": "^1.2.2-event-streaming.1"
"@improbable-eng/grpc-web": "^0.15.0",
"@improbable-eng/grpc-web-node-http-transport": "^0.15.0",
"@onflow/protobuf": "1.3.0-alpha.0",
"@onflow/rlp": "1.2.2-alpha.2",
"@onflow/util-address": "1.2.2-alpha.2",
"@onflow/util-invariant": "1.2.2-alpha.2",
"@onflow/util-template": "1.2.2-alpha.2"
}
}

@@ -6,9 +6,7 @@ ---

## Status
# Deprecated - DO NOT USE
- **Last Updated:** Jan 13th 2022
- **Stable:** Yes
- **Risk of Breaking Change:** Medium
This package is deprecated and will will no receive updates for new features. Please migrate your projects to use the [HTTP Transport] package (`@onflow/transport-http`) instead.
This package is working and in active development, breaking changes may happen.
Latest versions of FCL/JS-SDK will automatically use the HTTP Transport as long as the `sdk.transport` configuration key is not set.

@@ -15,0 +13,0 @@ ## Usage

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 not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc