@compass-labs/api-sdk 2.1.10-rc.2 → 2.1.10-rc.4
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.
- package/README.md +2 -2
- package/dist/commonjs/funcs/cctpCCTPBurn.d.ts +10 -4
- package/dist/commonjs/funcs/cctpCCTPBurn.d.ts.map +1 -1
- package/dist/commonjs/funcs/cctpCCTPBurn.js +10 -4
- package/dist/commonjs/funcs/cctpCCTPBurn.js.map +1 -1
- package/dist/commonjs/models/components/depositforburnrequest.d.ts +18 -5
- package/dist/commonjs/models/components/depositforburnrequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/depositforburnrequest.js +12 -3
- package/dist/commonjs/models/components/depositforburnrequest.js.map +1 -1
- package/dist/commonjs/models/components/depositforburnresponse.d.ts +29 -0
- package/dist/commonjs/models/components/depositforburnresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/depositforburnresponse.js +15 -1
- package/dist/commonjs/models/components/depositforburnresponse.js.map +1 -1
- package/dist/commonjs/models/components/mintpreparerequest.d.ts +8 -5
- package/dist/commonjs/models/components/mintpreparerequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/mintpreparerequest.js +2 -0
- package/dist/commonjs/models/components/mintpreparerequest.js.map +1 -1
- package/dist/commonjs/sdk/cctp.d.ts +10 -4
- package/dist/commonjs/sdk/cctp.d.ts.map +1 -1
- package/dist/commonjs/sdk/cctp.js +10 -4
- package/dist/commonjs/sdk/cctp.js.map +1 -1
- package/dist/esm/funcs/cctpCCTPBurn.d.ts +10 -4
- package/dist/esm/funcs/cctpCCTPBurn.d.ts.map +1 -1
- package/dist/esm/funcs/cctpCCTPBurn.js +10 -4
- package/dist/esm/funcs/cctpCCTPBurn.js.map +1 -1
- package/dist/esm/models/components/depositforburnrequest.d.ts +18 -5
- package/dist/esm/models/components/depositforburnrequest.d.ts.map +1 -1
- package/dist/esm/models/components/depositforburnrequest.js +11 -2
- package/dist/esm/models/components/depositforburnrequest.js.map +1 -1
- package/dist/esm/models/components/depositforburnresponse.d.ts +29 -0
- package/dist/esm/models/components/depositforburnresponse.d.ts.map +1 -1
- package/dist/esm/models/components/depositforburnresponse.js +14 -0
- package/dist/esm/models/components/depositforburnresponse.js.map +1 -1
- package/dist/esm/models/components/mintpreparerequest.d.ts +8 -5
- package/dist/esm/models/components/mintpreparerequest.d.ts.map +1 -1
- package/dist/esm/models/components/mintpreparerequest.js +2 -0
- package/dist/esm/models/components/mintpreparerequest.js.map +1 -1
- package/dist/esm/sdk/cctp.d.ts +10 -4
- package/dist/esm/sdk/cctp.d.ts.map +1 -1
- package/dist/esm/sdk/cctp.js +10 -4
- package/dist/esm/sdk/cctp.js.map +1 -1
- package/examples/node_modules/.package-lock.json +36 -36
- package/examples/node_modules/@esbuild/linux-x64/package.json +1 -1
- package/examples/node_modules/esbuild/lib/main.js +8 -8
- package/examples/node_modules/esbuild/package.json +27 -27
- package/examples/node_modules/tsx/dist/cli.mjs +1 -1
- package/examples/node_modules/tsx/dist/package-CeBgXWuR.mjs +1 -0
- package/examples/node_modules/tsx/dist/repl.mjs +1 -1
- package/examples/node_modules/tsx/package.json +2 -2
- package/examples/package-lock.json +111 -111
- package/package.json +1 -1
- package/src/funcs/cctpCCTPBurn.ts +10 -4
- package/src/models/components/depositforburnrequest.ts +26 -7
- package/src/models/components/depositforburnresponse.ts +40 -0
- package/src/models/components/mintpreparerequest.ts +10 -5
- package/src/sdk/cctp.ts +10 -4
- package/examples/node_modules/tsx/dist/package-DqlROeDy.mjs +0 -1
|
@@ -26,11 +26,17 @@ import { APICall, APIPromise } from "../types/async.js";
|
|
|
26
26
|
import { Result } from "../types/fp.js";
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Build depositForBurn transaction for Earn Account
|
|
29
|
+
* Build depositForBurn transaction for Earn Account (CCTP V2)
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
32
|
* Build a transaction to burn USDC from an Earn Account (Safe) on the source chain
|
|
33
|
-
* and initiate a cross-chain transfer via Circle's CCTP (Cross-Chain Transfer Protocol).
|
|
33
|
+
* and initiate a cross-chain transfer via Circle's CCTP V2 (Cross-Chain Transfer Protocol).
|
|
34
|
+
*
|
|
35
|
+
* **Transfer modes:**
|
|
36
|
+
* - `standard` (default): ~15-19 minute transfers, **free** (no fee)
|
|
37
|
+
* - `fast`: ~30 second transfers, requires a small fee (typically ~0.01%)
|
|
38
|
+
*
|
|
39
|
+
* The fee for fast mode is automatically calculated based on Circle's current rates.
|
|
34
40
|
*
|
|
35
41
|
* **Flow:**
|
|
36
42
|
* 1. Call this endpoint with `gas_sponsorship=false` to get an unsigned transaction,
|
|
@@ -38,7 +44,7 @@ import { Result } from "../types/fp.js";
|
|
|
38
44
|
* 2. Owner signs the transaction or typed data
|
|
39
45
|
* 3. Broadcast the transaction on the source chain (or submit to `/gas_sponsorship/prepare`)
|
|
40
46
|
* 4. Wait for Circle's attestation service to attest the burn
|
|
41
|
-
* 5. Call the mint endpoint
|
|
47
|
+
* 5. Call the mint endpoint to receive USDC on the destination chain
|
|
42
48
|
*
|
|
43
49
|
* **Supported chains:**
|
|
44
50
|
* - Ethereum (domain 0)
|
|
@@ -46,7 +52,7 @@ import { Result } from "../types/fp.js";
|
|
|
46
52
|
* - Base (domain 6)
|
|
47
53
|
*
|
|
48
54
|
* **Note:** The USDC must already be deposited in the Earn Account. If approval is needed
|
|
49
|
-
* for the
|
|
55
|
+
* for the TokenMessengerV2 contract, it will be included in the transaction automatically.
|
|
50
56
|
*
|
|
51
57
|
* **Gas estimate:** ~200,000 gas units (includes Safe execTransaction overhead)
|
|
52
58
|
*/
|
|
@@ -39,6 +39,20 @@ export const DestinationChain = {
|
|
|
39
39
|
*/
|
|
40
40
|
export type DestinationChain = ClosedEnum<typeof DestinationChain>;
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Transfer speed mode. 'fast': ~30 second transfers using confirmed finality (requires a small fee taken from transfer amount). 'standard': ~15-19 minute transfers using full finality (free, no fee). Default is 'standard'.
|
|
44
|
+
*/
|
|
45
|
+
export const DepositForBurnRequestTransferMode = {
|
|
46
|
+
Fast: "fast",
|
|
47
|
+
Standard: "standard",
|
|
48
|
+
} as const;
|
|
49
|
+
/**
|
|
50
|
+
* Transfer speed mode. 'fast': ~30 second transfers using confirmed finality (requires a small fee taken from transfer amount). 'standard': ~15-19 minute transfers using full finality (free, no fee). Default is 'standard'.
|
|
51
|
+
*/
|
|
52
|
+
export type DepositForBurnRequestTransferMode = ClosedEnum<
|
|
53
|
+
typeof DepositForBurnRequestTransferMode
|
|
54
|
+
>;
|
|
55
|
+
|
|
42
56
|
/**
|
|
43
57
|
* Request model for CCTP depositForBurn transaction from a smart account.
|
|
44
58
|
*
|
|
@@ -74,14 +88,14 @@ export type DepositForBurnRequest = {
|
|
|
74
88
|
* The destination chain where USDC will be minted.
|
|
75
89
|
*/
|
|
76
90
|
destinationChain: DestinationChain;
|
|
77
|
-
/**
|
|
78
|
-
* The recipient address on the destination chain.
|
|
79
|
-
*/
|
|
80
|
-
destinationAddress: string;
|
|
81
91
|
/**
|
|
82
92
|
* 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`).
|
|
83
93
|
*/
|
|
84
94
|
gasSponsorship?: boolean | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Transfer speed mode. 'fast': ~30 second transfers using confirmed finality (requires a small fee taken from transfer amount). 'standard': ~15-19 minute transfers using full finality (free, no fee). Default is 'standard'.
|
|
97
|
+
*/
|
|
98
|
+
transferMode?: DepositForBurnRequestTransferMode | undefined;
|
|
85
99
|
};
|
|
86
100
|
|
|
87
101
|
/** @internal */
|
|
@@ -114,14 +128,19 @@ export const DestinationChain$outboundSchema: z.ZodNativeEnum<
|
|
|
114
128
|
typeof DestinationChain
|
|
115
129
|
> = z.nativeEnum(DestinationChain);
|
|
116
130
|
|
|
131
|
+
/** @internal */
|
|
132
|
+
export const DepositForBurnRequestTransferMode$outboundSchema: z.ZodNativeEnum<
|
|
133
|
+
typeof DepositForBurnRequestTransferMode
|
|
134
|
+
> = z.nativeEnum(DepositForBurnRequestTransferMode);
|
|
135
|
+
|
|
117
136
|
/** @internal */
|
|
118
137
|
export type DepositForBurnRequest$Outbound = {
|
|
119
138
|
owner: string;
|
|
120
139
|
chain: string;
|
|
121
140
|
amount: number | string;
|
|
122
141
|
destination_chain: string;
|
|
123
|
-
destination_address: string;
|
|
124
142
|
gas_sponsorship?: boolean | undefined;
|
|
143
|
+
transfer_mode?: string | undefined;
|
|
125
144
|
};
|
|
126
145
|
|
|
127
146
|
/** @internal */
|
|
@@ -134,13 +153,13 @@ export const DepositForBurnRequest$outboundSchema: z.ZodType<
|
|
|
134
153
|
chain: DepositForBurnRequestChain$outboundSchema,
|
|
135
154
|
amount: z.union([z.number(), z.string()]),
|
|
136
155
|
destinationChain: DestinationChain$outboundSchema,
|
|
137
|
-
destinationAddress: z.string(),
|
|
138
156
|
gasSponsorship: z.boolean().optional(),
|
|
157
|
+
transferMode: DepositForBurnRequestTransferMode$outboundSchema.optional(),
|
|
139
158
|
}).transform((v) => {
|
|
140
159
|
return remap$(v, {
|
|
141
160
|
destinationChain: "destination_chain",
|
|
142
|
-
destinationAddress: "destination_address",
|
|
143
161
|
gasSponsorship: "gas_sponsorship",
|
|
162
|
+
transferMode: "transfer_mode",
|
|
144
163
|
});
|
|
145
164
|
});
|
|
146
165
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
9
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
10
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
11
|
import {
|
|
@@ -16,6 +17,20 @@ import {
|
|
|
16
17
|
UnsignedTransaction$inboundSchema,
|
|
17
18
|
} from "./unsignedtransaction.js";
|
|
18
19
|
|
|
20
|
+
/**
|
|
21
|
+
* The transfer speed mode used. 'fast' uses confirmed finality (~30s), 'standard' uses full finality (~15-19 min).
|
|
22
|
+
*/
|
|
23
|
+
export const DepositForBurnResponseTransferMode = {
|
|
24
|
+
Fast: "fast",
|
|
25
|
+
Standard: "standard",
|
|
26
|
+
} as const;
|
|
27
|
+
/**
|
|
28
|
+
* The transfer speed mode used. 'fast' uses confirmed finality (~30s), 'standard' uses full finality (~15-19 min).
|
|
29
|
+
*/
|
|
30
|
+
export type DepositForBurnResponseTransferMode = ClosedEnum<
|
|
31
|
+
typeof DepositForBurnResponseTransferMode
|
|
32
|
+
>;
|
|
33
|
+
|
|
19
34
|
/**
|
|
20
35
|
* Response model for CCTP depositForBurn transaction from a smart account.
|
|
21
36
|
*
|
|
@@ -35,6 +50,9 @@ import {
|
|
|
35
50
|
* eip_712: EIP-712 typed data for off-chain signing. The owner signs this
|
|
36
51
|
* data and submits it to /gas_sponsorship/prepare for a relayer to execute.
|
|
37
52
|
* Present when gas_sponsorship=True.
|
|
53
|
+
* transfer_mode: The transfer speed mode used for this bridge operation.
|
|
54
|
+
* fee: Fee amount in USDC (only charged for fast mode, None for standard).
|
|
55
|
+
* estimated_time_seconds: Estimated time to complete the bridge in seconds.
|
|
38
56
|
*/
|
|
39
57
|
export type DepositForBurnResponse = {
|
|
40
58
|
/**
|
|
@@ -43,8 +61,25 @@ export type DepositForBurnResponse = {
|
|
|
43
61
|
bridgeId?: string | null | undefined;
|
|
44
62
|
transaction: UnsignedTransaction | null;
|
|
45
63
|
eip712: BatchedSafeOperationsResponseOutput | null;
|
|
64
|
+
/**
|
|
65
|
+
* The transfer speed mode used. 'fast' uses confirmed finality (~30s), 'standard' uses full finality (~15-19 min).
|
|
66
|
+
*/
|
|
67
|
+
transferMode: DepositForBurnResponseTransferMode;
|
|
68
|
+
/**
|
|
69
|
+
* Fee amount in USDC charged for this transfer. Only present for fast mode. Standard mode transfers are free (fee is None or 0).
|
|
70
|
+
*/
|
|
71
|
+
fee?: string | null | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Estimated time to complete the bridge in seconds.
|
|
74
|
+
*/
|
|
75
|
+
estimatedTimeSeconds: number;
|
|
46
76
|
};
|
|
47
77
|
|
|
78
|
+
/** @internal */
|
|
79
|
+
export const DepositForBurnResponseTransferMode$inboundSchema: z.ZodNativeEnum<
|
|
80
|
+
typeof DepositForBurnResponseTransferMode
|
|
81
|
+
> = z.nativeEnum(DepositForBurnResponseTransferMode);
|
|
82
|
+
|
|
48
83
|
/** @internal */
|
|
49
84
|
export const DepositForBurnResponse$inboundSchema: z.ZodType<
|
|
50
85
|
DepositForBurnResponse,
|
|
@@ -54,10 +89,15 @@ export const DepositForBurnResponse$inboundSchema: z.ZodType<
|
|
|
54
89
|
bridge_id: z.nullable(z.string()).optional(),
|
|
55
90
|
transaction: z.nullable(UnsignedTransaction$inboundSchema),
|
|
56
91
|
eip_712: z.nullable(BatchedSafeOperationsResponseOutput$inboundSchema),
|
|
92
|
+
transfer_mode: DepositForBurnResponseTransferMode$inboundSchema,
|
|
93
|
+
fee: z.nullable(z.string()).optional(),
|
|
94
|
+
estimated_time_seconds: z.number().int(),
|
|
57
95
|
}).transform((v) => {
|
|
58
96
|
return remap$(v, {
|
|
59
97
|
"bridge_id": "bridgeId",
|
|
60
98
|
"eip_712": "eip712",
|
|
99
|
+
"transfer_mode": "transferMode",
|
|
100
|
+
"estimated_time_seconds": "estimatedTimeSeconds",
|
|
61
101
|
});
|
|
62
102
|
});
|
|
63
103
|
|
|
@@ -10,20 +10,22 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
10
10
|
*
|
|
11
11
|
* @remarks
|
|
12
12
|
*
|
|
13
|
-
* The mint/prepare endpoint uses the bridge_id to:
|
|
13
|
+
* The mint/prepare endpoint uses the bridge_id and burn_tx_hash to:
|
|
14
14
|
* 1. Look up the bridge session created during burn/prepare
|
|
15
|
-
* 2. Find the DepositForBurn event
|
|
15
|
+
* 2. Find the DepositForBurn event using the burn transaction hash
|
|
16
16
|
* 3. Extract the CCTP message and compute its hash
|
|
17
17
|
* 4. Check if Circle's attestation is ready
|
|
18
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
19
|
*/
|
|
22
20
|
export type MintPrepareRequest = {
|
|
23
21
|
/**
|
|
24
|
-
* The bridge identifier returned from /burn endpoint. This is used to look up the bridge session
|
|
22
|
+
* The bridge identifier returned from /burn endpoint. This is used to look up the bridge session.
|
|
25
23
|
*/
|
|
26
24
|
bridgeId: string;
|
|
25
|
+
/**
|
|
26
|
+
* The transaction hash of the burn transaction on the source chain. This is used to find the DepositForBurn event and extract the CCTP message.
|
|
27
|
+
*/
|
|
28
|
+
burnTxHash: string;
|
|
27
29
|
/**
|
|
28
30
|
* 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
31
|
*/
|
|
@@ -37,6 +39,7 @@ export type MintPrepareRequest = {
|
|
|
37
39
|
/** @internal */
|
|
38
40
|
export type MintPrepareRequest$Outbound = {
|
|
39
41
|
bridge_id: string;
|
|
42
|
+
burn_tx_hash: string;
|
|
40
43
|
owner: string;
|
|
41
44
|
gas_sponsorship?: boolean | undefined;
|
|
42
45
|
};
|
|
@@ -48,11 +51,13 @@ export const MintPrepareRequest$outboundSchema: z.ZodType<
|
|
|
48
51
|
MintPrepareRequest
|
|
49
52
|
> = z.object({
|
|
50
53
|
bridgeId: z.string(),
|
|
54
|
+
burnTxHash: z.string(),
|
|
51
55
|
owner: z.string(),
|
|
52
56
|
gasSponsorship: z.boolean().optional(),
|
|
53
57
|
}).transform((v) => {
|
|
54
58
|
return remap$(v, {
|
|
55
59
|
bridgeId: "bridge_id",
|
|
60
|
+
burnTxHash: "burn_tx_hash",
|
|
56
61
|
gasSponsorship: "gas_sponsorship",
|
|
57
62
|
});
|
|
58
63
|
});
|
package/src/sdk/cctp.ts
CHANGED
|
@@ -11,11 +11,17 @@ import { unwrapAsync } from "../types/fp.js";
|
|
|
11
11
|
|
|
12
12
|
export class Cctp extends ClientSDK {
|
|
13
13
|
/**
|
|
14
|
-
* Build depositForBurn transaction for Earn Account
|
|
14
|
+
* Build depositForBurn transaction for Earn Account (CCTP V2)
|
|
15
15
|
*
|
|
16
16
|
* @remarks
|
|
17
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).
|
|
18
|
+
* and initiate a cross-chain transfer via Circle's CCTP V2 (Cross-Chain Transfer Protocol).
|
|
19
|
+
*
|
|
20
|
+
* **Transfer modes:**
|
|
21
|
+
* - `standard` (default): ~15-19 minute transfers, **free** (no fee)
|
|
22
|
+
* - `fast`: ~30 second transfers, requires a small fee (typically ~0.01%)
|
|
23
|
+
*
|
|
24
|
+
* The fee for fast mode is automatically calculated based on Circle's current rates.
|
|
19
25
|
*
|
|
20
26
|
* **Flow:**
|
|
21
27
|
* 1. Call this endpoint with `gas_sponsorship=false` to get an unsigned transaction,
|
|
@@ -23,7 +29,7 @@ export class Cctp extends ClientSDK {
|
|
|
23
29
|
* 2. Owner signs the transaction or typed data
|
|
24
30
|
* 3. Broadcast the transaction on the source chain (or submit to `/gas_sponsorship/prepare`)
|
|
25
31
|
* 4. Wait for Circle's attestation service to attest the burn
|
|
26
|
-
* 5. Call the mint endpoint
|
|
32
|
+
* 5. Call the mint endpoint to receive USDC on the destination chain
|
|
27
33
|
*
|
|
28
34
|
* **Supported chains:**
|
|
29
35
|
* - Ethereum (domain 0)
|
|
@@ -31,7 +37,7 @@ export class Cctp extends ClientSDK {
|
|
|
31
37
|
* - Base (domain 6)
|
|
32
38
|
*
|
|
33
39
|
* **Note:** The USDC must already be deposited in the Earn Account. If approval is needed
|
|
34
|
-
* for the
|
|
40
|
+
* for the TokenMessengerV2 contract, it will be included in the transaction automatically.
|
|
35
41
|
*
|
|
36
42
|
* **Gas estimate:** ~200,000 gas units (includes Safe execTransaction overhead)
|
|
37
43
|
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var r="4.20.6";export{r as v};
|