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

refactor(AuthWit): Collapse creating AuthWit syntax on AztecJS #4821

Closed
Tracked by #2199
rahul-kothari opened this issue Feb 28, 2024 · 0 comments · Fixed by #5132
Closed
Tracked by #2199

refactor(AuthWit): Collapse creating AuthWit syntax on AztecJS #4821

rahul-kothari opened this issue Feb 28, 2024 · 0 comments · Fixed by #5132
Assignees

Comments

@rahul-kothari
Copy link
Contributor

rahul-kothari commented Feb 28, 2024

Creating AuthWit on AztecJS today looks like:

 const action = asset
          .withWallet(wallets[1])
          .methods.transfer(accounts[0].address, accounts[1].address, amount, nonce);

const messageHash = computeAuthWitMessageHash(accounts[1].address, action.request());

const witness = await wallets[0].createAuthWitness(messageHash);

await wallets[1].addAuthWitness(witness);
  1. Verbose
  2. You need to mention which wallet several times. This is error prone.

Perhaps collapse this into

const action = asset.withwallet().methods......computeWitness(wallet).addAuthWitness()

or something similar

@github-project-automation github-project-automation bot moved this to Todo in A3 Feb 28, 2024
@LHerskind LHerskind changed the title Collapse creating AuthWit syntax on AztecJS refactor(AuthWit): Collapse creating AuthWit syntax on AztecJS Mar 8, 2024
@LHerskind LHerskind added this to the Developer Facing Aztec.nr milestone Mar 8, 2024
@LHerskind LHerskind self-assigned this Mar 11, 2024
LHerskind added a commit that referenced this issue Mar 18, 2024
Fixes #4821 and #5075. 

Renames the functions related to `AuthWit` to use a similar naming scheme.

Extends the `createAuthWit`, `setPublicAuthWit` and `cancelAuthWit` functions such that they can now take an object 
```typescript
{
  caller: AztecAddress;
  action: ContractFunctionInteraction | FunctionCall;
},
```

Allowing for adding a new authwit more simply.

Example:
```typescript
await user1Wallet.createAuthWit({
  caller: l2Bridge.address,
  action: l2Token.methods.burn(ownerAddress, withdrawAmount, nonce)
});
```
@github-project-automation github-project-automation bot moved this from Todo to Done in A3 Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants