File tree Expand file tree Collapse file tree 4 files changed +44
-0
lines changed
Expand file tree Collapse file tree 4 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 4343 "@bitgo/abstract-eth" : " ^24.19.4" ,
4444 "@bitgo/sdk-core" : " ^36.25.0" ,
4545 "@bitgo/statics" : " ^58.19.0" ,
46+ "@bitgo/sdk-coin-evm" : " ^1.11.0" ,
4647 "@ethereumjs/common" : " ^2.6.5" ,
4748 "@ethereumjs/tx" : " ^3.3.0"
4849 },
Original file line number Diff line number Diff line change 11import { BitGoBase } from '@bitgo/sdk-core' ;
2+ import { EthLikeErc20Token } from '@bitgo/sdk-coin-evm' ;
23import { Xdc } from './xdc' ;
34import { Txdc } from './txdc' ;
45
56export const register = ( sdk : BitGoBase ) : void => {
67 sdk . register ( 'xdc' , Xdc . createInstance ) ;
78 sdk . register ( 'txdc' , Txdc . createInstance ) ;
9+ EthLikeErc20Token . createTokenConstructors ( {
10+ Mainnet : 'xdc' ,
11+ Testnet : 'txdc' ,
12+ } ) . forEach ( ( { name, coinConstructor } ) => {
13+ sdk . register ( name , coinConstructor ) ;
14+ } ) ;
815} ;
Original file line number Diff line number Diff line change 1+ import 'should' ;
2+ import { TestBitGo , TestBitGoAPI } from '@bitgo/sdk-test' ;
3+ import { BitGoAPI } from '@bitgo/sdk-api' ;
4+
5+ import { register } from '../../src' ;
6+
7+ describe ( 'XDC Token:' , function ( ) {
8+ let bitgo : TestBitGoAPI ;
9+ let xdcTokenCoin ;
10+ const tokenName = 'xdc:usdc' ;
11+
12+ before ( function ( ) {
13+ bitgo = TestBitGo . decorate ( BitGoAPI , { env : 'prod' } ) ;
14+ register ( bitgo ) ;
15+ bitgo . initializeTestVars ( ) ;
16+ xdcTokenCoin = bitgo . coin ( tokenName ) ;
17+ } ) ;
18+
19+ it ( 'should return constants' , function ( ) {
20+ xdcTokenCoin . getChain ( ) . should . equal ( 'xdc:usdc' ) ;
21+ xdcTokenCoin . getBaseChain ( ) . should . equal ( 'xdc' ) ;
22+ xdcTokenCoin . getFullName ( ) . should . equal ( 'ERC20 Token' ) ;
23+ xdcTokenCoin . getBaseFactor ( ) . should . equal ( 1e6 ) ;
24+ xdcTokenCoin . type . should . equal ( tokenName ) ;
25+ xdcTokenCoin . name . should . equal ( 'USD Coin' ) ;
26+ xdcTokenCoin . coin . should . equal ( 'xdc' ) ;
27+ xdcTokenCoin . network . should . equal ( 'Mainnet' ) ;
28+ xdcTokenCoin . decimalPlaces . should . equal ( 6 ) ;
29+ } ) ;
30+ } ) ;
Original file line number Diff line number Diff line change @@ -303,6 +303,9 @@ const mainnetBase: EnvironmentTemplate = {
303303 arc : {
304304 baseUrl : 'https://testnet.arcscan.app/api/v2' , // WIN-8039 => add mainnet url when available
305305 } ,
306+ xdc : {
307+ baseUrl : 'https://api.etherscan.io/v2' ,
308+ } ,
306309 } ,
307310 icpNodeUrl : 'https://ic0.app' ,
308311 worldExplorerBaseUrl : 'https://worldscan.org/' ,
@@ -469,6 +472,9 @@ const testnetBase: EnvironmentTemplate = {
469472 arc : {
470473 baseUrl : 'https://testnet.arcscan.app/api/v2' ,
471474 } ,
475+ xdc : {
476+ baseUrl : 'https://api.etherscan.io/v2' ,
477+ } ,
472478 } ,
473479 stxNodeUrl : 'https://api.testnet.hiro.so' ,
474480 vetNodeUrl : 'https://sync-testnet.vechain.org' ,
You can’t perform that action at this time.
0 commit comments