Skip to content

Commit a1a7732

Browse files
Merge pull request #5530 from BitGo/WIN-4533-alter-tokenId-for-hbar
chore(sdk-coin-hbar): use contractAddress to form tokenId
2 parents fbd8b18 + 6ca864a commit a1a7732

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

modules/sdk-coin-hbar/src/hbarToken.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ export class HbarToken extends Hbar {
4040
return this.tokenConfig.decimalPlaces;
4141
}
4242

43+
get nodeAccountId(): string {
44+
return this.tokenConfig.nodeAccountId;
45+
}
46+
47+
get tokenId(): string {
48+
return this.tokenConfig.tokenId;
49+
}
50+
51+
get contractAddress(): string {
52+
return this.tokenConfig.contractAddress;
53+
}
54+
4355
getChain(): string {
4456
return this.tokenConfig.type;
4557
}

modules/sdk-coin-hbar/test/unit/hbarToken.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,9 @@ describe('Hedera Hashgraph Token', function () {
2626
token.coin.should.equal('thbar');
2727
token.network.should.equal('Testnet');
2828
token.decimalPlaces.should.equal(6);
29+
token.nodeAccountId.should.equal('0.0.3');
30+
token.tokenId.should.equal('0.0.13078');
31+
token.contractAddress.should.equal('0.0.13078');
32+
token.tokenId.should.equal(token.contractAddress);
2933
});
3034
});

modules/statics/src/account.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ export class HederaToken extends AccountCoinToken {
284284
});
285285

286286
this.nodeAccountId = options.nodeAccountId;
287-
this.tokenId = options.tokenId;
287+
this.tokenId = options.contractAddress;
288288
this.contractAddress = options.contractAddress;
289289
}
290290
}

modules/statics/src/tokenConfig.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ export type OfcTokenConfig = BaseTokenConfig & {
6767
isFiat: boolean;
6868
};
6969

70-
export type HbarTokenConfig = BaseNetworkConfig;
70+
export type HbarTokenConfig = BaseNetworkConfig & {
71+
nodeAccountId: string;
72+
tokenId: string;
73+
contractAddress: string;
74+
};
7175

7276
export type XrpTokenConfig = BaseNetworkConfig & {
7377
issuerAddress: string;
@@ -451,6 +455,9 @@ const formattedHbarTokens = coins.reduce((acc: HbarTokenConfig[], coin) => {
451455
network: coin.network.type === NetworkType.MAINNET ? 'Mainnet' : 'Testnet',
452456
name: coin.fullName,
453457
decimalPlaces: coin.decimalPlaces,
458+
nodeAccountId: coin.nodeAccountId,
459+
tokenId: coin.tokenId,
460+
contractAddress: coin.contractAddress,
454461
});
455462
}
456463
return acc;

0 commit comments

Comments
 (0)