Skip to content

Commit

Permalink
fix: parallel get version issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tabaktoni committed Sep 25, 2023
1 parent da76508 commit c58c894
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/account/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export class Account extends Provider implements AccountInterface {
const declareContractTransaction = await this.buildDeclarePayload(declareContractPayload, {
...details,
walletAddress: this.address,
cairoVersion: await this.getCairoVersion(), // unused parameter
cairoVersion: undefined, // unused parameter
});

return this.declareContract(declareContractTransaction, details);
Expand Down Expand Up @@ -664,25 +664,24 @@ export class Account extends Provider implements AccountInterface {
const version = versions[0];
const safeNonce = await this.getNonceSafe(nonce);
const chainId = await this.getChainId();
let newAccClassHash: string;

// BULK ACTION FROM NEW ACCOUNT START WITH DEPLOY_ACCOUNT
const tx0Payload: any = 'payload' in invocations[0] ? invocations[0].payload : invocations[0];
const cairoVersion =
invocations[0].type === TransactionType.DEPLOY_ACCOUNT
? await this.getCairoVersion(tx0Payload.classHash)
: await this.getCairoVersion();

return Promise.all(
([] as Invocations).concat(invocations).map(async (transaction, index: number) => {
const txPayload: any = 'payload' in transaction ? transaction.payload : transaction;
// BULK ACTION FROM NEW ACCOUNT START WITH DEPLOY_ACCOUNT
if (index === 0 && transaction.type === TransactionType.DEPLOY_ACCOUNT) {
newAccClassHash = txPayload.classHash;
}

const signerDetails: InvocationsSignerDetails = {
walletAddress: this.address,
nonce: toBigInt(Number(safeNonce) + index),
maxFee: ZERO,
version,
chainId,
cairoVersion: newAccClassHash
? await this.getCairoVersion(newAccClassHash)
: await this.getCairoVersion(),
cairoVersion,
};
const common = {
type: transaction.type,
Expand Down

0 comments on commit c58c894

Please sign in to comment.