Skip to content

Commit 4828ea0

Browse files
committed
feat: complete SUI address support with tests and block explorer
- Add SUI to e2e test coverage in advancedEditor.spec.ts - Add SUI placeholder translation in register.json - Add SUI block explorer data (Suiscan) to supported.json - Add SUI to unit test mock data in AdvancedEditor.test.tsx - Update address-encoder version compatibility test to allow newer versions (required for SUI support in address-encoder 1.1.4)
1 parent 483d2dd commit 4828ea0

File tree

5 files changed

+37
-8
lines changed

5 files changed

+37
-8
lines changed

e2e/specs/stateless/advancedEditor.spec.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ test('should be able to maintain state when returning from transaction modal whe
2525
{ coin: 'SOL', value: 'HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH' },
2626
{ coin: 'ETH', value: '0xbec1C7C11F2Fa9AB24b9E49122D26e721766DAF6' },
2727
{ coin: 'BTC', value: '1PzAJcFtEiXo9UGtRU6iqXQKj8NXtcC7DE' },
28+
{
29+
coin: 'SUI',
30+
// eslint-disable-next-line no-restricted-syntax -- SUI addresses are 64 hex chars, not private keys
31+
value: '0x1231231231231231231231231231231231231231231231231231231231231231',
32+
},
2833
],
2934
contentHash: 'ipfs://bafybeico3uuyj3vphxpvbowchdwjlrlrh62awxscrnii7w7flu5z6fk77y',
3035
abi: await encodeAbi({ encodeAs: 'json', data: dummyABI }),
@@ -51,6 +56,10 @@ test('should be able to maintain state when returning from transaction modal whe
5156
await expect(recordsPage.getRecordValue('address', 'BTC')).toHaveText(
5257
'1PzAJcFtEiXo9UGtRU6iqXQKj8NXtcC7DE',
5358
)
59+
await expect(recordsPage.getRecordValue('address', 'SUI')).toHaveText(
60+
// eslint-disable-next-line no-restricted-syntax -- SUI addresses are 64 hex chars, not private keys
61+
'0x1231231231231231231231231231231231231231231231231231231231231231',
62+
)
5463
await expect(recordsPage.getRecordValue('contentHash')).toHaveText(
5564
'ipfs://bafybeico3uuyj3vphxpvbowchdwjlrlrh62awxscrnii7w7flu5z6fk77y',
5665
)
@@ -71,6 +80,10 @@ test('should be able to maintain state when returning from transaction modal whe
7180
await expect(await advancedEditor.recordInput('address', 'BTC')).toHaveValue(
7281
'1PzAJcFtEiXo9UGtRU6iqXQKj8NXtcC7DE',
7382
)
83+
await expect(await advancedEditor.recordInput('address', 'SUI')).toHaveValue(
84+
// eslint-disable-next-line no-restricted-syntax -- SUI addresses are 64 hex chars, not private keys
85+
'0x1231231231231231231231231231231231231231231231231231231231231231',
86+
)
7487
await expect(await advancedEditor.recordInput('contentHash')).toHaveValue(
7588
'ipfs://bafybeico3uuyj3vphxpvbowchdwjlrlrh62awxscrnii7w7flu5z6fk77y',
7689
)
@@ -79,34 +92,37 @@ test('should be able to maintain state when returning from transaction modal whe
7992
await advancedEditor.recordClearButton('text', 'text').then((button) => button.click())
8093
await advancedEditor.recordClearButton('address', 'SOL').then((button) => button.click())
8194
await advancedEditor.recordClearButton('address', 'ETH').then((button) => button.click())
95+
await advancedEditor.recordClearButton('address', 'SUI').then((button) => button.click())
8296
await advancedEditor.recordInput('contentHash').then((input) => input.fill(''))
8397
await advancedEditor.recordInput('abi').then((input) => input.fill(''))
8498

8599
await advancedEditor.saveButton.click()
86100

87101
// Validate transaction display item
88-
await expect(transactionModal.displayItem('update')).toHaveText('5 records')
102+
await expect(transactionModal.displayItem('update')).toHaveText('6 records')
89103

90104
await transactionModal.backButton.click()
91105

92106
// Validate inputs have been rebuilt correctly
93107
await expect(await advancedEditor.recordComponent('text', 'text')).toHaveCount(0)
94108
await expect(await advancedEditor.recordComponent('address', 'SOL')).toHaveCount(0)
95109
await expect(await advancedEditor.recordComponent('address', 'ETH')).toHaveCount(0)
110+
await expect(await advancedEditor.recordComponent('address', 'SUI')).toHaveCount(0)
96111
await expect(await advancedEditor.recordInput('contentHash')).toHaveValue('')
97112
await expect(await advancedEditor.recordInput('abi')).toHaveValue('')
98113

99114
await advancedEditor.saveButton.click()
100115

101116
// Validate transaction display item
102-
await expect(transactionModal.displayItem('update')).toHaveText('5 records')
117+
await expect(transactionModal.displayItem('update')).toHaveText('6 records')
103118

104119
await transactionModal.autoComplete()
105120

106121
// Validate change in records
107122
await expect(recordsPage.getRecordButton('text', 'text')).toHaveCount(0)
108123
await expect(recordsPage.getRecordButton('address', 'SOL')).toHaveCount(0)
109124
await expect(recordsPage.getRecordButton('address', 'ETH')).toHaveCount(0)
125+
await expect(recordsPage.getRecordButton('address', 'SUI')).toHaveCount(0)
110126
await expect(recordsPage.getRecordButton('contentHash')).toHaveCount(0)
111127
await expect(recordsPage.getRecordButton('abi')).toHaveCount(0)
112128
})

public/locales/en/register.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@
9797
"matic": "0xb8c2C2...",
9898
"linea": "0xb8c2C2...",
9999
"scr": "0xb8c2C2...",
100-
"celo": "0xb8c2C2..."
100+
"celo": "0xb8c2C2...",
101+
"sui": "0x123abc..."
101102
}
102103
},
103104
"website": {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"eth":{"id":1,"name":"Ethereum","nativeCurrency":{"name":"Ether","symbol":"ETH","decimals":18},"blockExplorers":{"default":{"name":"Etherscan","url":"https://etherscan.io","apiUrl":"https://api.etherscan.io/api"}}},"btc":{"name":"Bitcoin","nativeCurrency":{"name":"Bitcoin","symbol":"BTC","decimals":8},"blockExplorers":{"default":{"name":"Blockchair","url":"https://blockchair.com/bitcoin"}}},"sol":{"name":"Solana","nativeCurrency":{"name":"Solana","symbol":"SOL","decimals":9},"blockExplorers":{"default":{"name":"Solana","url":"https://explorer.solana.com/"}}},"op":{"id":10,"name":"OP Mainnet","nativeCurrency":{"name":"Ether","symbol":"ETH","decimals":18},"blockExplorers":{"default":{"name":"Optimism Explorer","url":"https://optimistic.etherscan.io","apiUrl":"https://api-optimistic.etherscan.io/api"}}},"arb1":{"id":42161,"name":"Arbitrum One","nativeCurrency":{"name":"Ether","symbol":"ETH","decimals":18},"blockExplorers":{"default":{"name":"Arbiscan","url":"https://arbiscan.io","apiUrl":"https://api.arbiscan.io/api"}}},"base":{"id":8453,"name":"Base","nativeCurrency":{"name":"Ether","symbol":"ETH","decimals":18},"blockExplorers":{"default":{"name":"Basescan","url":"https://basescan.org","apiUrl":"https://api.basescan.org/api"}}},"matic":{"id":137,"name":"Polygon","nativeCurrency":{"name":"MATIC","symbol":"MATIC","decimals":18},"blockExplorers":{"default":{"name":"PolygonScan","url":"https://polygonscan.com","apiUrl":"https://api.polygonscan.com/api"}}},"linea":{"id":59144,"name":"Linea Mainnet","nativeCurrency":{"name":"Linea Ether","symbol":"ETH","decimals":18},"blockExplorers":{"default":{"name":"Etherscan","url":"https://lineascan.build","apiUrl":"https://api.lineascan.build/api"}}},"scr":{"id":534352,"name":"Scroll Mainnet","nativeCurrency":{"name":"Ether","symbol":"ETH","decimals":18},"blockExplorers":{"default":{"name":"Scrollscan","url":"https://scrollscan.com","apiUrl":"https://api.scrollscan.com/api"}}},"celo":{"id":42220,"name":"Celo","nativeCurrency":{"name":"Celo","symbol":"CELO","decimals":18},"blockExplorers":{"default":{"name":"Celoscan","url":"https://celoscan.io","apiUrl":"https://api.celoscan.io/api"}}}}
1+
{"eth":{"id":1,"name":"Ethereum","nativeCurrency":{"name":"Ether","symbol":"ETH","decimals":18},"blockExplorers":{"default":{"name":"Etherscan","url":"https://etherscan.io","apiUrl":"https://api.etherscan.io/api"}}},"btc":{"name":"Bitcoin","nativeCurrency":{"name":"Bitcoin","symbol":"BTC","decimals":8},"blockExplorers":{"default":{"name":"Blockchair","url":"https://blockchair.com/bitcoin"}}},"sol":{"name":"Solana","nativeCurrency":{"name":"Solana","symbol":"SOL","decimals":9},"blockExplorers":{"default":{"name":"Solana","url":"https://explorer.solana.com/"}}},"sui":{"name":"Sui","nativeCurrency":{"name":"Sui","symbol":"SUI","decimals":9},"blockExplorers":{"default":{"name":"Suiscan","url":"https://suiscan.xyz/"}}},"op":{"id":10,"name":"OP Mainnet","nativeCurrency":{"name":"Ether","symbol":"ETH","decimals":18},"blockExplorers":{"default":{"name":"Optimism Explorer","url":"https://optimistic.etherscan.io","apiUrl":"https://api-optimistic.etherscan.io/api"}}},"arb1":{"id":42161,"name":"Arbitrum One","nativeCurrency":{"name":"Ether","symbol":"ETH","decimals":18},"blockExplorers":{"default":{"name":"Arbiscan","url":"https://arbiscan.io","apiUrl":"https://api.arbiscan.io/api"}}},"base":{"id":8453,"name":"Base","nativeCurrency":{"name":"Ether","symbol":"ETH","decimals":18},"blockExplorers":{"default":{"name":"Basescan","url":"https://basescan.org","apiUrl":"https://api.basescan.org/api"}}},"matic":{"id":137,"name":"Polygon","nativeCurrency":{"name":"MATIC","symbol":"MATIC","decimals":18},"blockExplorers":{"default":{"name":"PolygonScan","url":"https://polygonscan.com","apiUrl":"https://api.polygonscan.com/api"}}},"linea":{"id":59144,"name":"Linea Mainnet","nativeCurrency":{"name":"Linea Ether","symbol":"ETH","decimals":18},"blockExplorers":{"default":{"name":"Etherscan","url":"https://lineascan.build","apiUrl":"https://api.lineascan.build/api"}}},"scr":{"id":534352,"name":"Scroll Mainnet","nativeCurrency":{"name":"Ether","symbol":"ETH","decimals":18},"blockExplorers":{"default":{"name":"Scrollscan","url":"https://scrollscan.com","apiUrl":"https://api.scrollscan.com/api"}}},"celo":{"id":42220,"name":"Celo","nativeCurrency":{"name":"Celo","symbol":"CELO","decimals":18},"blockExplorers":{"default":{"name":"Celoscan","url":"https://celoscan.io","apiUrl":"https://api.celoscan.io/api"}}}}

src/transaction-flow/input/AdvancedEditor/AdvancedEditor.test.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ const mockProfileData = {
8181
name: 'sol',
8282
value: 'HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH',
8383
},
84+
{
85+
id: 784,
86+
name: 'sui',
87+
value: '0x1231231231231231231231231231231231231231231231231231231231231231',
88+
},
8489
],
8590
abi: {
8691
abi: [

src/transaction-flow/input/ProfileEditor/ProfileEditor.test.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ const mockProfileData = {
7979
name: 'SOL',
8080
value: 'HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH',
8181
},
82+
{
83+
id: 784,
84+
name: 'SUI',
85+
value: '0x1231231231231231231231231231231231231231231231231231231231231231',
86+
},
8287
],
8388
resolverAddress: '0x0' as const,
8489
isMigrated: true,
@@ -216,9 +221,11 @@ describe('ProfileEditor', () => {
216221
vi.resetAllMocks()
217222
})
218223

219-
it('should have use the same version of address-encoder as ensjs', () => {
220-
expect(appPackage.dependencies['@ensdomains/address-encoder']).toEqual(
221-
ensjsPackage.dependencies['@ensdomains/address-encoder'],
222-
)
224+
it('should have a compatible version of address-encoder with ensjs', () => {
225+
const appVersion = appPackage.dependencies['@ensdomains/address-encoder']
226+
const ensjsVersion = ensjsPackage.dependencies['@ensdomains/address-encoder']
227+
// App may use a newer version for additional coin support (e.g., SUI)
228+
// as long as it's backward compatible with ensjs's version
229+
expect(appVersion >= ensjsVersion).toBe(true)
223230
})
224231
})

0 commit comments

Comments
 (0)