Skip to content

Commit ddb0915

Browse files
Merge pull request #7434 from BitGo/GO-992-onboard-sui-deep
Onboard Sui:Deep
2 parents fb6a85a + cf45461 commit ddb0915

File tree

2 files changed

+120
-0
lines changed

2 files changed

+120
-0
lines changed

modules/statics/src/coins/ofcCoins.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ import {
3838
tofcaptToken,
3939
ofcTonToken,
4040
tofcTonToken,
41+
ofcSuiToken,
42+
tofcSuiToken,
4143
} from '../ofc';
4244
import { UnderlyingAsset, CoinKind, CoinFeature } from '../base';
4345

@@ -3593,4 +3595,12 @@ export const ofcCoins = [
35933595
9,
35943596
UnderlyingAsset['tton:ukwny-us']
35953597
),
3598+
ofcSuiToken('6313a162-0c48-4c0c-ae73-27cc3df9e000', 'ofcsui:deep', 'Deepbook', 6, UnderlyingAsset['sui:deep']),
3599+
tofcSuiToken(
3600+
'b6e53ed9-5a86-4994-8b69-ca59c243cac6',
3601+
'ofctsui:deep',
3602+
'Testnet Deepbook',
3603+
6,
3604+
UnderlyingAsset['tsui:deep']
3605+
),
35963606
];

modules/statics/src/ofc.ts

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2398,3 +2398,113 @@ export function tofcTonToken(
23982398
})
23992399
);
24002400
}
2401+
2402+
/**
2403+
* Factory function for testnet ofc ton token instances.
2404+
*
2405+
* @param id uuid v4
2406+
* @param name unique identifier of the coin
2407+
* @param fullName Complete human-readable name of the coin
2408+
* @param network Network object for this coin
2409+
* @param decimalPlaces Number of decimal places this coin supports (divisibility exponent)
2410+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
2411+
* @param kind Differentiates coins which represent fiat assets from those which represent crypto assets
2412+
* @param prefix? Optional coin prefix. Defaults to empty string
2413+
* @param suffix? Optional coin suffix. Defaults to coin name.
2414+
* @param isToken? Whether or not this account coin is a token of another coin
2415+
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `OfcCoin`
2416+
* @param primaryKeyCurve The elliptic curve for this chain/token
2417+
*/
2418+
export function ofcSuiToken(
2419+
id: string,
2420+
name: string,
2421+
fullName: string,
2422+
decimalPlaces: number,
2423+
asset: UnderlyingAsset,
2424+
kind: CoinKind = CoinKind.CRYPTO,
2425+
features: CoinFeature[] = OfcCoin.DEFAULT_FEATURES,
2426+
prefix = '',
2427+
suffix: string = name.replace(/^ofc/, '').toUpperCase(),
2428+
network: OfcNetwork = Networks.main.ofc,
2429+
isToken = true,
2430+
addressCoin = 'sui',
2431+
primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1
2432+
) {
2433+
const filteredFeatures = getFilteredFeatures(suffix);
2434+
if (filteredFeatures.length > 0) {
2435+
features = filteredFeatures;
2436+
}
2437+
return Object.freeze(
2438+
new OfcCoin({
2439+
id,
2440+
name,
2441+
fullName,
2442+
network,
2443+
prefix,
2444+
suffix,
2445+
features,
2446+
decimalPlaces,
2447+
isToken,
2448+
asset,
2449+
kind,
2450+
addressCoin,
2451+
primaryKeyCurve,
2452+
baseUnit: BaseUnit.SUI,
2453+
})
2454+
);
2455+
}
2456+
2457+
/**
2458+
* Factory function for testnet ofc ton token instances.
2459+
*
2460+
* @param id uuid v4
2461+
* @param name unique identifier of the coin
2462+
* @param fullName Complete human-readable name of the coin
2463+
* @param network Network object for this coin
2464+
* @param decimalPlaces Number of decimal places this coin supports (divisibility exponent)
2465+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
2466+
* @param kind Differentiates coins which represent fiat assets from those which represent crypto assets
2467+
* @param prefix? Optional coin prefix. Defaults to empty string
2468+
* @param suffix? Optional coin suffix. Defaults to coin name.
2469+
* @param isToken? Whether or not this account coin is a token of another coin
2470+
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `OfcCoin`
2471+
* @param primaryKeyCurve The elliptic curve for this chain/token
2472+
*/
2473+
export function tofcSuiToken(
2474+
id: string,
2475+
name: string,
2476+
fullName: string,
2477+
decimalPlaces: number,
2478+
asset: UnderlyingAsset,
2479+
kind: CoinKind = CoinKind.CRYPTO,
2480+
features: CoinFeature[] = OfcCoin.DEFAULT_FEATURES,
2481+
prefix = '',
2482+
suffix: string = name.replace(/^ofc/, '').toUpperCase(),
2483+
network: OfcNetwork = Networks.test.ofc,
2484+
isToken = true,
2485+
addressCoin = 'tsui',
2486+
primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1
2487+
) {
2488+
const filteredFeatures = getFilteredFeatures(suffix);
2489+
if (filteredFeatures.length > 0) {
2490+
features = filteredFeatures;
2491+
}
2492+
return Object.freeze(
2493+
new OfcCoin({
2494+
id,
2495+
name,
2496+
fullName,
2497+
network,
2498+
prefix,
2499+
suffix,
2500+
features,
2501+
decimalPlaces,
2502+
isToken,
2503+
asset,
2504+
kind,
2505+
addressCoin,
2506+
primaryKeyCurve,
2507+
baseUnit: BaseUnit.SUI,
2508+
})
2509+
);
2510+
}

0 commit comments

Comments
 (0)