Skip to content

feat: Add Authenticator flow for Permissioned Keys#317

Merged
adamfraser merged 7 commits intomainfrom
adam/add-authentications-functions
Jan 29, 2025
Merged

feat: Add Authenticator flow for Permissioned Keys#317
adamfraser merged 7 commits intomainfrom
adam/add-authentications-functions

Conversation

@adamfraser
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@drkatz
Copy link
Copy Markdown

drkatz commented Jan 31, 2025

Thanks @adamfraser for this PR.

Any word on when authenticators for long term (stateful) orders will be supported in Typescript? (#319)

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.

6 participants