Skip to content

Commit

Permalink
feat: add pox-4 signer-key to StackingClient methods (#1614)
Browse files Browse the repository at this point in the history
* feat: add pox-4 signer-key to StackingClient methods

* chore: account for missing signer-key

* refactor: remove pox period logic from live 2.1 fork

* refactor: fix signer-key ensure

* refactor: update to latest signer-key order

* feat: helper function to make pox-4 signer signature

* refactor: update to latest signer-sig arg

* refactor: update changes from self-review

* refactor: update signer helpers

* docs: add doc strings

* test: fix test imports

* refactor: update sign method

* chore: pr review updates

* docs: add dynamic fetch

* fix: make signer-sig arg an optional

* fix: make all signer-sig optional

* fix: undo double some

* feat: add max-amount and auth-id params

* feat: add fixture test for pox-4 message hash

* fix: update pox-4 args

* fix: add missing fields to agg-commit

* refactor: update authId to integer

---------

Co-authored-by: janniks <[email protected]>
Co-authored-by: Hank Stoever <[email protected]>
Co-authored-by: Matthew Little <[email protected]>
Co-authored-by: Friedger <[email protected]>
  • Loading branch information
5 people authored Mar 22, 2024
1 parent 4ef1815 commit 3e649de
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 3e649de

Please sign in to comment.