-
Notifications
You must be signed in to change notification settings - Fork 295
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(docs): Simple e2e tests to use in docs #4596
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
2477f76
docs example test file
catmcgee a92f80f
call view function
catmcgee 22da8b7
updated docs
catmcgee 9f4ff3f
fix some things
catmcgee 00ec6bf
Merge branch 'master' into docs/simple-aztecjs-e2e
catmcgee d433a16
Merge branch 'master' into docs/simple-aztecjs-e2e
catmcgee 0a419ef
include_code macro
catmcgee 0d7ecf8
ci config
catmcgee da9719d
Merge branch 'master' into docs/simple-aztecjs-e2e
catmcgee a9f2699
yarn format
catmcgee 489d102
remove console.log
catmcgee f2e5737
remove console.log
catmcgee 540d3a5
Merge branch 'master' into docs/simple-aztecjs-e2e
catmcgee 76aa6da
prettierignore docs examples
catmcgee 982063b
remove from unused var error
catmcgee e2749ef
remove from prettier
catmcgee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// docs:start:create_account_imports | ||
import { getSchnorrAccount } from '@aztec/accounts/schnorr'; | ||
import { GrumpkinScalar, createPXEClient } from '@aztec/aztec.js'; | ||
// docs:end:create_account_imports | ||
// docs:start:import_contract | ||
import { Contract } from '@aztec/aztec.js'; | ||
// docs:end:import_contract | ||
// docs:start:import_token_contract | ||
import { TokenContract, TokenContractArtifact } from '@aztec/noir-contracts.js/Token'; | ||
|
||
// docs:end:import_token_contract | ||
|
||
// docs:start:define_account_vars | ||
const PXE_URL = process.env.PXE_URL || 'http://localhost:8080'; | ||
const encryptionPrivateKey = GrumpkinScalar.random(); | ||
const signingPrivateKey = GrumpkinScalar.random(); | ||
const pxe = createPXEClient(PXE_URL); | ||
// docs:end:define_account_vars | ||
|
||
// docs:start:create_wallet | ||
const wallet = await getSchnorrAccount(pxe, encryptionPrivateKey, signingPrivateKey).waitDeploy(); | ||
// docs:end:create_wallet | ||
|
||
// docs:start:deploy_contract | ||
const deployedContract = await TokenContract.deploy( | ||
wallet, // wallet instance | ||
wallet.getAddress(), // account | ||
'TokenName', // constructor arg1 | ||
'TokenSymbol', // constructor arg2 | ||
18, | ||
) // constructor arg3 | ||
.send() | ||
.deployed(); | ||
// docs:end:deploy_contract | ||
|
||
// docs:start:get_contract | ||
const contract = await Contract.at(deployedContract.address, TokenContractArtifact, wallet); | ||
// docs:end:get_contract | ||
|
||
// docs:start:send_transaction | ||
const _tx = await contract.methods.transfer(1, wallet).send().wait(); | ||
// docs:end:send_transaction | ||
|
||
// docs:start:call_view_function | ||
const _balance = await contract.methods.getBalance(wallet.getAddress()).view(); | ||
// docs:end:call_view_function |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't structured as a test, but I guess that's fine since it will cause CI to fail if there is an error or anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would still be ideal to have a test block here just saying 'tests aztec.js doc commands'