Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions modules/statics/src/coins/ofcCoins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ import {
tofcaptToken,
ofcTonToken,
tofcTonToken,
ofcSuiToken,
tofcSuiToken,
} from '../ofc';
import { UnderlyingAsset, CoinKind, CoinFeature } from '../base';

Expand Down Expand Up @@ -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']
),
];
110 changes: 110 additions & 0 deletions modules/statics/src/ofc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
);
}