Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/sdk-coin-xdc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@bitgo/abstract-eth": "^24.19.4",
"@bitgo/sdk-core": "^36.25.0",
"@bitgo/statics": "^58.19.0",
"@bitgo/sdk-coin-evm": "^1.11.0",
"@ethereumjs/common": "^2.6.5",
"@ethereumjs/tx": "^3.3.0"
},
Expand Down
7 changes: 7 additions & 0 deletions modules/sdk-coin-xdc/src/register.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { BitGoBase } from '@bitgo/sdk-core';
import { EthLikeErc20Token } from '@bitgo/sdk-coin-evm';
import { Xdc } from './xdc';
import { Txdc } from './txdc';

export const register = (sdk: BitGoBase): void => {
sdk.register('xdc', Xdc.createInstance);
sdk.register('txdc', Txdc.createInstance);
EthLikeErc20Token.createTokenConstructors({
Mainnet: 'xdc',
Testnet: 'txdc',
}).forEach(({ name, coinConstructor }) => {
sdk.register(name, coinConstructor);
});
};
30 changes: 30 additions & 0 deletions modules/sdk-coin-xdc/test/unit/xdcToken.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import 'should';
import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test';
import { BitGoAPI } from '@bitgo/sdk-api';

import { register } from '../../src';

describe('XDC Token:', function () {
let bitgo: TestBitGoAPI;
let xdcTokenCoin;
const tokenName = 'xdc:usdc';

before(function () {
bitgo = TestBitGo.decorate(BitGoAPI, { env: 'prod' });
register(bitgo);
bitgo.initializeTestVars();
xdcTokenCoin = bitgo.coin(tokenName);
});

it('should return constants', function () {
xdcTokenCoin.getChain().should.equal('xdc:usdc');
xdcTokenCoin.getBaseChain().should.equal('xdc');
xdcTokenCoin.getFullName().should.equal('ERC20 Token');
xdcTokenCoin.getBaseFactor().should.equal(1e6);
xdcTokenCoin.type.should.equal(tokenName);
xdcTokenCoin.name.should.equal('USD Coin');
xdcTokenCoin.coin.should.equal('xdc');
xdcTokenCoin.network.should.equal('Mainnet');
xdcTokenCoin.decimalPlaces.should.equal(6);
});
});
6 changes: 6 additions & 0 deletions modules/sdk-core/src/bitgo/environments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ const mainnetBase: EnvironmentTemplate = {
arc: {
baseUrl: 'https://testnet.arcscan.app/api/v2', // WIN-8039 => add mainnet url when available
},
xdc: {
baseUrl: 'https://api.etherscan.io/v2',
},
},
icpNodeUrl: 'https://ic0.app',
worldExplorerBaseUrl: 'https://worldscan.org/',
Expand Down Expand Up @@ -469,6 +472,9 @@ const testnetBase: EnvironmentTemplate = {
arc: {
baseUrl: 'https://testnet.arcscan.app/api/v2',
},
xdc: {
baseUrl: 'https://api.etherscan.io/v2',
},
},
stxNodeUrl: 'https://api.testnet.hiro.so',
vetNodeUrl: 'https://sync-testnet.vechain.org',
Expand Down