@cowprotocol/sdk-ethers-v6-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 { InterfaceAbi, Interface, BytesLike, TypedDataDomain, TypedDataField, BigNumberish, SignatureLike, JsonRpcProvider, Provider, Signer } from 'ethers';
2
- import { GenericContractInterface, ContractValue, Log, AdapterUtils, ParamType, AbstractSigner, TransactionParams, TransactionResponse, AdapterTypes, PrivateKey, AbstractProviderAdapter, TransactionReceipt, Block, GenericContract } from '@cowprotocol/sdk-common';
2
+ import { GenericContractInterface, ContractValue, Log, AdapterUtils, Hex, ParamType, AbstractSigner, TransactionParams, TransactionResponse, AdapterTypes, PrivateKey, AbstractProviderAdapter, TransactionReceipt, Block, GenericContract } from '@cowprotocol/sdk-common';
3
3
 
4
4
  declare class EthersV6InterfaceWrapper implements GenericContractInterface {
5
5
  private ethersInterface;
@@ -49,14 +49,16 @@ declare class EthersV6Utils implements AdapterUtils {
49
49
  getCreate2Address(from: string, salt: BytesLike, initCodeHash: BytesLike): string;
50
50
  hexConcat(items: ReadonlyArray<BytesLike>): string;
51
51
  formatBytes32String(text: string): string;
52
- keccak256(data: BytesLike): string;
52
+ keccak256(data: BytesLike): Hex;
53
+ sha256(data: BytesLike): Hex;
53
54
  private toEthersBytesLike;
54
55
  hexZeroPad(value: BytesLike, length: number): string;
55
56
  arrayify(hexString: string): Uint8Array;
56
57
  hexlify(value: Uint8Array): string;
57
58
  solidityPack(types: string[], values: ContractValue[]): string;
58
59
  hashTypedData(domain: TypedDataDomain, types: Record<string, TypedDataField[]>, data: Record<string, unknown>): string;
59
- getChecksumAddress(address: string): string;
60
+ getChecksumAddress(address: string): Hex;
61
+ recoverAddress(hash: Hex, signature: Hex): Promise<Hex>;
60
62
  encodeAbi(types: string[], values: ContractValue[]): BytesLike;
61
63
  decodeAbi(types: string[], data: BytesLike): ContractValue[];
62
64
  id(text: string): BytesLike;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { InterfaceAbi, Interface, BytesLike, TypedDataDomain, TypedDataField, BigNumberish, SignatureLike, JsonRpcProvider, Provider, Signer } from 'ethers';
2
- import { GenericContractInterface, ContractValue, Log, AdapterUtils, ParamType, AbstractSigner, TransactionParams, TransactionResponse, AdapterTypes, PrivateKey, AbstractProviderAdapter, TransactionReceipt, Block, GenericContract } from '@cowprotocol/sdk-common';
2
+ import { GenericContractInterface, ContractValue, Log, AdapterUtils, Hex, ParamType, AbstractSigner, TransactionParams, TransactionResponse, AdapterTypes, PrivateKey, AbstractProviderAdapter, TransactionReceipt, Block, GenericContract } from '@cowprotocol/sdk-common';
3
3
 
4
4
  declare class EthersV6InterfaceWrapper implements GenericContractInterface {
5
5
  private ethersInterface;
@@ -49,14 +49,16 @@ declare class EthersV6Utils implements AdapterUtils {
49
49
  getCreate2Address(from: string, salt: BytesLike, initCodeHash: BytesLike): string;
50
50
  hexConcat(items: ReadonlyArray<BytesLike>): string;
51
51
  formatBytes32String(text: string): string;
52
- keccak256(data: BytesLike): string;
52
+ keccak256(data: BytesLike): Hex;
53
+ sha256(data: BytesLike): Hex;
53
54
  private toEthersBytesLike;
54
55
  hexZeroPad(value: BytesLike, length: number): string;
55
56
  arrayify(hexString: string): Uint8Array;
56
57
  hexlify(value: Uint8Array): string;
57
58
  solidityPack(types: string[], values: ContractValue[]): string;
58
59
  hashTypedData(domain: TypedDataDomain, types: Record<string, TypedDataField[]>, data: Record<string, unknown>): string;
59
- getChecksumAddress(address: string): string;
60
+ getChecksumAddress(address: string): Hex;
61
+ recoverAddress(hash: Hex, signature: Hex): Promise<Hex>;
60
62
  encodeAbi(types: string[], values: ContractValue[]): BytesLike;
61
63
  decodeAbi(types: string[], data: BytesLike): ContractValue[];
62
64
  id(text: string): BytesLike;
package/dist/index.js CHANGED
@@ -233,6 +233,9 @@ var EthersV6Utils = class {
233
233
  keccak256(data) {
234
234
  return (0, import_ethers2.keccak256)(this.toEthersBytesLike(data));
235
235
  }
236
+ sha256(data) {
237
+ return (0, import_ethers2.sha256)(this.toEthersBytesLike(data));
238
+ }
236
239
  // Helper method to convert our BytesLike to ethers BytesLike
237
240
  toEthersBytesLike(data) {
238
241
  if (typeof data === "string") {
@@ -266,6 +269,9 @@ var EthersV6Utils = class {
266
269
  getChecksumAddress(address) {
267
270
  return (0, import_ethers2.getAddress)(address);
268
271
  }
272
+ async recoverAddress(hash, signature) {
273
+ return (0, import_ethers2.recoverAddress)(hash, signature);
274
+ }
269
275
  encodeAbi(types, values) {
270
276
  return import_ethers2.AbiCoder.defaultAbiCoder().encode(types, values);
271
277
  }
@@ -429,6 +435,8 @@ var EthersV6SignerAdapter = class extends import_sdk_common3.AbstractSigner {
429
435
  throw new Error("Transaction failed");
430
436
  }
431
437
  return {
438
+ from: receipt.from,
439
+ to: receipt.to,
432
440
  transactionHash: receipt.hash,
433
441
  blockNumber: BigInt(receipt.blockNumber),
434
442
  blockHash: receipt.blockHash || "",
package/dist/index.mjs CHANGED
@@ -36,7 +36,9 @@ import {
36
36
  Contract,
37
37
  parseUnits,
38
38
  ParamType,
39
- isAddress
39
+ isAddress,
40
+ sha256,
41
+ recoverAddress
40
42
  } from "ethers";
41
43
 
42
44
  // src/EthersV6InterfaceWrapper.ts
@@ -240,6 +242,9 @@ var EthersV6Utils = class {
240
242
  keccak256(data) {
241
243
  return keccak256(this.toEthersBytesLike(data));
242
244
  }
245
+ sha256(data) {
246
+ return sha256(this.toEthersBytesLike(data));
247
+ }
243
248
  // Helper method to convert our BytesLike to ethers BytesLike
244
249
  toEthersBytesLike(data) {
245
250
  if (typeof data === "string") {
@@ -273,6 +278,9 @@ var EthersV6Utils = class {
273
278
  getChecksumAddress(address) {
274
279
  return getAddress(address);
275
280
  }
281
+ async recoverAddress(hash, signature) {
282
+ return recoverAddress(hash, signature);
283
+ }
276
284
  encodeAbi(types, values) {
277
285
  return AbiCoder.defaultAbiCoder().encode(types, values);
278
286
  }
@@ -436,6 +444,8 @@ var EthersV6SignerAdapter = class extends AbstractSigner {
436
444
  throw new Error("Transaction failed");
437
445
  }
438
446
  return {
447
+ from: receipt.from,
448
+ to: receipt.to,
439
449
  transactionHash: receipt.hash,
440
450
  blockNumber: BigInt(receipt.blockNumber),
441
451
  blockHash: receipt.blockHash || "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowprotocol/sdk-ethers-v6-adapter",
3
- "version": "0.2.4-beta.0",
3
+ "version": "0.3.0",
4
4
  "description": "Ethers v6 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
  "ethers": "^6.13.7"