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
6 changes: 6 additions & 0 deletions modules/bitgo/src/bitgo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
BaseCoin as StaticsBaseCoin,
} from '@bitgo/statics';
import { GlobalCoinFactory, registerCoinConstructors, getTokenConstructor, getCoinConstructor } from './v2/coinFactory';
import { Ofc } from './v2/coins';

// constructor params used exclusively for BitGo class
export type BitGoOptions = BitGoAPIOptions & {
Expand Down Expand Up @@ -111,6 +112,11 @@ export class BitGo extends BitGoAPI {
return;
}

//ofc is not present in statics coin map
if (tokenName === 'ofc') {
this._coinFactory.register(tokenName, Ofc.createInstance);
return;
}
// Get the coin/token details only if it's not present in statics library
let staticsBaseCoin: Readonly<StaticsBaseCoin> | undefined;
if (coins.has(tokenName)) {
Expand Down
11 changes: 11 additions & 0 deletions modules/bitgo/test/v2/unit/ams/ams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,16 @@ describe('Asset metadata service', () => {
const coin = bitgo.coin(tokenName);
should.exist(coin);
});

it('should be able to register the ofc token', async () => {
const bitgo = TestBitGo.decorate(BitGo, { env: 'mock', microservicesUri, useAms: true } as BitGoOptions);
bitgo.initializeTestVars();

const tokenName = 'ofc';

await bitgo.registerToken(tokenName);
const coin = bitgo.coin(tokenName);
should.exist(coin);
});
});
});