Skip to content

Commit edc32bc

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

File tree

23 files changed

+289
-5
lines changed

23 files changed

+289
-5
lines changed

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/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/sdk-coin-evm/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

modules/sdk-coin-evm/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
.idea/
3+
dist/

modules/sdk-coin-evm/.mocharc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require: 'ts-node/register'
2+
timeout: '60000'
3+
reporter: 'min'
4+
reporter-option:
5+
- 'cdn=true'
6+
- 'json=false'
7+
exit: true
8+
spec: ['test/**/*.ts']

modules/sdk-coin-evm/.npmignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
!dist/
2+
.idea/
3+
.prettierrc.yml
4+
tsconfig.json
5+
src/
6+
test/
7+
scripts/
8+
.nyc_output
9+
CODEOWNERS
10+
node_modules/
11+
.prettierignore
12+
.mocharc.js

modules/sdk-coin-evm/.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.nyc_output/
2+
dist/

modules/sdk-coin-evm/.prettierrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
printWidth: 120
2+
singleQuote: true
3+
trailingComma: 'es5'

modules/sdk-coin-evm/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

0 commit comments

Comments
 (0)