Skip to content

Commit

Permalink
build: fix circular dep issue (#1658)
Browse files Browse the repository at this point in the history
  • Loading branch information
janniks authored Mar 18, 2024
1 parent 20c1aaf commit 349b29a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/transactions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,5 @@ export * from './signer';
export * from './structuredDataSignature';
export { StacksTransaction, deserializeTransaction } from './transaction';
export * from './types';
export * from './message-types';
export * from './utils';
2 changes: 1 addition & 1 deletion packages/transactions/src/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
UNCOMPRESSED_PUBKEY_LENGTH_BYTES,
} from './constants';
import { hash160, hashP2PKH } from './utils';
import { StructuredDataSignature } from './structuredDataSignature';
import { StructuredDataSignature } from './message-types';

/**
* To use secp256k1.signSync set utils.hmacSha256Sync to a function using noble-hashes
Expand Down
8 changes: 8 additions & 0 deletions packages/transactions/src/message-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// todo: this file should hold the type definitions for more message types later
// needed now to fix a circular dependency issue in structuredDataSignature
import { StacksMessageType } from './constants';

export interface StructuredDataSignature {
readonly type: StacksMessageType.StructuredDataSignature;
data: string;
}
6 changes: 1 addition & 5 deletions packages/transactions/src/structuredDataSignature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { bytesToHex, concatBytes, utf8ToBytes } from '@stacks/common';
import { ClarityType, ClarityValue, serializeCV } from './clarity';
import { StacksMessageType } from './constants';
import { signMessageHashRsv, StacksPrivateKey } from './keys';
import { StructuredDataSignature } from './message-types';

// Refer to SIP018 https://github.com/stacksgov/sips/
// > asciiToBytes('SIP018')
Expand Down Expand Up @@ -66,11 +67,6 @@ export function decodeStructuredDataSignature(
};
}

export interface StructuredDataSignature {
readonly type: StacksMessageType.StructuredDataSignature;
data: string;
}

/**
* Signs a structured message (ClarityValue) and a domain (ClarityValue) using a private key.
* The resulting signature along with the original message can be verified using {@link verifyMessageSignature}
Expand Down

0 comments on commit 349b29a

Please sign in to comment.