Skip to content

Commit

Permalink
chore: review changes by janek
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvkelawala committed Oct 12, 2022
1 parent 0ab4d47 commit 8304fdf
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/provider/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export class RpcProvider implements ProviderInterface {
const result = await this.fetchEndpoint('starknet_call', {
request: {
contract_address: call.contractAddress,
entry_point_selector: getSelectorFromName(call.entrypoint.toString()),
entry_point_selector: getSelectorFromName(call.entrypoint),
calldata: parseCalldata(call.calldata),
},
block_id,
Expand Down
2 changes: 1 addition & 1 deletion src/provider/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export class SequencerProvider implements ProviderInterface {
{
signature: [],
contract_address: contractAddress,
entry_point_selector: getSelectorFromName(entryPointSelector.toString()),
entry_point_selector: getSelectorFromName(entryPointSelector),
calldata,
}
).then(this.responseParser.parseCallContractResponse);
Expand Down
2 changes: 1 addition & 1 deletion src/types/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export type CallDetails = {

export type Invocation = CallDetails & { signature?: Signature };

export type Call = CallDetails & { entrypoint: BigNumberish };
export type Call = CallDetails & { entrypoint: string };

export type InvocationsDetails = {
nonce?: BigNumberish;
Expand Down
15 changes: 2 additions & 13 deletions src/utils/hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,26 +156,15 @@ export function calculateDeclareTransactionHash(
chainId: StarknetChainId,
nonce: BigNumberish
): string {
let calldata: BigNumberish[] = [];
let additionalData: BigNumberish[] = [];

if (version !== ZERO) {
calldata = [classHash];
additionalData = [nonce];
} else {
calldata = [];
additionalData = [classHash];
}

return calculateTransactionHashCommon(
TransactionHashPrefix.DECLARE,
version,
senderAddress,
0,
calldata,
[classHash],
maxFee,
chainId,
additionalData
[nonce]
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const transformCallsToMulticallArrays = (calls: Call[]) => {
const data = call.calldata || [];
callArray.push({
to: toBN(call.contractAddress).toString(10),
selector: toBN(getSelectorFromName(call.entrypoint.toString())).toString(10),
selector: toBN(getSelectorFromName(call.entrypoint)).toString(10),
data_offset: calldata.length.toString(),
data_len: data.length.toString(),
});
Expand Down

0 comments on commit 8304fdf

Please sign in to comment.