Skip to content

Commit

Permalink
check if smart account
Browse files Browse the repository at this point in the history
  • Loading branch information
Aniket-Engg committed Jul 30, 2024
1 parent cdd51d1 commit b68cf9e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion apps/remix-ide/src/blockchain/blockchain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -861,11 +861,12 @@ export class Blockchain extends Plugin {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
let fromAddress
let fromSmartAccount
let value
let gasLimit
try {
fromAddress = await getAccount()
console.log('isSmartAccount--->', this.isSmartAccount(fromAddress))
fromSmartAccount = this.isSmartAccount(fromAddress)
value = await queryValue()
gasLimit = await getGasLimit()
} catch (e) {
Expand All @@ -878,6 +879,7 @@ export class Blockchain extends Plugin {
data: args.data.dataHex,
useCall: args.useCall,
from: fromAddress,
fromSmartAccount,
value: value,
gasLimit: gasLimit,
timestamp: args.data.timestamp
Expand Down
1 change: 1 addition & 0 deletions libs/remix-lib/src/execution/txRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { EventManager } from '../eventManager'

export type Transaction = {
from: string,
fromSmartAccount: boolean,
to: string,
value: string,
data: string,
Expand Down
6 changes: 4 additions & 2 deletions libs/remix-lib/src/execution/txRunnerWeb3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,19 @@ export class TxRunnerWeb3 {
}

execute (args: InternalTransaction, confirmationCb, gasEstimationForceSend, promptCb, callback) {
console.log('execute txRunnerWeb3--->', args)
let data = args.data
if (data.slice(0, 2) !== '0x') {
data = '0x' + data
}

return this.runInNode(args.from, args.to, data, args.value, args.gasLimit, args.useCall, args.timestamp, confirmationCb, gasEstimationForceSend, promptCb, callback)
return this.runInNode(args.from, args.fromSmartAccount, args.to, data, args.value, args.gasLimit, args.useCall, args.timestamp, confirmationCb, gasEstimationForceSend, promptCb, callback)
}

runInNode (from, to, data, value, gasLimit, useCall, timestamp, confirmCb, gasEstimationForceSend, promptCb, callback) {
runInNode (from, fromSmartAccount, to, data, value, gasLimit, useCall, timestamp, confirmCb, gasEstimationForceSend, promptCb, callback) {
const tx = { from: from, to: to, data: data, value: value }
if (!from) return callback('the value of "from" is not defined. Please make sure an account is selected.')
if (fromSmartAccount) return callback('from address is from a smart account')
if (useCall) {
if (this._api && this._api.isVM()) {
(this.getWeb3() as any).remix.registerCallId(timestamp)
Expand Down

0 comments on commit b68cf9e

Please sign in to comment.