From 679e6524a978810ac92107f022c74ef59cf20733 Mon Sep 17 00:00:00 2001 From: Akash Gianchandani Date: Mon, 11 Dec 2023 19:24:11 +0530 Subject: [PATCH] feat(sdk-coin-opeth): add opeth tokens WIN-963 TICKET: WIN-963 --- modules/statics/src/account.ts | 94 +++++++++++++++++++++++++++++++++- 1 file changed, 92 insertions(+), 2 deletions(-) diff --git a/modules/statics/src/account.ts b/modules/statics/src/account.ts index 5c8a868f33..26df14184a 100644 --- a/modules/statics/src/account.ts +++ b/modules/statics/src/account.ts @@ -1707,7 +1707,7 @@ export function tpolygonErc20( * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin. * @param prefix? Optional token prefix. Defaults to empty string * @param suffix? Optional token suffix. Defaults to token name. - * @param network? Optional token network. Defaults to Polygon main network. + * @param network? Optional token network. Defaults to Arbitrum main network. * @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin` * @param primaryKeyCurve The elliptic curve for this chain/token */ @@ -1754,7 +1754,7 @@ export function arbethErc20( * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin. * @param prefix? Optional token prefix. Defaults to empty string * @param suffix? Optional token suffix. Defaults to token name. - * @param network? Optional token network. Defaults to the Polygon test network. + * @param network? Optional token network. Defaults to the Arbitrum test network. * @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin` * @param primaryKeyCurve The elliptic curve for this chain/token */ @@ -1786,6 +1786,96 @@ export function tarbethErc20( ); } +/** + * Factory function for opethErc20 token instances. + * + * @param id uuid v4 + * @param name unique identifier of the token + * @param fullName Complete human-readable name of the token + * @param decimalPlaces Number of decimal places this token supports (divisibility exponent) + * @param contractAddress Contract address of this token + * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin. + * @param prefix? Optional token prefix. Defaults to empty string + * @param suffix? Optional token suffix. Defaults to token name. + * @param network? Optional token network. Defaults to Optimism main network. + * @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin` + * @param primaryKeyCurve The elliptic curve for this chain/token + */ +export function opethErc20( + id: string, + name: string, + fullName: string, + decimalPlaces: number, + contractAddress: string, + asset: UnderlyingAsset, + features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES, + prefix = '', + suffix: string = name.toUpperCase(), + network: AccountNetwork = Networks.main.optimism, + primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1 +) { + return Object.freeze( + new OpethERC20Token({ + id, + name, + fullName, + network, + contractAddress, + prefix, + suffix, + features, + decimalPlaces, + asset, + isToken: true, + primaryKeyCurve, + baseUnit: BaseUnit.ETH, + }) + ); +} + +/** + * Factory function for Optimism Sepolia testnet opethErc20 token instances. + * + * @param id uuid v4 + * @param name unique identifier of the token + * @param fullName Complete human-readable name of the token + * @param decimalPlaces Number of decimal places this token supports (divisibility exponent) + * @param contractAddress Contract address of this token + * @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin. + * @param prefix? Optional token prefix. Defaults to empty string + * @param suffix? Optional token suffix. Defaults to token name. + * @param network? Optional token network. Defaults to the Optimism test network. + * @param features? Features of this coin. Defaults to the DEFAULT_FEATURES defined in `AccountCoin` + * @param primaryKeyCurve The elliptic curve for this chain/token + */ +export function topethErc20( + id: string, + name: string, + fullName: string, + decimalPlaces: number, + contractAddress: string, + asset: UnderlyingAsset, + features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES, + prefix = '', + suffix: string = name.toUpperCase(), + network: AccountNetwork = Networks.test.optimism, + primaryKeyCurve: KeyCurve = KeyCurve.Secp256k1 +) { + return opethErc20( + id, + name, + fullName, + decimalPlaces, + contractAddress, + asset, + features, + prefix, + suffix, + network, + primaryKeyCurve + ); +} + /** * Factory function for xrp token instances. *