Skip to content

Commit fb94876

Browse files
committed
reset eslint, remove debug statements, remove array return type
1 parent f921352 commit fb94876

File tree

4 files changed

+4
-47
lines changed

4 files changed

+4
-47
lines changed

.eslintignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
node_modules/
22
dist/
3-
www/
4-
src/
3+
www/

__tests__/utils/calldataDecode.test.ts

+3-32
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,18 @@
11
import { DecodeConfig } from '../../src/types';
22

33
import {
4-
// Account,
54
BigNumberish,
65
CairoUint256,
7-
// CairoCustomEnum,
8-
// CairoOption,
9-
// CairoOptionVariant,
10-
// CairoResult,
11-
// CairoResultVariant,
12-
// CairoUint256,
13-
// CairoUint512,
146
CallData,
157
Calldata,
16-
// CompiledSierra,
17-
// Contract,
18-
// DeclareDeployUDCResponse,
198
RawArgsArray,
209
RawArgsObject,
21-
// byteArray,
2210
cairo,
23-
// ec,
24-
// hash,
25-
// num,
26-
// selector,
27-
// shortString,
28-
// stark,
29-
// types,
30-
// type Uint512,
3111
} from '../../src';
3212

33-
import {
34-
// compiledC1v2,
35-
// compiledHelloSierra,
36-
compiledComplexSierra,
37-
} from '../config/fixtures';
13+
import { compiledComplexSierra } from '../config/fixtures';
3814

39-
const {
40-
// uint256,
41-
tuple,
42-
// isCairo1Abi
43-
} = cairo;
15+
const { tuple } = cairo;
4416

4517
describe('Cairo 1', () => {
4618
test('should correctly compile and decompile complex data structures', async () => {
@@ -135,10 +107,9 @@ describe('Cairo 1', () => {
135107
'constructor',
136108
compiledDataFromArray,
137109
config,
138-
true
139110
);
140111

141112
expect(decompiledDataFromObject).toEqual(myRawArgsObject);
142-
expect(decompiledDataFromArray).toEqual(myRawArgsArray);
113+
expect(decompiledDataFromArray).toEqual(myRawArgsObject);
143114
});
144115
});

src/utils/calldata/calldataDecoder.ts

-4
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ function decodeBaseTypes(
7373
case isTypeUint(type):
7474
switch (true) {
7575
case CairoUint256.isAbiType(type):
76-
console.log('got 256 uint value');
7776
const low = it.next().value;
7877
const high = it.next().value;
7978

@@ -134,7 +133,6 @@ function decodeBaseTypes(
134133

135134
case isTypeFelt(type):
136135
temp = String(it.next().value);
137-
console.log('Original temp = ', temp);
138136
const configFeltConstructor = config?.['core::felt252'];
139137
if (configFeltConstructor) {
140138
if (configFeltConstructor === String) return decodeShortString(temp);
@@ -145,7 +143,6 @@ function decodeBaseTypes(
145143
return BigInt(temp);
146144

147145
default:
148-
console.log('went to default block for ');
149146
temp = it.next().value;
150147
return BigInt(temp);
151148
}
@@ -294,7 +291,6 @@ function decodeCalldataValue(
294291
parsedDataArr.push(val);
295292
}
296293
}
297-
console.log('Returning array: ', parsedDataArr);
298294
const configConstructor = config?.[element.name];
299295
if (configConstructor) {
300296
const concatenatedString = parsedDataArr.join('');

src/utils/calldata/index.ts

-9
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ export class CallData {
252252
method: string,
253253
calldata: string[],
254254
config?: DecodeConfig,
255-
returnArray?: boolean
256255
): RawArgs {
257256
const abiMethod = this.abi.find(
258257
(entry) => entry.name === method && entry.type === 'function'
@@ -273,14 +272,6 @@ export class CallData {
273272
return acc;
274273
}, {} as RawArgsObject);
275274

276-
if (returnArray === true) {
277-
const decodedArgsArray: RawArgsArray = [];
278-
abiMethod.inputs.forEach((input) => {
279-
const value = decodedArgs[input.name];
280-
decodedArgsArray.push(value);
281-
});
282-
}
283-
284275
return decodedArgs;
285276
}
286277

0 commit comments

Comments
 (0)