Skip to content

Commit 0f3648e

Browse files
committed
chore(statics): add statics fields to common fields
TICKET: WIN-4536
1 parent b6a6624 commit 0f3648e

File tree

4 files changed

+413
-2
lines changed

4 files changed

+413
-2
lines changed

modules/statics/src/account.ts

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export interface HederaCoinConstructorOptions extends AccountConstructorOptions
8181
export interface HederaTokenConstructorOptions extends AccountConstructorOptions {
8282
nodeAccountId: string;
8383
tokenId: string;
84+
contractAddress: string;
8485
}
8586

8687
export interface AlgoCoinConstructorOptions extends AccountConstructorOptions {
@@ -89,10 +90,12 @@ export interface AlgoCoinConstructorOptions extends AccountConstructorOptions {
8990

9091
export interface EosCoinConstructorOptions extends AccountConstructorOptions {
9192
contractName: string;
93+
contractAddress: string;
9294
}
9395

9496
export interface SolCoinConstructorOptions extends AccountConstructorOptions {
9597
tokenAddress: string;
98+
contractAddress: string;
9699
}
97100

98101
export interface AdaCoinConstructorOptions extends AccountConstructorOptions {
@@ -104,12 +107,14 @@ export interface XrpCoinConstructorOptions extends AccountConstructorOptions {
104107
issuerAddress: string;
105108
currencyCode: string;
106109
domain: string;
110+
contractAddress: string;
107111
}
108112

109113
export interface SuiCoinConstructorOptions extends AccountConstructorOptions {
110114
packageId: string;
111115
module: string;
112116
symbol: string;
117+
contractAddress: string;
113118
}
114119

115120
export interface AptCoinConstructorOptions extends AccountConstructorOptions {
@@ -271,6 +276,7 @@ export class HederaCoin extends AccountCoinToken {
271276
export class HederaToken extends AccountCoinToken {
272277
public nodeAccountId: string;
273278
public tokenId: string;
279+
public contractAddress: string;
274280

275281
constructor(options: HederaTokenConstructorOptions) {
276282
super({
@@ -279,6 +285,7 @@ export class HederaToken extends AccountCoinToken {
279285

280286
this.nodeAccountId = options.nodeAccountId;
281287
this.tokenId = options.tokenId;
288+
this.contractAddress = options.contractAddress;
282289
}
283290
}
284291

@@ -315,12 +322,14 @@ export class AlgoCoin extends AccountCoinToken {
315322
*/
316323
export class EosCoin extends AccountCoinToken {
317324
public contractName: string;
325+
public contractAddress: string;
318326
constructor(options: EosCoinConstructorOptions) {
319327
super({
320328
...options,
321329
});
322330

323331
this.contractName = options.contractName;
332+
this.contractAddress = options.contractAddress;
324333
}
325334
}
326335

@@ -332,12 +341,14 @@ export class EosCoin extends AccountCoinToken {
332341
*/
333342
export class SolCoin extends AccountCoinToken {
334343
public tokenAddress: string;
344+
public contractAddress: string;
335345
constructor(options: SolCoinConstructorOptions) {
336346
super({
337347
...options,
338348
});
339349

340350
this.tokenAddress = options.tokenAddress;
351+
this.contractAddress = options.contractAddress;
341352
}
342353
}
343354

@@ -429,6 +440,7 @@ export class XrpCoin extends AccountCoinToken {
429440
public issuerAddress: string;
430441
public currencyCode: string;
431442
public domain: string;
443+
public contractAddress: string;
432444
constructor(options: XrpCoinConstructorOptions) {
433445
super({
434446
...options,
@@ -441,13 +453,15 @@ export class XrpCoin extends AccountCoinToken {
441453
this.domain = options.domain as string;
442454
this.currencyCode = options.currencyCode;
443455
this.issuerAddress = options.issuerAddress;
456+
this.contractAddress = options.contractAddress;
444457
}
445458
}
446459

447460
export class SuiCoin extends AccountCoinToken {
448461
public packageId: string;
449462
public module: string;
450463
public symbol: string;
464+
public contractAddress: string;
451465

452466
constructor(options: SuiCoinConstructorOptions) {
453467
super({
@@ -457,6 +471,7 @@ export class SuiCoin extends AccountCoinToken {
457471
this.packageId = options.packageId;
458472
this.module = options.module;
459473
this.symbol = options.symbol;
474+
this.contractAddress = options.contractAddress;
460475
}
461476
}
462477

@@ -1234,6 +1249,7 @@ export function hederaCoin(
12341249
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
12351250
* @param nodeAccountId node account Id from which the transaction will be sent
12361251
* @param tokenId The unique identifier of this token
1252+
* @param contractAddress Contract address of this token, same as tokenId
12371253
* @param prefix? Optional token prefix. Defaults to empty string
12381254
* @param suffix? Optional token suffix. Defaults to token name.
12391255
* @param network? Optional token network. Defaults to Hedera mainnet.
@@ -1249,6 +1265,7 @@ export function hederaToken(
12491265
asset: UnderlyingAsset,
12501266
nodeAccountId = '0.0.3',
12511267
tokenId: string,
1268+
contractAddress: string,
12521269
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
12531270
prefix = '',
12541271
suffix: string = name.toUpperCase(),
@@ -1263,6 +1280,7 @@ export function hederaToken(
12631280
asset,
12641281
nodeAccountId,
12651282
tokenId,
1283+
contractAddress,
12661284
features,
12671285
prefix,
12681286
suffix,
@@ -1366,6 +1384,7 @@ export function talgoToken(
13661384
* @param fullName Complete human-readable name of the token
13671385
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
13681386
* @param contractName Contract address of this token
1387+
* @param contractAddress Contract address of this token
13691388
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
13701389
* @param prefix? Optional token prefix. Defaults to empty string
13711390
* @param suffix? Optional token suffix. Defaults to token name.
@@ -1379,6 +1398,7 @@ export function eosToken(
13791398
fullName: string,
13801399
decimalPlaces: number,
13811400
contractName: string,
1401+
contractAddress: string,
13821402
asset: UnderlyingAsset,
13831403
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
13841404
prefix = '',
@@ -1393,6 +1413,7 @@ export function eosToken(
13931413
fullName,
13941414
network,
13951415
contractName,
1416+
contractAddress,
13961417
prefix,
13971418
suffix,
13981419
features,
@@ -1412,6 +1433,7 @@ export function eosToken(
14121433
* @param name unique identifier of the token
14131434
* @param fullName Complete human-readable name of the token
14141435
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
1436+
* @param contractName Contract address of this token
14151437
* @param contractAddress Contract address of this token
14161438
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
14171439
* @param prefix? Optional token prefix. Defaults to empty string
@@ -1425,13 +1447,26 @@ export function teosToken(
14251447
fullName: string,
14261448
decimalPlaces: number,
14271449
contractName: string,
1450+
contractAddress: string,
14281451
asset: UnderlyingAsset,
14291452
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
14301453
prefix = '',
14311454
suffix: string = name.toUpperCase(),
14321455
network: AccountNetwork = Networks.test.eos
14331456
) {
1434-
return eosToken(id, name, fullName, decimalPlaces, contractName, asset, features, prefix, suffix, network);
1457+
return eosToken(
1458+
id,
1459+
name,
1460+
fullName,
1461+
decimalPlaces,
1462+
contractName,
1463+
contractAddress,
1464+
asset,
1465+
features,
1466+
prefix,
1467+
suffix,
1468+
network
1469+
);
14351470
}
14361471

14371472
/**
@@ -1442,6 +1477,7 @@ export function teosToken(
14421477
* @param fullName Complete human-readable name of the token
14431478
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
14441479
* @param tokenAddress Token address of this token
1480+
* @param contractAddress Contract address of this token
14451481
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
14461482
* @param prefix? Optional token prefix. Defaults to empty string
14471483
* @param suffix? Optional token suffix. Defaults to token name.
@@ -1455,6 +1491,7 @@ export function solToken(
14551491
fullName: string,
14561492
decimalPlaces: number,
14571493
tokenAddress: string,
1494+
contractAddress: string,
14581495
asset: UnderlyingAsset,
14591496
features: CoinFeature[] = [...AccountCoin.DEFAULT_FEATURES, CoinFeature.REQUIRES_RESERVE],
14601497
prefix = '',
@@ -1469,6 +1506,7 @@ export function solToken(
14691506
fullName,
14701507
network,
14711508
tokenAddress,
1509+
contractAddress,
14721510
prefix,
14731511
suffix,
14741512
features,
@@ -1501,13 +1539,26 @@ export function tsolToken(
15011539
fullName: string,
15021540
decimalPlaces: number,
15031541
tokenAddress: string,
1542+
contractAddress: string,
15041543
asset: UnderlyingAsset,
15051544
features: CoinFeature[] = [...AccountCoin.DEFAULT_FEATURES, CoinFeature.REQUIRES_RESERVE],
15061545
prefix = '',
15071546
suffix: string = name.toUpperCase(),
15081547
network: AccountNetwork = Networks.test.sol
15091548
) {
1510-
return solToken(id, name, fullName, decimalPlaces, tokenAddress, asset, features, prefix, suffix, network);
1549+
return solToken(
1550+
id,
1551+
name,
1552+
fullName,
1553+
decimalPlaces,
1554+
tokenAddress,
1555+
contractAddress,
1556+
asset,
1557+
features,
1558+
prefix,
1559+
suffix,
1560+
network
1561+
);
15111562
}
15121563

15131564
/**
@@ -2138,6 +2189,7 @@ export function tberaErc20(
21382189
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
21392190
* @param issuerAddress: The address of the issuer of the token,
21402191
* @param currencyCode The token symbol. Example: USD, BTC, ETH, etc.
2192+
* @param contractAddress Contract address of this token formed with `issuerAddress::currencyCode`
21412193
* @param domain? the domain of the issuer of the token,
21422194
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
21432195
* @param prefix? Optional token prefix. Defaults to empty string
@@ -2153,6 +2205,7 @@ export function xrpToken(
21532205
decimalPlaces: number,
21542206
issuerAddress: string,
21552207
currencyCode: string,
2208+
contractAddress: string,
21562209
domain = '',
21572210
asset: UnderlyingAsset,
21582211
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
@@ -2169,6 +2222,7 @@ export function xrpToken(
21692222
network,
21702223
issuerAddress,
21712224
currencyCode,
2225+
contractAddress,
21722226
domain,
21732227
prefix,
21742228
suffix,
@@ -2191,6 +2245,7 @@ export function xrpToken(
21912245
* @param decimalPlaces Number of decimal places this token supports (divisibility exponent)
21922246
* @param issuerAddress: The address of the issuer of the token,
21932247
* @param currencyCode The token symbol. Example: USD, BTC, ETH, etc.
2248+
* @param contractAddress Contract address of this token formed with `issuerAddress::currencyCode`
21942249
* @param domain? the domain of the issuer of the token,
21952250
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
21962251
* @param prefix? Optional token prefix. Defaults to empty string
@@ -2205,6 +2260,7 @@ export function txrpToken(
22052260
decimalPlaces: number,
22062261
issuerAddress: string,
22072262
currencyCode: string,
2263+
contractAddress: string,
22082264
domain = '',
22092265
asset: UnderlyingAsset,
22102266
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
@@ -2219,6 +2275,7 @@ export function txrpToken(
22192275
decimalPlaces,
22202276
issuerAddress,
22212277
currencyCode,
2278+
contractAddress,
22222279
domain,
22232280
asset,
22242281
features,
@@ -2238,6 +2295,7 @@ export function txrpToken(
22382295
* @param packageId PackageId of this token
22392296
* @param module The module of the package with id `packageId`
22402297
* @param symbol Identifies the coin defined in the module `module` of the package with id `packageId`
2298+
* @param contractAddress Contract address of this token formed with `packageId::module::symbol`
22412299
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
22422300
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES
22432301
* @param prefix? Optional token prefix. Defaults to empty string
@@ -2253,6 +2311,7 @@ export function suiToken(
22532311
packageId: string,
22542312
module: string,
22552313
symbol: string,
2314+
contractAddress: string,
22562315
asset: UnderlyingAsset,
22572316
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
22582317
prefix = '',
@@ -2269,6 +2328,7 @@ export function suiToken(
22692328
packageId,
22702329
module,
22712330
symbol,
2331+
contractAddress,
22722332
prefix,
22732333
suffix,
22742334
features,
@@ -2291,6 +2351,7 @@ export function suiToken(
22912351
* @param packageId PackageId of this token
22922352
* @param module The module of the package with id `packageId`
22932353
* @param symbol Identifies the coin defined in the module `module` of the package with id `packageId`
2354+
* @param contractAddress Contract address of this token formed with `packageId::module::symbol`
22942355
* @param asset Asset which this coin represents. This is the same for both mainnet and testnet variants of a coin.
22952356
* @param features? Features of this coin. Defaults to the DEFAULT_FEATURES
22962357
* @param prefix? Optional token prefix. Defaults to empty string
@@ -2307,6 +2368,7 @@ export function tsuiToken(
23072368
packageId: string,
23082369
module: string,
23092370
symbol: string,
2371+
contractAddress: string,
23102372
asset: UnderlyingAsset,
23112373
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
23122374
prefix = '',
@@ -2322,6 +2384,7 @@ export function tsuiToken(
23222384
packageId,
23232385
module,
23242386
symbol,
2387+
contractAddress,
23252388
asset,
23262389
features,
23272390
prefix,

0 commit comments

Comments
 (0)