Skip to content

Commit e31371c

Browse files
feat(sdk-coin-starknet): add isSignablePreHashed to starknet
CECHO-1376 TICKET: CECHO-1376
1 parent 80bc267 commit e31371c

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
VerifyTransactionOptions,
1616
verifyMPCWalletAddress,
1717
UnexpectedAddressError,
18+
SignableTransaction,
1819
} from '@bitgo/sdk-core';
1920
import { coins, BaseCoin as StaticsBaseCoin } from '@bitgo/statics';
2021
import { createHash, Hash } from 'crypto';
@@ -126,6 +127,14 @@ export class Starknet extends BaseCoin {
126127
return {};
127128
}
128129

130+
/**
131+
* Returns true because Starknet's signableHex is already the final 32-byte hash.
132+
* This prevents ecdsaMPCv2 from hashing the payload a second time.
133+
*/
134+
isSignablePreHashed(unsignedTx: SignableTransaction): boolean {
135+
return true;
136+
}
137+
129138
public generateKeyPair(seed?: Buffer): KeyPair {
130139
return utils.generateKeyPair(seed);
131140
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ describe('Starknet', function () {
8787
it('should return ECDSA as MPC algorithm', function () {
8888
basecoin.getMPCAlgorithm().should.equal('ecdsa');
8989
});
90+
91+
it('should identify as pre-hashed signable', function () {
92+
basecoin.isSignablePreHashed({} as any).should.equal(true);
93+
});
9094
});
9195

9296
describe('Key pair generation', () => {

0 commit comments

Comments
 (0)