Skip to content

Commit

Permalink
Prettify
Browse files Browse the repository at this point in the history
  • Loading branch information
Destiner committed Mar 18, 2024
1 parent 8731192 commit bb325dd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
31 changes: 17 additions & 14 deletions src/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ async function all<T>(
callData,
};
});
const response = contract && contract.aggregate
? await contract.aggregate(callRequests, overrides || {})
: await callDeployless(provider, callRequests, overrides?.blockTag);
const response =
contract && contract.aggregate
? await contract.aggregate(callRequests, overrides || {})
: await callDeployless(provider, callRequests, overrides?.blockTag);
const callCount = calls.length;
const callResult: T[] = [];
for (let i = 0; i < callCount; i++) {
const call = calls[i];
if (!call) {
throw new Error("Unable to access the call");
throw new Error('Unable to access the call');
}
const name = call.name;
const outputs = call.outputs;
Expand Down Expand Up @@ -98,21 +99,22 @@ async function tryAll<T>(
callData,
};
});
const response: CallResult[] = contract && contract.tryAggregate
? await contract.tryAggregate(false, callRequests, overrides || {})
: await callDeployless2(provider, callRequests, overrides?.blockTag);
const response: CallResult[] =
contract && contract.tryAggregate
? await contract.tryAggregate(false, callRequests, overrides || {})
: await callDeployless2(provider, callRequests, overrides?.blockTag);
const callCount = calls.length;
const callResult: (T | null)[] = [];
for (let i = 0; i < callCount; i++) {
const call = calls[i];
if (!call) {
throw new Error("Unable to access the call");
throw new Error('Unable to access the call');
}
const name = call.name;
const outputs = call.outputs;
const result = response[i];
if (!result) {
throw new Error("Unable to access the result");
throw new Error('Unable to access the result');
}
if (!result.success) {
callResult.push(null);
Expand Down Expand Up @@ -147,21 +149,22 @@ async function tryEach<T>(
callData,
};
});
const response: CallResult[] = contract && contract.aggregate3
? await contract.aggregate3(callRequests, overrides || {})
: await callDeployless3(provider, callRequests, overrides?.blockTag);
const response: CallResult[] =
contract && contract.aggregate3
? await contract.aggregate3(callRequests, overrides || {})
: await callDeployless3(provider, callRequests, overrides?.blockTag);
const callCount = calls.length;
const callResult: (T | null)[] = [];
for (let i = 0; i < callCount; i++) {
const call = calls[i];
if (!call) {
throw new Error("Unable to access the call");
throw new Error('Unable to access the call');
}
const name = call.name;
const outputs = call.outputs;
const result = response[i];
if (!result) {
throw new Error("Unable to access the result");
throw new Error('Unable to access the result');
}
if (!result.success) {
callResult.push(null);
Expand Down
2 changes: 1 addition & 1 deletion src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class Provider {
const failableCalls = calls.map((call, index) => {
const callCanFail = canFail[index];
if (callCanFail === undefined) {
throw new Error("Unable to access the canFail value");
throw new Error('Unable to access the canFail value');
}
return {
...call,
Expand Down

0 comments on commit bb325dd

Please sign in to comment.