@cowprotocol/cow-sdk 5.10.1 → 6.0.0-RC.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.
Files changed (106) hide show
  1. package/dist/bridging/BridgingSdk/BridgingSdk.d.ts +49 -0
  2. package/dist/bridging/BridgingSdk/getQuoteWithBridging.d.ts +9 -0
  3. package/dist/bridging/BridgingSdk/getQuoteWithoutBridge.d.ts +7 -0
  4. package/dist/bridging/const.d.ts +2 -0
  5. package/dist/bridging/index.d.ts +5 -0
  6. package/dist/bridging/providers/across/AcrossApi.d.ts +195 -0
  7. package/dist/bridging/providers/across/AcrossBridgeProvider.d.ts +41 -0
  8. package/dist/bridging/providers/across/abi.d.ts +154 -0
  9. package/dist/bridging/providers/across/const/contracts.d.ts +3 -0
  10. package/dist/bridging/providers/across/const/tokens.d.ts +11 -0
  11. package/dist/bridging/providers/across/createAcrossDepositCall.d.ts +9 -0
  12. package/dist/bridging/providers/across/util.d.ts +39 -0
  13. package/dist/bridging/providers/mock/MockBridgeProvider.d.ts +20 -0
  14. package/dist/bridging/types.d.ts +243 -0
  15. package/dist/bridging/utils.d.ts +2 -0
  16. package/dist/chains/const/index.d.ts +25 -0
  17. package/dist/chains/const/path.d.ts +1 -0
  18. package/dist/chains/details/arbitrum.d.ts +7 -0
  19. package/dist/chains/details/base.d.ts +7 -0
  20. package/dist/chains/details/gnosis.d.ts +7 -0
  21. package/dist/chains/details/mainnet.d.ts +7 -0
  22. package/dist/chains/details/optimism.d.ts +2 -0
  23. package/dist/chains/details/polygon.d.ts +2 -0
  24. package/dist/chains/details/sepolia.d.ts +7 -0
  25. package/dist/chains/index.d.ts +3 -0
  26. package/dist/chains/types.d.ts +122 -0
  27. package/dist/chains/utils.d.ts +18 -0
  28. package/dist/common/consts/config.d.ts +9 -0
  29. package/dist/common/{consts.d.ts → consts/contracts.d.ts} +7 -12
  30. package/dist/common/consts/path.d.ts +1 -0
  31. package/dist/common/consts/tokens.d.ts +9 -0
  32. package/dist/common/index.d.ts +10 -5
  33. package/dist/common/{configs.d.ts → types/config.d.ts} +1 -9
  34. package/dist/common/{cow-error.d.ts → types/cow-error.d.ts} +0 -1
  35. package/dist/common/types/ethereum.d.ts +5 -0
  36. package/dist/common/types/tokens.d.ts +12 -0
  37. package/dist/common/types/wallets.d.ts +5 -0
  38. package/dist/common/utils/config.d.ts +4 -0
  39. package/dist/common/utils/serialize.d.ts +1 -0
  40. package/dist/common/utils/wallet.d.ts +3 -0
  41. package/dist/composable/Multiplexer.d.ts +1 -1
  42. package/dist/composable/contracts.d.ts +1 -1
  43. package/dist/composable/types.d.ts +1 -1
  44. package/dist/composable/utils.d.ts +1 -1
  45. package/dist/cow-shed/CowShedSdk.d.ts +69 -0
  46. package/dist/cow-shed/{proxyInitCode.d.ts → contracts/CoWShedHooks.d.ts} +44 -0
  47. package/dist/cow-shed/contracts/utils.d.ts +4 -0
  48. package/dist/cow-shed/index.d.ts +1 -3
  49. package/dist/cow-shed/types.d.ts +0 -16
  50. package/dist/hooks/utils.d.ts +2 -0
  51. package/dist/index-f14ff795.js +29 -0
  52. package/dist/index-f14ff795.js.map +1 -0
  53. package/dist/index.d.ts +1 -0
  54. package/dist/index.js +4 -4
  55. package/dist/index.js.map +1 -1
  56. package/dist/index.modern.mjs +1 -1
  57. package/dist/index.module.js +4 -4
  58. package/dist/index.module.js.map +1 -1
  59. package/dist/order-book/api.d.ts +1 -1
  60. package/dist/order-book/quoteAmountsAndCostsUtils.d.ts +13 -2
  61. package/dist/order-book/types.d.ts +54 -18
  62. package/dist/order-signing/orderSigningUtils.d.ts +1 -1
  63. package/dist/order-signing/types.d.ts +1 -1
  64. package/dist/order-signing/utils.d.ts +1 -1
  65. package/dist/package.json +4 -2
  66. package/dist/schemas/trading/LimitOrderAdvancedSettings.ts +26 -0
  67. package/dist/schemas/trading/LimitTradeParameters.ts +3 -0
  68. package/dist/schemas/trading/QuoteResultsSerialized.ts +21 -12
  69. package/dist/schemas/trading/QuoterParameters.ts +1 -1
  70. package/dist/schemas/trading/SwapAdvancedSettings.ts +26 -0
  71. package/dist/schemas/trading/TradeParameters.ts +3 -0
  72. package/dist/src/bridging/README.md +44 -0
  73. package/dist/src/cow-shed/README.md +60 -0
  74. package/dist/src/trading/README.md +1 -0
  75. package/dist/src/weiroll/README.md +55 -0
  76. package/dist/subgraph/api.d.ts +2 -2
  77. package/dist/trading/calculateUniqueOrderId.d.ts +3 -4
  78. package/dist/trading/consts.d.ts +2 -0
  79. package/dist/trading/getEthFlowTransaction.d.ts +4 -5
  80. package/dist/trading/getOrderTypedData.d.ts +1 -1
  81. package/dist/trading/getPreSignTransaction.d.ts +2 -2
  82. package/dist/trading/getQuote.d.ts +1 -1
  83. package/dist/trading/postCoWProtocolTrade.d.ts +4 -4
  84. package/dist/trading/postSellNativeCurrencyOrder.d.ts +2 -3
  85. package/dist/trading/postSwapOrder.d.ts +1 -1
  86. package/dist/trading/tradingSdk.d.ts +13 -10
  87. package/dist/trading/types.d.ts +61 -10
  88. package/dist/trading/utils.d.ts +8 -4
  89. package/dist/{utils-35087bda.js → utils-23d3241a.js} +1 -1
  90. package/dist/utils-23d3241a.js.map +1 -0
  91. package/dist/{utils-04fc2d68.js → utils-31e2d1e7.js} +1 -1
  92. package/dist/utils-31e2d1e7.js.map +1 -0
  93. package/dist/{utils-ce0d26d7.js → utils-6959b448.js} +2 -2
  94. package/dist/utils-6959b448.js.map +1 -0
  95. package/dist/utils.d.ts +1 -1
  96. package/dist/weiroll/index.d.ts +20 -0
  97. package/package.json +4 -2
  98. package/dist/common/chains.d.ts +0 -11
  99. package/dist/cow-shed/CoWShedHooks.d.ts +0 -35
  100. package/dist/cow-shed/contracts.d.ts +0 -4
  101. package/dist/index-cc713836.js +0 -29
  102. package/dist/index-cc713836.js.map +0 -1
  103. package/dist/utils-04fc2d68.js.map +0 -1
  104. package/dist/utils-35087bda.js.map +0 -1
  105. package/dist/utils-ce0d26d7.js.map +0 -1
  106. /package/dist/common/{ipfs.d.ts → consts/ipfs.d.ts} +0 -0
@@ -0,0 +1,69 @@
1
+ import { EvmCall, SignerLike } from '../common';
2
+ import { SupportedChainId } from '../chains';
3
+ import { CowShedHooks } from './contracts/CoWShedHooks';
4
+ import { EcdsaSigningScheme } from '@cowprotocol/contracts';
5
+ import { ICoWShedCall, ICoWShedOptions } from './types';
6
+ export interface SignAndEncodeTxArgs {
7
+ /**
8
+ * Calls to pre-authorize on the cow-shed account
9
+ */
10
+ calls: ICoWShedCall[];
11
+ /**
12
+ * Signer for the cow-shed's owner account.
13
+ *
14
+ * The signer will be used to pre-authorise the calls.
15
+ * The cow-shed account will be derived from this signer.
16
+ */
17
+ signer?: SignerLike;
18
+ /**
19
+ * Chain ID to use for the transaction.
20
+ */
21
+ chainId: SupportedChainId;
22
+ /**
23
+ * Nonce to use for the transaction. If not provided, the current timestamp will be used.
24
+ */
25
+ nonce?: string;
26
+ /**
27
+ * Deadline to use for the transaction. If not provided, the maximum uint256 will be used.
28
+ */
29
+ deadline?: bigint;
30
+ /**
31
+ * Default gas limit to use for the transaction. If not provided, it will throw an error if the gas limit cannot be estimated.
32
+ */
33
+ defaultGasLimit?: bigint;
34
+ /**
35
+ * Signing scheme to use for the transaction.
36
+ */
37
+ signingScheme?: EcdsaSigningScheme;
38
+ }
39
+ export interface CowShedCall {
40
+ cowShedAccount: string;
41
+ signedMulticall: EvmCall;
42
+ gasLimit: bigint;
43
+ }
44
+ export interface CowShedSdkOptions {
45
+ /**
46
+ * Signer for the cow-shed's owner account.
47
+ */
48
+ signer?: SignerLike;
49
+ /**
50
+ * Custom options for the cow-shed hooks.
51
+ */
52
+ factoryOptions?: ICoWShedOptions;
53
+ }
54
+ export declare class CowShedSdk {
55
+ private options;
56
+ protected hooksCache: Map<SupportedChainId, CowShedHooks>;
57
+ constructor(options?: CowShedSdkOptions);
58
+ getCowShedAccount(chainId: SupportedChainId, ownerAddress: string): string;
59
+ /**
60
+ * Encodes multiple calls into a single pre-authorized call to the cow-shed factory.
61
+ *
62
+ * This single call will create the cow-shed account if it doesn't exist yet, then will execute the calls.
63
+ *
64
+ * @returns pre-authorized multicall details
65
+ */
66
+ signCalls({ calls, signer: signerParam, chainId, nonce, deadline, defaultGasLimit, signingScheme, }: SignAndEncodeTxArgs): Promise<CowShedCall>;
67
+ protected getCowShedHooks(chainId: SupportedChainId, customOptions?: ICoWShedOptions): CowShedHooks;
68
+ protected static getNonce(): string;
69
+ }
@@ -1 +1,45 @@
1
+ import { EcdsaSigningScheme } from '@cowprotocol/contracts';
2
+ import { SupportedChainId } from '../../chains';
3
+ import type { Signer, TypedDataDomain } from '@ethersproject/abstract-signer';
4
+ import { ICoWShedCall, ICoWShedOptions } from '../types';
1
5
  export declare const COW_SHED_PROXY_INIT_CODE = "0x60a034608e57601f61037138819003918201601f19168301916001600160401b038311848410176093578084926040948552833981010312608e57604b602060458360a9565b920160a9565b6080527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc556040516102b490816100bd8239608051818181608f01526101720152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203608e5756fe60806040526004361015610018575b3661019457610194565b6000803560e01c908163025b22bc1461003b575063f851a4400361000e5761010d565b3461010a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010a5773ffffffffffffffffffffffffffffffffffffffff60043581811691828203610106577f0000000000000000000000000000000000000000000000000000000000000000163314600014610101577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b61023d565b8380fd5b80fd5b346101645760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610164576020610146610169565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b600080fd5b333003610101577f000000000000000000000000000000000000000000000000000000000000000090565b60ff7f68df44b1011761f481358c0f49a711192727fb02c377d697bcb0ea8ff8393ac0541615806101ef575b1561023d5760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b507f400ada75000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000006000351614156101c0565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546000808092368280378136915af43d82803e1561027a573d90f35b3d90fdfea2646970667358221220c7c26ff3040b96a28e96d6d27b743972943aeaef81cc821544c5fe1e24f9b17264736f6c63430008190033";
6
+ export declare const COW_SHED_712_TYPES: {
7
+ ExecuteHooks: {
8
+ type: string;
9
+ name: string;
10
+ }[];
11
+ Call: {
12
+ type: string;
13
+ name: string;
14
+ }[];
15
+ };
16
+ export declare class CowShedHooks {
17
+ private chainId;
18
+ private customOptions?;
19
+ constructor(chainId: SupportedChainId, customOptions?: ICoWShedOptions | undefined);
20
+ proxyOf(user: string): string;
21
+ encodeExecuteHooksForFactory(calls: ICoWShedCall[], nonce: string, deadline: bigint, user: string, signature: string): string;
22
+ signCalls(calls: ICoWShedCall[], nonce: string, deadline: bigint, signer: Signer, signingScheme: EcdsaSigningScheme): Promise<string>;
23
+ infoToSign(calls: ICoWShedCall[], nonce: string, deadline: bigint, proxy: string): {
24
+ domain: TypedDataDomain;
25
+ types: {
26
+ ExecuteHooks: {
27
+ type: string;
28
+ name: string;
29
+ }[];
30
+ Call: {
31
+ type: string;
32
+ name: string;
33
+ }[];
34
+ };
35
+ message: {
36
+ calls: ICoWShedCall[];
37
+ nonce: string;
38
+ deadline: bigint;
39
+ };
40
+ };
41
+ getDomain(proxy: string): TypedDataDomain;
42
+ proxyCreationCode(): string;
43
+ getFactoryAddress(): string;
44
+ getImplementationAddress(): string;
45
+ }
@@ -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,4 +1,2 @@
1
1
  export * from './types';
2
- export * from './CoWShedHooks';
3
- export * from './contracts';
4
- export * from './proxyInitCode';
2
+ export * from './CowShedSdk';
@@ -15,19 +15,3 @@ 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
- };
@@ -0,0 +1,2 @@
1
+ import { latest } from '@cowprotocol/app-data';
2
+ export declare function getHookMockForCostEstimation(gasLimit: number): latest.OrderInteractionHooks;