Skip to content

Commit 4d0f4d1

Browse files
authored
Merge pull request #7239 from BitGo/celocleanup
feat!(sdk-coin-celo): remove unused files and functions
2 parents 96525af + a47e0b1 commit 4d0f4d1

File tree

5 files changed

+38
-1175
lines changed

5 files changed

+38
-1175
lines changed

modules/sdk-coin-celo/package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,10 @@
4444
"@bitgo/sdk-coin-eth": "^25.3.4",
4545
"@bitgo/sdk-core": "^36.12.0",
4646
"@bitgo/statics": "^58.4.0",
47-
"@celo/connect": "^2.0.0",
48-
"@celo/contractkit": "^2.0.0",
49-
"@celo/wallet-base": "^2.0.0",
50-
"@celo/wallet-local": "^2.0.0",
5147
"@ethereumjs/common": "^2.6.5",
5248
"bignumber.js": "^9.0.0",
5349
"ethereumjs-abi": "^0.6.5",
54-
"ethereumjs-util": "7.1.5",
55-
"ethers": "^5.1.3"
50+
"ethereumjs-util": "7.1.5"
5651
},
5752
"devDependencies": {
5853
"@bitgo/sdk-api": "^1.70.1",

modules/sdk-coin-celo/src/lib/types.ts

Lines changed: 0 additions & 265 deletions
This file was deleted.

modules/sdk-coin-celo/src/lib/utils.ts

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,8 @@
11
import { NetworkType } from '@bitgo/statics';
22
import EthereumCommon from '@ethereumjs/common';
3-
import { recoverTransaction } from '@celo/wallet-base';
4-
import * as ethers from 'ethers';
5-
import BigNumber from 'bignumber.js';
6-
import { ETHTransactionType, LegacyTxData } from '@bitgo/sdk-coin-eth';
7-
import { InvalidTransactionError, ParseTransactionError } from '@bitgo/sdk-core';
3+
import { InvalidTransactionError } from '@bitgo/sdk-core';
84
import { mainnetCommon, testnetCommon } from './resources';
95

10-
/**
11-
* Celo transaction deserialization based on code
12-
* from @celo/contractkit/lib/utils/signing-utils
13-
* github: https://github.com/celo-org/celo-monorepo/tree/master/packages/contractkit
14-
*
15-
* @param {string} serializedTx the serialized transaction
16-
* @returns {LegacyTxData} the deserialized transaction
17-
*/
18-
export function deserialize(serializedTx: string): LegacyTxData {
19-
try {
20-
const decodedTx = ethers.utils.RLP.decode(serializedTx);
21-
decodedTx.splice(3, 3); // remove unused feeCurrency, gatewayFeeRecipient and gatewayFee
22-
const [nonce, gasPrice, gasLimit, to, value, data, v, r, s] = decodedTx;
23-
let chainId = v;
24-
let from;
25-
if (r !== '0x' && s !== '0x') {
26-
const [tx, sender] = recoverTransaction(serializedTx);
27-
from = sender;
28-
chainId = tx.chainId;
29-
}
30-
const celoTx: LegacyTxData = {
31-
_type: ETHTransactionType.LEGACY,
32-
nonce: nonce.toLowerCase() === '0x' ? 0 : parseInt(nonce, 16),
33-
gasPrice: gasPrice.toLowerCase() === '0x' ? '0' : new BigNumber(gasPrice, 16).toString(),
34-
gasLimit: gasLimit.toLowerCase() === '0x' ? '0' : new BigNumber(gasLimit, 16).toString(),
35-
value: value.toLowerCase() === '0x' ? '0' : new BigNumber(value, 16).toString(),
36-
data,
37-
chainId,
38-
from,
39-
v,
40-
r,
41-
s,
42-
};
43-
44-
if (to !== '0x') {
45-
celoTx.to = to;
46-
}
47-
48-
return celoTx;
49-
} catch {
50-
throw new ParseTransactionError('Invalid serialized transaction');
51-
}
52-
}
53-
546
const commons: Map<NetworkType, EthereumCommon> = new Map<NetworkType, EthereumCommon>([
557
[NetworkType.MAINNET, mainnetCommon],
568
[NetworkType.TESTNET, testnetCommon],

scripts/check-package-dependencies.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ const options = {
2121
'express-serve-static-core',
2222
// Required for sdk-coin-ada
2323
'@emurgo/cardano-serialization-lib-browser',
24-
// Required for sdk-coin-celo inner dependencies
25-
'@celo/contractkit',
2624
// Webpack - not detected by depcheck
2725
'@testing-library/cypress',
2826
'css-loader',

0 commit comments

Comments
 (0)