essential-eth 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- export declare const version = "0.9.2";
1
+ export declare const version = "0.10.0";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // Generated by genversion.
5
- exports.version = '0.9.2';
5
+ exports.version = '0.10.0';
@@ -1,79 +1,4 @@
1
1
  export const abi = [
2
- {
3
- name: 'Fund',
4
- inputs: [
5
- {
6
- type: 'address',
7
- name: 'recipient',
8
- indexed: true,
9
- },
10
- {
11
- type: 'uint256',
12
- name: 'amount',
13
- indexed: false,
14
- },
15
- ],
16
- anonymous: false,
17
- type: 'event',
18
- },
19
- {
20
- name: 'Claim',
21
- inputs: [
22
- {
23
- type: 'address',
24
- name: 'recipient',
25
- indexed: true,
26
- },
27
- {
28
- type: 'uint256',
29
- name: 'claimed',
30
- indexed: false,
31
- },
32
- ],
33
- anonymous: false,
34
- type: 'event',
35
- },
36
- {
37
- name: 'ToggleDisable',
38
- inputs: [
39
- {
40
- type: 'address',
41
- name: 'recipient',
42
- indexed: false,
43
- },
44
- {
45
- type: 'bool',
46
- name: 'disabled',
47
- indexed: false,
48
- },
49
- ],
50
- anonymous: false,
51
- type: 'event',
52
- },
53
- {
54
- name: 'CommitOwnership',
55
- inputs: [
56
- {
57
- type: 'address',
58
- name: 'admin',
59
- indexed: false,
60
- },
61
- ],
62
- anonymous: false,
63
- type: 'event',
64
- },
65
- {
66
- name: 'ApplyOwnership',
67
- inputs: [
68
- {
69
- type: 'address',
70
- name: 'admin',
71
- indexed: false,
72
- },
73
- ],
74
- anonymous: false,
75
- type: 'event',
76
- },
77
2
  {
78
3
  outputs: [],
79
4
  inputs: [
@@ -0,0 +1,2 @@
1
+ import type { JSONABI } from '../../../types/Contract.types';
2
+ export declare const abi: JSONABI;
@@ -0,0 +1,8 @@
1
+ export const abi = [
2
+ {
3
+ name: 'getAllAddressesThatHaveVoted',
4
+ outputs: [{ type: 'address[]', name: '' }],
5
+ inputs: [],
6
+ type: 'function',
7
+ },
8
+ ];
@@ -28,7 +28,7 @@ function expandType(type) {
28
28
  if (type === 'uint[]') {
29
29
  return 'uint256[]';
30
30
  }
31
- else if (type === 'int[]') {
31
+ if (type === 'int[]') {
32
32
  return 'int256[]';
33
33
  }
34
34
  return type;
@@ -109,8 +109,15 @@ export function decodeRPCResponse(jsonABIArgument, nodeResponse) {
109
109
  const hexToDecode = responseData.slice(decimalOffset * 2, decimalOffset * 2 + decimalLength * 2);
110
110
  return hexToUtf8(hexToDecode);
111
111
  }
112
- const encodedOutputs = slicedResponse.match(/.{1,64}/g);
113
- const outputs = (encodedOutputs || []).map((output, i) => {
112
+ const encodedOutputs = slicedResponse.match(/.{1,64}/g) || [];
113
+ if (jsonABIArgument?.outputs?.length === 1 &&
114
+ jsonABIArgument.outputs[0].type === 'address[]') {
115
+ const unformattedAddresses = encodedOutputs.slice(2);
116
+ return unformattedAddresses.map((unformattedAddress) => {
117
+ return toChecksumAddress(`0x${unformattedAddress.slice(24)}`);
118
+ });
119
+ }
120
+ const outputs = encodedOutputs.map((output, i) => {
114
121
  const outputType = (rawOutputs || [])[i].type;
115
122
  switch (outputType) {
116
123
  case 'bool':
@@ -1,13 +1,14 @@
1
- export { Contract, BaseContract } from './classes/Contract';
1
+ export { BaseContract, Contract } from './classes/Contract';
2
2
  export { AlchemyProvider } from './providers/AlchemyProvider';
3
- export { FallthroughProvider, ConstructorOptions, } from './providers/FallthroughProvider';
3
+ export { ConstructorOptions, FallthroughProvider, } from './providers/FallthroughProvider';
4
4
  export { jsonRpcProvider, JsonRpcProvider } from './providers/JsonRpcProvider';
5
5
  export { tinyBig, TinyBig } from './shared/tiny-big/tiny-big';
6
- export { BlockResponse, RPCBlock, BlockTag } from './types/Block.types';
6
+ export { BlockResponse, BlockTag, RPCBlock } from './types/Block.types';
7
7
  export { ContractTypes, JSONABI, JSONABIArgument, } from './types/Contract.types';
8
8
  export { Filter, FilterByBlockHash } from './types/Filter.types';
9
9
  export { Network } from './types/Network.types';
10
- export { TransactionResponse, RPCTransaction, RPCTransactionReceipt, TransactionRequest, RPCTransactionRequest, TransactionReceipt, RPCLog, Log, BlockTransactionResponse, } from './types/Transaction.types';
10
+ export { BlockTransactionResponse, Log, RPCLog, RPCTransaction, RPCTransactionReceipt, RPCTransactionRequest, TransactionReceipt, TransactionRequest, TransactionResponse, } from './types/Transaction.types';
11
+ export { arrayify, Bytes, BytesLike, BytesLikeWithNumber, concat, DataOptions, Hexable, hexConcat, hexDataLength, hexDataSlice, hexlify, hexStripZeros, hexValue, hexZeroPad, isBytes, isBytesLike, isHexString, Signature, SignatureLike, stripZeros, zeroPad, } from './utils/bytes';
11
12
  export { computeAddress } from './utils/compute-address';
12
13
  export { computePublicKey } from './utils/compute-public-key';
13
14
  export { etherToGwei } from './utils/ether-to-gwei';
@@ -15,10 +16,9 @@ export { etherToWei } from './utils/ether-to-wei';
15
16
  export { gweiToEther } from './utils/gwei-to-ether';
16
17
  export { hashMessage } from './utils/hash-message';
17
18
  export { isAddress } from './utils/is-address';
19
+ export { keccak256 } from './utils/keccak256';
20
+ export { pack, solidityKeccak256 } from './utils/solidity-keccak256';
18
21
  export { splitSignature } from './utils/split-signature';
19
22
  export { toChecksumAddress } from './utils/to-checksum-address';
20
23
  export { toUtf8Bytes } from './utils/to-utf8-bytes';
21
24
  export { weiToEther } from './utils/wei-to-ether';
22
- export { Bytes, BytesLike, BytesLikeWithNumber, DataOptions, Hexable, SignatureLike, Signature, isBytesLike, isBytes, arrayify, concat, stripZeros, zeroPad, isHexString, hexlify, hexDataLength, hexDataSlice, hexConcat, hexValue, hexStripZeros, hexZeroPad, } from './utils/bytes';
23
- export { keccak256 } from './utils/keccak256';
24
- export { pack, solidityKeccak256 } from './utils/solidity-keccak256';
package/dist/esm/index.js CHANGED
@@ -1,8 +1,9 @@
1
- export { Contract, BaseContract } from './classes/Contract';
1
+ export { BaseContract, Contract } from './classes/Contract';
2
2
  export { AlchemyProvider } from './providers/AlchemyProvider';
3
3
  export { FallthroughProvider, } from './providers/FallthroughProvider';
4
4
  export { jsonRpcProvider, JsonRpcProvider } from './providers/JsonRpcProvider';
5
5
  export { tinyBig, TinyBig } from './shared/tiny-big/tiny-big';
6
+ export { arrayify, concat, hexConcat, hexDataLength, hexDataSlice, hexlify, hexStripZeros, hexValue, hexZeroPad, isBytes, isBytesLike, isHexString, stripZeros, zeroPad, } from './utils/bytes';
6
7
  export { computeAddress } from './utils/compute-address';
7
8
  export { computePublicKey } from './utils/compute-public-key';
8
9
  export { etherToGwei } from './utils/ether-to-gwei';
@@ -10,10 +11,9 @@ export { etherToWei } from './utils/ether-to-wei';
10
11
  export { gweiToEther } from './utils/gwei-to-ether';
11
12
  export { hashMessage } from './utils/hash-message';
12
13
  export { isAddress } from './utils/is-address';
14
+ export { keccak256 } from './utils/keccak256';
15
+ export { pack, solidityKeccak256 } from './utils/solidity-keccak256';
13
16
  export { splitSignature } from './utils/split-signature';
14
17
  export { toChecksumAddress } from './utils/to-checksum-address';
15
18
  export { toUtf8Bytes } from './utils/to-utf8-bytes';
16
19
  export { weiToEther } from './utils/wei-to-ether';
17
- export { isBytesLike, isBytes, arrayify, concat, stripZeros, zeroPad, isHexString, hexlify, hexDataLength, hexDataSlice, hexConcat, hexValue, hexStripZeros, hexZeroPad, } from './utils/bytes';
18
- export { keccak256 } from './utils/keccak256';
19
- export { pack, solidityKeccak256 } from './utils/solidity-keccak256';
@@ -1 +1 @@
1
- export declare const version = "0.9.2";
1
+ export declare const version = "0.10.0";
@@ -1 +1 @@
1
- export const version = '0.9.2';
1
+ export const version = '0.10.0';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "essential-eth",
3
3
  "description": "Ultralight JS for Ethereum",
4
- "version": "0.9.2",
4
+ "version": "0.10.0",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "type": "module",
@@ -93,7 +93,10 @@
93
93
  "prettier": {
94
94
  "trailingComma": "all",
95
95
  "tabWidth": 2,
96
- "singleQuote": true
96
+ "singleQuote": true,
97
+ "plugins": [
98
+ "prettier-plugin-organize-imports"
99
+ ]
97
100
  },
98
101
  "keywords": [
99
102
  "ethereum",
package/readme.md CHANGED
@@ -126,7 +126,7 @@ Browsers:
126
126
 
127
127
  ```html
128
128
  <!-- index.html -->
129
- <script src="https://unpkg.com/essential-eth@0.9.2"></script>
129
+ <script src="https://unpkg.com/essential-eth@0.10.0"></script>
130
130
  ```
131
131
 
132
132
  <!-- ⛔️ AUTO-GENERATED-CONTENT:END (UNPKG_SCRIPT_TAG) -->