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

Debug / Failing E2E tests #841

Draft
wants to merge 8 commits into
base: v2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions src/controllers/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1257,9 +1257,19 @@ export class MainController extends EventEmitter {
)
)
}

const signer = await this.keystore.getSigner(feePayerKey.addr, feePayerKey.type)
if (signer.init) signer.init(this.#externalSignerControllers[feePayerKey.type])

const storage = JSON.stringify(await this.#storage.get('keystoreKeys', 'default'))
const storageKeystoreSecrets = JSON.stringify(await this.#storage.get('keystoreSecrets', 'default'))



throw new Error(
`feePayerKeyAddr: ${feePayerKey.addr}, feePayerKeyType: ${feePayerKey.type}, signerKeyAddr ${signer.key.addr}, walletAddress: ${signer.walletKey}, storage: ${storage}, keystoreSecrets: ${storageKeystoreSecrets}`
)

const gasFeePayment = accountOp.gasFeePayment!
const { to, value, data } = accountOp.calls[0]
const rawTxn: TxnRequest = {
Expand Down Expand Up @@ -1536,18 +1546,18 @@ export class MainController extends EventEmitter {
}

#throwAccountOpBroadcastError(error: Error) {
let message =
const message =
error?.message ||
'Unable to broadcast the transaction. Please try again or contact Ambire support if the issue persists.'

if (message) {
if (message.includes('insufficient funds')) {
// TODO: Better message?
message = 'Insufficient funds for intristic transaction cost'
} else {
message = message.length > 300 ? `${message.substring(0, 300)}...` : message
}
}
// if (message) {
// if (message.includes('insufficient funds')) {
// // TODO: Better message?
// message = 'Insufficient funds for intristic transaction cost'
// } else {
// message = message.length > 300 ? `${message.substring(0, 300)}...` : message
// }
// }

this.emitError({ level: 'major', message, error })
// To enable another try for signing in case of broadcast fail
Expand Down
3 changes: 3 additions & 0 deletions src/libs/keystoreSigner/keystoreSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { TypedMessage } from '../../interfaces/userRequest'
export class KeystoreSigner implements KeystoreSignerInterface {
key: Key

walletKey: string

#signer: Wallet

constructor(_key: Key, _privKey?: string) {
Expand All @@ -16,6 +18,7 @@ export class KeystoreSigner implements KeystoreSignerInterface {

this.key = _key
this.#signer = new Wallet(_privKey)
this.walletKey = this.#signer.address
}

async signRawTransaction(params: TransactionRequest) {
Expand Down
Loading