@compass-labs/api-sdk 2.1.14 → 2.1.15-rc.1

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 (140) hide show
  1. package/README.md +20 -18
  2. package/codeSamples_typescript.yaml +8 -2
  3. package/dist/commonjs/funcs/earnEarnBundle.d.ts +31 -0
  4. package/dist/commonjs/funcs/earnEarnBundle.d.ts.map +1 -0
  5. package/dist/commonjs/funcs/earnEarnBundle.js +131 -0
  6. package/dist/commonjs/funcs/earnEarnBundle.js.map +1 -0
  7. package/dist/commonjs/lib/config.d.ts +2 -2
  8. package/dist/commonjs/lib/config.js +2 -2
  9. package/dist/commonjs/models/components/earnmanageparams.d.ts +63 -0
  10. package/dist/commonjs/models/components/earnmanageparams.d.ts.map +1 -0
  11. package/dist/commonjs/models/components/earnmanageparams.js +74 -0
  12. package/dist/commonjs/models/components/earnmanageparams.js.map +1 -0
  13. package/dist/commonjs/models/components/earnmanagerequest.d.ts +25 -13
  14. package/dist/commonjs/models/components/earnmanagerequest.d.ts.map +1 -1
  15. package/dist/commonjs/models/components/earnmanagerequest.js +9 -7
  16. package/dist/commonjs/models/components/earnmanagerequest.js.map +1 -1
  17. package/dist/commonjs/models/components/earnswapparams.d.ts +60 -0
  18. package/dist/commonjs/models/components/earnswapparams.d.ts.map +1 -0
  19. package/dist/commonjs/models/components/earnswapparams.js +73 -0
  20. package/dist/commonjs/models/components/earnswapparams.js.map +1 -0
  21. package/dist/commonjs/models/components/earnswaprequest.d.ts +26 -14
  22. package/dist/commonjs/models/components/earnswaprequest.d.ts.map +1 -1
  23. package/dist/commonjs/models/components/earnswaprequest.js +10 -8
  24. package/dist/commonjs/models/components/earnswaprequest.js.map +1 -1
  25. package/dist/commonjs/models/components/index.d.ts +5 -0
  26. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  27. package/dist/commonjs/models/components/index.js +5 -0
  28. package/dist/commonjs/models/components/index.js.map +1 -1
  29. package/dist/commonjs/models/components/useroperation.d.ts +4 -4
  30. package/dist/commonjs/models/components/useroperation.d.ts.map +1 -1
  31. package/dist/commonjs/models/components/useroperation.js +5 -5
  32. package/dist/commonjs/models/components/useroperation.js.map +1 -1
  33. package/dist/commonjs/models/components/v2bundlerequest.d.ts +43 -0
  34. package/dist/commonjs/models/components/v2bundlerequest.d.ts.map +1 -0
  35. package/dist/commonjs/models/components/v2bundlerequest.js +59 -0
  36. package/dist/commonjs/models/components/v2bundlerequest.js.map +1 -0
  37. package/dist/commonjs/models/components/v2bundleresponse.d.ts +31 -0
  38. package/dist/commonjs/models/components/v2bundleresponse.d.ts.map +1 -0
  39. package/dist/commonjs/models/components/v2bundleresponse.js +61 -0
  40. package/dist/commonjs/models/components/v2bundleresponse.js.map +1 -0
  41. package/dist/commonjs/models/components/v2useroperation.d.ts +23 -0
  42. package/dist/commonjs/models/components/v2useroperation.d.ts.map +1 -0
  43. package/dist/commonjs/models/components/v2useroperation.js +60 -0
  44. package/dist/commonjs/models/components/v2useroperation.js.map +1 -0
  45. package/dist/commonjs/sdk/earn.d.ts +20 -0
  46. package/dist/commonjs/sdk/earn.d.ts.map +1 -1
  47. package/dist/commonjs/sdk/earn.js +23 -0
  48. package/dist/commonjs/sdk/earn.js.map +1 -1
  49. package/dist/esm/funcs/earnEarnBundle.d.ts +31 -0
  50. package/dist/esm/funcs/earnEarnBundle.d.ts.map +1 -0
  51. package/dist/esm/funcs/earnEarnBundle.js +95 -0
  52. package/dist/esm/funcs/earnEarnBundle.js.map +1 -0
  53. package/dist/esm/lib/config.d.ts +2 -2
  54. package/dist/esm/lib/config.js +2 -2
  55. package/dist/esm/models/components/earnmanageparams.d.ts +63 -0
  56. package/dist/esm/models/components/earnmanageparams.d.ts.map +1 -0
  57. package/dist/esm/models/components/earnmanageparams.js +36 -0
  58. package/dist/esm/models/components/earnmanageparams.js.map +1 -0
  59. package/dist/esm/models/components/earnmanagerequest.d.ts +25 -13
  60. package/dist/esm/models/components/earnmanagerequest.d.ts.map +1 -1
  61. package/dist/esm/models/components/earnmanagerequest.js +7 -5
  62. package/dist/esm/models/components/earnmanagerequest.js.map +1 -1
  63. package/dist/esm/models/components/earnswapparams.d.ts +60 -0
  64. package/dist/esm/models/components/earnswapparams.d.ts.map +1 -0
  65. package/dist/esm/models/components/earnswapparams.js +34 -0
  66. package/dist/esm/models/components/earnswapparams.js.map +1 -0
  67. package/dist/esm/models/components/earnswaprequest.d.ts +26 -14
  68. package/dist/esm/models/components/earnswaprequest.d.ts.map +1 -1
  69. package/dist/esm/models/components/earnswaprequest.js +8 -6
  70. package/dist/esm/models/components/earnswaprequest.js.map +1 -1
  71. package/dist/esm/models/components/index.d.ts +5 -0
  72. package/dist/esm/models/components/index.d.ts.map +1 -1
  73. package/dist/esm/models/components/index.js +5 -0
  74. package/dist/esm/models/components/index.js.map +1 -1
  75. package/dist/esm/models/components/useroperation.d.ts +4 -4
  76. package/dist/esm/models/components/useroperation.d.ts.map +1 -1
  77. package/dist/esm/models/components/useroperation.js +3 -3
  78. package/dist/esm/models/components/useroperation.js.map +1 -1
  79. package/dist/esm/models/components/v2bundlerequest.d.ts +43 -0
  80. package/dist/esm/models/components/v2bundlerequest.d.ts.map +1 -0
  81. package/dist/esm/models/components/v2bundlerequest.js +22 -0
  82. package/dist/esm/models/components/v2bundlerequest.js.map +1 -0
  83. package/dist/esm/models/components/v2bundleresponse.d.ts +31 -0
  84. package/dist/esm/models/components/v2bundleresponse.d.ts.map +1 -0
  85. package/dist/esm/models/components/v2bundleresponse.js +24 -0
  86. package/dist/esm/models/components/v2bundleresponse.js.map +1 -0
  87. package/dist/esm/models/components/v2useroperation.d.ts +23 -0
  88. package/dist/esm/models/components/v2useroperation.d.ts.map +1 -0
  89. package/dist/esm/models/components/v2useroperation.js +22 -0
  90. package/dist/esm/models/components/v2useroperation.js.map +1 -0
  91. package/dist/esm/sdk/earn.d.ts +20 -0
  92. package/dist/esm/sdk/earn.d.ts.map +1 -1
  93. package/dist/esm/sdk/earn.js +23 -0
  94. package/dist/esm/sdk/earn.js.map +1 -1
  95. package/docs/models/components/earnmanageparams.md +31 -0
  96. package/docs/models/components/earnmanageparamsaction.md +17 -0
  97. package/docs/models/components/{venue.md → earnmanageparamsvenue.md} +1 -1
  98. package/docs/models/components/earnmanagerequest.md +12 -6
  99. package/docs/models/components/earnmanagerequestvenue.md +25 -0
  100. package/docs/models/components/earnswapparams.md +29 -0
  101. package/docs/models/components/earnswapparamsamountin.md +19 -0
  102. package/docs/models/components/{slippage.md → earnswapparamsslippage.md} +3 -3
  103. package/docs/models/components/earnswaprequest.md +10 -5
  104. package/docs/models/components/earnswaprequestslippage.md +19 -0
  105. package/docs/models/components/useroperation.md +3 -3
  106. package/docs/models/components/{body.md → useroperationbody.md} +1 -1
  107. package/docs/models/components/v2bundlerequest.md +52 -0
  108. package/docs/models/components/v2bundleresponse.md +24 -0
  109. package/docs/models/components/v2useroperation.md +27 -0
  110. package/docs/models/components/v2useroperationbody.md +31 -0
  111. package/docs/sdks/aavev3/README.md +0 -1
  112. package/docs/sdks/aerodromeslipstream/README.md +0 -1
  113. package/docs/sdks/bridge/README.md +0 -1
  114. package/docs/sdks/earn/README.md +148 -11
  115. package/docs/sdks/erc4626vaults/README.md +1 -2
  116. package/docs/sdks/ethena/README.md +0 -1
  117. package/docs/sdks/gassponsorship/README.md +0 -1
  118. package/docs/sdks/morpho/README.md +0 -1
  119. package/docs/sdks/pendle/README.md +0 -1
  120. package/docs/sdks/sky/README.md +0 -1
  121. package/docs/sdks/smartaccount/README.md +0 -1
  122. package/docs/sdks/swap/README.md +0 -1
  123. package/docs/sdks/token/README.md +0 -1
  124. package/docs/sdks/transactionbundler/README.md +0 -1
  125. package/docs/sdks/uniswapv3/README.md +0 -1
  126. package/docs/sdks/universal/README.md +0 -1
  127. package/docs/sdks/wildcat/README.md +0 -1
  128. package/package.json +1 -1
  129. package/src/funcs/earnEarnBundle.ts +182 -0
  130. package/src/lib/config.ts +2 -2
  131. package/src/models/components/earnmanageparams.ts +118 -0
  132. package/src/models/components/earnmanagerequest.ts +38 -18
  133. package/src/models/components/earnswapparams.ts +115 -0
  134. package/src/models/components/earnswaprequest.ts +38 -20
  135. package/src/models/components/index.ts +5 -0
  136. package/src/models/components/useroperation.ts +52 -45
  137. package/src/models/components/v2bundlerequest.ts +72 -0
  138. package/src/models/components/v2bundleresponse.ts +67 -0
  139. package/src/models/components/v2useroperation.ts +67 -0
  140. package/src/sdk/earn.ts +31 -0
@@ -0,0 +1,52 @@
1
+ # V2BundleRequest
2
+
3
+ Request model for bundling multiple V2 earn actions into a single Safe
4
+ transaction.
5
+
6
+ This endpoint allows combining multiple actions (swaps, vault deposits/withdrawals,
7
+ Aave deposits/withdrawals) into a single atomic transaction executed Compass Account.
8
+
9
+ Example use case: Swap USDC to AUSD, then deposit AUSD into a vault - all in one tx.
10
+
11
+ ## Example Usage
12
+
13
+ ```typescript
14
+ import { V2BundleRequest } from "@compass-labs/api-sdk/models/components";
15
+
16
+ let value: V2BundleRequest = {
17
+ owner: "0x0B8A11cF0679F163087802c4428F640cA7C89926",
18
+ chain: "ethereum",
19
+ actions: [
20
+ {
21
+ body: {
22
+ actionType: "V2_SWAP",
23
+ tokenIn: "USDC",
24
+ tokenOut: "AUSD",
25
+ amountIn: "100",
26
+ slippage: "0.5",
27
+ },
28
+ },
29
+ {
30
+ body: {
31
+ actionType: "V2_MANAGE",
32
+ venue: {
33
+ type: "VAULT",
34
+ vaultAddress: "0x1B4cd53a1A8e5F50aB6320EF34E5fB4D3df7B6f6",
35
+ },
36
+ action: "DEPOSIT",
37
+ amount: "ALL",
38
+ },
39
+ },
40
+ ],
41
+ gasSponsorship: false,
42
+ };
43
+ ```
44
+
45
+ ## Fields
46
+
47
+ | Field | Type | Required | Description | Example |
48
+ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
49
+ | `owner` | *string* | :heavy_check_mark: | The owner's wallet address that controls the Earn Account (Safe). | |
50
+ | `chain` | [components.Chain](../../models/components/chain.md) | :heavy_check_mark: | The chain to use. | |
51
+ | `actions` | [components.V2UserOperation](../../models/components/v2useroperation.md)[] | :heavy_check_mark: | List of actions to bundle. Actions are executed in order. | |
52
+ | `gasSponsorship` | *boolean* | :heavy_minus_sign: | If true, returns EIP-712 typed data for gas sponsorship. The owner must sign this data and submit to /gas_sponsorship/prepare. | false |
@@ -0,0 +1,24 @@
1
+ # V2BundleResponse
2
+
3
+ Response model for V2 bundle execution.
4
+
5
+ Returns either an unsigned transaction (for direct execution) or EIP-712 typed data
6
+ (for gas-sponsored execution).
7
+
8
+ ## Example Usage
9
+
10
+ ```typescript
11
+ import { V2BundleResponse } from "@compass-labs/api-sdk/models/components";
12
+
13
+ let value: V2BundleResponse = {
14
+ actionsCount: 314088,
15
+ };
16
+ ```
17
+
18
+ ## Fields
19
+
20
+ | Field | Type | Required | Description |
21
+ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
22
+ | `transaction` | [components.UnsignedTransaction](../../models/components/unsignedtransaction.md) | :heavy_minus_sign: | Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false. |
23
+ | `eip712` | [components.BatchedSafeOperationsResponseOutput](../../models/components/batchedsafeoperationsresponseoutput.md) | :heavy_minus_sign: | EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true. Owner must sign and submit to /gas_sponsorship/prepare. |
24
+ | `actionsCount` | *number* | :heavy_check_mark: | Number of individual transactions bundled in this execution. |
@@ -0,0 +1,27 @@
1
+ # V2UserOperation
2
+
3
+ A single operation in a V2 bundle.
4
+
5
+ ## Example Usage
6
+
7
+ ```typescript
8
+ import { V2UserOperation } from "@compass-labs/api-sdk/models/components";
9
+
10
+ let value: V2UserOperation = {
11
+ body: {
12
+ actionType: "V2_MANAGE",
13
+ venue: {
14
+ type: "VAULT",
15
+ vaultAddress: "<value>",
16
+ },
17
+ action: "WITHDRAW",
18
+ amount: 6398.2,
19
+ },
20
+ };
21
+ ```
22
+
23
+ ## Fields
24
+
25
+ | Field | Type | Required | Description |
26
+ | -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- |
27
+ | `body` | *components.V2UserOperationBody* | :heavy_check_mark: | N/A |
@@ -0,0 +1,31 @@
1
+ # V2UserOperationBody
2
+
3
+
4
+ ## Supported Types
5
+
6
+ ### `components.EarnManageParams`
7
+
8
+ ```typescript
9
+ const value: components.EarnManageParams = {
10
+ actionType: "V2_MANAGE",
11
+ venue: {
12
+ type: "VAULT",
13
+ vaultAddress: "<value>",
14
+ },
15
+ action: "WITHDRAW",
16
+ amount: 3994.36,
17
+ };
18
+ ```
19
+
20
+ ### `components.EarnSwapParams`
21
+
22
+ ```typescript
23
+ const value: components.EarnSwapParams = {
24
+ actionType: "V2_SWAP",
25
+ tokenIn: "<value>",
26
+ tokenOut: "<value>",
27
+ amountIn: 1543.87,
28
+ slippage: "0.5",
29
+ };
30
+ ```
31
+
@@ -1,5 +1,4 @@
1
1
  # AaveV3
2
- (*aaveV3*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # AerodromeSlipstream
2
- (*aerodromeSlipstream*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # Bridge
2
- (*bridge*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # Earn
2
- (*earn*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -13,6 +12,7 @@
13
12
  * [earnTransfer](#earntransfer) - Transfer tokens to/from account
14
13
  * [earnManage](#earnmanage) - Manage earn position
15
14
  * [earnSwap](#earnswap) - Swap tokens within Earn Account
15
+ * [earnBundle](#earnbundle) - Execute multiple earn actions
16
16
 
17
17
  ## earnPositions
18
18
 
@@ -537,14 +537,15 @@ const compassApiSDK = new CompassApiSDK({
537
537
 
538
538
  async function run() {
539
539
  const result = await compassApiSDK.earn.earnManage({
540
- owner: "0xe5310C39a8A8f16E6126ee6B1006bf6eD58B3A49",
541
- chain: "base",
542
540
  venue: {
543
541
  type: "VAULT",
544
542
  vaultAddress: "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A",
545
543
  },
546
- action: "WITHDRAW",
544
+ action: "DEPOSIT",
547
545
  amount: "0.01",
546
+ owner: "0xe5310C39a8A8f16E6126ee6B1006bf6eD58B3A49",
547
+ chain: "base",
548
+ gasSponsorship: false,
548
549
  });
549
550
 
550
551
  console.log(result);
@@ -569,14 +570,15 @@ const compassApiSDK = new CompassApiSDKCore({
569
570
 
570
571
  async function run() {
571
572
  const res = await earnEarnManage(compassApiSDK, {
572
- owner: "0xe5310C39a8A8f16E6126ee6B1006bf6eD58B3A49",
573
- chain: "base",
574
573
  venue: {
575
574
  type: "VAULT",
576
575
  vaultAddress: "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A",
577
576
  },
578
- action: "WITHDRAW",
577
+ action: "DEPOSIT",
579
578
  amount: "0.01",
579
+ owner: "0xe5310C39a8A8f16E6126ee6B1006bf6eD58B3A49",
580
+ chain: "base",
581
+ gasSponsorship: false,
580
582
  });
581
583
  if (res.ok) {
582
584
  const { value: result } = res;
@@ -625,12 +627,12 @@ const compassApiSDK = new CompassApiSDK({
625
627
 
626
628
  async function run() {
627
629
  const result = await compassApiSDK.earn.earnSwap({
628
- owner: "0xC1be8f91480648De355a45f3E2562811b4e2D3FF",
629
- chain: "base",
630
630
  tokenIn: "USDC",
631
631
  tokenOut: "USDT",
632
632
  amountIn: "0.01",
633
633
  slippage: "0.5",
634
+ owner: "0xC1be8f91480648De355a45f3E2562811b4e2D3FF",
635
+ chain: "base",
634
636
  gasSponsorship: false,
635
637
  });
636
638
 
@@ -656,12 +658,12 @@ const compassApiSDK = new CompassApiSDKCore({
656
658
 
657
659
  async function run() {
658
660
  const res = await earnEarnSwap(compassApiSDK, {
659
- owner: "0xC1be8f91480648De355a45f3E2562811b4e2D3FF",
660
- chain: "base",
661
661
  tokenIn: "USDC",
662
662
  tokenOut: "USDT",
663
663
  amountIn: "0.01",
664
664
  slippage: "0.5",
665
+ owner: "0xC1be8f91480648De355a45f3E2562811b4e2D3FF",
666
+ chain: "base",
665
667
  gasSponsorship: false,
666
668
  });
667
669
  if (res.ok) {
@@ -690,6 +692,141 @@ run();
690
692
 
691
693
  ### Errors
692
694
 
695
+ | Error Type | Status Code | Content Type |
696
+ | -------------------------- | -------------------------- | -------------------------- |
697
+ | errors.HTTPValidationError | 422 | application/json |
698
+ | errors.APIError | 4XX, 5XX | \*/\* |
699
+
700
+ ## earnBundle
701
+
702
+ This endpoint allows combining multiple actions (swaps, vault
703
+ deposits/withdrawals, Aave deposits/withdrawals) into a single atomic transaction
704
+ executed via the Earn account).
705
+
706
+ **Example Use Case:** Swap USDC to AUSD, then deposit AUSD into a vault - all in one transaction.
707
+
708
+ Actions are executed in the order they are provided. Each action type has its own parameters:
709
+
710
+ - **V2_SWAP**: Swapping tokens within the Earn Account
711
+ - **V2_MANAGE**: Manage positions - deposit/withdraw to ERC-4626 vaults or Aave lending pool
712
+
713
+ The bundled transaction can be gas-sponsored by setting `gas_sponsorship=true`.
714
+ This returns EIP-712 typed data that the owner must sign and submit to
715
+ `/gas_sponsorship/prepare` for execution by a gas sponsor.
716
+
717
+ ### Example Usage
718
+
719
+ <!-- UsageSnippet language="typescript" operationID="v2_earn_bundle" method="post" path="/v2/earn/bundle" -->
720
+ ```typescript
721
+ import { CompassApiSDK } from "@compass-labs/api-sdk";
722
+
723
+ const compassApiSDK = new CompassApiSDK({
724
+ apiKeyAuth: "<YOUR_API_KEY_HERE>",
725
+ });
726
+
727
+ async function run() {
728
+ const result = await compassApiSDK.earn.earnBundle({
729
+ owner: "0x0B8A11cF0679F163087802c4428F640cA7C89926",
730
+ chain: "ethereum",
731
+ actions: [
732
+ {
733
+ body: {
734
+ actionType: "V2_SWAP",
735
+ tokenIn: "USDC",
736
+ tokenOut: "AUSD",
737
+ amountIn: "100",
738
+ slippage: "0.5",
739
+ },
740
+ },
741
+ {
742
+ body: {
743
+ actionType: "V2_MANAGE",
744
+ venue: {
745
+ type: "VAULT",
746
+ vaultAddress: "0x1B4cd53a1A8e5F50aB6320EF34E5fB4D3df7B6f6",
747
+ },
748
+ action: "DEPOSIT",
749
+ amount: "ALL",
750
+ },
751
+ },
752
+ ],
753
+ gasSponsorship: false,
754
+ });
755
+
756
+ console.log(result);
757
+ }
758
+
759
+ run();
760
+ ```
761
+
762
+ ### Standalone function
763
+
764
+ The standalone function version of this method:
765
+
766
+ ```typescript
767
+ import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
768
+ import { earnEarnBundle } from "@compass-labs/api-sdk/funcs/earnEarnBundle.js";
769
+
770
+ // Use `CompassApiSDKCore` for best tree-shaking performance.
771
+ // You can create one instance of it to use across an application.
772
+ const compassApiSDK = new CompassApiSDKCore({
773
+ apiKeyAuth: "<YOUR_API_KEY_HERE>",
774
+ });
775
+
776
+ async function run() {
777
+ const res = await earnEarnBundle(compassApiSDK, {
778
+ owner: "0x0B8A11cF0679F163087802c4428F640cA7C89926",
779
+ chain: "ethereum",
780
+ actions: [
781
+ {
782
+ body: {
783
+ actionType: "V2_SWAP",
784
+ tokenIn: "USDC",
785
+ tokenOut: "AUSD",
786
+ amountIn: "100",
787
+ slippage: "0.5",
788
+ },
789
+ },
790
+ {
791
+ body: {
792
+ actionType: "V2_MANAGE",
793
+ venue: {
794
+ type: "VAULT",
795
+ vaultAddress: "0x1B4cd53a1A8e5F50aB6320EF34E5fB4D3df7B6f6",
796
+ },
797
+ action: "DEPOSIT",
798
+ amount: "ALL",
799
+ },
800
+ },
801
+ ],
802
+ gasSponsorship: false,
803
+ });
804
+ if (res.ok) {
805
+ const { value: result } = res;
806
+ console.log(result);
807
+ } else {
808
+ console.log("earnEarnBundle failed:", res.error);
809
+ }
810
+ }
811
+
812
+ run();
813
+ ```
814
+
815
+ ### Parameters
816
+
817
+ | Parameter | Type | Required | Description |
818
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
819
+ | `request` | [components.V2BundleRequest](../../models/components/v2bundlerequest.md) | :heavy_check_mark: | The request object to use for the request. |
820
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
821
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
822
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
823
+
824
+ ### Response
825
+
826
+ **Promise\<[components.V2BundleResponse](../../models/components/v2bundleresponse.md)\>**
827
+
828
+ ### Errors
829
+
693
830
  | Error Type | Status Code | Content Type |
694
831
  | -------------------------- | -------------------------- | -------------------------- |
695
832
  | errors.HTTPValidationError | 422 | application/json |
@@ -1,5 +1,4 @@
1
- # Erc4626Vaults
2
- (*erc4626Vaults*)
1
+ # ERC4626Vaults
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # Ethena
2
- (*ethena*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # GasSponsorship
2
- (*gasSponsorship*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # Morpho
2
- (*morpho*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # Pendle
2
- (*pendle*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # Sky
2
- (*sky*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # SmartAccount
2
- (*smartAccount*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # Swap
2
- (*swap*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # Token
2
- (*token*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # TransactionBundler
2
- (*transactionBundler*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # UniswapV3
2
- (*uniswapV3*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # Universal
2
- (*universal*)
3
2
 
4
3
  ## Overview
5
4
 
@@ -1,5 +1,4 @@
1
1
  # Wildcat
2
- (*wildcat*)
3
2
 
4
3
  ## Overview
5
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compass-labs/api-sdk",
3
- "version": "2.1.14",
3
+ "version": "2.1.15-rc.1",
4
4
  "author": "royalnine",
5
5
  "type": "module",
6
6
  "tshy": {
@@ -0,0 +1,182 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { CompassApiSDKCore } from "../core.js";
6
+ import { encodeJSON } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import * as components from "../models/components/index.js";
14
+ import { CompassAPISDKError } from "../models/errors/compassapisdkerror.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Execute multiple earn actions
30
+ *
31
+ * @remarks
32
+ * This endpoint allows combining multiple actions (swaps, vault
33
+ * deposits/withdrawals, Aave deposits/withdrawals) into a single atomic transaction
34
+ * executed via the Earn account).
35
+ *
36
+ * **Example Use Case:** Swap USDC to AUSD, then deposit AUSD into a vault - all in one transaction.
37
+ *
38
+ * Actions are executed in the order they are provided. Each action type has its own parameters:
39
+ *
40
+ * - **V2_SWAP**: Swapping tokens within the Earn Account
41
+ * - **V2_MANAGE**: Manage positions - deposit/withdraw to ERC-4626 vaults or Aave lending pool
42
+ *
43
+ * The bundled transaction can be gas-sponsored by setting `gas_sponsorship=true`.
44
+ * This returns EIP-712 typed data that the owner must sign and submit to
45
+ * `/gas_sponsorship/prepare` for execution by a gas sponsor.
46
+ */
47
+ export function earnEarnBundle(
48
+ client: CompassApiSDKCore,
49
+ request: components.V2BundleRequest,
50
+ options?: RequestOptions,
51
+ ): APIPromise<
52
+ Result<
53
+ components.V2BundleResponse,
54
+ | errors.HTTPValidationError
55
+ | CompassAPISDKError
56
+ | ResponseValidationError
57
+ | ConnectionError
58
+ | RequestAbortedError
59
+ | RequestTimeoutError
60
+ | InvalidRequestError
61
+ | UnexpectedClientError
62
+ | SDKValidationError
63
+ >
64
+ > {
65
+ return new APIPromise($do(
66
+ client,
67
+ request,
68
+ options,
69
+ ));
70
+ }
71
+
72
+ async function $do(
73
+ client: CompassApiSDKCore,
74
+ request: components.V2BundleRequest,
75
+ options?: RequestOptions,
76
+ ): Promise<
77
+ [
78
+ Result<
79
+ components.V2BundleResponse,
80
+ | errors.HTTPValidationError
81
+ | CompassAPISDKError
82
+ | ResponseValidationError
83
+ | ConnectionError
84
+ | RequestAbortedError
85
+ | RequestTimeoutError
86
+ | InvalidRequestError
87
+ | UnexpectedClientError
88
+ | SDKValidationError
89
+ >,
90
+ APICall,
91
+ ]
92
+ > {
93
+ const parsed = safeParse(
94
+ request,
95
+ (value) => components.V2BundleRequest$outboundSchema.parse(value),
96
+ "Input validation failed",
97
+ );
98
+ if (!parsed.ok) {
99
+ return [parsed, { status: "invalid" }];
100
+ }
101
+ const payload = parsed.value;
102
+ const body = encodeJSON("body", payload, { explode: true });
103
+
104
+ const path = pathToFunc("/v2/earn/bundle")();
105
+
106
+ const headers = new Headers(compactMap({
107
+ "Content-Type": "application/json",
108
+ Accept: "application/json",
109
+ }));
110
+
111
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
112
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
113
+ const requestSecurity = resolveGlobalSecurity(securityInput);
114
+
115
+ const context = {
116
+ options: client._options,
117
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
118
+ operationID: "v2_earn_bundle",
119
+ oAuth2Scopes: null,
120
+
121
+ resolvedSecurity: requestSecurity,
122
+
123
+ securitySource: client._options.apiKeyAuth,
124
+ retryConfig: options?.retries
125
+ || client._options.retryConfig
126
+ || { strategy: "none" },
127
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
128
+ };
129
+
130
+ const requestRes = client._createRequest(context, {
131
+ security: requestSecurity,
132
+ method: "POST",
133
+ baseURL: options?.serverURL,
134
+ path: path,
135
+ headers: headers,
136
+ body: body,
137
+ userAgent: client._options.userAgent,
138
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
139
+ }, options);
140
+ if (!requestRes.ok) {
141
+ return [requestRes, { status: "invalid" }];
142
+ }
143
+ const req = requestRes.value;
144
+
145
+ const doResult = await client._do(req, {
146
+ context,
147
+ errorCodes: ["422", "4XX", "5XX"],
148
+ retryConfig: context.retryConfig,
149
+ retryCodes: context.retryCodes,
150
+ });
151
+ if (!doResult.ok) {
152
+ return [doResult, { status: "request-error", request: req }];
153
+ }
154
+ const response = doResult.value;
155
+
156
+ const responseFields = {
157
+ HttpMeta: { Response: response, Request: req },
158
+ };
159
+
160
+ const [result] = await M.match<
161
+ components.V2BundleResponse,
162
+ | errors.HTTPValidationError
163
+ | CompassAPISDKError
164
+ | ResponseValidationError
165
+ | ConnectionError
166
+ | RequestAbortedError
167
+ | RequestTimeoutError
168
+ | InvalidRequestError
169
+ | UnexpectedClientError
170
+ | SDKValidationError
171
+ >(
172
+ M.json(200, components.V2BundleResponse$inboundSchema),
173
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
174
+ M.fail("4XX"),
175
+ M.fail("5XX"),
176
+ )(response, req, { extraFields: responseFields });
177
+ if (!result.ok) {
178
+ return [result, { status: "complete", request: req, response }];
179
+ }
180
+
181
+ return [result, { status: "complete", request: req, response }];
182
+ }