Skip to content

Commit

Permalink
test: refactor btc address format stacking with bitcoin rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
janniks committed Jan 22, 2024
1 parent eaffd31 commit 2acac32
Show file tree
Hide file tree
Showing 7 changed files with 268 additions and 829 deletions.
5 changes: 2 additions & 3 deletions src/test-utils/test-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ import { coerceToBuffer, hexToBuffer, runMigrations, timeout } from '@hirosystem
import { MIGRATIONS_DIR } from '../datastore/pg-store';
import { getConnectionArgs } from '../datastore/connection';

/** A (buff 33) signer key of all zeroes, to be used for testing */
export const ZERO_SIGNER_KEY_BYTES = hexToBytes('00'.repeat(33));

export async function migrate(direction: 'up' | 'down') {
await runMigrations(MIGRATIONS_DIR, direction, getConnectionArgs());
}
Expand Down Expand Up @@ -137,6 +134,7 @@ export function accountFromKey(
return { secretKey, pubKey, stxAddr, poxAddr, poxAddrClar, btcAddr, btcTestnetAddr, wif };
}

/** Stand by until prepare phase of next pox cycle (still in current cycle) */
export async function standByForNextPoxCycle(): Promise<CoreRpcPoxInfo> {
const firstPoxInfo = await testEnv.client.getPox();
await standByUntilBurnBlock(firstPoxInfo.next_cycle.prepare_phase_start_block_height);
Expand All @@ -151,6 +149,7 @@ export async function standByForNextPoxCycle(): Promise<CoreRpcPoxInfo> {
return lastPoxInfo;
}

/** Stand by until `current_cycle.id` increases */
export async function standByForPoxCycle(
apiArg?: ApiServer,
clientArg?: StacksCoreRpcClient
Expand Down
Loading

0 comments on commit 2acac32

Please sign in to comment.