Skip to content

Commit 2a03433

Browse files
committed
feat: add sdk-coin-evm
Ticket: WIN-5511
1 parent f839d67 commit 2a03433

32 files changed

+305
-5
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
/modules/sdk-coin-cspr/ @BitGo/ethalt-team
6363
/modules/sdk-coin-dot/ @BitGo/ethalt-team
6464
/modules/sdk-coin-eos/ @BitGo/ethalt-team
65+
/modules/sdk-coin-evm/ @BitGo/ethalt-team
6566
/modules/sdk-coin-fetchai/ @BitGo/ethalt-team
6667
/modules/sdk-coin-flr/ @BitGo/ethalt-team
6768
/modules/sdk-coin-ethlike/ @BitGo/ethalt-team

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ COPY --from=builder /tmp/bitgo/modules/abstract-cosmos /var/modules/abstract-cos
6666
COPY --from=builder /tmp/bitgo/modules/sdk-coin-avaxc /var/modules/sdk-coin-avaxc/
6767
COPY --from=builder /tmp/bitgo/modules/sdk-coin-avaxp /var/modules/sdk-coin-avaxp/
6868
COPY --from=builder /tmp/bitgo/modules/sdk-coin-eth /var/modules/sdk-coin-eth/
69+
COPY --from=builder /tmp/bitgo/modules/sdk-coin-evm /var/modules/sdk-coin-evm/
6970
COPY --from=builder /tmp/bitgo/modules/sdk-coin-baby /var/modules/sdk-coin-baby/
7071
COPY --from=builder /tmp/bitgo/modules/sdk-coin-bera /var/modules/sdk-coin-bera/
7172
COPY --from=builder /tmp/bitgo/modules/sdk-coin-bld /var/modules/sdk-coin-bld/
@@ -159,6 +160,7 @@ cd /var/modules/abstract-cosmos && yarn link && \
159160
cd /var/modules/sdk-coin-avaxc && yarn link && \
160161
cd /var/modules/sdk-coin-avaxp && yarn link && \
161162
cd /var/modules/sdk-coin-eth && yarn link && \
163+
cd /var/modules/sdk-coin-evm && yarn link && \
162164
cd /var/modules/sdk-coin-baby && yarn link && \
163165
cd /var/modules/sdk-coin-bera && yarn link && \
164166
cd /var/modules/sdk-coin-bld && yarn link && \
@@ -255,6 +257,7 @@ RUN cd /var/bitgo-express && \
255257
yarn link @bitgo/sdk-coin-avaxc && \
256258
yarn link @bitgo/sdk-coin-avaxp && \
257259
yarn link @bitgo/sdk-coin-eth && \
260+
yarn link @bitgo/sdk-coin-evm && \
258261
yarn link @bitgo/sdk-coin-baby && \
259262
yarn link @bitgo/sdk-coin-bera && \
260263
yarn link @bitgo/sdk-coin-bld && \

modules/account-lib/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"@bitgo/sdk-coin-dot": "^4.2.0",
4747
"@bitgo/sdk-coin-etc": "^2.2.50",
4848
"@bitgo/sdk-coin-eth": "^24.5.0",
49+
"@bitgo/sdk-coin-evm": "^1.0.0",
4950
"@bitgo/sdk-coin-fetchai": "^2.0.2",
5051
"@bitgo/sdk-coin-flr": "^1.2.7",
5152
"@bitgo/sdk-coin-hash": "^3.0.52",

modules/account-lib/src/index.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
accountLibBaseCoin,
99
acountLibCrypto,
1010
} from '@bitgo/sdk-core';
11-
import { BaseCoin as CoinConfig, coins } from '@bitgo/statics';
11+
import { BaseCoin as CoinConfig, coins, CoinFeature } from '@bitgo/statics';
1212
export { Ed25519BIP32, Eddsa };
1313

1414
/**
@@ -191,6 +191,9 @@ export { Stt };
191191
import * as Soneium from '@bitgo/sdk-coin-soneium';
192192
export { Soneium };
193193

194+
import * as EvmCoin from '@bitgo/sdk-coin-evm';
195+
export { EvmCoin };
196+
194197
const coinBuilderMap = {
195198
trx: Trx.WrappedBuilder,
196199
ttrx: Trx.WrappedBuilder,
@@ -303,6 +306,16 @@ const coinBuilderMap = {
303306
tpolyx: Polyx.TransactionBuilderFactory,
304307
};
305308

309+
/**
310+
* coins.filter(coin => coin.coinFeature.has(EVM_SHARED_SDK)).forEach(coin => coinBuilderMap[coin.name] = EvmCoin.TransactionBuilder);
311+
*/
312+
313+
coins
314+
.filter((coin) => coin.features.includes(CoinFeature.SHARED_EVM_SDK))
315+
.forEach((coin) => {
316+
coinBuilderMap[coin.name] = EvmCoin.TransactionBuilder;
317+
});
318+
306319
/**
307320
* Get the list of coin tickers supported by this library.
308321
*/

modules/account-lib/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
{
5050
"path": "../sdk-coin-eth"
5151
},
52+
{
53+
"path": "../sdk-coin-evm"
54+
},
5255
{
5356
"path": "../sdk-coin-flr"
5457
},

modules/bitgo/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"@bitgo/sdk-coin-eth": "^24.5.0",
8080
"@bitgo/sdk-coin-ethlike": "^1.2.18",
8181
"@bitgo/sdk-coin-ethw": "^20.0.83",
82+
"@bitgo/sdk-coin-evm": "^1.0.0",
8283
"@bitgo/sdk-coin-fetchai": "^2.0.2",
8384
"@bitgo/sdk-coin-flr": "^1.2.7",
8485
"@bitgo/sdk-coin-hash": "^3.0.52",

modules/bitgo/src/v2/coinFactory.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Near, TNear } from '@bitgo/sdk-coin-near';
99
import { SolToken } from '@bitgo/sdk-coin-sol';
1010
import { TrxToken } from '@bitgo/sdk-coin-trx';
1111
import { CoinFactory } from '@bitgo/sdk-core';
12-
import { CoinMap, coins, getFormattedTokens } from '@bitgo/statics';
12+
import { CoinFeature, CoinMap, coins, getFormattedTokens } from '@bitgo/statics';
1313
import {
1414
Ada,
1515
Algo,
@@ -49,6 +49,7 @@ import {
4949
Eth,
5050
Ethw,
5151
EthLikeCoin,
52+
EvmCoin,
5253
FetchAi,
5354
Flr,
5455
TethLikeCoin,
@@ -345,6 +346,12 @@ export function registerCoinConstructors(coinFactory: CoinFactory, coinMap: Coin
345346
coinFactory.register('zeta', Zeta.createInstance);
346347
coinFactory.register('zketh', Zketh.createInstance);
347348

349+
coins
350+
.filter((coin) => coin.features.includes(CoinFeature.SHARED_EVM_SDK))
351+
.forEach((coin) => {
352+
coinFactory.register(coin.name, EvmCoin.createInstance);
353+
});
354+
348355
const tokens = getFormattedTokens(coinMap);
349356

350357
Erc20Token.createTokenConstructors([...tokens.bitcoin.eth.tokens, ...tokens.testnet.eth.tokens]).forEach(

modules/bitgo/src/v2/coins/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { Erc20Token, Eth, Gteth, Hteth, Teth } from '@bitgo/sdk-coin-eth';
3131
import { FetchAi, TfetchAi } from '@bitgo/sdk-coin-fetchai';
3232
import { Flr, Tflr } from '@bitgo/sdk-coin-flr';
3333
import { Ethw } from '@bitgo/sdk-coin-ethw';
34+
import { EvmCoin } from '@bitgo/sdk-coin-evm';
3435
import { EthLikeCoin, TethLikeCoin } from '@bitgo/sdk-coin-ethlike';
3536
import { Hash, Thash } from '@bitgo/sdk-coin-hash';
3637
import { Hbar, Thbar } from '@bitgo/sdk-coin-hbar';
@@ -102,6 +103,7 @@ export { Erc20Token, Eth, Gteth, Hteth, Teth };
102103
export { Ethw };
103104
export { EthLikeCoin, TethLikeCoin };
104105
export { Etc, Tetc };
106+
export { EvmCoin };
105107
export { FetchAi, TfetchAi };
106108
export { Flr, Tflr };
107109
export { Hash, Thash };

modules/bitgo/test/browser/browser.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe('Coins', () => {
4343
Polyx: 1,
4444
Tpolyx: 1,
4545
CoredaoToken: 1,
46+
EvmCoin: 1,
4647
};
4748
Object.keys(BitGoJS.Coin)
4849
.filter((coinName) => !excludedKeys[coinName])

modules/bitgo/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@
149149
{
150150
"path": "../sdk-coin-ethw"
151151
},
152+
{
153+
"path": "../sdk-coin-evm"
154+
},
152155
{
153156
"path": "../sdk-coin-fetchai"
154157
},

0 commit comments

Comments
 (0)