@cowprotocol/sdk-ethers-v5-adapter 0.2.4-beta.0 → 0.3.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.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ethers, BytesLike, TypedDataDomain, TypedDataField, Signer, BigNumberish } from 'ethers';
2
- import { AdapterUtils, GenericContractInterface, ContractValue, BigIntish, Address, ParamType, AbstractSigner, TransactionParams, TransactionResponse, AdapterTypes, PrivateKey, AbstractProviderAdapter, TransactionReceipt, GenericContract } from '@cowprotocol/sdk-common';
2
+ import { AdapterUtils, GenericContractInterface, ContractValue, Hex, BigIntish, Address, ParamType, AbstractSigner, TransactionParams, TransactionResponse, AdapterTypes, PrivateKey, AbstractProviderAdapter, TransactionReceipt, GenericContract } from '@cowprotocol/sdk-common';
3
3
  import { TypedDataSigner } from '@ethersproject/abstract-signer';
4
4
 
5
5
  type Abi$1 = ConstructorParameters<typeof ethers.utils.Interface>[0];
@@ -10,13 +10,15 @@ declare class EthersV5Utils implements AdapterUtils {
10
10
  hexConcat(items: ReadonlyArray<BytesLike>): string;
11
11
  formatBytes32String(text: string): string;
12
12
  encodeDeploy(encodeDeployArgs: ContractValue[], abi: Abi$1): string;
13
- keccak256(data: BytesLike): string;
13
+ keccak256(data: BytesLike): Hex;
14
+ sha256(data: BytesLike): Hex;
14
15
  hexZeroPad(value: BytesLike, length: number): string;
15
16
  arrayify(hexString: string): Uint8Array;
16
17
  hexlify(value: BytesLike): string;
17
18
  solidityPack(types: string[], values: ContractValue[]): string;
18
19
  hashTypedData(domain: TypedDataDomain, types: Record<string, TypedDataField[]>, data: Record<string, unknown>): string;
19
- getChecksumAddress(address: string): string;
20
+ getChecksumAddress(address: string): Hex;
21
+ recoverAddress(hash: Hex, signature: Hex): Promise<Hex>;
20
22
  encodeAbi(types: string[], values: ContractValue[]): BytesLike;
21
23
  decodeAbi(types: string[], data: BytesLike): ContractValue[];
22
24
  private convertBigNumbersToBigInt;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ethers, BytesLike, TypedDataDomain, TypedDataField, Signer, BigNumberish } from 'ethers';
2
- import { AdapterUtils, GenericContractInterface, ContractValue, BigIntish, Address, ParamType, AbstractSigner, TransactionParams, TransactionResponse, AdapterTypes, PrivateKey, AbstractProviderAdapter, TransactionReceipt, GenericContract } from '@cowprotocol/sdk-common';
2
+ import { AdapterUtils, GenericContractInterface, ContractValue, Hex, BigIntish, Address, ParamType, AbstractSigner, TransactionParams, TransactionResponse, AdapterTypes, PrivateKey, AbstractProviderAdapter, TransactionReceipt, GenericContract } from '@cowprotocol/sdk-common';
3
3
  import { TypedDataSigner } from '@ethersproject/abstract-signer';
4
4
 
5
5
  type Abi$1 = ConstructorParameters<typeof ethers.utils.Interface>[0];
@@ -10,13 +10,15 @@ declare class EthersV5Utils implements AdapterUtils {
10
10
  hexConcat(items: ReadonlyArray<BytesLike>): string;
11
11
  formatBytes32String(text: string): string;
12
12
  encodeDeploy(encodeDeployArgs: ContractValue[], abi: Abi$1): string;
13
- keccak256(data: BytesLike): string;
13
+ keccak256(data: BytesLike): Hex;
14
+ sha256(data: BytesLike): Hex;
14
15
  hexZeroPad(value: BytesLike, length: number): string;
15
16
  arrayify(hexString: string): Uint8Array;
16
17
  hexlify(value: BytesLike): string;
17
18
  solidityPack(types: string[], values: ContractValue[]): string;
18
19
  hashTypedData(domain: TypedDataDomain, types: Record<string, TypedDataField[]>, data: Record<string, unknown>): string;
19
- getChecksumAddress(address: string): string;
20
+ getChecksumAddress(address: string): Hex;
21
+ recoverAddress(hash: Hex, signature: Hex): Promise<Hex>;
20
22
  encodeAbi(types: string[], values: ContractValue[]): BytesLike;
21
23
  decodeAbi(types: string[], data: BytesLike): ContractValue[];
22
24
  private convertBigNumbersToBigInt;
package/dist/index.js CHANGED
@@ -53,6 +53,9 @@ var EthersV5Utils = class {
53
53
  keccak256(data) {
54
54
  return import_ethers.ethers.utils.keccak256(data);
55
55
  }
56
+ sha256(data) {
57
+ return import_ethers.ethers.utils.sha256(data);
58
+ }
56
59
  hexZeroPad(value, length) {
57
60
  return import_ethers.ethers.utils.hexZeroPad(value, length);
58
61
  }
@@ -71,6 +74,9 @@ var EthersV5Utils = class {
71
74
  getChecksumAddress(address) {
72
75
  return import_ethers.ethers.utils.getAddress(address);
73
76
  }
77
+ async recoverAddress(hash, signature) {
78
+ return import_ethers.ethers.utils.recoverAddress(hash, signature);
79
+ }
74
80
  encodeAbi(types, values) {
75
81
  return import_ethers.ethers.utils.defaultAbiCoder.encode(types, values);
76
82
  }
@@ -245,6 +251,8 @@ var EthersV5SignerAdapter = class extends import_sdk_common.AbstractSigner {
245
251
  wait: async (confirmations) => {
246
252
  const receipt = await tx.wait(confirmations);
247
253
  return {
254
+ from: receipt.from,
255
+ to: receipt.to,
248
256
  transactionHash: receipt.transactionHash,
249
257
  blockNumber: BigInt(receipt.blockNumber),
250
258
  blockHash: receipt.blockHash,
package/dist/index.mjs CHANGED
@@ -30,6 +30,9 @@ var EthersV5Utils = class {
30
30
  keccak256(data) {
31
31
  return ethers.utils.keccak256(data);
32
32
  }
33
+ sha256(data) {
34
+ return ethers.utils.sha256(data);
35
+ }
33
36
  hexZeroPad(value, length) {
34
37
  return ethers.utils.hexZeroPad(value, length);
35
38
  }
@@ -48,6 +51,9 @@ var EthersV5Utils = class {
48
51
  getChecksumAddress(address) {
49
52
  return ethers.utils.getAddress(address);
50
53
  }
54
+ async recoverAddress(hash, signature) {
55
+ return ethers.utils.recoverAddress(hash, signature);
56
+ }
51
57
  encodeAbi(types, values) {
52
58
  return ethers.utils.defaultAbiCoder.encode(types, values);
53
59
  }
@@ -222,6 +228,8 @@ var EthersV5SignerAdapter = class extends AbstractSigner {
222
228
  wait: async (confirmations) => {
223
229
  const receipt = await tx.wait(confirmations);
224
230
  return {
231
+ from: receipt.from,
232
+ to: receipt.to,
225
233
  transactionHash: receipt.transactionHash,
226
234
  blockNumber: BigInt(receipt.blockNumber),
227
235
  blockHash: receipt.blockHash,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowprotocol/sdk-ethers-v5-adapter",
3
- "version": "0.2.4-beta.0",
3
+ "version": "0.3.0",
4
4
  "description": "Ethers v5 adapter for CoW Protocol SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -13,7 +13,7 @@
13
13
  "access": "public"
14
14
  },
15
15
  "dependencies": {
16
- "@cowprotocol/sdk-common": "0.4.0-beta.0"
16
+ "@cowprotocol/sdk-common": "0.4.0"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "@ethersproject/abstract-signer": "^5.8.0",