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

Hotfix/tx sim #1930

Merged
merged 5 commits into from
Mar 21, 2023
Merged

Hotfix/tx sim #1930

merged 5 commits into from
Mar 21, 2023

Conversation

dhruvkelawala
Copy link
Contributor

@dhruvkelawala dhruvkelawala commented Mar 21, 2023

Issue / feature description

Add New Transaction Simulation Spinner and fix nonce issue

Checklist

  • Rebased to the last commit of the target branch (or merged)
  • Code self-reviewed
  • Code self-tested
  • Tests updated (if needed)
  • All tests are passing locally

@dhruvkelawala dhruvkelawala changed the base branch from develop to main March 21, 2023 13:01
Comment on lines -17 to -51
export const handleTransactionMessage: HandleMessage<
TransactionMessage
> = async ({ msg, background: { wallet, actionQueue }, respond: respond }) => {
switch (msg.type) {
case "EXECUTE_TRANSACTION": {
const { meta } = await actionQueue.push({
type: "TRANSACTION",
payload: msg.data,
})
return respond({
type: "EXECUTE_TRANSACTION_RES",
data: { actionHash: meta.hash },
})
}

case "ESTIMATE_TRANSACTION_FEE": {
const selectedAccount = await wallet.getSelectedAccount()
const starknetAccount = await wallet.getSelectedStarknetAccount()
const transactions = msg.data

if (!selectedAccount) {
throw Error("no accounts")
export const handleTransactionMessage: HandleMessage<TransactionMessage> =
async ({ msg, background: { wallet, actionQueue }, respond: respond }) => {
switch (msg.type) {
case "EXECUTE_TRANSACTION": {
const { meta } = await actionQueue.push({
type: "TRANSACTION",
payload: msg.data,
})
return respond({
type: "EXECUTE_TRANSACTION_RES",
data: { actionHash: meta.hash },
})
}
try {
let txFee = "0",
maxTxFee = "0",
accountDeploymentFee: string | undefined,
maxADFee: string | undefined

if (
selectedAccount.needsDeploy &&
!(await isAccountDeployed(
selectedAccount,
starknetAccount.getClassAt,
))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure why but the linter is auto-formatting code on commit. There hasn't been so many changes

signature,
nonce,
version,
const nonce = await starknetAccount.getNonce()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the main change in this file

@github-actions
Copy link

Builds for local testing

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

0.0% 0.0% Coverage
2.1% 2.1% Duplication

@dhruvkelawala dhruvkelawala merged commit b3611d0 into main Mar 21, 2023
@dhruvkelawala dhruvkelawala deleted the hotfix/tx-sim-2 branch March 21, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants