Skip to content

Commit

Permalink
ethers -> ethers_v6, some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
meetmangukiya committed May 25, 2024
1 parent 93ca166 commit a9330df
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"build": "tsc"
},
"dependencies": {
"ethers": "^6.12.1",
"ethers_v6": "npm:ethers@^6.12.1",
"typescript": "^5.4.5"
},
"devDependencies": {
Expand Down
22 changes: 11 additions & 11 deletions ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,42 @@ import {
solidityPackedKeccak256,
TypedDataDomain,
TypedDataEncoder,
} from 'ethers';
} from 'ethers_v6';
import { FACTORY_ABI, PROXY_CREATION_CODE, SHED_ABI } from './constants';

export const computeProxyAddress = (user: string) => {
getCreate2Address;
};

interface ISdkOptions {
export interface ISdkOptions {
factoryAddress: string;
proxyCreationCode?: string;
implementationAddress: string;
chainId: number;
}

interface ICall {
export interface ICall {
target: string;
value: bigint;
callData: string;
allowFailure: boolean;
isDelegateCall: boolean;
}

interface IExecuteHooks {
export interface IExecuteHooks {
calls: ICall[];
nonce: string;
deadline: bigint;
}

const ABI_CODER = new ethers.AbiCoder();

const COW_SHED_712_TYPES = {
const DOMAIN_TYPE = {
EIP712Domain: [
{ type: 'string', name: 'name' },
{ type: 'string', name: 'version' },
{ type: 'uint256', name: 'chainId' },
{ type: 'address', name: 'verifyingContract' },
],
};

const COW_SHED_712_TYPES = {
ExecuteHooks: [
{ type: 'Call[]', name: 'calls' },
{ type: 'bytes32', name: 'nonce' },
Expand Down Expand Up @@ -79,8 +78,9 @@ export class CowShedSdk {
}

computeDomainSeparator(proxy: string) {
return TYPED_DATA_ENCODER.hashStruct(
return TypedDataEncoder.hashStruct(
'EIP712Domain',
DOMAIN_TYPE,
this._getDomain(proxy)
);
}
Expand Down Expand Up @@ -139,7 +139,7 @@ export class CowShedSdk {
}

static encodeEOASignature(r: bigint, s: bigint, v: number) {
return solidityPacked(['bytes32', 'bytes32', 'uint8'], [r, s, v]);
return solidityPacked(['uint', 'uint', 'uint8'], [r, s, v]);
}

private _hashToSign(
Expand Down
2 changes: 1 addition & 1 deletion ts/testUtil.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TypedDataEncoder, ZeroAddress } from 'ethers';
import { TypedDataEncoder, ZeroAddress } from 'ethers_v6';

interface ICall {
target: string;
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ diff@^4.0.1:
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==

ethers@^6.12.1:
"ethers_v6@npm:ethers@^6.12.1":
version "6.12.1"
resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.12.1.tgz#517ff6d66d4fd5433e38e903051da3e57c87ff37"
integrity sha512-j6wcVoZf06nqEcBbDWkKg8Fp895SS96dSnTCjiXT+8vt2o02raTn4Lo9ERUuIVU5bAjoPYeA+7ytQFexFmLuVw==
Expand Down

0 comments on commit a9330df

Please sign in to comment.