@cowprotocol/sdk-ethers-v6-adapter 0.2.0-beta.0 → 0.2.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 +17 -22
- package/dist/index.d.ts +17 -22
- package/dist/index.js +2 -3
- package/dist/index.mjs +2 -3
- package/package.json +12 -13
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InterfaceAbi, Interface, BytesLike, TypedDataDomain, TypedDataField, BigNumberish, SignatureLike, JsonRpcProvider,
|
|
2
|
-
import { GenericContractInterface, Log, AdapterUtils, AbstractSigner, TransactionParams, TransactionResponse, AdapterTypes, PrivateKey, AbstractProviderAdapter, TransactionReceipt, Block, GenericContract } from '@cowprotocol/sdk-common';
|
|
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';
|
|
3
3
|
|
|
4
4
|
declare class EthersV6InterfaceWrapper implements GenericContractInterface {
|
|
5
5
|
private ethersInterface;
|
|
@@ -18,20 +18,20 @@ declare class EthersV6InterfaceWrapper implements GenericContractInterface {
|
|
|
18
18
|
/**
|
|
19
19
|
* Encode function data
|
|
20
20
|
*/
|
|
21
|
-
encodeFunctionData(name: string, args:
|
|
21
|
+
encodeFunctionData(name: string, args: ContractValue[]): string;
|
|
22
22
|
/**
|
|
23
23
|
* Decode function data
|
|
24
24
|
* Fixed to return data in the same format as ethers v5 for compatibility
|
|
25
25
|
*/
|
|
26
|
-
decodeFunctionData(functionName: string, data: string):
|
|
26
|
+
decodeFunctionData(functionName: string, data: string): ContractValue[];
|
|
27
27
|
parseLog(event: Log): {
|
|
28
|
-
args: unknown
|
|
28
|
+
args: Record<string, unknown>;
|
|
29
29
|
} | null;
|
|
30
30
|
getEventTopic(name: string): string | null;
|
|
31
31
|
/**
|
|
32
32
|
* Get all fragments
|
|
33
33
|
*/
|
|
34
|
-
get fragments():
|
|
34
|
+
get fragments(): Record<string, unknown>[];
|
|
35
35
|
/**
|
|
36
36
|
* Get functions object (ethers v5 compatibility)
|
|
37
37
|
*/
|
|
@@ -39,13 +39,13 @@ declare class EthersV6InterfaceWrapper implements GenericContractInterface {
|
|
|
39
39
|
/**
|
|
40
40
|
* Get ABI
|
|
41
41
|
*/
|
|
42
|
-
get abi():
|
|
42
|
+
get abi(): Record<string, unknown>[];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
type Abi$1 = ConstructorParameters<typeof Interface>[0];
|
|
46
46
|
declare class EthersV6Utils implements AdapterUtils {
|
|
47
47
|
toUtf8Bytes(text: string): Uint8Array;
|
|
48
|
-
encodeDeploy(encodeDeployArgs:
|
|
48
|
+
encodeDeploy(encodeDeployArgs: ContractValue[], abi: Abi$1): string;
|
|
49
49
|
getCreate2Address(from: string, salt: BytesLike, initCodeHash: BytesLike): string;
|
|
50
50
|
hexConcat(items: ReadonlyArray<BytesLike>): string;
|
|
51
51
|
formatBytes32String(text: string): string;
|
|
@@ -54,14 +54,13 @@ declare class EthersV6Utils implements AdapterUtils {
|
|
|
54
54
|
hexZeroPad(value: BytesLike, length: number): string;
|
|
55
55
|
arrayify(hexString: string): Uint8Array;
|
|
56
56
|
hexlify(value: Uint8Array): string;
|
|
57
|
-
solidityPack(types: string[], values:
|
|
57
|
+
solidityPack(types: string[], values: ContractValue[]): string;
|
|
58
58
|
hashTypedData(domain: TypedDataDomain, types: Record<string, TypedDataField[]>, data: Record<string, unknown>): string;
|
|
59
59
|
getChecksumAddress(address: string): string;
|
|
60
|
-
encodeAbi(types: string[], values:
|
|
61
|
-
decodeAbi(types: string[], data: BytesLike):
|
|
60
|
+
encodeAbi(types: string[], values: ContractValue[]): BytesLike;
|
|
61
|
+
decodeAbi(types: string[], data: BytesLike): ContractValue[];
|
|
62
62
|
id(text: string): BytesLike;
|
|
63
63
|
toBigIntish(value: string | number | BigNumberish): BigNumberish;
|
|
64
|
-
newBigintish(value: number | string): BigNumberish;
|
|
65
64
|
hexDataSlice(data: BytesLike, offset: number, endOffset?: number): BytesLike;
|
|
66
65
|
joinSignature(signature: {
|
|
67
66
|
r: string;
|
|
@@ -83,19 +82,19 @@ declare class EthersV6Utils implements AdapterUtils {
|
|
|
83
82
|
inputs: Array<{
|
|
84
83
|
type: string;
|
|
85
84
|
}>;
|
|
86
|
-
}>, functionName: string, args:
|
|
85
|
+
}>, functionName: string, args: ContractValue[]): string;
|
|
87
86
|
decodeFunctionData(abi: Array<{
|
|
88
87
|
name: string;
|
|
89
88
|
inputs: Array<{
|
|
90
89
|
type: string;
|
|
91
90
|
}>;
|
|
92
|
-
}>, functionName: string, data: string):
|
|
91
|
+
}>, functionName: string, data: string): ContractValue[];
|
|
93
92
|
toNumber(value: BigNumberish): number;
|
|
94
|
-
solidityKeccak256(types: string[], values:
|
|
93
|
+
solidityKeccak256(types: string[], values: ContractValue[]): string;
|
|
95
94
|
createInterface(abi: InterfaceAbi): EthersV6InterfaceWrapper;
|
|
96
95
|
hashDomain(domain: TypedDataDomain): string;
|
|
97
|
-
grantRequiredRoles(authorizerAddress: string, authorizerAbi: Abi$1, vaultAddress: string, vaultRelayerAddress: string, contractCall: (address: string, abi: Abi$1, functionName: string, args:
|
|
98
|
-
readStorage(baseAddress: string, baseAbi: any[], readerAddress: string, readerAbi: any[], provider: JsonRpcProvider, method: string, parameters:
|
|
96
|
+
grantRequiredRoles(authorizerAddress: string, authorizerAbi: Abi$1, vaultAddress: string, vaultRelayerAddress: string, contractCall: (address: string, abi: Abi$1, functionName: string, args: ContractValue[]) => Promise<void>): Promise<void>;
|
|
97
|
+
readStorage(baseAddress: string, baseAbi: any[], readerAddress: string, readerAbi: any[], provider: JsonRpcProvider, method: string, parameters: ContractValue[]): Promise<any>;
|
|
99
98
|
randomBytes(length: number): string;
|
|
100
99
|
isAddress(address: string): boolean;
|
|
101
100
|
isHexString(value: string): boolean;
|
|
@@ -148,14 +147,10 @@ declare class IntChainIdTypedDataV4Signer extends EthersV6SignerAdapter {
|
|
|
148
147
|
type Abi = ConstructorParameters<typeof Interface>[0];
|
|
149
148
|
interface EthersV6Types extends AdapterTypes {
|
|
150
149
|
Abi: Abi;
|
|
151
|
-
Address: string;
|
|
152
150
|
Bytes: BytesLike;
|
|
153
|
-
BigIntish: BigNumberish;
|
|
154
151
|
ContractInterface: Interface;
|
|
155
152
|
Provider: Provider;
|
|
156
153
|
Signer: Signer;
|
|
157
|
-
TypedDataDomain: TypedDataDomain;
|
|
158
|
-
TypedDataTypes: Record<string, TypedDataField[]>;
|
|
159
154
|
}
|
|
160
155
|
interface EthersV6AdapterOptions {
|
|
161
156
|
provider: Provider | string;
|
|
@@ -183,7 +178,7 @@ declare class EthersV6Adapter extends AbstractProviderAdapter<EthersV6Types> {
|
|
|
183
178
|
address: string;
|
|
184
179
|
abi: Abi;
|
|
185
180
|
functionName: string;
|
|
186
|
-
args?:
|
|
181
|
+
args?: ContractValue[];
|
|
187
182
|
}, provider?: Provider): Promise<unknown>;
|
|
188
183
|
getBlock(blockTag: string, provider?: Provider): Promise<Block>;
|
|
189
184
|
getContract(address: string, abi: Abi): GenericContract;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InterfaceAbi, Interface, BytesLike, TypedDataDomain, TypedDataField, BigNumberish, SignatureLike, JsonRpcProvider,
|
|
2
|
-
import { GenericContractInterface, Log, AdapterUtils, AbstractSigner, TransactionParams, TransactionResponse, AdapterTypes, PrivateKey, AbstractProviderAdapter, TransactionReceipt, Block, GenericContract } from '@cowprotocol/sdk-common';
|
|
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';
|
|
3
3
|
|
|
4
4
|
declare class EthersV6InterfaceWrapper implements GenericContractInterface {
|
|
5
5
|
private ethersInterface;
|
|
@@ -18,20 +18,20 @@ declare class EthersV6InterfaceWrapper implements GenericContractInterface {
|
|
|
18
18
|
/**
|
|
19
19
|
* Encode function data
|
|
20
20
|
*/
|
|
21
|
-
encodeFunctionData(name: string, args:
|
|
21
|
+
encodeFunctionData(name: string, args: ContractValue[]): string;
|
|
22
22
|
/**
|
|
23
23
|
* Decode function data
|
|
24
24
|
* Fixed to return data in the same format as ethers v5 for compatibility
|
|
25
25
|
*/
|
|
26
|
-
decodeFunctionData(functionName: string, data: string):
|
|
26
|
+
decodeFunctionData(functionName: string, data: string): ContractValue[];
|
|
27
27
|
parseLog(event: Log): {
|
|
28
|
-
args: unknown
|
|
28
|
+
args: Record<string, unknown>;
|
|
29
29
|
} | null;
|
|
30
30
|
getEventTopic(name: string): string | null;
|
|
31
31
|
/**
|
|
32
32
|
* Get all fragments
|
|
33
33
|
*/
|
|
34
|
-
get fragments():
|
|
34
|
+
get fragments(): Record<string, unknown>[];
|
|
35
35
|
/**
|
|
36
36
|
* Get functions object (ethers v5 compatibility)
|
|
37
37
|
*/
|
|
@@ -39,13 +39,13 @@ declare class EthersV6InterfaceWrapper implements GenericContractInterface {
|
|
|
39
39
|
/**
|
|
40
40
|
* Get ABI
|
|
41
41
|
*/
|
|
42
|
-
get abi():
|
|
42
|
+
get abi(): Record<string, unknown>[];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
type Abi$1 = ConstructorParameters<typeof Interface>[0];
|
|
46
46
|
declare class EthersV6Utils implements AdapterUtils {
|
|
47
47
|
toUtf8Bytes(text: string): Uint8Array;
|
|
48
|
-
encodeDeploy(encodeDeployArgs:
|
|
48
|
+
encodeDeploy(encodeDeployArgs: ContractValue[], abi: Abi$1): string;
|
|
49
49
|
getCreate2Address(from: string, salt: BytesLike, initCodeHash: BytesLike): string;
|
|
50
50
|
hexConcat(items: ReadonlyArray<BytesLike>): string;
|
|
51
51
|
formatBytes32String(text: string): string;
|
|
@@ -54,14 +54,13 @@ declare class EthersV6Utils implements AdapterUtils {
|
|
|
54
54
|
hexZeroPad(value: BytesLike, length: number): string;
|
|
55
55
|
arrayify(hexString: string): Uint8Array;
|
|
56
56
|
hexlify(value: Uint8Array): string;
|
|
57
|
-
solidityPack(types: string[], values:
|
|
57
|
+
solidityPack(types: string[], values: ContractValue[]): string;
|
|
58
58
|
hashTypedData(domain: TypedDataDomain, types: Record<string, TypedDataField[]>, data: Record<string, unknown>): string;
|
|
59
59
|
getChecksumAddress(address: string): string;
|
|
60
|
-
encodeAbi(types: string[], values:
|
|
61
|
-
decodeAbi(types: string[], data: BytesLike):
|
|
60
|
+
encodeAbi(types: string[], values: ContractValue[]): BytesLike;
|
|
61
|
+
decodeAbi(types: string[], data: BytesLike): ContractValue[];
|
|
62
62
|
id(text: string): BytesLike;
|
|
63
63
|
toBigIntish(value: string | number | BigNumberish): BigNumberish;
|
|
64
|
-
newBigintish(value: number | string): BigNumberish;
|
|
65
64
|
hexDataSlice(data: BytesLike, offset: number, endOffset?: number): BytesLike;
|
|
66
65
|
joinSignature(signature: {
|
|
67
66
|
r: string;
|
|
@@ -83,19 +82,19 @@ declare class EthersV6Utils implements AdapterUtils {
|
|
|
83
82
|
inputs: Array<{
|
|
84
83
|
type: string;
|
|
85
84
|
}>;
|
|
86
|
-
}>, functionName: string, args:
|
|
85
|
+
}>, functionName: string, args: ContractValue[]): string;
|
|
87
86
|
decodeFunctionData(abi: Array<{
|
|
88
87
|
name: string;
|
|
89
88
|
inputs: Array<{
|
|
90
89
|
type: string;
|
|
91
90
|
}>;
|
|
92
|
-
}>, functionName: string, data: string):
|
|
91
|
+
}>, functionName: string, data: string): ContractValue[];
|
|
93
92
|
toNumber(value: BigNumberish): number;
|
|
94
|
-
solidityKeccak256(types: string[], values:
|
|
93
|
+
solidityKeccak256(types: string[], values: ContractValue[]): string;
|
|
95
94
|
createInterface(abi: InterfaceAbi): EthersV6InterfaceWrapper;
|
|
96
95
|
hashDomain(domain: TypedDataDomain): string;
|
|
97
|
-
grantRequiredRoles(authorizerAddress: string, authorizerAbi: Abi$1, vaultAddress: string, vaultRelayerAddress: string, contractCall: (address: string, abi: Abi$1, functionName: string, args:
|
|
98
|
-
readStorage(baseAddress: string, baseAbi: any[], readerAddress: string, readerAbi: any[], provider: JsonRpcProvider, method: string, parameters:
|
|
96
|
+
grantRequiredRoles(authorizerAddress: string, authorizerAbi: Abi$1, vaultAddress: string, vaultRelayerAddress: string, contractCall: (address: string, abi: Abi$1, functionName: string, args: ContractValue[]) => Promise<void>): Promise<void>;
|
|
97
|
+
readStorage(baseAddress: string, baseAbi: any[], readerAddress: string, readerAbi: any[], provider: JsonRpcProvider, method: string, parameters: ContractValue[]): Promise<any>;
|
|
99
98
|
randomBytes(length: number): string;
|
|
100
99
|
isAddress(address: string): boolean;
|
|
101
100
|
isHexString(value: string): boolean;
|
|
@@ -148,14 +147,10 @@ declare class IntChainIdTypedDataV4Signer extends EthersV6SignerAdapter {
|
|
|
148
147
|
type Abi = ConstructorParameters<typeof Interface>[0];
|
|
149
148
|
interface EthersV6Types extends AdapterTypes {
|
|
150
149
|
Abi: Abi;
|
|
151
|
-
Address: string;
|
|
152
150
|
Bytes: BytesLike;
|
|
153
|
-
BigIntish: BigNumberish;
|
|
154
151
|
ContractInterface: Interface;
|
|
155
152
|
Provider: Provider;
|
|
156
153
|
Signer: Signer;
|
|
157
|
-
TypedDataDomain: TypedDataDomain;
|
|
158
|
-
TypedDataTypes: Record<string, TypedDataField[]>;
|
|
159
154
|
}
|
|
160
155
|
interface EthersV6AdapterOptions {
|
|
161
156
|
provider: Provider | string;
|
|
@@ -183,7 +178,7 @@ declare class EthersV6Adapter extends AbstractProviderAdapter<EthersV6Types> {
|
|
|
183
178
|
address: string;
|
|
184
179
|
abi: Abi;
|
|
185
180
|
functionName: string;
|
|
186
|
-
args?:
|
|
181
|
+
args?: ContractValue[];
|
|
187
182
|
}, provider?: Provider): Promise<unknown>;
|
|
188
183
|
getBlock(blockTag: string, provider?: Provider): Promise<Block>;
|
|
189
184
|
getContract(address: string, abi: Abi): GenericContract;
|
package/dist/index.js
CHANGED
|
@@ -278,9 +278,6 @@ var EthersV6Utils = class {
|
|
|
278
278
|
toBigIntish(value) {
|
|
279
279
|
return (0, import_ethers2.toBigInt)(value);
|
|
280
280
|
}
|
|
281
|
-
newBigintish(value) {
|
|
282
|
-
return (0, import_ethers2.toBigInt)(value);
|
|
283
|
-
}
|
|
284
281
|
hexDataSlice(data, offset, endOffset) {
|
|
285
282
|
return (0, import_ethers2.dataSlice)(data, offset, endOffset);
|
|
286
283
|
}
|
|
@@ -432,6 +429,8 @@ var EthersV6SignerAdapter = class extends import_sdk_common3.AbstractSigner {
|
|
|
432
429
|
throw new Error("Transaction failed");
|
|
433
430
|
}
|
|
434
431
|
return {
|
|
432
|
+
from: receipt.from,
|
|
433
|
+
to: receipt.to,
|
|
435
434
|
transactionHash: receipt.hash,
|
|
436
435
|
blockNumber: BigInt(receipt.blockNumber),
|
|
437
436
|
blockHash: receipt.blockHash || "",
|
package/dist/index.mjs
CHANGED
|
@@ -285,9 +285,6 @@ var EthersV6Utils = class {
|
|
|
285
285
|
toBigIntish(value) {
|
|
286
286
|
return toBigInt(value);
|
|
287
287
|
}
|
|
288
|
-
newBigintish(value) {
|
|
289
|
-
return toBigInt(value);
|
|
290
|
-
}
|
|
291
288
|
hexDataSlice(data, offset, endOffset) {
|
|
292
289
|
return dataSlice(data, offset, endOffset);
|
|
293
290
|
}
|
|
@@ -439,6 +436,8 @@ var EthersV6SignerAdapter = class extends AbstractSigner {
|
|
|
439
436
|
throw new Error("Transaction failed");
|
|
440
437
|
}
|
|
441
438
|
return {
|
|
439
|
+
from: receipt.from,
|
|
440
|
+
to: receipt.to,
|
|
442
441
|
transactionHash: receipt.hash,
|
|
443
442
|
blockNumber: BigInt(receipt.blockNumber),
|
|
444
443
|
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.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Ethers v6 adapter for CoW Protocol SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -12,24 +12,23 @@
|
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
17
|
-
"dev": "tsup src/index.ts --format esm,cjs --watch --dts",
|
|
18
|
-
"lint": "eslint src/**/*.ts",
|
|
19
|
-
"typecheck": "tsc --noEmit",
|
|
20
|
-
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
21
|
-
"prepublishOnly": "npm run build"
|
|
22
|
-
},
|
|
23
15
|
"dependencies": {
|
|
24
|
-
"@cowprotocol/sdk-common": "
|
|
16
|
+
"@cowprotocol/sdk-common": "0.3.0"
|
|
25
17
|
},
|
|
26
18
|
"peerDependencies": {
|
|
27
19
|
"ethers": "^6.13.7"
|
|
28
20
|
},
|
|
29
21
|
"devDependencies": {
|
|
30
|
-
"@cow-sdk/typescript-config": "workspace:*",
|
|
31
22
|
"@types/node": "^20.5.2",
|
|
32
23
|
"tsup": "^7.2.0",
|
|
33
|
-
"typescript": "^5.2.2"
|
|
24
|
+
"typescript": "^5.2.2",
|
|
25
|
+
"@cow-sdk/typescript-config": "0.0.0-beta.0"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
29
|
+
"dev": "tsup src/index.ts --format esm,cjs --watch --dts",
|
|
30
|
+
"lint": "eslint src/**/*.ts",
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
34
33
|
}
|
|
35
|
-
}
|
|
34
|
+
}
|