Skip to content

Commit 4ab78c1

Browse files
committed
refactor: remove validation on index = 0 for baseaddress
ticket: WP-7080 TICKET: WP-7080
1 parent 1a8f17c commit 4ab78c1

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

modules/sdk-coin-icp/src/icp.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,6 @@ export class Icp extends BaseCoin {
147147
/**
148148
* Verify that an address belongs to this wallet.
149149
*
150-
* For wallet version 1 (memo-based): The address format is `rootAddress?memoId=X`.
151-
* We extract the root address and verify it against the commonKeychain at index 0.
152-
*
153-
* For wallet version 2+: The address is derived directly from the commonKeychain
154-
* at the specified index.
155-
*
156150
* @param {TssVerifyIcpAddressOptions} params - Verification parameters
157151
* @returns {Promise<boolean>} True if address belongs to wallet
158152
* @throws {InvalidAddressError} If address format is invalid or doesn't match derived address
@@ -166,8 +160,6 @@ export class Icp extends BaseCoin {
166160
}
167161

168162
let addressToVerify = address;
169-
const parsedIndex = typeof params.index === 'string' ? parseInt(params.index, 10) : params.index;
170-
171163
if (walletVersion === 1) {
172164
if (!rootAddress) {
173165
throw new Error('rootAddress is required for wallet version 1');
@@ -182,8 +174,6 @@ export class Icp extends BaseCoin {
182174
);
183175
}
184176
addressToVerify = rootAddress;
185-
} else if (rootAddress && address.toLowerCase() === rootAddress.toLowerCase() && parsedIndex !== 0) {
186-
throw new Error(`Root address verification requires index 0, but got index ${params.index}`);
187177
}
188178

189179
const indexToVerify = walletVersion === 1 ? 0 : params.index;

modules/sdk-coin-icp/test/unit/icp.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -415,20 +415,6 @@ describe('Internet computer', function () {
415415
await basecoin.isWalletAddress(params).should.be.rejectedWith('missing required param keychains');
416416
});
417417

418-
it('should throw error when verifying root address with wrong index', async function () {
419-
const params = {
420-
address: addressVerificationData.rootAddress,
421-
rootAddress: addressVerificationData.rootAddress,
422-
keychains: keychains,
423-
index: 1,
424-
walletVersion: 2,
425-
};
426-
427-
await basecoin
428-
.isWalletAddress(params)
429-
.should.be.rejectedWith('Root address verification requires index 0, but got index 1');
430-
});
431-
432418
it('should handle string index', async function () {
433419
const params = {
434420
address: addressVerificationData.rootAddress,

0 commit comments

Comments
 (0)