From cf45461f2839e685a8333a16eb64f8d5e99f6f89 Mon Sep 17 00:00:00 2001 From: Gurshabd Varaich Date: Wed, 5 Nov 2025 12:54:22 -0500 Subject: [PATCH] feat: onboard Sui:Deep TICKET: GO-1960 --- modules/statics/src/coins/ofcCoins.ts | 10 +++ modules/statics/src/ofc.ts | 110 ++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) diff --git a/modules/statics/src/coins/ofcCoins.ts b/modules/statics/src/coins/ofcCoins.ts index 395667e4e9..be225af669 100644 --- a/modules/statics/src/coins/ofcCoins.ts +++ b/modules/statics/src/coins/ofcCoins.ts @@ -38,6 +38,8 @@ import { tofcaptToken, ofcTonToken, tofcTonToken, + ofcSuiToken, + tofcSuiToken, } from '../ofc'; import { UnderlyingAsset, CoinKind, CoinFeature } from '../base'; @@ -3593,4 +3595,12 @@ export const ofcCoins = [ 9, UnderlyingAsset['tton:ukwny-us'] ), + ofcSuiToken('6313a162-0c48-4c0c-ae73-27cc3df9e000', 'ofcsui:deep', 'Deepbook', 6, UnderlyingAsset['sui:deep']), + tofcSuiToken( + 'b6e53ed9-5a86-4994-8b69-ca59c243cac6', + 'ofctsui:deep', + 'Testnet Deepbook', + 6, + UnderlyingAsset['tsui:deep'] + ), ]; diff --git a/modules/statics/src/ofc.ts b/modules/statics/src/ofc.ts index 4a9bdc6a4f..9235570aab 100644 --- a/modules/statics/src/ofc.ts +++ b/modules/statics/src/ofc.ts @@ -2398,3 +2398,113 @@ export function tofcTonToken( }) ); } + +/** + * Factory function for testnet ofc ton token 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 ofcSuiToken( + 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 = 'sui', + primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1 +) { + const filteredFeatures = getFilteredFeatures(suffix); + if (filteredFeatures.length > 0) { + features = filteredFeatures; + } + return Object.freeze( + new OfcCoin({ + id, + name, + fullName, + network, + prefix, + suffix, + features, + decimalPlaces, + isToken, + asset, + kind, + addressCoin, + primaryKeyCurve, + baseUnit: BaseUnit.SUI, + }) + ); +} + +/** + * Factory function for testnet ofc ton token 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 tofcSuiToken( + 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.test.ofc, + isToken = true, + addressCoin = 'tsui', + primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1 +) { + const filteredFeatures = getFilteredFeatures(suffix); + if (filteredFeatures.length > 0) { + features = filteredFeatures; + } + return Object.freeze( + new OfcCoin({ + id, + name, + fullName, + network, + prefix, + suffix, + features, + decimalPlaces, + isToken, + asset, + kind, + addressCoin, + primaryKeyCurve, + baseUnit: BaseUnit.SUI, + }) + ); +}