Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions modules/sdk-coin-starknet/src/starknet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions modules/sdk-coin-starknet/test/unit/starknet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Loading