@onflow/transport-grpc
Advanced tools
Comparing version 1.2.0-alpha.4 to 1.2.0
# @onflow/transport-grpc | ||
## 1.2.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 | ||
- [#1577](https://github.com/onflow/fcl-js/pull/1577) [`d9a49531`](https://github.com/onflow/fcl-js/commit/d9a495316cd03ed0de99e0f01d1b8850a1f0eec4) Thanks [@chasefleming](https://github.com/chasefleming)! - Add npmignore file for build | ||
### Patch Changes | ||
- [#1663](https://github.com/onflow/fcl-js/pull/1663) [`62dfafa9`](https://github.com/onflow/fcl-js/commit/62dfafa9c7adc3933822b0d3171d6eb025f1719e) Thanks [@nialexsan](https://github.com/nialexsan)! - Upgrade jest to v29.5 and update tests accordingly. Change build to transpile with ESM modules. | ||
- [#1658](https://github.com/onflow/fcl-js/pull/1658) [`2512b5c5`](https://github.com/onflow/fcl-js/commit/2512b5c53dff708fca97cd8afdbb1f4a46b2f106) Thanks [@nialexsan](https://github.com/nialexsan)! - Align jest version | ||
- [#1608](https://github.com/onflow/fcl-js/pull/1608) [`0ec0c5d4`](https://github.com/onflow/fcl-js/commit/0ec0c5d46b780e2b277846f9271ab311aa048b19) Thanks [@nialexsan](https://github.com/nialexsan)! - prep for react-native package | ||
- Updated dependencies [[`2d143bc7`](https://github.com/onflow/fcl-js/commit/2d143bc7b30f59e9f9289eee020cfaae74b4f4e1), [`62dfafa9`](https://github.com/onflow/fcl-js/commit/62dfafa9c7adc3933822b0d3171d6eb025f1719e), [`bbdeea32`](https://github.com/onflow/fcl-js/commit/bbdeea32f024d6eea4a74c94023e01688a38b6cb), [`2512b5c5`](https://github.com/onflow/fcl-js/commit/2512b5c53dff708fca97cd8afdbb1f4a46b2f106), [`5bec5576`](https://github.com/onflow/fcl-js/commit/5bec5576a79809d0684411736e3f4c02b8051c22), [`d9a49531`](https://github.com/onflow/fcl-js/commit/d9a495316cd03ed0de99e0f01d1b8850a1f0eec4)]: | ||
- @onflow/util-address@1.1.0 | ||
- @onflow/protobuf@1.2.0 | ||
- @onflow/rlp@1.1.0 | ||
- @onflow/util-invariant@1.1.0 | ||
- @onflow/util-template@1.1.0 | ||
## 1.2.0-alpha.4 | ||
@@ -4,0 +27,0 @@ |
@@ -26,3 +26,2 @@ 'use strict'; | ||
} = _ref; | ||
if (status === grpcWeb.grpc.Code.OK) { | ||
@@ -39,5 +38,3 @@ resolve(message); | ||
const argumentBuffer$1 = (arg, context) => context.Buffer.from(JSON.stringify(arg), "utf8"); | ||
const hexBuffer$7 = (hex, context) => context.Buffer.from(hex, "hex"); | ||
async function sendExecuteScriptAtBlockIDRequest(ix, context, opts) { | ||
@@ -53,3 +50,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendExecuteScriptAtBlockHeightRequest(ix, context, opts) { | ||
@@ -65,3 +61,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendExecuteScriptAtLatestBlockRequest(ix, context, opts) { | ||
@@ -76,3 +71,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
function constructResponse$4(ix, context, res) { | ||
@@ -84,3 +78,2 @@ let ret = context.response(); | ||
} | ||
async function sendExecuteScript(ix) { | ||
@@ -93,3 +86,2 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
ix = await ix; | ||
if (ix.block.id) { | ||
@@ -105,7 +97,4 @@ return await sendExecuteScriptAtBlockIDRequest(ix, context, opts); | ||
const u8ToHex$7 = (u8, context) => context.Buffer.from(u8).toString("hex"); | ||
const paddedHexBuffer$1 = (hex, pad, context) => context.Buffer.from(hex.padStart(pad * 2, 0), "hex"); | ||
const addressBuffer$1 = (addr, context) => paddedHexBuffer$1(addr, 8, context); | ||
const HashAlgorithmNames = { | ||
@@ -123,3 +112,2 @@ 1: "SHA2_256", | ||
}; | ||
async function sendGetAccountAtBlockHeightRequest(ix, context, opts) { | ||
@@ -133,3 +121,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendGetAccountAtLatestBlockRequest(ix, context, opts) { | ||
@@ -142,3 +129,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
function constructResponse$3(ix, context, res) { | ||
@@ -149,3 +135,4 @@ let ret = context.response(); | ||
let contractsMap; | ||
const contracts = (contractsMap = account.getContractsMap()) ? contractsMap.getEntryList().reduce((acc, contract) => ({ ...acc, | ||
const contracts = (contractsMap = account.getContractsMap()) ? contractsMap.getEntryList().reduce((acc, contract) => ({ | ||
...acc, | ||
[contract[0]]: context.Buffer.from(contract[1] || new UInt8Array()).toString("utf8") | ||
@@ -174,3 +161,2 @@ }), {}) : {}; | ||
} | ||
async function sendGetAccount(ix) { | ||
@@ -183,3 +169,2 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
ix = await ix; | ||
if (ix.block.height !== null) { | ||
@@ -193,5 +178,3 @@ return await sendGetAccountAtBlockHeightRequest(ix, context, opts); | ||
const u8ToHex$6 = (u8, context) => context.Buffer.from(u8).toString("hex"); | ||
const hexBuffer$6 = (hex, context) => context.Buffer.from(hex, "hex"); | ||
async function sendGetBlockHeaderByIDRequest(ix, context, opts) { | ||
@@ -204,3 +187,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendGetBlockHeaderByHeightRequest(ix, context, opts) { | ||
@@ -213,17 +195,11 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendGetLatestBlockHeaderRequest(ix, context, opts) { | ||
var _ix$block; | ||
const unary$1 = opts.unary || unary; | ||
const req = new protobuf.GetLatestBlockHeaderRequest(); | ||
if ((_ix$block = ix.block) !== null && _ix$block !== void 0 && _ix$block.isSealed) { | ||
if (ix.block?.isSealed) { | ||
req.setIsSealed(ix.block.isSealed); | ||
} | ||
const res = await unary$1(opts.node, protobuf.AccessAPI.GetLatestBlockHeader, req, context); | ||
return constructResponse$2(ix, context, res); | ||
} | ||
function constructResponse$2(ix, context, res) { | ||
@@ -241,3 +217,2 @@ const blockHeader = res.getBlock(); | ||
} | ||
async function sendGetBlockHeader(ix) { | ||
@@ -252,3 +227,2 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
const interactionHasBlockHeight = ix.block.height !== null; | ||
if (interactionHasBlockID) { | ||
@@ -264,5 +238,3 @@ return await sendGetBlockHeaderByIDRequest(ix, context, opts); | ||
const u8ToHex$5 = (u8, context) => context.Buffer.from(u8).toString("hex"); | ||
const hexBuffer$5 = (hex, context) => context.Buffer.from(hex, "hex"); | ||
async function sendGetBlockByIDRequest(ix, context, opts) { | ||
@@ -275,3 +247,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendGetBlockByHeightRequest(ix, context, opts) { | ||
@@ -284,17 +255,11 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendGetBlockRequest(ix, context, opts) { | ||
var _ix$block; | ||
const unary$1 = opts.unary || unary; | ||
const req = new protobuf.GetLatestBlockRequest(); | ||
if ((_ix$block = ix.block) !== null && _ix$block !== void 0 && _ix$block.isSealed) { | ||
if (ix.block?.isSealed) { | ||
req.setIsSealed(ix.block.isSealed); | ||
} | ||
const res = await unary$1(opts.node, protobuf.AccessAPI.GetLatestBlock, req, context); | ||
return constructResponse$1(ix, context, res); | ||
} | ||
function constructResponse$1(ix, context, res) { | ||
@@ -322,3 +287,2 @@ const block = res.getBlock(); | ||
} | ||
async function sendGetBlock(ix) { | ||
@@ -333,3 +297,2 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
const interactionHasBlockHeight = ix.block.height !== null; | ||
if (interactionHasBlockID) { | ||
@@ -345,5 +308,3 @@ return await sendGetBlockByIDRequest(ix, context, opts); | ||
const u8ToHex$4 = (u8, context) => context.Buffer.from(u8).toString("hex"); | ||
const hexBuffer$4 = (hex, context) => context.Buffer.from(hex, "hex"); | ||
async function sendGetCollection(ix) { | ||
@@ -371,5 +332,3 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
const u8ToHex$3 = (u8, context) => context.Buffer.from(u8).toString("hex"); | ||
const hexBuffer$3 = (hex, context) => context.Buffer.from(hex, "hex"); | ||
async function sendGetEventsForHeightRangeRequest(ix, context, opts) { | ||
@@ -384,3 +343,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendGetEventsForBlockIDsRequest(ix, context, opts) { | ||
@@ -394,3 +352,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
function constructResponse(ix, context, res) { | ||
@@ -421,3 +378,2 @@ let ret = context.response(); | ||
} | ||
async function sendGetEvents(ix) { | ||
@@ -433,3 +389,2 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
utilInvariant.invariant(interactionContainsBlockHeightRange || interactionContainsBlockIDsList, "SendGetEventsError: Unable to determine which get events request to send. Either a block height range, or block IDs must be specified."); | ||
if (interactionContainsBlockHeightRange) { | ||
@@ -443,5 +398,3 @@ return await sendGetEventsForHeightRangeRequest(ix, context, opts); | ||
const u8ToHex$2 = (u8, context) => context.Buffer.from(u8).toString("hex"); | ||
const hexBuffer$2 = (hex, context) => context.Buffer.from(hex, "hex"); | ||
async function sendGetTransaction(ix) { | ||
@@ -460,3 +413,2 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
ret.tag = ix.tag; | ||
const unwrapKey = key => ({ | ||
@@ -467,3 +419,2 @@ address: u8ToHex$2(key.getAddress_asU8(), context), | ||
}); | ||
const unwrapSignature = sig => ({ | ||
@@ -474,3 +425,2 @@ address: u8ToHex$2(sig.getAddress_asU8(), context), | ||
}); | ||
let transaction = res.getTransaction(); | ||
@@ -499,9 +449,5 @@ ret.transaction = { | ||
}; | ||
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 hexBuffer$1 = (hex, context) => context.Buffer.from(hex, "hex"); | ||
async function sendGetTransactionStatus(ix) { | ||
@@ -553,13 +499,7 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
const u8ToHex = (u8, context) => context.Buffer.from(u8).toString("hex"); | ||
const paddedHexBuffer = (hex, pad, context) => context.Buffer.from(hex.padStart(pad * 2, 0), "hex"); | ||
const scriptBuffer = (script, context) => context.Buffer.from(script, "utf8"); | ||
const hexBuffer = (hex, context) => context.Buffer.from(hex, "hex"); | ||
const addressBuffer = (addr, context) => paddedHexBuffer(addr, 8, context); | ||
const argumentBuffer = (arg, context) => context.Buffer.from(JSON.stringify(arg), "utf8"); | ||
async function sendTransaction(ix) { | ||
@@ -586,4 +526,5 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
proposalKey.setSequenceNumber(ix.accounts[ix.proposer].sequenceNum); | ||
tx.setProposalKey(proposalKey); // Apply Non Payer Signatures to Payload Signatures | ||
tx.setProposalKey(proposalKey); | ||
// Apply Non Payer Signatures to Payload Signatures | ||
for (let acct of Object.values(ix.accounts)) { | ||
@@ -605,5 +546,5 @@ try { | ||
} | ||
} // Apply Payer Signatures to Envelope Signatures | ||
} | ||
// Apply Payer Signatures to Envelope Signatures | ||
for (let acct of Object.values(ix.accounts)) { | ||
@@ -626,3 +567,2 @@ try { | ||
} | ||
const req = new protobuf.SendTransactionRequest(); | ||
@@ -636,3 +576,2 @@ req.setTransaction(tx); | ||
ret.transactionId = u8ToHex(res.getId_asU8(), context); | ||
if (typeof window !== "undefined" && typeof CustomEvent !== "undefined") { | ||
@@ -646,3 +585,2 @@ window.dispatchEvent(new CustomEvent("FLOW::TX", { | ||
} | ||
return ret; | ||
@@ -674,38 +612,28 @@ } | ||
utilInvariant.invariant(context.ix, `SDK Send Error: context.ix must be defined.`); | ||
ix = await ix; // prettier-ignore | ||
ix = await ix; | ||
// prettier-ignore | ||
switch (true) { | ||
case context.ix.isTransaction(ix): | ||
return opts.sendTransaction ? opts.sendTransaction(ix, context, opts) : sendTransaction(ix, context, opts); | ||
case context.ix.isGetTransactionStatus(ix): | ||
return opts.sendGetTransactionStatus ? opts.sendGetTransactionStatus(ix, context, opts) : sendGetTransactionStatus(ix, context, opts); | ||
case context.ix.isGetTransaction(ix): | ||
return opts.sendGetTransaction ? opts.sendGetTransaction(ix, context, opts) : sendGetTransaction(ix, context, opts); | ||
case context.ix.isScript(ix): | ||
return opts.sendExecuteScript ? opts.sendExecuteScript(ix, context, opts) : sendExecuteScript(ix, context, opts); | ||
case context.ix.isGetAccount(ix): | ||
return opts.sendGetAccount ? opts.sendGetAccount(ix, context, opts) : sendGetAccount(ix, context, opts); | ||
case context.ix.isGetEvents(ix): | ||
return opts.sendGetEvents ? opts.sendGetEvents(ix, context, opts) : sendGetEvents(ix, context, opts); | ||
case context.ix.isGetBlock(ix): | ||
return opts.sendGetBlock ? opts.sendGetBlock(ix, context, opts) : sendGetBlock(ix, context, opts); | ||
case context.ix.isGetBlockHeader(ix): | ||
return opts.sendGetBlockHeader ? opts.sendGetBlockHeader(ix, context, opts) : sendGetBlockHeader(ix, context, opts); | ||
case context.ix.isGetCollection(ix): | ||
return opts.sendGetCollection ? opts.sendGetCollection(ix, context, opts) : sendGetCollection(ix, context, opts); | ||
case context.ix.isPing(ix): | ||
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: | ||
@@ -712,0 +640,0 @@ return ix; |
@@ -22,3 +22,2 @@ import { invariant } from '@onflow/util-invariant'; | ||
} = _ref; | ||
if (status === grpc.Code.OK) { | ||
@@ -35,5 +34,3 @@ resolve(message); | ||
const argumentBuffer$1 = (arg, context) => context.Buffer.from(JSON.stringify(arg), "utf8"); | ||
const hexBuffer$7 = (hex, context) => context.Buffer.from(hex, "hex"); | ||
async function sendExecuteScriptAtBlockIDRequest(ix, context, opts) { | ||
@@ -49,3 +46,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendExecuteScriptAtBlockHeightRequest(ix, context, opts) { | ||
@@ -61,3 +57,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendExecuteScriptAtLatestBlockRequest(ix, context, opts) { | ||
@@ -72,3 +67,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
function constructResponse$4(ix, context, res) { | ||
@@ -80,3 +74,2 @@ let ret = context.response(); | ||
} | ||
async function sendExecuteScript(ix) { | ||
@@ -89,3 +82,2 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
ix = await ix; | ||
if (ix.block.id) { | ||
@@ -101,7 +93,4 @@ return await sendExecuteScriptAtBlockIDRequest(ix, context, opts); | ||
const u8ToHex$7 = (u8, context) => context.Buffer.from(u8).toString("hex"); | ||
const paddedHexBuffer$1 = (hex, pad, context) => context.Buffer.from(hex.padStart(pad * 2, 0), "hex"); | ||
const addressBuffer$1 = (addr, context) => paddedHexBuffer$1(addr, 8, context); | ||
const HashAlgorithmNames = { | ||
@@ -119,3 +108,2 @@ 1: "SHA2_256", | ||
}; | ||
async function sendGetAccountAtBlockHeightRequest(ix, context, opts) { | ||
@@ -129,3 +117,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendGetAccountAtLatestBlockRequest(ix, context, opts) { | ||
@@ -138,3 +125,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
function constructResponse$3(ix, context, res) { | ||
@@ -145,3 +131,4 @@ let ret = context.response(); | ||
let contractsMap; | ||
const contracts = (contractsMap = account.getContractsMap()) ? contractsMap.getEntryList().reduce((acc, contract) => ({ ...acc, | ||
const contracts = (contractsMap = account.getContractsMap()) ? contractsMap.getEntryList().reduce((acc, contract) => ({ | ||
...acc, | ||
[contract[0]]: context.Buffer.from(contract[1] || new UInt8Array()).toString("utf8") | ||
@@ -170,3 +157,2 @@ }), {}) : {}; | ||
} | ||
async function sendGetAccount(ix) { | ||
@@ -179,3 +165,2 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
ix = await ix; | ||
if (ix.block.height !== null) { | ||
@@ -189,5 +174,3 @@ return await sendGetAccountAtBlockHeightRequest(ix, context, opts); | ||
const u8ToHex$6 = (u8, context) => context.Buffer.from(u8).toString("hex"); | ||
const hexBuffer$6 = (hex, context) => context.Buffer.from(hex, "hex"); | ||
async function sendGetBlockHeaderByIDRequest(ix, context, opts) { | ||
@@ -200,3 +183,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendGetBlockHeaderByHeightRequest(ix, context, opts) { | ||
@@ -209,17 +191,11 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendGetLatestBlockHeaderRequest(ix, context, opts) { | ||
var _ix$block; | ||
const unary$1 = opts.unary || unary; | ||
const req = new GetLatestBlockHeaderRequest(); | ||
if ((_ix$block = ix.block) !== null && _ix$block !== void 0 && _ix$block.isSealed) { | ||
if (ix.block?.isSealed) { | ||
req.setIsSealed(ix.block.isSealed); | ||
} | ||
const res = await unary$1(opts.node, AccessAPI.GetLatestBlockHeader, req, context); | ||
return constructResponse$2(ix, context, res); | ||
} | ||
function constructResponse$2(ix, context, res) { | ||
@@ -237,3 +213,2 @@ const blockHeader = res.getBlock(); | ||
} | ||
async function sendGetBlockHeader(ix) { | ||
@@ -248,3 +223,2 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
const interactionHasBlockHeight = ix.block.height !== null; | ||
if (interactionHasBlockID) { | ||
@@ -260,5 +234,3 @@ return await sendGetBlockHeaderByIDRequest(ix, context, opts); | ||
const u8ToHex$5 = (u8, context) => context.Buffer.from(u8).toString("hex"); | ||
const hexBuffer$5 = (hex, context) => context.Buffer.from(hex, "hex"); | ||
async function sendGetBlockByIDRequest(ix, context, opts) { | ||
@@ -271,3 +243,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendGetBlockByHeightRequest(ix, context, opts) { | ||
@@ -280,17 +251,11 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendGetBlockRequest(ix, context, opts) { | ||
var _ix$block; | ||
const unary$1 = opts.unary || unary; | ||
const req = new GetLatestBlockRequest(); | ||
if ((_ix$block = ix.block) !== null && _ix$block !== void 0 && _ix$block.isSealed) { | ||
if (ix.block?.isSealed) { | ||
req.setIsSealed(ix.block.isSealed); | ||
} | ||
const res = await unary$1(opts.node, AccessAPI.GetLatestBlock, req, context); | ||
return constructResponse$1(ix, context, res); | ||
} | ||
function constructResponse$1(ix, context, res) { | ||
@@ -318,3 +283,2 @@ const block = res.getBlock(); | ||
} | ||
async function sendGetBlock(ix) { | ||
@@ -329,3 +293,2 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
const interactionHasBlockHeight = ix.block.height !== null; | ||
if (interactionHasBlockID) { | ||
@@ -341,5 +304,3 @@ return await sendGetBlockByIDRequest(ix, context, opts); | ||
const u8ToHex$4 = (u8, context) => context.Buffer.from(u8).toString("hex"); | ||
const hexBuffer$4 = (hex, context) => context.Buffer.from(hex, "hex"); | ||
async function sendGetCollection(ix) { | ||
@@ -367,5 +328,3 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
const u8ToHex$3 = (u8, context) => context.Buffer.from(u8).toString("hex"); | ||
const hexBuffer$3 = (hex, context) => context.Buffer.from(hex, "hex"); | ||
async function sendGetEventsForHeightRangeRequest(ix, context, opts) { | ||
@@ -380,3 +339,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
async function sendGetEventsForBlockIDsRequest(ix, context, opts) { | ||
@@ -390,3 +348,2 @@ const unary$1 = opts.unary || unary; | ||
} | ||
function constructResponse(ix, context, res) { | ||
@@ -417,3 +374,2 @@ let ret = context.response(); | ||
} | ||
async function sendGetEvents(ix) { | ||
@@ -429,3 +385,2 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
invariant(interactionContainsBlockHeightRange || interactionContainsBlockIDsList, "SendGetEventsError: Unable to determine which get events request to send. Either a block height range, or block IDs must be specified."); | ||
if (interactionContainsBlockHeightRange) { | ||
@@ -439,5 +394,3 @@ return await sendGetEventsForHeightRangeRequest(ix, context, opts); | ||
const u8ToHex$2 = (u8, context) => context.Buffer.from(u8).toString("hex"); | ||
const hexBuffer$2 = (hex, context) => context.Buffer.from(hex, "hex"); | ||
async function sendGetTransaction(ix) { | ||
@@ -456,3 +409,2 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
ret.tag = ix.tag; | ||
const unwrapKey = key => ({ | ||
@@ -463,3 +415,2 @@ address: u8ToHex$2(key.getAddress_asU8(), context), | ||
}); | ||
const unwrapSignature = sig => ({ | ||
@@ -470,3 +421,2 @@ address: u8ToHex$2(sig.getAddress_asU8(), context), | ||
}); | ||
let transaction = res.getTransaction(); | ||
@@ -495,9 +445,5 @@ ret.transaction = { | ||
}; | ||
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 hexBuffer$1 = (hex, context) => context.Buffer.from(hex, "hex"); | ||
async function sendGetTransactionStatus(ix) { | ||
@@ -549,13 +495,7 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
const u8ToHex = (u8, context) => context.Buffer.from(u8).toString("hex"); | ||
const paddedHexBuffer = (hex, pad, context) => context.Buffer.from(hex.padStart(pad * 2, 0), "hex"); | ||
const scriptBuffer = (script, context) => context.Buffer.from(script, "utf8"); | ||
const hexBuffer = (hex, context) => context.Buffer.from(hex, "hex"); | ||
const addressBuffer = (addr, context) => paddedHexBuffer(addr, 8, context); | ||
const argumentBuffer = (arg, context) => context.Buffer.from(JSON.stringify(arg), "utf8"); | ||
async function sendTransaction(ix) { | ||
@@ -582,4 +522,5 @@ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
proposalKey.setSequenceNumber(ix.accounts[ix.proposer].sequenceNum); | ||
tx.setProposalKey(proposalKey); // Apply Non Payer Signatures to Payload Signatures | ||
tx.setProposalKey(proposalKey); | ||
// Apply Non Payer Signatures to Payload Signatures | ||
for (let acct of Object.values(ix.accounts)) { | ||
@@ -601,5 +542,5 @@ try { | ||
} | ||
} // Apply Payer Signatures to Envelope Signatures | ||
} | ||
// Apply Payer Signatures to Envelope Signatures | ||
for (let acct of Object.values(ix.accounts)) { | ||
@@ -622,3 +563,2 @@ try { | ||
} | ||
const req = new SendTransactionRequest(); | ||
@@ -632,3 +572,2 @@ req.setTransaction(tx); | ||
ret.transactionId = u8ToHex(res.getId_asU8(), context); | ||
if (typeof window !== "undefined" && typeof CustomEvent !== "undefined") { | ||
@@ -642,3 +581,2 @@ window.dispatchEvent(new CustomEvent("FLOW::TX", { | ||
} | ||
return ret; | ||
@@ -670,38 +608,28 @@ } | ||
invariant(context.ix, `SDK Send Error: context.ix must be defined.`); | ||
ix = await ix; // prettier-ignore | ||
ix = await ix; | ||
// prettier-ignore | ||
switch (true) { | ||
case context.ix.isTransaction(ix): | ||
return opts.sendTransaction ? opts.sendTransaction(ix, context, opts) : sendTransaction(ix, context, opts); | ||
case context.ix.isGetTransactionStatus(ix): | ||
return opts.sendGetTransactionStatus ? opts.sendGetTransactionStatus(ix, context, opts) : sendGetTransactionStatus(ix, context, opts); | ||
case context.ix.isGetTransaction(ix): | ||
return opts.sendGetTransaction ? opts.sendGetTransaction(ix, context, opts) : sendGetTransaction(ix, context, opts); | ||
case context.ix.isScript(ix): | ||
return opts.sendExecuteScript ? opts.sendExecuteScript(ix, context, opts) : sendExecuteScript(ix, context, opts); | ||
case context.ix.isGetAccount(ix): | ||
return opts.sendGetAccount ? opts.sendGetAccount(ix, context, opts) : sendGetAccount(ix, context, opts); | ||
case context.ix.isGetEvents(ix): | ||
return opts.sendGetEvents ? opts.sendGetEvents(ix, context, opts) : sendGetEvents(ix, context, opts); | ||
case context.ix.isGetBlock(ix): | ||
return opts.sendGetBlock ? opts.sendGetBlock(ix, context, opts) : sendGetBlock(ix, context, opts); | ||
case context.ix.isGetBlockHeader(ix): | ||
return opts.sendGetBlockHeader ? opts.sendGetBlockHeader(ix, context, opts) : sendGetBlockHeader(ix, context, opts); | ||
case context.ix.isGetCollection(ix): | ||
return opts.sendGetCollection ? opts.sendGetCollection(ix, context, opts) : sendGetCollection(ix, context, opts); | ||
case context.ix.isPing(ix): | ||
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: | ||
@@ -708,0 +636,0 @@ return ix; |
{ | ||
"name": "@onflow/transport-grpc", | ||
"version": "1.2.0-alpha.4", | ||
"version": "1.2.0", | ||
"description": "Flow SDK GRPC Transport Module", | ||
@@ -16,4 +16,4 @@ "license": "Apache-2.0", | ||
"devDependencies": { | ||
"@onflow/fcl-bundle": "^1.3.0-alpha.0", | ||
"@onflow/sdk": "^1.2.0-alpha.10", | ||
"@onflow/fcl-bundle": "^1.3.0", | ||
"@onflow/sdk": "^1.2.0", | ||
"jest": "^29.5.0" | ||
@@ -37,8 +37,8 @@ }, | ||
"@improbable-eng/grpc-web-node-http-transport": "^0.14.0", | ||
"@onflow/protobuf": "^1.2.0-alpha.2", | ||
"@onflow/rlp": "^1.1.0-alpha.2", | ||
"@onflow/util-address": "^1.1.0-alpha.5", | ||
"@onflow/util-invariant": "^1.1.0-alpha.2", | ||
"@onflow/util-template": "^1.1.0-alpha.2" | ||
"@onflow/protobuf": "^1.2.0", | ||
"@onflow/rlp": "^1.1.0", | ||
"@onflow/util-address": "^1.1.0", | ||
"@onflow/util-invariant": "^1.1.0", | ||
"@onflow/util-template": "^1.1.0" | ||
} | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
5827
1
1078229
Updated@onflow/protobuf@^1.2.0
Updated@onflow/rlp@^1.1.0
Updated@onflow/util-address@^1.1.0
Updated@onflow/util-template@^1.1.0