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

@onflow/transport-grpc

Package Overview
Dependencies
Maintainers
12
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 0.0.2 to 0.0.3-alpha.0

LICENSE

5

package.json
{
"name": "@onflow/transport-grpc",
"version": "0.0.2",
"version": "0.0.3-alpha.0",
"description": "Flow SDK GRPC Transport Module",

@@ -45,3 +45,4 @@ "license": "Apache-2.0",

"@onflow/util-template": "0.0.1"
}
},
"gitHead": "8b7f364ecbed509eeaf890d7af1cf42d680b9843"
}

170

src/send-transaction.test.js

@@ -9,3 +9,3 @@ import {AccessAPI} from "@onflow/protobuf"

import {authorizations} from "../../sdk/src/build/build-authorizations.js"
import {preSendCheck} from "../../sdk/src/build/build-pre-send-check.js"
import {voucherIntercept} from "../../sdk/src/build/build-voucher-intercept.js"
import {voucherToTxId} from "../../sdk/src/resolve/voucher.js"

@@ -15,26 +15,26 @@ import {resolve} from "../../sdk/src/resolve/resolve.js"

const jsonToUInt8Array = (json) => {
var str = JSON.stringify(json, null, 0);
var ret = new Uint8Array(str.length);
for (var i = 0; i < str.length; i++) {
ret[i] = str.charCodeAt(i);
}
return ret
};
const jsonToUInt8Array = json => {
var str = JSON.stringify(json, null, 0)
var ret = new Uint8Array(str.length)
for (var i = 0; i < str.length; i++) {
ret[i] = str.charCodeAt(i)
}
return ret
}
const hexStrToUInt8Array = (hex) => {
return new Uint8Array(hex.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
};
const hexStrToUInt8Array = hex => {
return new Uint8Array(hex.match(/.{1,2}/g).map(byte => parseInt(byte, 16)))
}
const strToUInt8Array = (str) => {
var ret = new Uint8Array(str.length);
for (var i = 0; i < str.length; i++) {
ret[i] = str.charCodeAt(i);
}
return ret
};
const strToUInt8Array = str => {
var ret = new Uint8Array(str.length)
for (var i = 0; i < str.length; i++) {
ret[i] = str.charCodeAt(i)
}
return ret
}
describe("Transaction", () => {
test("SendTransaction", async () => {
const unaryMock = jest.fn();
const unaryMock = jest.fn()

@@ -44,60 +44,75 @@ const returnedTransactionId = "a1b2c3"

unaryMock.mockReturnValue({
getId_asU8: () => hexStrToUInt8Array("a1b2c3")
});
getId_asU8: () => hexStrToUInt8Array("a1b2c3"),
})
const response = await sendTransaction(
await resolve(
await build([
transaction`cadence transaction`,
proposer({
addr: "f8d6e0586b0a20c7",
keyId: 1,
sequenceNum: 123,
signingFunction: () => ({
addr: "f8d6e0586b0a20c7",
keyId: 1,
signature: "abc123"
}),
resolve: null,
roles: { proposer: true, authorizer: true, payer: true, param: false },
}),
payer({
addr: "f8d6e0586b0a20c7",
keyId: 1,
sequenceNum: 123,
signingFunction: () => ({
addr: "f8d6e0586b0a20c7",
keyId: 1,
signature: "abc123"
}),
resolve: null,
roles: { proposer: true, authorizer: true, payer: true, param: false },
}),
authorizations([
{
addr: "f8d6e0586b0a20c7",
keyId: 1,
sequenceNum: 123,
signingFunction: () => ({
addr: "f8d6e0586b0a20c7",
keyId: 1,
signature: "abc123"
}),
resolve: null,
roles: { proposer: true, authorizer: true, payer: true, param: false },
}
]),
ref("abc123"),
preSendCheck(async voucher => {
voucherToTxId(voucher)
}),
])
),
{
response: responseADT
},
{
unary: unaryMock,
node: "localhost:3000"
}
await resolve(
await build([
transaction`cadence transaction`,
proposer({
addr: "f8d6e0586b0a20c7",
keyId: 1,
sequenceNum: 123,
signingFunction: () => ({
addr: "f8d6e0586b0a20c7",
keyId: 1,
signature: "abc123",
}),
resolve: null,
roles: {
proposer: true,
authorizer: true,
payer: true,
param: false,
},
}),
payer({
addr: "f8d6e0586b0a20c7",
keyId: 1,
sequenceNum: 123,
signingFunction: () => ({
addr: "f8d6e0586b0a20c7",
keyId: 1,
signature: "abc123",
}),
resolve: null,
roles: {
proposer: true,
authorizer: true,
payer: true,
param: false,
},
}),
authorizations([
{
addr: "f8d6e0586b0a20c7",
keyId: 1,
sequenceNum: 123,
signingFunction: () => ({
addr: "f8d6e0586b0a20c7",
keyId: 1,
signature: "abc123",
}),
resolve: null,
roles: {
proposer: true,
authorizer: true,
payer: true,
param: false,
},
},
]),
ref("abc123"),
voucherIntercept(async voucher => {
voucherToTxId(voucher)
}),
])
),
{
response: responseADT,
},
{
unary: unaryMock,
node: "localhost:3000",
}
)

@@ -121,3 +136,2 @@

})
})
})
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