Skip to content

Commit

Permalink
fix(type-naming): more expressive types
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Han committed Nov 5, 2021
1 parent 08a2e31 commit 5277b12
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/starknet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import axios from 'axios';

import type {
AddTransactionResponse,
Call,
CallContractResponse,
CallContractTransaction,
CompiledContract,
GetBlockResponse,
GetCodeResponse,
Expand Down Expand Up @@ -46,7 +46,10 @@ export function getContractAddresses(): Promise<GetContractAddressesResponse> {
* @param blockId
* @returns the result of the function on the smart contract.
*/
export function callContract(invokeTx: Call, blockId?: number): Promise<CallContractResponse> {
export function callContract(
invokeTx: CallContractTransaction,
blockId?: number
): Promise<CallContractResponse> {
return new Promise((resolve, reject) => {
axios
.post(`${FEEDER_GATEWAY_URL}/call_contract?blockId=${blockId ?? 'null'}`, {
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export type InvokeFunctionTransaction = {
calldata?: string[];
};

export type Call = Omit<InvokeFunctionTransaction, 'type'>;
export type CallContractTransaction = Omit<InvokeFunctionTransaction, 'type'>;

export type Transaction = DeployTransaction | InvokeFunctionTransaction;

Expand Down

0 comments on commit 5277b12

Please sign in to comment.