@compass-labs/api-sdk 2.1.9-rc.2 → 2.1.10-rc.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 (134) hide show
  1. package/README.md +7 -0
  2. package/dist/commonjs/funcs/cctpCCTPBurn.d.ts +37 -0
  3. package/dist/commonjs/funcs/cctpCCTPBurn.d.ts.map +1 -0
  4. package/dist/commonjs/funcs/cctpCCTPBurn.js +137 -0
  5. package/dist/commonjs/funcs/cctpCCTPBurn.js.map +1 -0
  6. package/dist/commonjs/funcs/cctpCCTPMint.d.ts +52 -0
  7. package/dist/commonjs/funcs/cctpCCTPMint.d.ts.map +1 -0
  8. package/dist/commonjs/funcs/cctpCCTPMint.js +152 -0
  9. package/dist/commonjs/funcs/cctpCCTPMint.js.map +1 -0
  10. package/dist/commonjs/lib/config.d.ts +2 -2
  11. package/dist/commonjs/lib/config.js +2 -2
  12. package/dist/commonjs/lib/encodings.d.ts +1 -0
  13. package/dist/commonjs/lib/encodings.d.ts.map +1 -1
  14. package/dist/commonjs/lib/encodings.js +9 -0
  15. package/dist/commonjs/lib/encodings.js.map +1 -1
  16. package/dist/commonjs/models/components/depositforburnrequest.d.ts +96 -0
  17. package/dist/commonjs/models/components/depositforburnrequest.d.ts.map +1 -0
  18. package/dist/commonjs/models/components/depositforburnrequest.js +87 -0
  19. package/dist/commonjs/models/components/depositforburnrequest.js.map +1 -0
  20. package/dist/commonjs/models/components/depositforburnresponse.d.ts +37 -0
  21. package/dist/commonjs/models/components/depositforburnresponse.d.ts.map +1 -0
  22. package/dist/commonjs/models/components/depositforburnresponse.js +60 -0
  23. package/dist/commonjs/models/components/depositforburnresponse.js.map +1 -0
  24. package/dist/commonjs/models/components/index.d.ts +5 -0
  25. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/index.js +5 -0
  27. package/dist/commonjs/models/components/index.js.map +1 -1
  28. package/dist/commonjs/models/components/mintpreparependingresponse.d.ts +43 -0
  29. package/dist/commonjs/models/components/mintpreparependingresponse.d.ts.map +1 -0
  30. package/dist/commonjs/models/components/mintpreparependingresponse.js +64 -0
  31. package/dist/commonjs/models/components/mintpreparependingresponse.js.map +1 -0
  32. package/dist/commonjs/models/components/mintpreparereadyresponse.d.ts +41 -0
  33. package/dist/commonjs/models/components/mintpreparereadyresponse.d.ts.map +1 -0
  34. package/dist/commonjs/models/components/mintpreparereadyresponse.js +64 -0
  35. package/dist/commonjs/models/components/mintpreparereadyresponse.js.map +1 -0
  36. package/dist/commonjs/models/components/mintpreparerequest.d.ts +39 -0
  37. package/dist/commonjs/models/components/mintpreparerequest.d.ts.map +1 -0
  38. package/dist/commonjs/models/components/mintpreparerequest.js +57 -0
  39. package/dist/commonjs/models/components/mintpreparerequest.js.map +1 -0
  40. package/dist/commonjs/models/operations/index.d.ts +1 -0
  41. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  42. package/dist/commonjs/models/operations/index.js +1 -0
  43. package/dist/commonjs/models/operations/index.js.map +1 -1
  44. package/dist/commonjs/models/operations/v2cctpmint.d.ts +9 -0
  45. package/dist/commonjs/models/operations/v2cctpmint.d.ts.map +1 -0
  46. package/dist/commonjs/models/operations/v2cctpmint.js +52 -0
  47. package/dist/commonjs/models/operations/v2cctpmint.js.map +1 -0
  48. package/dist/commonjs/sdk/cctp.d.ts +72 -0
  49. package/dist/commonjs/sdk/cctp.d.ts.map +1 -0
  50. package/dist/commonjs/sdk/cctp.js +84 -0
  51. package/dist/commonjs/sdk/cctp.js.map +1 -0
  52. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  53. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  54. package/dist/commonjs/sdk/sdk.js +4 -0
  55. package/dist/commonjs/sdk/sdk.js.map +1 -1
  56. package/dist/commonjs/types/unrecognized.d.ts +7 -1
  57. package/dist/commonjs/types/unrecognized.d.ts.map +1 -1
  58. package/dist/commonjs/types/unrecognized.js +9 -1
  59. package/dist/commonjs/types/unrecognized.js.map +1 -1
  60. package/dist/esm/funcs/cctpCCTPBurn.d.ts +37 -0
  61. package/dist/esm/funcs/cctpCCTPBurn.d.ts.map +1 -0
  62. package/dist/esm/funcs/cctpCCTPBurn.js +101 -0
  63. package/dist/esm/funcs/cctpCCTPBurn.js.map +1 -0
  64. package/dist/esm/funcs/cctpCCTPMint.d.ts +52 -0
  65. package/dist/esm/funcs/cctpCCTPMint.d.ts.map +1 -0
  66. package/dist/esm/funcs/cctpCCTPMint.js +116 -0
  67. package/dist/esm/funcs/cctpCCTPMint.js.map +1 -0
  68. package/dist/esm/lib/config.d.ts +2 -2
  69. package/dist/esm/lib/config.js +2 -2
  70. package/dist/esm/lib/encodings.d.ts +1 -0
  71. package/dist/esm/lib/encodings.d.ts.map +1 -1
  72. package/dist/esm/lib/encodings.js +9 -0
  73. package/dist/esm/lib/encodings.js.map +1 -1
  74. package/dist/esm/models/components/depositforburnrequest.d.ts +96 -0
  75. package/dist/esm/models/components/depositforburnrequest.d.ts.map +1 -0
  76. package/dist/esm/models/components/depositforburnrequest.js +49 -0
  77. package/dist/esm/models/components/depositforburnrequest.js.map +1 -0
  78. package/dist/esm/models/components/depositforburnresponse.d.ts +37 -0
  79. package/dist/esm/models/components/depositforburnresponse.d.ts.map +1 -0
  80. package/dist/esm/models/components/depositforburnresponse.js +23 -0
  81. package/dist/esm/models/components/depositforburnresponse.js.map +1 -0
  82. package/dist/esm/models/components/index.d.ts +5 -0
  83. package/dist/esm/models/components/index.d.ts.map +1 -1
  84. package/dist/esm/models/components/index.js +5 -0
  85. package/dist/esm/models/components/index.js.map +1 -1
  86. package/dist/esm/models/components/mintpreparependingresponse.d.ts +43 -0
  87. package/dist/esm/models/components/mintpreparependingresponse.d.ts.map +1 -0
  88. package/dist/esm/models/components/mintpreparependingresponse.js +27 -0
  89. package/dist/esm/models/components/mintpreparependingresponse.js.map +1 -0
  90. package/dist/esm/models/components/mintpreparereadyresponse.d.ts +41 -0
  91. package/dist/esm/models/components/mintpreparereadyresponse.d.ts.map +1 -0
  92. package/dist/esm/models/components/mintpreparereadyresponse.js +27 -0
  93. package/dist/esm/models/components/mintpreparereadyresponse.js.map +1 -0
  94. package/dist/esm/models/components/mintpreparerequest.d.ts +39 -0
  95. package/dist/esm/models/components/mintpreparerequest.d.ts.map +1 -0
  96. package/dist/esm/models/components/mintpreparerequest.js +20 -0
  97. package/dist/esm/models/components/mintpreparerequest.js.map +1 -0
  98. package/dist/esm/models/operations/index.d.ts +1 -0
  99. package/dist/esm/models/operations/index.d.ts.map +1 -1
  100. package/dist/esm/models/operations/index.js +1 -0
  101. package/dist/esm/models/operations/index.js.map +1 -1
  102. package/dist/esm/models/operations/v2cctpmint.d.ts +9 -0
  103. package/dist/esm/models/operations/v2cctpmint.d.ts.map +1 -0
  104. package/dist/esm/models/operations/v2cctpmint.js +15 -0
  105. package/dist/esm/models/operations/v2cctpmint.js.map +1 -0
  106. package/dist/esm/sdk/cctp.d.ts +72 -0
  107. package/dist/esm/sdk/cctp.d.ts.map +1 -0
  108. package/dist/esm/sdk/cctp.js +80 -0
  109. package/dist/esm/sdk/cctp.js.map +1 -0
  110. package/dist/esm/sdk/sdk.d.ts +3 -0
  111. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  112. package/dist/esm/sdk/sdk.js +4 -0
  113. package/dist/esm/sdk/sdk.js.map +1 -1
  114. package/dist/esm/types/unrecognized.d.ts +7 -1
  115. package/dist/esm/types/unrecognized.d.ts.map +1 -1
  116. package/dist/esm/types/unrecognized.js +9 -1
  117. package/dist/esm/types/unrecognized.js.map +1 -1
  118. package/package.json +1 -1
  119. package/src/funcs/cctpCCTPBurn.ts +188 -0
  120. package/src/funcs/cctpCCTPMint.ts +204 -0
  121. package/src/lib/config.ts +2 -2
  122. package/src/lib/encodings.ts +13 -0
  123. package/src/models/components/depositforburnrequest.ts +153 -0
  124. package/src/models/components/depositforburnresponse.ts +72 -0
  125. package/src/models/components/index.ts +5 -0
  126. package/src/models/components/mintpreparependingresponse.ts +78 -0
  127. package/src/models/components/mintpreparereadyresponse.ts +80 -0
  128. package/src/models/components/mintpreparerequest.ts +66 -0
  129. package/src/models/operations/index.ts +1 -0
  130. package/src/models/operations/v2cctpmint.ts +33 -0
  131. package/src/sdk/cctp.ts +98 -0
  132. package/src/sdk/sdk.ts +6 -0
  133. package/src/types/unrecognized.ts +9 -1
  134. package/tsconfig.json +0 -1
@@ -0,0 +1,78 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ /**
12
+ * Response when attestation is not yet ready.
13
+ *
14
+ * @remarks
15
+ *
16
+ * Returned with 202 Accepted status code. The client should either:
17
+ * - Connect to the SSE stream for real-time updates
18
+ * - Poll the status endpoint periodically
19
+ * - Call /mint/prepare again after some time
20
+ */
21
+ export type MintPreparePendingResponse = {
22
+ /**
23
+ * Indicates the attestation is still being awaited.
24
+ */
25
+ status?: "pending" | undefined;
26
+ /**
27
+ * The bridge identifier.
28
+ */
29
+ bridgeId: string;
30
+ /**
31
+ * The CCTP message hash being polled for attestation.
32
+ */
33
+ messageHash: string;
34
+ /**
35
+ * SSE endpoint URL for real-time attestation updates.
36
+ */
37
+ sseUrl: string;
38
+ /**
39
+ * HTTP endpoint URL for polling bridge status.
40
+ */
41
+ statusUrl: string;
42
+ /**
43
+ * Estimated wait time in seconds. Fast mode is typically ~30 seconds, standard mode is 15-19 minutes.
44
+ */
45
+ estimatedWaitSeconds: number;
46
+ };
47
+
48
+ /** @internal */
49
+ export const MintPreparePendingResponse$inboundSchema: z.ZodType<
50
+ MintPreparePendingResponse,
51
+ z.ZodTypeDef,
52
+ unknown
53
+ > = z.object({
54
+ status: z.literal("pending").default("pending").optional(),
55
+ bridge_id: z.string(),
56
+ message_hash: z.string(),
57
+ sse_url: z.string(),
58
+ status_url: z.string(),
59
+ estimated_wait_seconds: z.number().int(),
60
+ }).transform((v) => {
61
+ return remap$(v, {
62
+ "bridge_id": "bridgeId",
63
+ "message_hash": "messageHash",
64
+ "sse_url": "sseUrl",
65
+ "status_url": "statusUrl",
66
+ "estimated_wait_seconds": "estimatedWaitSeconds",
67
+ });
68
+ });
69
+
70
+ export function mintPreparePendingResponseFromJSON(
71
+ jsonString: string,
72
+ ): SafeParseResult<MintPreparePendingResponse, SDKValidationError> {
73
+ return safeParse(
74
+ jsonString,
75
+ (x) => MintPreparePendingResponse$inboundSchema.parse(JSON.parse(x)),
76
+ `Failed to parse 'MintPreparePendingResponse' from JSON`,
77
+ );
78
+ }
@@ -0,0 +1,80 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import {
11
+ BatchedSafeOperationsResponseOutput,
12
+ BatchedSafeOperationsResponseOutput$inboundSchema,
13
+ } from "./batchedsafeoperationsresponseoutput.js";
14
+ import {
15
+ UnsignedTransaction,
16
+ UnsignedTransaction$inboundSchema,
17
+ } from "./unsignedtransaction.js";
18
+
19
+ /**
20
+ * Response when attestation is ready and mint transaction can be built.
21
+ *
22
+ * @remarks
23
+ *
24
+ * Returned with 200 OK status code. Contains either an unsigned transaction for direct
25
+ * submission or EIP-712 typed data for gas-sponsored transactions. The transaction
26
+ * calls receiveMessage on the MessageTransmitter contract through the Earn Account
27
+ * (Safe).
28
+ */
29
+ export type MintPrepareReadyResponse = {
30
+ /**
31
+ * Indicates the attestation is ready and mint transaction is available.
32
+ */
33
+ status?: "ready" | undefined;
34
+ /**
35
+ * The bridge identifier.
36
+ */
37
+ bridgeId: string;
38
+ /**
39
+ * Unsigned Safe execTransaction for the destination chain that calls receiveMessage on the MessageTransmitter contract. Sign and broadcast this to mint USDC to your Earn Account. Present when gas_sponsorship=False.
40
+ */
41
+ transaction?: UnsignedTransaction | null | undefined;
42
+ /**
43
+ * EIP-712 typed data for off-chain signing. The owner signs this data and submits it to /gas_sponsorship/prepare for a relayer to execute. Present when gas_sponsorship=True.
44
+ */
45
+ eip712?: BatchedSafeOperationsResponseOutput | null | undefined;
46
+ /**
47
+ * The CCTP message hash used to obtain the attestation.
48
+ */
49
+ messageHash: string;
50
+ };
51
+
52
+ /** @internal */
53
+ export const MintPrepareReadyResponse$inboundSchema: z.ZodType<
54
+ MintPrepareReadyResponse,
55
+ z.ZodTypeDef,
56
+ unknown
57
+ > = z.object({
58
+ status: z.literal("ready").default("ready").optional(),
59
+ bridge_id: z.string(),
60
+ transaction: z.nullable(UnsignedTransaction$inboundSchema).optional(),
61
+ eip_712: z.nullable(BatchedSafeOperationsResponseOutput$inboundSchema)
62
+ .optional(),
63
+ message_hash: z.string(),
64
+ }).transform((v) => {
65
+ return remap$(v, {
66
+ "bridge_id": "bridgeId",
67
+ "eip_712": "eip712",
68
+ "message_hash": "messageHash",
69
+ });
70
+ });
71
+
72
+ export function mintPrepareReadyResponseFromJSON(
73
+ jsonString: string,
74
+ ): SafeParseResult<MintPrepareReadyResponse, SDKValidationError> {
75
+ return safeParse(
76
+ jsonString,
77
+ (x) => MintPrepareReadyResponse$inboundSchema.parse(JSON.parse(x)),
78
+ `Failed to parse 'MintPrepareReadyResponse' from JSON`,
79
+ );
80
+ }
@@ -0,0 +1,66 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+
8
+ /**
9
+ * Request model for preparing a CCTP mint transaction on an Earn Account.
10
+ *
11
+ * @remarks
12
+ *
13
+ * The mint/prepare endpoint uses the bridge_id to:
14
+ * 1. Look up the bridge session created during burn/prepare
15
+ * 2. Find the DepositForBurn event on the source chain
16
+ * 3. Extract the CCTP message and compute its hash
17
+ * 4. Check if Circle's attestation is ready
18
+ * 5. Return the mint transaction wrapped in Safe execTransaction
19
+ *
20
+ * This eliminates the need for users to provide the burn transaction hash.
21
+ */
22
+ export type MintPrepareRequest = {
23
+ /**
24
+ * The bridge identifier returned from /burn endpoint. This is used to look up the bridge session and find the burn event.
25
+ */
26
+ bridgeId: string;
27
+ /**
28
+ * The primary wallet address that owns and controls the Earn Account (Safe) on the destination chain. This is used to determine the Safe address that will receive and execute the receiveMessage transaction.
29
+ */
30
+ owner: string;
31
+ /**
32
+ * Optionally request gas sponsorship. If set to `true`, EIP-712 typed data will be returned that must be signed by the `owner` and submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`).
33
+ */
34
+ gasSponsorship?: boolean | undefined;
35
+ };
36
+
37
+ /** @internal */
38
+ export type MintPrepareRequest$Outbound = {
39
+ bridge_id: string;
40
+ owner: string;
41
+ gas_sponsorship?: boolean | undefined;
42
+ };
43
+
44
+ /** @internal */
45
+ export const MintPrepareRequest$outboundSchema: z.ZodType<
46
+ MintPrepareRequest$Outbound,
47
+ z.ZodTypeDef,
48
+ MintPrepareRequest
49
+ > = z.object({
50
+ bridgeId: z.string(),
51
+ owner: z.string(),
52
+ gasSponsorship: z.boolean().optional(),
53
+ }).transform((v) => {
54
+ return remap$(v, {
55
+ bridgeId: "bridge_id",
56
+ gasSponsorship: "gas_sponsorship",
57
+ });
58
+ });
59
+
60
+ export function mintPrepareRequestToJSON(
61
+ mintPrepareRequest: MintPrepareRequest,
62
+ ): string {
63
+ return JSON.stringify(
64
+ MintPrepareRequest$outboundSchema.parse(mintPrepareRequest),
65
+ );
66
+ }
@@ -40,6 +40,7 @@ export * from "./v1uniswapquotebuyexactly.js";
40
40
  export * from "./v1uniswapquotesellexactly.js";
41
41
  export * from "./v1vaultsvault.js";
42
42
  export * from "./v1wildcatmarket.js";
43
+ export * from "./v2cctpmint.js";
43
44
  export * from "./v2earnaavetokenrates.js";
44
45
  export * from "./v2earnpositions.js";
45
46
  export * from "./v2earnpositionspositionid.js";
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import * as components from "../components/index.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ export type V2CctpMintResponse =
12
+ | components.MintPreparePendingResponse
13
+ | components.MintPrepareReadyResponse;
14
+
15
+ /** @internal */
16
+ export const V2CctpMintResponse$inboundSchema: z.ZodType<
17
+ V2CctpMintResponse,
18
+ z.ZodTypeDef,
19
+ unknown
20
+ > = z.union([
21
+ components.MintPreparePendingResponse$inboundSchema,
22
+ components.MintPrepareReadyResponse$inboundSchema,
23
+ ]);
24
+
25
+ export function v2CctpMintResponseFromJSON(
26
+ jsonString: string,
27
+ ): SafeParseResult<V2CctpMintResponse, SDKValidationError> {
28
+ return safeParse(
29
+ jsonString,
30
+ (x) => V2CctpMintResponse$inboundSchema.parse(JSON.parse(x)),
31
+ `Failed to parse 'V2CctpMintResponse' from JSON`,
32
+ );
33
+ }
@@ -0,0 +1,98 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { cctpCCTPBurn } from "../funcs/cctpCCTPBurn.js";
6
+ import { cctpCCTPMint } from "../funcs/cctpCCTPMint.js";
7
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
8
+ import * as components from "../models/components/index.js";
9
+ import * as operations from "../models/operations/index.js";
10
+ import { unwrapAsync } from "../types/fp.js";
11
+
12
+ export class Cctp extends ClientSDK {
13
+ /**
14
+ * Build depositForBurn transaction for Earn Account
15
+ *
16
+ * @remarks
17
+ * Build a transaction to burn USDC from an Earn Account (Safe) on the source chain
18
+ * and initiate a cross-chain transfer via Circle's CCTP (Cross-Chain Transfer Protocol).
19
+ *
20
+ * **Flow:**
21
+ * 1. Call this endpoint with `gas_sponsorship=false` to get an unsigned transaction,
22
+ * or `gas_sponsorship=true` to get EIP-712 typed data for gas-sponsored execution
23
+ * 2. Owner signs the transaction or typed data
24
+ * 3. Broadcast the transaction on the source chain (or submit to `/gas_sponsorship/prepare`)
25
+ * 4. Wait for Circle's attestation service to attest the burn
26
+ * 5. Call the mint endpoint (when available) to receive USDC on the destination chain
27
+ *
28
+ * **Supported chains:**
29
+ * - Ethereum (domain 0)
30
+ * - Arbitrum (domain 3)
31
+ * - Base (domain 6)
32
+ *
33
+ * **Note:** The USDC must already be deposited in the Earn Account. If approval is needed
34
+ * for the TokenMessenger contract, it will be included in the transaction automatically.
35
+ *
36
+ * **Gas estimate:** ~200,000 gas units (includes Safe execTransaction overhead)
37
+ */
38
+ async cctpBurn(
39
+ request: components.DepositForBurnRequest,
40
+ options?: RequestOptions,
41
+ ): Promise<components.DepositForBurnResponse> {
42
+ return unwrapAsync(cctpCCTPBurn(
43
+ this,
44
+ request,
45
+ options,
46
+ ));
47
+ }
48
+
49
+ /**
50
+ * Prepare mint transaction for Earn Account on destination chain
51
+ *
52
+ * @remarks
53
+ * Prepare a receiveMessage transaction to mint USDC to an Earn Account (Safe) on the
54
+ * destination chain.
55
+ *
56
+ * **How it works:**
57
+ *
58
+ * This endpoint uses the `bridge_id` from `/burn` to:
59
+ * 1. Look up the bridge session (no burn tx hash needed!)
60
+ * 2. Find the DepositForBurn event on the source chain using stored nonce
61
+ * 3. Extract the CCTP message and compute its hash
62
+ * 4. Check if Circle's attestation is ready
63
+ * 5. Return the mint transaction wrapped in Safe execTransaction
64
+ *
65
+ * **Request parameters:**
66
+ *
67
+ * - `bridge_id`: The bridge ID returned from `/burn`
68
+ * - `owner`: The wallet address that owns the Earn Account (Safe) on the destination chain
69
+ * - `gas_sponsorship`: If true, returns EIP-712 typed data for gas-sponsored execution
70
+ *
71
+ * **Response codes:**
72
+ *
73
+ * - **200 OK**: Attestation is ready, mint transaction is included
74
+ * - **202 Accepted**: Attestation is pending, SSE URL for real-time updates is included
75
+ * - **400 Bad Request**: Bridge not found, or burn event not found yet
76
+ *
77
+ * **After receiving 202:**
78
+ *
79
+ * Either:
80
+ * - Connect to the SSE stream at `sse_url` and wait for `attestation_ready` event
81
+ * - Poll this endpoint periodically until you get 200
82
+ *
83
+ * **After receiving 200:**
84
+ *
85
+ * Sign and broadcast the returned transaction on the destination chain to mint USDC
86
+ * to your Earn Account.
87
+ */
88
+ async cctpMint(
89
+ request: components.MintPrepareRequest,
90
+ options?: RequestOptions,
91
+ ): Promise<operations.V2CctpMintResponse> {
92
+ return unwrapAsync(cctpCCTPMint(
93
+ this,
94
+ request,
95
+ options,
96
+ ));
97
+ }
98
+ }
package/src/sdk/sdk.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  import { ClientSDK } from "../lib/sdks.js";
6
6
  import { AaveV3 } from "./aavev3.js";
7
7
  import { AerodromeSlipstream } from "./aerodromeslipstream.js";
8
+ import { Cctp } from "./cctp.js";
8
9
  import { Earn } from "./earn.js";
9
10
  import { Erc4626Vaults } from "./erc4626vaults.js";
10
11
  import { Ethena } from "./ethena.js";
@@ -102,4 +103,9 @@ export class CompassApiSDK extends ClientSDK {
102
103
  get earn(): Earn {
103
104
  return (this._earn ??= new Earn(this._options));
104
105
  }
106
+
107
+ private _cctp?: Cctp;
108
+ get cctp(): Cctp {
109
+ return (this._cctp ??= new Cctp(this._options));
110
+ }
105
111
  }
@@ -16,8 +16,16 @@ export function startCountingUnrecognized() {
16
16
  refCount++;
17
17
  const start = globalCount;
18
18
  return {
19
- end: () => {
19
+ /**
20
+ * Ends counting and returns the delta.
21
+ * @param delta - If provided, only this amount is added to the parent counter
22
+ * (used for nested unions where we only want to record the winning option's count).
23
+ * If not provided, records all counts since start().
24
+ */
25
+ end: (delta?: number) => {
20
26
  const count = globalCount - start;
27
+ // Reset globalCount back to start, then add only the specified delta
28
+ globalCount = start + (delta ?? count);
21
29
  if (--refCount === 0) globalCount = 0;
22
30
  return count;
23
31
  },
package/tsconfig.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "incremental": true,
4
- "tsBuildInfoFile": ".tsbuildinfo",
5
4
  "target": "ES2020",
6
5
  "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
6
  "jsx": "react-jsx",