Skip to content

Commit 686047a

Browse files
Merge pull request #5529 from BitGo/WIN-4531
chore(sdk-coin-sui): add contractAddress to tokenConfig
2 parents a1a7732 + c230ecb commit 686047a

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

modules/sdk-coin-sui/src/suiToken.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ export class SuiToken extends Sui {
5252
return this.tokenConfig.decimalPlaces;
5353
}
5454

55+
get contractAddress(): string {
56+
return this.tokenConfig.contractAddress;
57+
}
58+
5559
getChain(): string {
5660
return this.tokenConfig.type;
5761
}

modules/sdk-coin-sui/test/unit/suiToken.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,15 @@ describe('Sui Tokens', function () {
2828
suiTokenCoin.coin.should.equal('tsui');
2929
suiTokenCoin.network.should.equal('Testnet');
3030
suiTokenCoin.decimalPlaces.should.equal(6);
31+
suiTokenCoin.packageId.should.equal('0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8');
32+
suiTokenCoin.module.should.equal('deep');
33+
suiTokenCoin.symbol.should.equal('DEEP');
34+
suiTokenCoin.contractAddress.should.equal(
35+
'0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP'
36+
);
37+
const [packageId, module, symbol] = suiTokenCoin.contractAddress.split('::');
38+
packageId.should.equal(suiTokenCoin.packageId);
39+
module.should.equal(suiTokenCoin.module);
40+
symbol.should.equal(suiTokenCoin.symbol);
3141
});
3242
});

modules/statics/src/tokenConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export type SuiTokenConfig = BaseNetworkConfig & {
8484
packageId: string;
8585
module: string;
8686
symbol: string;
87+
contractAddress: string;
8788
};
8889

8990
export type AptTokenConfig = BaseNetworkConfig & {
@@ -520,6 +521,7 @@ const formattedSuiTokens = coins.reduce((acc: SuiTokenConfig[], coin) => {
520521
packageId: coin.packageId,
521522
module: coin.module,
522523
symbol: coin.symbol,
524+
contractAddress: coin.contractAddress,
523525
});
524526
}
525527
return acc;

0 commit comments

Comments
 (0)