@cowprotocol/sdk-ethers-v5-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 +15 -22
- package/dist/index.d.ts +15 -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,7 +1,6 @@
|
|
|
1
|
-
import { ethers, BytesLike, TypedDataDomain, TypedDataField,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ParamType } from 'ethers/lib/utils';
|
|
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';
|
|
3
|
+
import { TypedDataSigner } from '@ethersproject/abstract-signer';
|
|
5
4
|
|
|
6
5
|
type Abi$1 = ConstructorParameters<typeof ethers.utils.Interface>[0];
|
|
7
6
|
declare class EthersV5Utils implements AdapterUtils {
|
|
@@ -10,20 +9,19 @@ declare class EthersV5Utils implements AdapterUtils {
|
|
|
10
9
|
getCreate2Address(from: string, salt: BytesLike, initCodeHash: BytesLike): string;
|
|
11
10
|
hexConcat(items: ReadonlyArray<BytesLike>): string;
|
|
12
11
|
formatBytes32String(text: string): string;
|
|
13
|
-
encodeDeploy(encodeDeployArgs:
|
|
12
|
+
encodeDeploy(encodeDeployArgs: ContractValue[], abi: Abi$1): string;
|
|
14
13
|
keccak256(data: BytesLike): string;
|
|
15
14
|
hexZeroPad(value: BytesLike, length: number): string;
|
|
16
15
|
arrayify(hexString: string): Uint8Array;
|
|
17
16
|
hexlify(value: BytesLike): string;
|
|
18
|
-
solidityPack(types: string[], values:
|
|
17
|
+
solidityPack(types: string[], values: ContractValue[]): string;
|
|
19
18
|
hashTypedData(domain: TypedDataDomain, types: Record<string, TypedDataField[]>, data: Record<string, unknown>): string;
|
|
20
19
|
getChecksumAddress(address: string): string;
|
|
21
|
-
encodeAbi(types: string[], values:
|
|
22
|
-
decodeAbi(types: string[], data: BytesLike):
|
|
20
|
+
encodeAbi(types: string[], values: ContractValue[]): BytesLike;
|
|
21
|
+
decodeAbi(types: string[], data: BytesLike): ContractValue[];
|
|
23
22
|
private convertBigNumbersToBigInt;
|
|
24
23
|
id(text: string): BytesLike;
|
|
25
|
-
toBigIntish(value:
|
|
26
|
-
newBigintish(value: number | string): BigNumberish;
|
|
24
|
+
toBigIntish(value: unknown): BigIntish;
|
|
27
25
|
hexDataSlice(data: BytesLike, offset: number, endOffset?: number): BytesLike;
|
|
28
26
|
joinSignature(signature: {
|
|
29
27
|
r: string;
|
|
@@ -45,18 +43,18 @@ declare class EthersV5Utils implements AdapterUtils {
|
|
|
45
43
|
inputs: Array<{
|
|
46
44
|
type: string;
|
|
47
45
|
}>;
|
|
48
|
-
}>, functionName: string, args:
|
|
46
|
+
}>, functionName: string, args: ContractValue[]): string;
|
|
49
47
|
decodeFunctionData(abi: Array<{
|
|
50
48
|
name: string;
|
|
51
49
|
inputs: Array<{
|
|
52
50
|
type: string;
|
|
53
51
|
}>;
|
|
54
|
-
}>, functionName: string, data: string):
|
|
55
|
-
toNumber(value:
|
|
56
|
-
solidityKeccak256(types: string[], values:
|
|
52
|
+
}>, functionName: string, data: string): ContractValue[];
|
|
53
|
+
toNumber(value: BigIntish): number;
|
|
54
|
+
solidityKeccak256(types: string[], values: ContractValue[]): string;
|
|
57
55
|
hashDomain(domain: TypedDataDomain): string;
|
|
58
|
-
grantRequiredRoles(authorizerAddress: string, authorizerAbi: Abi$1, vaultAddress: string, vaultRelayerAddress: string, contractCall: (address: string, abi: Abi$1, functionName: string, args:
|
|
59
|
-
readStorage(baseAddress: Address, baseAbi: Abi$1, readerAddress: Address, readerAbi: Abi$1, provider: ethers.providers.JsonRpcProvider, method: string, parameters:
|
|
56
|
+
grantRequiredRoles(authorizerAddress: string, authorizerAbi: Abi$1, vaultAddress: string, vaultRelayerAddress: string, contractCall: (address: string, abi: Abi$1, functionName: string, args: ContractValue[]) => Promise<void>): Promise<void>;
|
|
57
|
+
readStorage(baseAddress: Address, baseAbi: Abi$1, readerAddress: Address, readerAbi: Abi$1, provider: ethers.providers.JsonRpcProvider, method: string, parameters: ContractValue[]): Promise<any>;
|
|
60
58
|
randomBytes(length: number): string;
|
|
61
59
|
isAddress(address: string): boolean;
|
|
62
60
|
isHexString(value: string): boolean;
|
|
@@ -110,21 +108,16 @@ type Interface = ethers.utils.Interface;
|
|
|
110
108
|
type RpcProvider = ethers.providers.Provider;
|
|
111
109
|
interface EthersV5Types extends AdapterTypes {
|
|
112
110
|
Abi: Abi;
|
|
113
|
-
Address: string;
|
|
114
111
|
Bytes: BytesLike;
|
|
115
|
-
BigIntish: BigNumberish;
|
|
116
112
|
ContractInterface: Interface;
|
|
117
113
|
Provider: RpcProvider;
|
|
118
114
|
Signer: ethers.Signer;
|
|
119
|
-
TypedDataDomain: TypedDataDomain$1;
|
|
120
|
-
TypedDataTypes: Record<string, TypedDataField$1[]>;
|
|
121
115
|
}
|
|
122
116
|
interface EthersV5AdapterOptions {
|
|
123
117
|
provider: RpcProvider | string;
|
|
124
118
|
signer?: ethers.Signer | PrivateKey;
|
|
125
119
|
}
|
|
126
120
|
declare class EthersV5Adapter extends AbstractProviderAdapter<EthersV5Types> {
|
|
127
|
-
protected _type?: EthersV5Types;
|
|
128
121
|
private _provider;
|
|
129
122
|
private _signerAdapter?;
|
|
130
123
|
utils: EthersV5Utils;
|
|
@@ -146,7 +139,7 @@ declare class EthersV5Adapter extends AbstractProviderAdapter<EthersV5Types> {
|
|
|
146
139
|
address: string;
|
|
147
140
|
abi: Abi;
|
|
148
141
|
functionName: string;
|
|
149
|
-
args?:
|
|
142
|
+
args?: ContractValue[];
|
|
150
143
|
}, provider?: RpcProvider): Promise<unknown>;
|
|
151
144
|
getBlock(blockTag: string, provider?: ethers.providers.JsonRpcProvider): Promise<ethers.providers.Block>;
|
|
152
145
|
getContract(address: string, abi: Abi): GenericContract;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ethers, BytesLike, TypedDataDomain, TypedDataField,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ParamType } from 'ethers/lib/utils';
|
|
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';
|
|
3
|
+
import { TypedDataSigner } from '@ethersproject/abstract-signer';
|
|
5
4
|
|
|
6
5
|
type Abi$1 = ConstructorParameters<typeof ethers.utils.Interface>[0];
|
|
7
6
|
declare class EthersV5Utils implements AdapterUtils {
|
|
@@ -10,20 +9,19 @@ declare class EthersV5Utils implements AdapterUtils {
|
|
|
10
9
|
getCreate2Address(from: string, salt: BytesLike, initCodeHash: BytesLike): string;
|
|
11
10
|
hexConcat(items: ReadonlyArray<BytesLike>): string;
|
|
12
11
|
formatBytes32String(text: string): string;
|
|
13
|
-
encodeDeploy(encodeDeployArgs:
|
|
12
|
+
encodeDeploy(encodeDeployArgs: ContractValue[], abi: Abi$1): string;
|
|
14
13
|
keccak256(data: BytesLike): string;
|
|
15
14
|
hexZeroPad(value: BytesLike, length: number): string;
|
|
16
15
|
arrayify(hexString: string): Uint8Array;
|
|
17
16
|
hexlify(value: BytesLike): string;
|
|
18
|
-
solidityPack(types: string[], values:
|
|
17
|
+
solidityPack(types: string[], values: ContractValue[]): string;
|
|
19
18
|
hashTypedData(domain: TypedDataDomain, types: Record<string, TypedDataField[]>, data: Record<string, unknown>): string;
|
|
20
19
|
getChecksumAddress(address: string): string;
|
|
21
|
-
encodeAbi(types: string[], values:
|
|
22
|
-
decodeAbi(types: string[], data: BytesLike):
|
|
20
|
+
encodeAbi(types: string[], values: ContractValue[]): BytesLike;
|
|
21
|
+
decodeAbi(types: string[], data: BytesLike): ContractValue[];
|
|
23
22
|
private convertBigNumbersToBigInt;
|
|
24
23
|
id(text: string): BytesLike;
|
|
25
|
-
toBigIntish(value:
|
|
26
|
-
newBigintish(value: number | string): BigNumberish;
|
|
24
|
+
toBigIntish(value: unknown): BigIntish;
|
|
27
25
|
hexDataSlice(data: BytesLike, offset: number, endOffset?: number): BytesLike;
|
|
28
26
|
joinSignature(signature: {
|
|
29
27
|
r: string;
|
|
@@ -45,18 +43,18 @@ declare class EthersV5Utils implements AdapterUtils {
|
|
|
45
43
|
inputs: Array<{
|
|
46
44
|
type: string;
|
|
47
45
|
}>;
|
|
48
|
-
}>, functionName: string, args:
|
|
46
|
+
}>, functionName: string, args: ContractValue[]): string;
|
|
49
47
|
decodeFunctionData(abi: Array<{
|
|
50
48
|
name: string;
|
|
51
49
|
inputs: Array<{
|
|
52
50
|
type: string;
|
|
53
51
|
}>;
|
|
54
|
-
}>, functionName: string, data: string):
|
|
55
|
-
toNumber(value:
|
|
56
|
-
solidityKeccak256(types: string[], values:
|
|
52
|
+
}>, functionName: string, data: string): ContractValue[];
|
|
53
|
+
toNumber(value: BigIntish): number;
|
|
54
|
+
solidityKeccak256(types: string[], values: ContractValue[]): string;
|
|
57
55
|
hashDomain(domain: TypedDataDomain): string;
|
|
58
|
-
grantRequiredRoles(authorizerAddress: string, authorizerAbi: Abi$1, vaultAddress: string, vaultRelayerAddress: string, contractCall: (address: string, abi: Abi$1, functionName: string, args:
|
|
59
|
-
readStorage(baseAddress: Address, baseAbi: Abi$1, readerAddress: Address, readerAbi: Abi$1, provider: ethers.providers.JsonRpcProvider, method: string, parameters:
|
|
56
|
+
grantRequiredRoles(authorizerAddress: string, authorizerAbi: Abi$1, vaultAddress: string, vaultRelayerAddress: string, contractCall: (address: string, abi: Abi$1, functionName: string, args: ContractValue[]) => Promise<void>): Promise<void>;
|
|
57
|
+
readStorage(baseAddress: Address, baseAbi: Abi$1, readerAddress: Address, readerAbi: Abi$1, provider: ethers.providers.JsonRpcProvider, method: string, parameters: ContractValue[]): Promise<any>;
|
|
60
58
|
randomBytes(length: number): string;
|
|
61
59
|
isAddress(address: string): boolean;
|
|
62
60
|
isHexString(value: string): boolean;
|
|
@@ -110,21 +108,16 @@ type Interface = ethers.utils.Interface;
|
|
|
110
108
|
type RpcProvider = ethers.providers.Provider;
|
|
111
109
|
interface EthersV5Types extends AdapterTypes {
|
|
112
110
|
Abi: Abi;
|
|
113
|
-
Address: string;
|
|
114
111
|
Bytes: BytesLike;
|
|
115
|
-
BigIntish: BigNumberish;
|
|
116
112
|
ContractInterface: Interface;
|
|
117
113
|
Provider: RpcProvider;
|
|
118
114
|
Signer: ethers.Signer;
|
|
119
|
-
TypedDataDomain: TypedDataDomain$1;
|
|
120
|
-
TypedDataTypes: Record<string, TypedDataField$1[]>;
|
|
121
115
|
}
|
|
122
116
|
interface EthersV5AdapterOptions {
|
|
123
117
|
provider: RpcProvider | string;
|
|
124
118
|
signer?: ethers.Signer | PrivateKey;
|
|
125
119
|
}
|
|
126
120
|
declare class EthersV5Adapter extends AbstractProviderAdapter<EthersV5Types> {
|
|
127
|
-
protected _type?: EthersV5Types;
|
|
128
121
|
private _provider;
|
|
129
122
|
private _signerAdapter?;
|
|
130
123
|
utils: EthersV5Utils;
|
|
@@ -146,7 +139,7 @@ declare class EthersV5Adapter extends AbstractProviderAdapter<EthersV5Types> {
|
|
|
146
139
|
address: string;
|
|
147
140
|
abi: Abi;
|
|
148
141
|
functionName: string;
|
|
149
|
-
args?:
|
|
142
|
+
args?: ContractValue[];
|
|
150
143
|
}, provider?: RpcProvider): Promise<unknown>;
|
|
151
144
|
getBlock(blockTag: string, provider?: ethers.providers.JsonRpcProvider): Promise<ethers.providers.Block>;
|
|
152
145
|
getContract(address: string, abi: Abi): GenericContract;
|
package/dist/index.js
CHANGED
|
@@ -112,9 +112,6 @@ var EthersV5Utils = class {
|
|
|
112
112
|
toBigIntish(value) {
|
|
113
113
|
return import_ethers.ethers.BigNumber.from(value).toBigInt();
|
|
114
114
|
}
|
|
115
|
-
newBigintish(value) {
|
|
116
|
-
return import_ethers.ethers.BigNumber.from(value).toBigInt();
|
|
117
|
-
}
|
|
118
115
|
hexDataSlice(data, offset, endOffset) {
|
|
119
116
|
return import_ethers.ethers.utils.hexDataSlice(data, offset, endOffset);
|
|
120
117
|
}
|
|
@@ -248,6 +245,8 @@ var EthersV5SignerAdapter = class extends import_sdk_common.AbstractSigner {
|
|
|
248
245
|
wait: async (confirmations) => {
|
|
249
246
|
const receipt = await tx.wait(confirmations);
|
|
250
247
|
return {
|
|
248
|
+
from: receipt.from,
|
|
249
|
+
to: receipt.to,
|
|
251
250
|
transactionHash: receipt.transactionHash,
|
|
252
251
|
blockNumber: BigInt(receipt.blockNumber),
|
|
253
252
|
blockHash: receipt.blockHash,
|
package/dist/index.mjs
CHANGED
|
@@ -89,9 +89,6 @@ var EthersV5Utils = class {
|
|
|
89
89
|
toBigIntish(value) {
|
|
90
90
|
return ethers.BigNumber.from(value).toBigInt();
|
|
91
91
|
}
|
|
92
|
-
newBigintish(value) {
|
|
93
|
-
return ethers.BigNumber.from(value).toBigInt();
|
|
94
|
-
}
|
|
95
92
|
hexDataSlice(data, offset, endOffset) {
|
|
96
93
|
return ethers.utils.hexDataSlice(data, offset, endOffset);
|
|
97
94
|
}
|
|
@@ -225,6 +222,8 @@ var EthersV5SignerAdapter = class extends AbstractSigner {
|
|
|
225
222
|
wait: async (confirmations) => {
|
|
226
223
|
const receipt = await tx.wait(confirmations);
|
|
227
224
|
return {
|
|
225
|
+
from: receipt.from,
|
|
226
|
+
to: receipt.to,
|
|
228
227
|
transactionHash: receipt.transactionHash,
|
|
229
228
|
blockNumber: BigInt(receipt.blockNumber),
|
|
230
229
|
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.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Ethers v5 adapter for CoW Protocol SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -12,16 +12,8 @@
|
|
|
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
|
"@ethersproject/abstract-signer": "^5.8.0",
|
|
@@ -29,9 +21,16 @@
|
|
|
29
21
|
"ethers": "^5.7.2"
|
|
30
22
|
},
|
|
31
23
|
"devDependencies": {
|
|
32
|
-
"@cow-sdk/typescript-config": "workspace:*",
|
|
33
24
|
"@types/node": "^20.5.2",
|
|
34
25
|
"tsup": "^7.2.0",
|
|
35
|
-
"typescript": "^5.2.2"
|
|
26
|
+
"typescript": "^5.2.2",
|
|
27
|
+
"@cow-sdk/typescript-config": "0.0.0-beta.0"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
31
|
+
"dev": "tsup src/index.ts --format esm,cjs --watch --dts",
|
|
32
|
+
"lint": "eslint src/**/*.ts",
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
36
35
|
}
|
|
37
|
-
}
|
|
36
|
+
}
|