diff --git a/modules/sdk-coin-starknet/src/starknet.ts b/modules/sdk-coin-starknet/src/starknet.ts index d89c24c57b..8265fed72f 100644 --- a/modules/sdk-coin-starknet/src/starknet.ts +++ b/modules/sdk-coin-starknet/src/starknet.ts @@ -15,6 +15,7 @@ import { VerifyTransactionOptions, verifyMPCWalletAddress, UnexpectedAddressError, + SignableTransaction, } from '@bitgo/sdk-core'; import { coins, BaseCoin as StaticsBaseCoin } from '@bitgo/statics'; import { createHash, Hash } from 'crypto'; @@ -126,6 +127,14 @@ export class Starknet extends BaseCoin { return {}; } + /** + * Returns true because Starknet's signableHex is already the final 32-byte hash. + * This prevents ecdsaMPCv2 from hashing the payload a second time. + */ + isSignablePreHashed(unsignedTx: SignableTransaction): boolean { + return true; + } + public generateKeyPair(seed?: Buffer): KeyPair { return utils.generateKeyPair(seed); } diff --git a/modules/sdk-coin-starknet/test/unit/starknet.ts b/modules/sdk-coin-starknet/test/unit/starknet.ts index 4552e4be55..efe51772fd 100644 --- a/modules/sdk-coin-starknet/test/unit/starknet.ts +++ b/modules/sdk-coin-starknet/test/unit/starknet.ts @@ -87,6 +87,10 @@ describe('Starknet', function () { it('should return ECDSA as MPC algorithm', function () { basecoin.getMPCAlgorithm().should.equal('ecdsa'); }); + + it('should identify as pre-hashed signable', function () { + basecoin.isSignablePreHashed({} as any).should.equal(true); + }); }); describe('Key pair generation', () => {