Skip to content

Commit

Permalink
Merge pull request #376 from GridPlus/dev
Browse files Browse the repository at this point in the history
v1.2.3
  • Loading branch information
alex-miller-0 authored May 3, 2022
2 parents 809ea38 + b4855ff commit 3be9142
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 29 deletions.
24 changes: 2 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gridplus-sdk",
"version": "1.2.2",
"version": "1.2.3",
"description": "SDK to interact with GridPlus Lattice1 device",
"scripts": {
"build": "tsc -p tsconfig.json",
Expand Down Expand Up @@ -40,7 +40,6 @@
"eth-eip712-util-browser": "^0.0.3",
"hash.js": "^1.1.7",
"js-sha3": "^0.8.0",
"rlp-browser": "^1.0.1",
"rlp": "^3.0.0",
"secp256k1": "4.0.2",
"superagent": "^3.8.3"
Expand Down
9 changes: 4 additions & 5 deletions src/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import cbor from 'borc';
import { TypedDataUtils } from 'eth-eip712-util-browser';
import { keccak256 } from 'js-sha3';
import { encode as rlpEncode } from 'rlp';
import rlp from 'rlp-browser'; // [TODO: Deprecate]
import secp256k1 from 'secp256k1';
import {
ASCII_REGEX,
Expand Down Expand Up @@ -416,14 +415,14 @@ const buildEthRawTx = function (tx, sig, address) {
// See: https://github.com/ethereumjs/ethereumjs-tx/blob/master/src/transaction.ts#L187
newRawTx.push(stripZeros(newSig.r));
newRawTx.push(stripZeros(newSig.s));
let rlpEncodedWithSig = rlp.encode(newRawTx);
let rlpEncodedWithSig = rlpEncode(newRawTx);
if (tx.type) {
rlpEncodedWithSig = Buffer.concat([
Buffer.from([tx.type]),
rlpEncodedWithSig,
]);
}
return { rawTx: rlpEncodedWithSig.toString('hex'), sigWithV: newSig };
return { rawTx: Buffer.from(rlpEncodedWithSig).toString('hex'), sigWithV: newSig };
};

// Attach a recovery parameter to a signature by brute-forcing ECRecover
Expand Down Expand Up @@ -920,9 +919,9 @@ function get_personal_sign_prefix(L) {

function get_rlp_encoded_preimage(rawTx, txType) {
if (txType) {
return Buffer.concat([Buffer.from([txType]), rlp.encode(rawTx)]);
return Buffer.concat([Buffer.from([txType]), rlpEncode(rawTx)]);
} else {
return rlp.encode(rawTx);
return rlpEncode(rawTx);
}
}

Expand Down

0 comments on commit 3be9142

Please sign in to comment.