Skip to content

Commit

Permalink
feat(nakamoto): add pox-4 signer-key to StackingClient methods (#1614)
Browse files Browse the repository at this point in the history
  • Loading branch information
janniks committed Mar 22, 2024
1 parent 1ac9d0e commit bf48df5
Show file tree
Hide file tree
Showing 6 changed files with 562 additions and 109 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion packages/stacking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,27 @@ const privateKey = 'd48f215481c16cbe6426f8e557df9b78895661971d71735126545abddcd5
// block height at which to stack
const burnBlockHeight = 2000;

// signer key
const signerPrivateKey = makeRandomPrivKey();
const signerKey = getPublicKeyFromPrivate(signerPrivateKey.data);

// Refer to initialization section to create client instance
const signerSignature = client.signPoxSignature({
topic: 'stack-stx',
rewardCycle: await client.getPoxInfo().reward_cycle_id,
poxAddress,
period: cycles,
signerPrivateKey,
});

const stackingResults = await client.stack({
amountMicroStx,
poxAddress,
cycles,
privateKey,
burnBlockHeight,
signerKey,
signerSignature,
});

// {
Expand Down Expand Up @@ -521,7 +535,7 @@ const delegetateCommitResponse = await poolClient.stackAggregationCommitIndexed(

#### Increase existing commitment

The result of this commit transaction will contain the index of the pools reward set entry.
Increase partially stacked STX via the index of the reward set entry.

```typescript
// reward cycle id to commit to
Expand Down
1 change: 1 addition & 0 deletions packages/stacking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"typecheck:watch": "npm run typecheck -- --watch"
},
"dependencies": {
"@noble/hashes": "1.1.5",
"@scure/base": "1.1.1",
"@stacks/common": "^6.10.0",
"@stacks/encryption": "^6.12.1",
Expand Down
Loading

0 comments on commit bf48df5

Please sign in to comment.