-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ts-sdk, explorer): improve object type truncation (#3750)
* feat: improve type truncation * refactor: use format digests for digests * revert: dapp changes * feat: improve type truncation * feat: Add unit test for formatters * fmt --------- Co-authored-by: marc2332 <[email protected]>
- Loading branch information
1 parent
08a371a
commit bf5189f
Showing
7 changed files
with
44 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { describe, expect, it } from 'vitest'; | ||
import { formatType } from '../../src/utils'; | ||
|
||
describe('Formatters', () => { | ||
it('formatType formats correctly', async () => { | ||
const typeClock = '0x2::clock::Clock'; | ||
expect(formatType(typeClock), '0x0000…0002::clock::Clock'); | ||
|
||
const typeCoolCoin = | ||
'0x2::coin::Coin<0x2e0b8d1e74947a2d97121bc7b7981eaff1f32911d15c5e0921fdd08cf61f445b::cool_coin::COOL_COIN>'; | ||
expect( | ||
formatType(typeCoolCoin), | ||
'0x0000…0002::coin::Coin<x2e0b8d…445b::cool_coin::COOL_COIN>', | ||
); | ||
}); | ||
}); |