diff --git a/modules/bitgo/test/v2/unit/ams/ams.ts b/modules/bitgo/test/v2/unit/ams/ams.ts index 6de7233b6f..279fa60655 100644 --- a/modules/bitgo/test/v2/unit/ams/ams.ts +++ b/modules/bitgo/test/v2/unit/ams/ams.ts @@ -154,5 +154,23 @@ describe('Asset metadata service', () => { } staticsCoin.family.should.equal('hypeevm'); }); + + it('should register a SOL token from statics library if available', async () => { + const bitgo = TestBitGo.decorate(BitGo, { env: 'mock', microservicesUri, useAms: true } as BitGoOptions); + bitgo.initializeTestVars(); + await bitgo.registerToken('tsol:usdc'); + const coin = bitgo.coin('tsol:usdc'); + should.exist(coin); + coin.type.should.equal('tsol:usdc'); + coin.getBaseFactor().should.equal(1e9); + }); + }); + + it('should create a custom coin factory from ams response and include SOL tokens from statics', async () => { + bitgo.initCoinFactory(reducedAmsTokenConfig); + const coin = bitgo.coin('tsol:usdc'); + should.exist(coin); + coin.type.should.equal('tsol:usdc'); + coin.getBaseFactor().should.equal(1e9); }); }); diff --git a/modules/sdk-coin-sol/src/solToken.ts b/modules/sdk-coin-sol/src/solToken.ts index e883030e96..2ff760f6e6 100644 --- a/modules/sdk-coin-sol/src/solToken.ts +++ b/modules/sdk-coin-sol/src/solToken.ts @@ -9,6 +9,7 @@ export interface SolTokenConfig { network: string; tokenAddress: string; decimalPlaces: number; + programId?: string; } export class SolToken extends Sol { @@ -59,6 +60,10 @@ export class SolToken extends Sol { return this.tokenConfig.tokenAddress; } + get programId() { + return this.tokenConfig.programId; + } + getChain() { return this.tokenConfig.type; } diff --git a/modules/statics/src/tokenConfig.ts b/modules/statics/src/tokenConfig.ts index c3c4df16b4..18e3351741 100644 --- a/modules/statics/src/tokenConfig.ts +++ b/modules/statics/src/tokenConfig.ts @@ -77,6 +77,7 @@ export type StellarTokenConfig = BaseNetworkConfig; export type SolTokenConfig = BaseNetworkConfig & { tokenAddress: string; contractAddress: string; + programId?: string; }; export type AdaTokenConfig = BaseNetworkConfig & { @@ -832,6 +833,7 @@ function getSolTokenConfig(coin: SolCoin): SolTokenConfig { tokenAddress: coin.tokenAddress, decimalPlaces: coin.decimalPlaces, contractAddress: coin.contractAddress, + programId: coin.programId, }; } const getFormattedSolTokens = (customCoinMap = coins) =>