Skip to content

Commit

Permalink
Merge pull request #5437 from BitGo/fix-apt-fungible-address-to-assetId
Browse files Browse the repository at this point in the history
feat(sdk-coin-apt): change fungibleAddress to assetId
  • Loading branch information
baltiyal authored Jan 29, 2025
2 parents b23f83a + 3c1bd56 commit 96f6801
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions modules/sdk-coin-apt/src/aptToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export class AptToken extends Apt {
return this.tokenConfig.network;
}

get fungibleAssestAddress(): string {
return this.tokenConfig.fungibleAssetAddress;
get assetId(): string {
return this.tokenConfig.assetId;
}

get decimalPlaces(): number {
Expand Down
1 change: 1 addition & 0 deletions modules/sdk-coin-apt/test/unit/aptToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe('Apt Tokens', function () {
aptTokenCoin.name.should.equal('USD Tether');
aptTokenCoin.coin.should.equal('tapt');
aptTokenCoin.network.should.equal('Testnet');
aptTokenCoin.assetId.should.equal('0xd5d0d561493ea2b9410f67da804653ae44e793c2423707d4f11edb2e38192050');
aptTokenCoin.decimalPlaces.should.equal(6);
});
});
18 changes: 9 additions & 9 deletions modules/statics/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export interface SuiCoinConstructorOptions extends AccountConstructorOptions {
}

export interface AptCoinConstructorOptions extends AccountConstructorOptions {
fungibleAssetAddress: string;
assetId: string;
}

type FiatCoinName = `fiat${string}` | `tfiat${string}`;
Expand Down Expand Up @@ -466,13 +466,13 @@ export class SuiCoin extends AccountCoinToken {
*
*/
export class AptCoin extends AccountCoinToken {
public fungibleAssetAddress: string;
public assetId: string;
constructor(options: AptCoinConstructorOptions) {
super({
...options,
});

this.fungibleAssetAddress = options.fungibleAssetAddress;
this.assetId = options.assetId;
}
}

Expand Down Expand Up @@ -2337,7 +2337,7 @@ export function tsuiToken(
* @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 fungibleAssetAddress Fungible asset address of this token
* @param assetId Asset Id of this token i.e. the unique identifier of the token for all tokens - fungible, non-fungible and legacy
* @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.
Expand All @@ -2350,7 +2350,7 @@ export function aptToken(
name: string,
fullName: string,
decimalPlaces: number,
fungibleAssetAddress: string,
assetId: string,
asset: UnderlyingAsset,
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
prefix = '',
Expand All @@ -2364,7 +2364,7 @@ export function aptToken(
name,
fullName,
network,
fungibleAssetAddress,
assetId,
prefix,
suffix,
features,
Expand All @@ -2384,7 +2384,7 @@ export function aptToken(
* @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 fungibleAssetAddress Fungible asset of this token
* @param assetId Asset Id of this token i.e. the unique identifier of the token for all tokens - fungible, non-fungible and legacy
* @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.
Expand All @@ -2397,7 +2397,7 @@ export function taptToken(
name: string,
fullName: string,
decimalPlaces: number,
fungibleAssetAddress: string,
assetId: string,
asset: UnderlyingAsset,
features: CoinFeature[] = AccountCoin.DEFAULT_FEATURES,
prefix = '',
Expand All @@ -2410,7 +2410,7 @@ export function taptToken(
name,
fullName,
decimalPlaces,
fungibleAssetAddress,
assetId,
asset,
features,
prefix,
Expand Down
4 changes: 2 additions & 2 deletions modules/statics/src/coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20525,14 +20525,14 @@ export const coins = CoinMap.fromCoins([
'USD Tether',
6,
'0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b',
UnderlyingAsset['tapt:usdt']
UnderlyingAsset['apt:usdt']
),
taptToken(
'2695e728-96dd-46e6-9d01-bd0fdbe1ff38',
'tapt:usdt',
'USD Tether',
6,
'0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b',
'0xd5d0d561493ea2b9410f67da804653ae44e793c2423707d4f11edb2e38192050',
UnderlyingAsset['tapt:usdt']
),
fiat('3f89b1f5-4ada-49c0-a613-15e484d42426', 'fiatusd', 'US Dollar', Networks.main.fiat, 2, UnderlyingAsset.USD),
Expand Down
4 changes: 2 additions & 2 deletions modules/statics/src/tokenConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export type SuiTokenConfig = BaseNetworkConfig & {
};

export type AptTokenConfig = BaseNetworkConfig & {
fungibleAssetAddress: string;
assetId: string;
};

export interface Tokens {
Expand Down Expand Up @@ -523,7 +523,7 @@ const formattedAptTokens = coins.reduce((acc: AptTokenConfig[], coin) => {
coin: coin.network.type === NetworkType.MAINNET ? 'apt' : 'tapt',
network: coin.network.type === NetworkType.MAINNET ? 'Mainnet' : 'Testnet',
name: coin.fullName,
fungibleAssetAddress: coin.fungibleAssetAddress,
assetId: coin.assetId,
decimalPlaces: coin.decimalPlaces,
});
}
Expand Down

0 comments on commit 96f6801

Please sign in to comment.