Skip to content

Commit 18a0fac

Browse files
authored
Merge pull request #483 from BitGo/COIN-1418-etc-wrw-support
feat(etc): add non-bitgo recovery and unsigned sweep support for etc
2 parents f716375 + 8961b05 commit 18a0fac

File tree

9 files changed

+7417
-176
lines changed

9 files changed

+7417
-176
lines changed

ETC.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Create a new file called `broadcastETCTransaction.js`
2323
and add the following script:
2424

2525
```js
26-
const axios = require('axios');
26+
import axios from 'axios';
2727
2828
// Replace with your API key
2929
const apiKey = 'your-api-key-here';

electron/main/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { Dot, Tdot } from '@bitgo/sdk-coin-dot';
3131
import { Eos, Teos } from '@bitgo/sdk-coin-eos';
3232
import { AbstractEthLikeNewCoins, Erc20Token, Eth, Hteth } from '@bitgo/sdk-coin-eth';
3333
import { Ethw } from '@bitgo/sdk-coin-ethw';
34+
import { Etc, Tetc } from '@bitgo/sdk-coin-etc';
3435
import { Ltc } from '@bitgo/sdk-coin-ltc';
3536
import { Near, TNear } from '@bitgo/sdk-coin-near';
3637
import { Opeth, Topeth, OpethToken } from '@bitgo/sdk-coin-opeth';
@@ -83,6 +84,8 @@ sdk.register('tbtc', Tbtc.createInstance);
8384
sdk.register('eth', Eth.createInstance);
8485
sdk.register('hteth', Hteth.createInstance);
8586
sdk.register('ethw', Ethw.createInstance);
87+
sdk.register('etc', Etc.createInstance);
88+
sdk.register('tetc', Tetc.createInstance);
8689
sdk.register('eos', Eos.createInstance);
8790
sdk.register('teos', Teos.createInstance);
8891
sdk.register('xlm', Xlm.createInstance);

package-lock.json

Lines changed: 7395 additions & 168 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@bitgo/sdk-coin-doge": "2.0.32",
3030
"@bitgo/sdk-coin-dot": "4.1.10",
3131
"@bitgo/sdk-coin-eos": "2.1.25",
32+
"@bitgo/sdk-coin-etc": "2.2.0",
3233
"@bitgo/sdk-coin-eth": "24.2.21",
3334
"@bitgo/sdk-coin-ethlike": "1.1.13",
3435
"@bitgo/sdk-coin-ethw": "20.0.32",

scripts/build-icons.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const coins = [
1313
'zec',
1414
'btg',
1515
'eth',
16+
'etc',
1617
'trx',
1718
'bsv',
1819
'eos',

src/containers/BuildUnsignedSweepCoin/BuildUnsignedSweepCoin.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useNavigate, useParams } from 'react-router-dom';
22
import { CoinsSelectAutocomplete } from '~/components';
33
import { useAlertBanner } from '~/contexts';
44
import {
5-
assert,
5+
assert, getEip1559Params,
66
getEthLikeRecoveryChainId,
77
getTokenChain,
88
includePubsFor,
@@ -112,6 +112,8 @@ function Form() {
112112
);
113113
case 'eth':
114114
case 'hteth':
115+
case 'etc':
116+
case 'tetc':
115117
case 'arbeth':
116118
case 'tarbeth':
117119
case 'opeth':
@@ -135,10 +137,7 @@ function Form() {
135137
await updateKeysFromIds(coin, values);
136138
const recoverData = await window.commands.recover(coin, {
137139
...rest,
138-
eip1559: {
139-
maxFeePerGas: toWei(maxFeePerGas),
140-
maxPriorityFeePerGas: toWei(maxPriorityFeePerGas),
141-
},
140+
eip1559: getEip1559Params(coin, maxFeePerGas, maxPriorityFeePerGas),
142141
replayProtectionOptions: {
143142
chain: getEthLikeRecoveryChainId(coin, bitGoEnvironment),
144143
hardfork: 'london',

src/containers/NonBitGoRecoveryCoin/NonBitGoRecoveryCoin.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ function Form() {
332332
);
333333
case 'eth':
334334
case 'hteth':
335+
case 'etc':
336+
case 'tetc':
335337
case 'arbeth':
336338
case 'tarbeth':
337339
case 'opeth':

src/helpers/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ export const buildUnsignedSweepCoins: Record<
632632
allCoinMetas.zec,
633633
allCoinMetas.btg,
634634
allCoinMetas.eth,
635+
allCoinMetas.etc,
635636
allCoinMetas.ethw,
636637
allCoinMetas.erc20,
637638
allCoinMetas.trx,
@@ -661,6 +662,7 @@ export const buildUnsignedSweepCoins: Record<
661662
allCoinMetas.txrp,
662663
allCoinMetas.txlm,
663664
allCoinMetas.hteth,
665+
allCoinMetas.tetc,
664666
allCoinMetas.hterc20,
665667
allCoinMetas.ttrx,
666668
allCoinMetas.ttrxToken,
@@ -697,6 +699,7 @@ export const nonBitgoRecoveryCoins: Record<BitgoEnv, readonly CoinMetadata[]> =
697699
allCoinMetas.zec,
698700
allCoinMetas.btg,
699701
allCoinMetas.eth,
702+
allCoinMetas.etc,
700703
allCoinMetas.ethw,
701704
allCoinMetas.erc20,
702705
allCoinMetas.trx,
@@ -736,6 +739,7 @@ export const nonBitgoRecoveryCoins: Record<BitgoEnv, readonly CoinMetadata[]> =
736739
allCoinMetas.txrp,
737740
allCoinMetas.txlm,
738741
allCoinMetas.hteth,
742+
allCoinMetas.tetc,
739743
allCoinMetas.hterc20,
740744
allCoinMetas.ttrx,
741745
allCoinMetas.ttrxToken,

src/helpers/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,13 @@ export function isBscChain(coin: string) {
260260
return (coin === 'bsc' || coin === 'tbsc')
261261
}
262262

263+
export function isEtcChain(coin: string) {
264+
return (coin === 'etc' || coin === 'tetc')
265+
}
266+
263267
export function getEip1559Params(coin: string, maxFeePerGas: number, maxPriorityFeePerGas: number) {
264-
// bsc and tbsc doesn't support EIP-1559
265-
if (isBscChain(coin)) {
268+
// bsc/tbsc and etc/tetc doesn't support EIP-1559
269+
if (isBscChain(coin) || isEtcChain(coin)) {
266270
return undefined;
267271
}
268272
return {

0 commit comments

Comments
 (0)