@cowprotocol/cow-sdk 5.10.2-RC.0 → 5.10.2

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.
Files changed (88) hide show
  1. package/dist/common/chains.d.ts +11 -0
  2. package/dist/common/{types/config.d.ts → configs.d.ts} +9 -1
  3. package/dist/common/{consts/contracts.d.ts → consts.d.ts} +12 -1
  4. package/dist/common/{types/cow-error.d.ts → cow-error.d.ts} +1 -0
  5. package/dist/common/index.d.ts +5 -10
  6. package/dist/composable/Multiplexer.d.ts +1 -1
  7. package/dist/composable/contracts.d.ts +1 -1
  8. package/dist/composable/types.d.ts +1 -1
  9. package/dist/composable/utils.d.ts +1 -1
  10. package/dist/cow-shed/CoWShedHooks.d.ts +35 -0
  11. package/dist/cow-shed/contracts.d.ts +4 -0
  12. package/dist/cow-shed/index.d.ts +3 -1
  13. package/dist/cow-shed/{contracts/CoWShedHooks.d.ts → proxyInitCode.d.ts} +0 -45
  14. package/dist/cow-shed/types.d.ts +16 -0
  15. package/dist/index-2ed223c8.js +29 -0
  16. package/dist/index-2ed223c8.js.map +1 -0
  17. package/dist/index.d.ts +0 -1
  18. package/dist/index.js +4 -4
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.modern.mjs +1 -1
  21. package/dist/index.module.js +4 -4
  22. package/dist/index.module.js.map +1 -1
  23. package/dist/order-book/api.d.ts +1 -1
  24. package/dist/order-signing/orderSigningUtils.d.ts +1 -1
  25. package/dist/order-signing/types.d.ts +1 -1
  26. package/dist/order-signing/utils.d.ts +1 -1
  27. package/dist/package.json +2 -3
  28. package/dist/schemas/trading/LimitOrderAdvancedSettings.ts +0 -26
  29. package/dist/schemas/trading/LimitTradeParameters.ts +0 -3
  30. package/dist/schemas/trading/QuoteResultsSerialized.ts +0 -3
  31. package/dist/schemas/trading/SwapAdvancedSettings.ts +0 -26
  32. package/dist/schemas/trading/TradeParameters.ts +0 -3
  33. package/dist/src/trading/README.md +0 -1
  34. package/dist/subgraph/api.d.ts +2 -2
  35. package/dist/trading/calculateUniqueOrderId.d.ts +4 -3
  36. package/dist/trading/consts.d.ts +0 -2
  37. package/dist/trading/getEthFlowTransaction.d.ts +4 -3
  38. package/dist/trading/getOrderTypedData.d.ts +1 -1
  39. package/dist/trading/getPreSignTransaction.d.ts +1 -1
  40. package/dist/trading/postCoWProtocolTrade.d.ts +3 -3
  41. package/dist/trading/postSellNativeCurrencyOrder.d.ts +3 -2
  42. package/dist/trading/tradingSdk.d.ts +7 -9
  43. package/dist/trading/types.d.ts +8 -36
  44. package/dist/trading/utils.d.ts +4 -8
  45. package/dist/{utils-c854e052.js → utils-4bdd94dd.js} +2 -2
  46. package/dist/utils-4bdd94dd.js.map +1 -0
  47. package/dist/{utils-69f2c801.js → utils-63156cab.js} +1 -1
  48. package/dist/utils-63156cab.js.map +1 -0
  49. package/dist/{utils-8d77110e.js → utils-faedc0ab.js} +1 -1
  50. package/dist/utils-faedc0ab.js.map +1 -0
  51. package/dist/utils.d.ts +1 -1
  52. package/package.json +2 -3
  53. package/dist/bridging/BridgingSdk.d.ts +0 -42
  54. package/dist/bridging/const.d.ts +0 -1
  55. package/dist/bridging/index.d.ts +0 -3
  56. package/dist/bridging/providers/MockBridgeProvider.d.ts +0 -20
  57. package/dist/bridging/types.d.ts +0 -147
  58. package/dist/chains/const.d.ts +0 -14
  59. package/dist/chains/details/arbitrum.d.ts +0 -7
  60. package/dist/chains/details/base.d.ts +0 -7
  61. package/dist/chains/details/gnosis.d.ts +0 -7
  62. package/dist/chains/details/mainnet.d.ts +0 -7
  63. package/dist/chains/details/optimism.d.ts +0 -2
  64. package/dist/chains/details/polygon.d.ts +0 -2
  65. package/dist/chains/details/sepolia.d.ts +0 -7
  66. package/dist/chains/index.d.ts +0 -2
  67. package/dist/chains/types.d.ts +0 -106
  68. package/dist/common/consts/config.d.ts +0 -9
  69. package/dist/common/consts/path.d.ts +0 -1
  70. package/dist/common/consts/tokens.d.ts +0 -9
  71. package/dist/common/types/ethereum.d.ts +0 -5
  72. package/dist/common/types/tokens.d.ts +0 -12
  73. package/dist/common/types/wallets.d.ts +0 -5
  74. package/dist/common/utils/config.d.ts +0 -4
  75. package/dist/common/utils/serialize.d.ts +0 -1
  76. package/dist/common/utils/wallet.d.ts +0 -3
  77. package/dist/cow-shed/CowShedSdk.d.ts +0 -69
  78. package/dist/cow-shed/contracts/utils.d.ts +0 -4
  79. package/dist/index-0ebfdcaf.js +0 -29
  80. package/dist/index-0ebfdcaf.js.map +0 -1
  81. package/dist/src/bridging/README.md +0 -44
  82. package/dist/src/cow-shed/README.md +0 -60
  83. package/dist/src/weiroll/README.md +0 -55
  84. package/dist/utils-69f2c801.js.map +0 -1
  85. package/dist/utils-8d77110e.js.map +0 -1
  86. package/dist/utils-c854e052.js.map +0 -1
  87. package/dist/weiroll/index.d.ts +0 -20
  88. /package/dist/common/{consts/ipfs.d.ts → ipfs.d.ts} +0 -0
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Supported chains and their `chainId` for the SDK.
3
+ * @enum
4
+ */
5
+ export declare enum SupportedChainId {
6
+ MAINNET = 1,
7
+ GNOSIS_CHAIN = 100,
8
+ ARBITRUM_ONE = 42161,
9
+ BASE = 8453,
10
+ SEPOLIA = 11155111
11
+ }
@@ -1,6 +1,6 @@
1
1
  import { BackoffOptions } from 'exponential-backoff';
2
2
  import { RateLimiterOpts } from 'limiter/dist/esm';
3
- import { SupportedChainId } from '../../chains/types';
3
+ import { SupportedChainId } from './chains';
4
4
  /**
5
5
  * IPFS configuration.
6
6
  *
@@ -68,3 +68,11 @@ export interface ApiContext {
68
68
  limiterOpts?: RateLimiterOpts;
69
69
  backoffOpts?: BackoffOptions;
70
70
  }
71
+ /**
72
+ * The list of available environments.
73
+ */
74
+ export declare const ENVS_LIST: CowEnv[];
75
+ /**
76
+ * The default CoW Protocol API context.
77
+ */
78
+ export declare const DEFAULT_COW_API_CONTEXT: ApiContext;
@@ -1,9 +1,16 @@
1
- import { SupportedChainId } from '../../chains/types';
1
+ import { SupportedChainId } from './chains';
2
2
  export declare const ETH_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
3
3
  export declare const EXTENSIBLE_FALLBACK_HANDLER = "0x2f55e8b20D0B9FEFA187AA7d00B6Cbe563605bF5";
4
4
  export declare const COMPOSABLE_COW = "0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74";
5
5
  export declare const COW_SHED_FACTORY = "0x00E989b87700514118Fa55326CD1cCE82faebEF6";
6
6
  export declare const COW_SHED_IMPLEMENTATION = "0x2CFFA8cf11B90C9F437567b86352169dF4009F73";
7
+ /**
8
+ * The list of supported chains.
9
+ */
10
+ export declare const ALL_SUPPORTED_CHAIN_IDS: SupportedChainId[];
11
+ export declare function mapSupportedNetworks<T>(value: (chainId: SupportedChainId) => T): Record<SupportedChainId, T>;
12
+ export declare function mapSupportedNetworks<T>(value: T): Record<SupportedChainId, T>;
13
+ export declare function mapAddressToSupportedNetworks(address: string): Record<SupportedChainId, string>;
7
14
  /**
8
15
  * An object containing the addresses of the CoW Protocol settlement contracts for each supported chain.
9
16
  */
@@ -20,6 +27,10 @@ export declare const EXTENSIBLE_FALLBACK_HANDLER_CONTRACT_ADDRESS: Record<Suppor
20
27
  * An object containing the addresses of the `ComposableCow` contracts for each supported chain.
21
28
  */
22
29
  export declare const COMPOSABLE_COW_CONTRACT_ADDRESS: Record<SupportedChainId, string>;
30
+ /**
31
+ * An object containing the addresses of wrapped native currencies for each supported chain.
32
+ */
33
+ export declare const WRAPPED_NATIVE_CURRENCIES: Record<SupportedChainId, string>;
23
34
  export declare const ETH_FLOW_ADDRESS = "0xba3cb449bd2b4adddbc894d8697f5170800eadec";
24
35
  export declare const BARN_ETH_FLOW_ADDRESS = "0x04501b9b1d52e67f6862d157e00d13419d2d6e95";
25
36
  /**
@@ -2,3 +2,4 @@ export declare class CowError extends Error {
2
2
  error_code?: string;
3
3
  constructor(message: string, error_code?: string);
4
4
  }
5
+ export declare const logPrefix = "cow-sdk:";
@@ -1,10 +1,5 @@
1
- export * from './types/config';
2
- export * from './types/cow-error';
3
- export * from './types/ethereum';
4
- export * from './types/tokens';
5
- export * from './types/wallets';
6
- export * from '../chains/const';
7
- export * from './consts/config';
8
- export * from './consts/contracts';
9
- export * from './consts/ipfs';
10
- export * from './consts/tokens';
1
+ export * from './chains';
2
+ export * from './configs';
3
+ export * from './cow-error';
4
+ export * from './ipfs';
5
+ export * from './consts';
@@ -1,5 +1,5 @@
1
1
  import { providers } from 'ethers';
2
- import { SupportedChainId } from '../chains';
2
+ import { SupportedChainId } from '../common';
3
3
  import { ComposableCoW, GPv2Order } from '../common/generated/ComposableCoW';
4
4
  import { ProofLocation, ProofWithParams, ConditionalOrderParams } from './types';
5
5
  import { ConditionalOrder } from './ConditionalOrder';
@@ -1,5 +1,5 @@
1
1
  import { providers } from 'ethers';
2
- import { SupportedChainId } from '../chains';
2
+ import { SupportedChainId } from '../common';
3
3
  import { ComposableCoW } from '../common/generated';
4
4
  import { ComposableCoWInterface } from '../common/generated/ComposableCoW';
5
5
  export declare function getComposableCowInterface(): ComposableCoWInterface;
@@ -1,5 +1,5 @@
1
1
  import { OrderBookApi } from '../order-book';
2
- import { SupportedChainId } from '../chains';
2
+ import { SupportedChainId } from '../common';
3
3
  import { GPv2Order } from '../common/generated/ComposableCoW';
4
4
  import { providers } from 'ethers';
5
5
  export interface ConditionalOrderArguments<T> {
@@ -1,5 +1,5 @@
1
1
  import { utils, providers, BigNumber } from 'ethers';
2
- import { SupportedChainId } from '../chains';
2
+ import { SupportedChainId } from '../common';
3
3
  import { BlockInfo, ConditionalOrderParams, IsValid, IsValidResult } from './types';
4
4
  import { Order } from '@cowprotocol/contracts';
5
5
  import { GPv2Order } from '../common/generated/ComposableCoW';
@@ -0,0 +1,35 @@
1
+ import { EcdsaSigningScheme } from '@cowprotocol/contracts';
2
+ import type { Signer } from '@ethersproject/abstract-signer';
3
+ import { TypedDataDomain } from 'ethers';
4
+ import { SupportedChainId } from '../common';
5
+ import { ICoWShedCall, ICoWShedOptions } from './types';
6
+ export declare class CowShedHooks {
7
+ private chainId;
8
+ private customOptions?;
9
+ constructor(chainId: SupportedChainId, customOptions?: ICoWShedOptions | undefined);
10
+ proxyOf(user: string): string;
11
+ encodeExecuteHooksForFactory(calls: ICoWShedCall[], nonce: string, deadline: bigint, user: string, signature: string): string;
12
+ signCalls(calls: ICoWShedCall[], nonce: string, deadline: bigint, signer: Signer, signingScheme: EcdsaSigningScheme): Promise<string>;
13
+ infoToSign(calls: ICoWShedCall[], nonce: string, deadline: bigint, proxy: string): {
14
+ domain: TypedDataDomain;
15
+ types: {
16
+ ExecuteHooks: {
17
+ type: string;
18
+ name: string;
19
+ }[];
20
+ Call: {
21
+ type: string;
22
+ name: string;
23
+ }[];
24
+ };
25
+ message: {
26
+ calls: ICoWShedCall[];
27
+ nonce: string;
28
+ deadline: bigint;
29
+ };
30
+ };
31
+ getDomain(proxy: string): TypedDataDomain;
32
+ proxyCreationCode(): string;
33
+ getFactoryAddress(): string;
34
+ getImplementationAddress(): string;
35
+ }
@@ -0,0 +1,4 @@
1
+ import { CoWShedInterface } from '../common/generated/CoWShed';
2
+ import { CoWShedFactoryInterface } from '../common/generated/CoWShedFactory';
3
+ export declare function getCoWShedInterface(): CoWShedInterface;
4
+ export declare function getCoWShedFactoryInterface(): CoWShedFactoryInterface;
@@ -1,2 +1,4 @@
1
1
  export * from './types';
2
- export * from './CowShedSdk';
2
+ export * from './CoWShedHooks';
3
+ export * from './contracts';
4
+ export * from './proxyInitCode';
@@ -1,46 +1 @@
1
- import { EcdsaSigningScheme } from '@cowprotocol/contracts';
2
- import { SupportedChainId } from '../../chains';
3
- import type { Signer } from '@ethersproject/abstract-signer';
4
- import { TypedDataDomain } from 'ethers';
5
- import { ICoWShedCall, ICoWShedOptions } from '../types';
6
1
  export declare const COW_SHED_PROXY_INIT_CODE = "0x60a034608e57601f61037138819003918201601f19168301916001600160401b038311848410176093578084926040948552833981010312608e57604b602060458360a9565b920160a9565b6080527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc556040516102b490816100bd8239608051818181608f01526101720152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203608e5756fe60806040526004361015610018575b3661019457610194565b6000803560e01c908163025b22bc1461003b575063f851a4400361000e5761010d565b3461010a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010a5773ffffffffffffffffffffffffffffffffffffffff60043581811691828203610106577f0000000000000000000000000000000000000000000000000000000000000000163314600014610101577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b61023d565b8380fd5b80fd5b346101645760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610164576020610146610169565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b600080fd5b333003610101577f000000000000000000000000000000000000000000000000000000000000000090565b60ff7f68df44b1011761f481358c0f49a711192727fb02c377d697bcb0ea8ff8393ac0541615806101ef575b1561023d5760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b507f400ada75000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000006000351614156101c0565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546000808092368280378136915af43d82803e1561027a573d90f35b3d90fdfea2646970667358221220c7c26ff3040b96a28e96d6d27b743972943aeaef81cc821544c5fe1e24f9b17264736f6c63430008190033";
7
- export declare const COW_SHED_712_TYPES: {
8
- ExecuteHooks: {
9
- type: string;
10
- name: string;
11
- }[];
12
- Call: {
13
- type: string;
14
- name: string;
15
- }[];
16
- };
17
- export declare class CowShedHooks {
18
- private chainId;
19
- private customOptions?;
20
- constructor(chainId: SupportedChainId, customOptions?: ICoWShedOptions | undefined);
21
- proxyOf(user: string): string;
22
- encodeExecuteHooksForFactory(calls: ICoWShedCall[], nonce: string, deadline: bigint, user: string, signature: string): string;
23
- signCalls(calls: ICoWShedCall[], nonce: string, deadline: bigint, signer: Signer, signingScheme: EcdsaSigningScheme): Promise<string>;
24
- infoToSign(calls: ICoWShedCall[], nonce: string, deadline: bigint, proxy: string): {
25
- domain: TypedDataDomain;
26
- types: {
27
- ExecuteHooks: {
28
- type: string;
29
- name: string;
30
- }[];
31
- Call: {
32
- type: string;
33
- name: string;
34
- }[];
35
- };
36
- message: {
37
- calls: ICoWShedCall[];
38
- nonce: string;
39
- deadline: bigint;
40
- };
41
- };
42
- getDomain(proxy: string): TypedDataDomain;
43
- proxyCreationCode(): string;
44
- getFactoryAddress(): string;
45
- getImplementationAddress(): string;
46
- }
@@ -15,3 +15,19 @@ export interface ICoWShedOptions {
15
15
  proxyCreationCode?: string;
16
16
  implementationAddress: string;
17
17
  }
18
+ export declare const DOMAIN_TYPE: {
19
+ EIP712Domain: {
20
+ type: string;
21
+ name: string;
22
+ }[];
23
+ };
24
+ export declare const COW_SHED_712_TYPES: {
25
+ ExecuteHooks: {
26
+ type: string;
27
+ name: string;
28
+ }[];
29
+ Call: {
30
+ type: string;
31
+ name: string;
32
+ }[];
33
+ };