Skip to content

Commit

Permalink
fix: remove account_deployment_data from deploy Account
Browse files Browse the repository at this point in the history
  • Loading branch information
tabaktoni committed Dec 7, 2023
1 parent 13ad26e commit ede83bf
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/channel/rpc_0_6.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ export class RpcChannel {
resource_bounds: details.resourceBounds,
tip: toHex(details.tip),
paymaster_data: details.paymasterData.map((it) => toHex(it)),
account_deployment_data: details.accountDeploymentData.map((it) => toHex(it)),
nonce_data_availability_mode: details.nonceDataAvailabilityMode,
fee_data_availability_mode: details.feeDataAvailabilityMode,
},
Expand Down Expand Up @@ -607,13 +606,7 @@ export class RpcChannel {
paymaster_data: invocation.paymasterData.map((it) => toHex(it)),
nonce_data_availability_mode: invocation.nonceDataAvailabilityMode,
fee_data_availability_mode: invocation.feeDataAvailabilityMode,

// dont add account_deployment_data if invocation.type === TransactionType.DEPLOY_ACCOUNT
...(invocation.type === TransactionType.DEPLOY_ACCOUNT
? {}
: {
account_deployment_data: invocation.accountDeploymentData.map((it) => toHex(it)),
}),
account_deployment_data: invocation.accountDeploymentData.map((it) => toHex(it)),
};
}

Expand Down Expand Up @@ -652,14 +645,16 @@ export class RpcChannel {
} as RPC.SPEC.BROADCASTED_DECLARE_TXN;
}
if (invocation.type === TransactionType.DEPLOY_ACCOUNT) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { account_deployment_data, ...restDetails } = details;
// v1 v3
return {
type: invocation.type,
constructor_calldata: CallData.toHex(invocation.constructorCalldata || []),
class_hash: toHex(invocation.classHash),
contract_address_salt: toHex(invocation.addressSalt || 0),
version: toHex(invocation.version || defaultVersions.v3) as RPC.SPEC.INVOKE_TXN['version'],
...details,
...restDetails,
} as RPC.SPEC.BROADCASTED_DEPLOY_ACCOUNT_TXN;
}
throw Error('RPC buildTransaction received unknown TransactionType');
Expand Down

0 comments on commit ede83bf

Please sign in to comment.