Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Authenticator flow for Permissioned Keys #317

Merged
merged 7 commits into from
Jan 29, 2025

Conversation

adamfraser
Copy link
Contributor

Adds functionality to enable signing transactions using the authenticator flow on the protocol.

  • Helper function to add an authenticator
  • Helper function to remove an authenticator
  • Changes signing flow to accept an optional Autheticator and Wallet to sign a transaction with
  • E2E example showing how to add an Authenticator and place a transaction with an authenticated wallet

@adamfraser adamfraser requested a review from a team as a code owner January 27, 2025 20:33
jayy04
jayy04 previously approved these changes Jan 27, 2025
ruixhuang
ruixhuang previously approved these changes Jan 27, 2025
@adamfraser adamfraser dismissed stale reviews from ruixhuang and jayy04 via d050d77 January 28, 2025 16:50
@adamfraser adamfraser force-pushed the adam/add-authentications-functions branch from d050d77 to e0d1c76 Compare January 28, 2025 17:24
@adamfraser adamfraser changed the title Add Authenticator flow for Permissioned Keys Add Authenticator flow for Permissioned Keys Jan 28, 2025
@adamfraser adamfraser force-pushed the adam/add-authentications-functions branch from 834cce5 to ca2c897 Compare January 28, 2025 21:00
@adamfraser adamfraser changed the title Add Authenticator flow for Permissioned Keys feat: Add Authenticator flow for Permissioned Keys Jan 28, 2025
const wallet1 = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC, BECH32_PREFIX);
const wallet2 = await LocalWallet.fromMnemonic(DYDX_TEST_MNEMONIC_2, BECH32_PREFIX);

const network = Network.staging();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be set to testnet?

// Change second wallet pubkey
// Add an authenticator to allow wallet2 to place orders
console.log("** Adding authenticator **");
await addAuthenticator(client, subaccount1, wallet2.pubKey!.value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some delay here, as it seems it goes to fast between adding and doing the getAuthenticators step after that

await sleep(500);

@adamfraser adamfraser merged commit bdbab8c into main Jan 29, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants