Skip to content

Commit 6dd444d

Browse files
authored
fix(bitgo): register ofc constructor without using AMS api
2 parents 42974af + d327755 commit 6dd444d

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

modules/bitgo/src/bitgo.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
BaseCoin as StaticsBaseCoin,
1818
} from '@bitgo/statics';
1919
import { GlobalCoinFactory, registerCoinConstructors, getTokenConstructor, getCoinConstructor } from './v2/coinFactory';
20+
import { Ofc } from './v2/coins';
2021

2122
// constructor params used exclusively for BitGo class
2223
export type BitGoOptions = BitGoAPIOptions & {
@@ -111,6 +112,11 @@ export class BitGo extends BitGoAPI {
111112
return;
112113
}
113114

115+
//ofc is not present in statics coin map
116+
if (tokenName === 'ofc') {
117+
this._coinFactory.register(tokenName, Ofc.createInstance);
118+
return;
119+
}
114120
// Get the coin/token details only if it's not present in statics library
115121
let staticsBaseCoin: Readonly<StaticsBaseCoin> | undefined;
116122
if (coins.has(tokenName)) {

modules/bitgo/test/v2/unit/ams/ams.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,16 @@ describe('Asset metadata service', () => {
9090
const coin = bitgo.coin(tokenName);
9191
should.exist(coin);
9292
});
93+
94+
it('should be able to register the ofc token', async () => {
95+
const bitgo = TestBitGo.decorate(BitGo, { env: 'mock', microservicesUri, useAms: true } as BitGoOptions);
96+
bitgo.initializeTestVars();
97+
98+
const tokenName = 'ofc';
99+
100+
await bitgo.registerToken(tokenName);
101+
const coin = bitgo.coin(tokenName);
102+
should.exist(coin);
103+
});
93104
});
94105
});

0 commit comments

Comments
 (0)