Skip to content

Commit 0283578

Browse files
committed
feat(sdk-coin-ada): onboarding in go accounts
Ticket: CSHLD-401
1 parent 276777a commit 0283578

2 files changed

Lines changed: 137 additions & 0 deletions

File tree

modules/statics/src/coins/ofcCoins.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ import {
4242
tofcSuiToken,
4343
ofcTempoToken,
4444
tofcTempoToken,
45+
ofcAdaToken,
46+
tofcAdaToken,
4547
} from '../ofc';
4648
import { UnderlyingAsset, CoinKind, CoinFeature } from '../base';
4749

@@ -4166,4 +4168,31 @@ export const ofcCoins = [
41664168
UnderlyingAsset.HOODETH,
41674169
CoinKind.CRYPTO
41684170
),
4171+
// ADA OFC tokens
4172+
ofcAdaToken('227d98e7-6397-45a9-acbe-c3d48fca1a7b', 'ofcada:night', 'NIGHT Token', 6, UnderlyingAsset['ada:night']),
4173+
ofcAdaToken('b002bfaa-43e8-41c8-9a3d-3d3fc64af866', 'ofcada:min', 'Minswap', 6, UnderlyingAsset['ada:min']),
4174+
ofcAdaToken('145f9663-990c-4e07-9229-820155e12db7', 'ofcada:snek', 'Snek', 0, UnderlyingAsset['ada:snek']),
4175+
ofcAdaToken('192b99ce-3dfb-46f9-a53c-94f54732c779', 'ofcada:iag', 'IAGON', 6, UnderlyingAsset['ada:iag']),
4176+
ofcAdaToken('af90c0c1-d0ab-4480-8f3e-480eea0f1368', 'ofcada:djed', 'Djed USD', 6, UnderlyingAsset['ada:djed']),
4177+
ofcAdaToken(
4178+
'9a4635c0-96e1-4343-aac4-bcb8c0a589de',
4179+
'ofcada:usda',
4180+
'Anzens USDA Stablecoin',
4181+
6,
4182+
UnderlyingAsset['ada:usda']
4183+
),
4184+
ofcAdaToken(
4185+
'6bde5053-4681-4bd5-9e6c-defae2e26291',
4186+
'ofcada:wmtx',
4187+
'World Mobile Token X',
4188+
6,
4189+
UnderlyingAsset['ada:wmtx']
4190+
),
4191+
tofcAdaToken(
4192+
'1f4e7747-f825-4107-a71f-766e847d557b',
4193+
'ofctada:water',
4194+
'Test ADA Water Token',
4195+
0,
4196+
UnderlyingAsset['tada:water']
4197+
),
41694198
];

modules/statics/src/ofc.ts

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2618,3 +2618,111 @@ export function tofcTempoToken(
26182618
})
26192619
);
26202620
}
2621+
2622+
/**
2623+
* Factory function for ofc ada token instances.
2624+
*
2625+
* @param id uuid v4
2626+
* @param name unique identifier of the coin
2627+
* @param fullName Complete human-readable name of the coin
2628+
* @param decimalPlaces Number of decimal places this coin supports (divisibility exponent)
2629+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
2630+
* @param kind Differentiates coins which represent fiat assets from those which represent crypto assets
2631+
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `OfcCoin`
2632+
* @param prefix? Optional coin prefix. Defaults to empty string
2633+
* @param suffix? Optional coin suffix. Defaults to coin name.
2634+
* @param isToken? Whether or not this account coin is a token of another coin
2635+
* @param primaryKeyCurve The elliptic curve for this chain/token
2636+
*/
2637+
export function ofcAdaToken(
2638+
id: string,
2639+
name: string,
2640+
fullName: string,
2641+
decimalPlaces: number,
2642+
asset: UnderlyingAsset,
2643+
kind: CoinKind = CoinKind.CRYPTO,
2644+
features: CoinFeature[] = [...OfcCoin.DEFAULT_FEATURES, CoinFeature.REQUIRES_RESERVE],
2645+
prefix = '',
2646+
suffix: string = name.replace(/^ofc/, '').toUpperCase(),
2647+
network: OfcNetwork = Networks.main.ofc,
2648+
isToken = true,
2649+
addressCoin = 'ada',
2650+
primaryKeyCurve: KeyCurve = KeyCurve.Ed25519
2651+
) {
2652+
const filteredFeatures = getFilteredFeatures(suffix);
2653+
if (filteredFeatures.length > 0) {
2654+
features = filteredFeatures;
2655+
}
2656+
return Object.freeze(
2657+
new OfcCoin({
2658+
id,
2659+
name,
2660+
fullName,
2661+
network,
2662+
prefix,
2663+
suffix,
2664+
features,
2665+
decimalPlaces,
2666+
isToken,
2667+
asset,
2668+
kind,
2669+
addressCoin,
2670+
primaryKeyCurve,
2671+
baseUnit: BaseUnit.ADA,
2672+
})
2673+
);
2674+
}
2675+
2676+
/**
2677+
* Factory function for testnet ofc ada token instances.
2678+
*
2679+
* @param id uuid v4
2680+
* @param name unique identifier of the coin
2681+
* @param fullName Complete human-readable name of the coin
2682+
* @param decimalPlaces Number of decimal places this coin supports (divisibility exponent)
2683+
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
2684+
* @param kind Differentiates coins which represent fiat assets from those which represent crypto assets
2685+
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `OfcCoin`
2686+
* @param prefix? Optional coin prefix. Defaults to empty string
2687+
* @param suffix? Optional coin suffix. Defaults to coin name.
2688+
* @param isToken? Whether or not this account coin is a token of another coin
2689+
* @param primaryKeyCurve The elliptic curve for this chain/token
2690+
*/
2691+
export function tofcAdaToken(
2692+
id: string,
2693+
name: string,
2694+
fullName: string,
2695+
decimalPlaces: number,
2696+
asset: UnderlyingAsset,
2697+
kind: CoinKind = CoinKind.CRYPTO,
2698+
features: CoinFeature[] = [...OfcCoin.DEFAULT_FEATURES, CoinFeature.REQUIRES_RESERVE],
2699+
prefix = '',
2700+
suffix: string = name.replace(/^ofc/, '').toUpperCase(),
2701+
network: OfcNetwork = Networks.test.ofc,
2702+
isToken = true,
2703+
addressCoin = 'tada',
2704+
primaryKeyCurve: KeyCurve = KeyCurve.Ed25519
2705+
) {
2706+
const filteredFeatures = getFilteredFeatures(suffix);
2707+
if (filteredFeatures.length > 0) {
2708+
features = filteredFeatures;
2709+
}
2710+
return Object.freeze(
2711+
new OfcCoin({
2712+
id,
2713+
name,
2714+
fullName,
2715+
network,
2716+
prefix,
2717+
suffix,
2718+
features,
2719+
decimalPlaces,
2720+
isToken,
2721+
asset,
2722+
kind,
2723+
addressCoin,
2724+
primaryKeyCurve,
2725+
baseUnit: BaseUnit.ADA,
2726+
})
2727+
);
2728+
}

0 commit comments

Comments
 (0)