Skip to content

Commit

Permalink
feat: new abi encoder supporting tuples (#68)
Browse files Browse the repository at this point in the history
Co-authored-by: Ignacio Mazzara <nachomazzara@gmail.com>
  • Loading branch information
menduz and nachomazzara authored Apr 16, 2021
1 parent 7fc2bf5 commit 2254a2d
Show file tree
Hide file tree
Showing 72 changed files with 4,445 additions and 1,489 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ eth_common/.ethereum
src/temp
**/*.lcov
coverage.lcov
test-result
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ watch:
${TSC} --project tsconfig.json --watch

lint:
${TSLINT}
${TSLINT} --project tsconfig.json

test:
node --experimental-modules --es-module-specifier-resolution=node node_modules/.bin/nyc node_modules/mocha/bin/_mocha
test-fast:
node --inspect --experimental-modules node_modules/.bin/_mocha
test-fast-bail:
node --inspect --experimental-modules node_modules/.bin/_mocha --bail

test-coveralls:
${NYC} report --reporter=text-lcov | ${COVERALLS} --verbose
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,4 @@ make test-local
You can find full documentation [here](docs/index.md).

You may find issues while using this library, as it's still under development. Please report any issues you come accross.

11 changes: 0 additions & 11 deletions docs/eth-connect.abiinput.components.md

This file was deleted.

11 changes: 0 additions & 11 deletions docs/eth-connect.abiinput.internaltype.md

This file was deleted.

7 changes: 2 additions & 5 deletions docs/eth-connect.abiinput.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@
<b>Signature:</b>

```typescript
export interface AbiInput
export interface AbiInput extends AbiOutput
```
<b>Extends:</b> [AbiOutput](./eth-connect.abioutput.md)
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [components?](./eth-connect.abiinput.components.md) | [AbiInput](./eth-connect.abiinput.md)<!-- -->\[\] | <i>(Optional)</i> |
| [indexed?](./eth-connect.abiinput.indexed.md) | boolean | <i>(Optional)</i> |
| [internalType?](./eth-connect.abiinput.internaltype.md) | string | <i>(Optional)</i> |
| [name](./eth-connect.abiinput.name.md) | string | |
| [type](./eth-connect.abiinput.type.md) | string | |
11 changes: 0 additions & 11 deletions docs/eth-connect.abiinput.name.md

This file was deleted.

11 changes: 0 additions & 11 deletions docs/eth-connect.abiinput.type.md

This file was deleted.

23 changes: 23 additions & 0 deletions docs/eth-connect.bytestohex.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [eth-connect](./eth-connect.md) &gt; [bytesToHex](./eth-connect.bytestohex.md)

## bytesToHex() function


<b>Signature:</b>

```typescript
export declare function bytesToHex(bytes: Uint8Array): string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| bytes | Uint8Array | |

<b>Returns:</b>

string

24 changes: 24 additions & 0 deletions docs/eth-connect.bytestoutf8string.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [eth-connect](./eth-connect.md) &gt; [bytesToUtf8String](./eth-connect.bytestoutf8string.md)

## bytesToUtf8String() function

Decodes an Uint8Array or hex string into a UTF-8 string

<b>Signature:</b>

```typescript
export declare function bytesToUtf8String(bytesOrHexString: Uint8Array | string): string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| bytesOrHexString | Uint8Array \| string | |

<b>Returns:</b>

string

22 changes: 22 additions & 0 deletions docs/eth-connect.concatbytes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [eth-connect](./eth-connect.md) &gt; [concatBytes](./eth-connect.concatbytes.md)

## concatBytes() function

<b>Signature:</b>

```typescript
export declare function concatBytes(...buffers: Uint8Array[]): Uint8Array;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| buffers | Uint8Array\[\] | |

<b>Returns:</b>

Uint8Array

25 changes: 25 additions & 0 deletions docs/eth-connect.fromtwoscomplement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [eth-connect](./eth-connect.md) &gt; [fromTwosComplement](./eth-connect.fromtwoscomplement.md)

## fromTwosComplement() function

If the bit N is 1

<b>Signature:</b>

```typescript
export declare function fromTwosComplement(num: BigNumber, bits?: number): BigNumber;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| num | [BigNumber](./eth-connect.bignumber.md) | |
| bits | number | |

<b>Returns:</b>

[BigNumber](./eth-connect.bignumber.md)

25 changes: 0 additions & 25 deletions docs/eth-connect.fromutf8.md

This file was deleted.

23 changes: 23 additions & 0 deletions docs/eth-connect.getaddress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [eth-connect](./eth-connect.md) &gt; [getAddress](./eth-connect.getaddress.md)

## getAddress() function


<b>Signature:</b>

```typescript
export declare function getAddress(address: string): string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| address | string | |

<b>Returns:</b>

string

25 changes: 25 additions & 0 deletions docs/eth-connect.signedisnegative.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [eth-connect](./eth-connect.md) &gt; [signedIsNegative](./eth-connect.signedisnegative.md)

## signedIsNegative() function

Check if input value is negative in twos complement

<b>Signature:</b>

```typescript
export declare function signedIsNegative(value: BigNumber, bits: number): boolean;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| value | [BigNumber](./eth-connect.bignumber.md) | |
| bits | number | |

<b>Returns:</b>

boolean

4 changes: 2 additions & 2 deletions docs/eth-connect.solidityevent.types.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Should be used to get filtered param types
<b>Signature:</b>

```typescript
types(indexed: boolean): string[];
types(indexed: boolean): AbiInput[];
```

## Parameters
Expand All @@ -20,5 +20,5 @@ types(indexed: boolean): string[];

<b>Returns:</b>

string\[\]
[AbiInput](./eth-connect.abiinput.md)<!-- -->\[\]

2 changes: 1 addition & 1 deletion docs/eth-connect.solidityfunction._inputtypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<b>Signature:</b>

```typescript
_inputTypes: string[];
_inputTypes: AbiInput[];
```
2 changes: 1 addition & 1 deletion docs/eth-connect.solidityfunction._outputtypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<b>Signature:</b>

```typescript
_outputTypes: string[];
_outputTypes: AbiOutput[];
```
4 changes: 2 additions & 2 deletions docs/eth-connect.solidityfunction.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export declare class SolidityFunction
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [\_constant](./eth-connect.solidityfunction._constant.md) | | boolean | |
| [\_inputTypes](./eth-connect.solidityfunction._inputtypes.md) | | string\[\] | |
| [\_inputTypes](./eth-connect.solidityfunction._inputtypes.md) | | [AbiInput](./eth-connect.abiinput.md)<!-- -->\[\] | |
| [\_name](./eth-connect.solidityfunction._name.md) | | string | |
| [\_outputTypes](./eth-connect.solidityfunction._outputtypes.md) | | string\[\] | |
| [\_outputTypes](./eth-connect.solidityfunction._outputtypes.md) | | [AbiOutput](./eth-connect.abioutput.md)<!-- -->\[\] | |
| [\_payable](./eth-connect.solidityfunction._payable.md) | | boolean | |
| [json](./eth-connect.solidityfunction.json.md) | | [AbiFunction](./eth-connect.abifunction.md) | |
| [needsToBeTransaction](./eth-connect.solidityfunction.needstobetransaction.md) | | boolean | |
Expand Down
24 changes: 24 additions & 0 deletions docs/eth-connect.stringtoutf8bytes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [eth-connect](./eth-connect.md) &gt; [stringToUtf8Bytes](./eth-connect.stringtoutf8bytes.md)

## stringToUtf8Bytes() function

Converts a string into a Uint8Array encoded with UTF-8

<b>Signature:</b>

```typescript
export declare function stringToUtf8Bytes(str: string): Uint8Array;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| str | string | |

<b>Returns:</b>

Uint8Array

4 changes: 2 additions & 2 deletions docs/eth-connect.tohex.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ And even stringifys objects before.
<b>Signature:</b>

```typescript
export declare function toHex(val: BigNumber.Value | boolean): string;
export declare function toHex(val: BigNumber.Value | boolean | Uint8Array): string;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| val | [BigNumber.Value](./eth-connect.bignumber.value.md) \| boolean | |
| val | [BigNumber.Value](./eth-connect.bignumber.value.md) \| boolean \| Uint8Array | |

<b>Returns:</b>

Expand Down
3 changes: 2 additions & 1 deletion docs/eth-connect.totwoscomplement.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ Takes and input transforms it into bignumber and if it is negative value, into t
<b>Signature:</b>

```typescript
export declare function toTwosComplement(num: BigNumber.Value): BigNumber;
export declare function toTwosComplement(num: BigNumber.Value, bits?: number): BigNumber;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| num | [BigNumber.Value](./eth-connect.bignumber.value.md) | |
| bits | number | |

<b>Returns:</b>

Expand Down
24 changes: 0 additions & 24 deletions docs/eth-connect.toutf8.md

This file was deleted.

Loading

0 comments on commit 2254a2d

Please sign in to comment.