From f508e14deab6cd9902f96b01ed6d02c80bfa5c6a Mon Sep 17 00:00:00 2001 From: Vibhav Simha G Date: Fri, 4 Sep 2026 13:50:21 +0530 Subject: [PATCH] fix(sdk-coin-sui): guard precomputedMaterial shape in signRecoveryTx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WRW passes openSSLBytes as the second positional arg to recover() for EVM coins. SUI's recoverConsolidations PR added precomputedMaterial as the second arg, causing the ArrayBuffer to be consumed as signing material — resulting in JSON.parse(undefined) at runtime. Ticket: WCI-1439 --- modules/sdk-coin-sui/src/sui.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/sdk-coin-sui/src/sui.ts b/modules/sdk-coin-sui/src/sui.ts index 082ed8afa5..32739d168a 100644 --- a/modules/sdk-coin-sui/src/sui.ts +++ b/modules/sdk-coin-sui/src/sui.ts @@ -12,6 +12,7 @@ import { EddsaSigningMaterial, Environments, getEddsaSigningMaterial as sharedGetEddsaSigningMaterial, + isEddsaSigningMaterial, KeyPair, MPCAlgorithm, MPCRecoveryOptions, @@ -695,8 +696,9 @@ export class Sui extends BaseCoin { const backupKey = params.backupKey.replace(/\s/g, ''); const bitgoKey = params.bitgoKey.replace(/\s/g, ''); - const signingMaterial = - precomputedMaterial ?? (await this.getEddsaSigningMaterial(userKey, params.walletPassphrase)); + const signingMaterial = isEddsaSigningMaterial(precomputedMaterial) + ? precomputedMaterial + : await this.getEddsaSigningMaterial(userKey, params.walletPassphrase); if (signingMaterial.version === 'v2') { const signature = await this.signSuiMpcV2Recovery({