Skip to content

Commit

Permalink
updated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
vadiminc committed Jul 25, 2023
1 parent 7c9babe commit f5bd2dd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/example-02/example-complex.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function main() {
await fsp.writeFile(getKeySharesFilePath(2), keyShares.toJson(), { encoding: 'utf-8' });

// Now save to key shares file encrypted shares and validator public key
await keyShares.update({ publicKey });
await keyShares.update({ ownerAddress: TEST_OWNER_ADDRESS, ownerNonce: TEST_OWNER_NONCE, publicKey });
await fsp.writeFile(getKeySharesFilePath(3), keyShares.toJson(), { encoding: 'utf-8' });

// Build shares from operator IDs and public keys
Expand Down
2 changes: 1 addition & 1 deletion examples/example-02/example-typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function main() {
operatorKey,
}));

keyShares.update({ operators, publicKey });
keyShares.update({ ownerAddress: TEST_OWNER_ADDRESS, ownerNonce: TEST_OWNER_NONCE, operators, publicKey });

// 3. Save it with version only and with no any data.
await fsp.writeFile(getKeySharesFilePath(2), keyShares.toJson(), { encoding: 'utf-8' });
Expand Down
7 changes: 6 additions & 1 deletion examples/react-app/src/UserFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ function UserFlow() {
console.log('Payload ready');

// Keyshares
keyShares.update({ operators, publicKey });
keyShares.update({
ownerAddress: TEST_OWNER_ADDRESS,
ownerNonce: TEST_OWNER_NONCE,
operators,
publicKey
});
setKeyShares(keyShares.toJson());
console.log('KeyShares ready');
setStep(STEPS.FINISH);
Expand Down
7 changes: 6 additions & 1 deletion examples/server-worker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ app.post('/key-shares/generate', async (req: Request, res: Response) => {

// Build final web3 transaction payload and update keyshares file with payload data
const keyShares = new KeyShares();
keyShares.update({ operators, publicKey });
keyShares.update({
ownerAddress: owner_address,
ownerNonce: nonce,
operators,
publicKey
});

// The cluster owner address
await keyShares.buildPayload({
Expand Down

0 comments on commit f5bd2dd

Please sign in to comment.