@onflow/transport-grpc
Advanced tools
Comparing version 0.0.2 to 0.0.3-alpha.0
{ | ||
"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" | ||
} |
@@ -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 @@ | ||
}) | ||
}) | ||
}) |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
397304
38
2250
1