diff --git a/modules/bitgo/test/v2/unit/coins/ofcToken.ts b/modules/bitgo/test/v2/unit/coins/ofcToken.ts index bf3da45dde..afbd64309b 100644 --- a/modules/bitgo/test/v2/unit/coins/ofcToken.ts +++ b/modules/bitgo/test/v2/unit/coins/ofcToken.ts @@ -422,7 +422,16 @@ describe('OFC:', function () { }); describe('check ofc tokens for ripple', function () { + const tokenMain = 'ofcxrp:rlusd'; const tokenTest = 'ofctxrp:rlusd'; + describe('for main network', function () { + it(`should have the correct values for ${tokenMain}`, function () { + const ofcCoin = bitgo.coin(tokenMain); + ofcCoin.getChain().should.equal(tokenMain); + ofcCoin.getFullName().should.equal('Ripple USD'); + ofcCoin.getBaseFactor().should.equal(PRECISION_96); + }); + }); describe('for test network', function () { it(`should have the correct values for ${tokenTest}`, function () { const ofcCoin = bitgo.coin(tokenTest); diff --git a/modules/statics/src/base.ts b/modules/statics/src/base.ts index c70e33af33..8f581460cd 100644 --- a/modules/statics/src/base.ts +++ b/modules/statics/src/base.ts @@ -2307,10 +2307,14 @@ export enum UnderlyingAsset { 'sol:bonk' = 'sol:bonk', 'jto' = 'jto', 'jup' = 'jup', + 'sol:jup' = 'sol:jup', 'sol:honey' = 'sol:honey', 'mobile' = 'mobile', + 'sol:mobile' = 'sol:mobile', 'wif' = 'wif', + 'sol:wif' = 'sol:wif', 'natix' = 'natix', + 'sol:natix' = 'sol:natix', 'sol:ks' = 'sol:ks', 'sol:apusdt' = 'sol:apusdt', 'sol:acusd' = 'sol:acusd', diff --git a/modules/statics/src/coins.ts b/modules/statics/src/coins.ts index abb07ac153..6775cb01ba 100644 --- a/modules/statics/src/coins.ts +++ b/modules/statics/src/coins.ts @@ -62,6 +62,7 @@ import { ofcsolToken, ofcStellarToken, ofcTronToken, + ofcXrpToken, tofc, tofcAlgoToken, tofcArbethErc20, @@ -1638,7 +1639,7 @@ export const coins = CoinMap.fromCoins([ 'ofcsol:natix', 'NATIX Network ', 6, - UnderlyingAsset['natix'], + UnderlyingAsset['sol:natix'], SOL_TOKEN_FEATURES ), ofcsolToken( @@ -1646,7 +1647,7 @@ export const coins = CoinMap.fromCoins([ 'ofcsol:mobile', 'Helium Mobile', 6, - UnderlyingAsset['mobile'], + UnderlyingAsset['sol:mobile'], SOL_TOKEN_FEATURES ), ofcsolToken( @@ -1654,7 +1655,7 @@ export const coins = CoinMap.fromCoins([ 'ofcsol:jup', 'Jupiter', 6, - UnderlyingAsset['jup'], + UnderlyingAsset['sol:jup'], SOL_TOKEN_FEATURES ), ofcsolToken( @@ -1670,7 +1671,7 @@ export const coins = CoinMap.fromCoins([ 'ofcsol:wif', 'dogwifhat', 6, - UnderlyingAsset['wif'], + UnderlyingAsset['sol:wif'], SOL_TOKEN_FEATURES ), ofcsolToken( @@ -1756,6 +1757,7 @@ export const coins = CoinMap.fromCoins([ ), tofcTronToken('937efe97-a17a-4d2a-aaf2-0ffdb529a943', 'ofcttrx:usdt', 'Tether USD', 6, UnderlyingAsset['ttrx:usdt']), ofcTronToken('94b00b66-68a4-45ed-b772-77e5bca1e34c', 'ofctrx:usdt', 'Tether USD', 6, UnderlyingAsset['trx:usdt']), + ofcXrpToken('6a173023-5faf-4a0a-af38-b8be98abe94f', 'ofcxrp:rlusd', 'Ripple USD', 96, UnderlyingAsset['xrp:rlusd']), tofcXrpToken('bd406dab-3b55-4ab5-b0a5-74b9f94268a3', 'ofctxrp:rlusd', 'RLUSD', 96, UnderlyingAsset['txrp:rlusd']), ofc('837f0cab-cad1-4510-a8e4-f2c60e1a8760', 'ofcusd', 'USD', 2, UnderlyingAsset.USD, CoinKind.FIAT), ofc('798f2a7c-23fd-4e16-9fe5-6bf47ca438a0', 'ofceur', 'Euro', 2, UnderlyingAsset.EUR, CoinKind.FIAT), diff --git a/modules/statics/src/ofc.ts b/modules/statics/src/ofc.ts index 1c0bd222f8..e09153a332 100644 --- a/modules/statics/src/ofc.ts +++ b/modules/statics/src/ofc.ts @@ -1018,6 +1018,57 @@ export function ofcBscToken( ); } +/** + * Factory function for mainnet ofc xrp instances. + * + * @param id uuid v4 + * @param name unique identifier of the coin + * @param fullName Complete human-readable name of the coin + * @param network Network object for this coin + * @param decimalPlaces Number of decimal places this coin supports (divisibility exponent) + * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin. + * @param kind Differentiates coins which represent fiat assets from those which represent crypto assets + * @param prefix? Optional coin prefix. Defaults to empty string + * @param suffix? Optional coin suffix. Defaults to coin name. + * @param isToken? Whether or not this account coin is a token of another coin + * @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `OfcCoin` + * @param primaryKeyCurve The elliptic curve for this chain/token + */ +export function ofcXrpToken( + id: string, + name: string, + fullName: string, + decimalPlaces: number, + asset: UnderlyingAsset, + kind: CoinKind = CoinKind.CRYPTO, + features: CoinFeature[] = OfcCoin.DEFAULT_FEATURES, + prefix = '', + suffix: string = name.replace(/^ofc/, '').toUpperCase(), + network: OfcNetwork = Networks.main.ofc, + isToken = true, + addressCoin = 'xrp', + primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1 +) { + return Object.freeze( + new OfcCoin({ + id, + name, + fullName, + network, + prefix, + suffix, + features, + decimalPlaces, + isToken, + asset, + kind, + addressCoin, + primaryKeyCurve, + baseUnit: BaseUnit.XRP, + }) + ); +} + /** * Factory function for testnet ofc xrp token instances. *