@compass-labs/api-sdk 2.1.9 → 2.1.10-rc.3
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 +7 -0
- package/dist/commonjs/funcs/cctpCCTPBurn.d.ts +43 -0
- package/dist/commonjs/funcs/cctpCCTPBurn.d.ts.map +1 -0
- package/dist/commonjs/funcs/cctpCCTPBurn.js +143 -0
- package/dist/commonjs/funcs/cctpCCTPBurn.js.map +1 -0
- package/dist/commonjs/funcs/cctpCCTPMint.d.ts +52 -0
- package/dist/commonjs/funcs/cctpCCTPMint.d.ts.map +1 -0
- package/dist/commonjs/funcs/cctpCCTPMint.js +152 -0
- package/dist/commonjs/funcs/cctpCCTPMint.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/lib/encodings.d.ts +1 -0
- package/dist/commonjs/lib/encodings.d.ts.map +1 -1
- package/dist/commonjs/lib/encodings.js +9 -0
- package/dist/commonjs/lib/encodings.js.map +1 -1
- package/dist/commonjs/models/components/depositforburnrequest.d.ts +109 -0
- package/dist/commonjs/models/components/depositforburnrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/depositforburnrequest.js +96 -0
- package/dist/commonjs/models/components/depositforburnrequest.js.map +1 -0
- package/dist/commonjs/models/components/depositforburnresponse.d.ts +66 -0
- package/dist/commonjs/models/components/depositforburnresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/depositforburnresponse.js +74 -0
- package/dist/commonjs/models/components/depositforburnresponse.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +5 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +5 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/mintpreparependingresponse.d.ts +43 -0
- package/dist/commonjs/models/components/mintpreparependingresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/mintpreparependingresponse.js +64 -0
- package/dist/commonjs/models/components/mintpreparependingresponse.js.map +1 -0
- package/dist/commonjs/models/components/mintpreparereadyresponse.d.ts +41 -0
- package/dist/commonjs/models/components/mintpreparereadyresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/mintpreparereadyresponse.js +64 -0
- package/dist/commonjs/models/components/mintpreparereadyresponse.js.map +1 -0
- package/dist/commonjs/models/components/mintpreparerequest.d.ts +39 -0
- package/dist/commonjs/models/components/mintpreparerequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/mintpreparerequest.js +57 -0
- package/dist/commonjs/models/components/mintpreparerequest.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/v2cctpmint.d.ts +9 -0
- package/dist/commonjs/models/operations/v2cctpmint.d.ts.map +1 -0
- package/dist/commonjs/models/operations/v2cctpmint.js +52 -0
- package/dist/commonjs/models/operations/v2cctpmint.js.map +1 -0
- package/dist/commonjs/sdk/cctp.d.ts +78 -0
- package/dist/commonjs/sdk/cctp.d.ts.map +1 -0
- package/dist/commonjs/sdk/cctp.js +90 -0
- package/dist/commonjs/sdk/cctp.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/commonjs/types/unrecognized.d.ts +7 -1
- package/dist/commonjs/types/unrecognized.d.ts.map +1 -1
- package/dist/commonjs/types/unrecognized.js +9 -1
- package/dist/commonjs/types/unrecognized.js.map +1 -1
- package/dist/esm/funcs/cctpCCTPBurn.d.ts +43 -0
- package/dist/esm/funcs/cctpCCTPBurn.d.ts.map +1 -0
- package/dist/esm/funcs/cctpCCTPBurn.js +107 -0
- package/dist/esm/funcs/cctpCCTPBurn.js.map +1 -0
- package/dist/esm/funcs/cctpCCTPMint.d.ts +52 -0
- package/dist/esm/funcs/cctpCCTPMint.d.ts.map +1 -0
- package/dist/esm/funcs/cctpCCTPMint.js +116 -0
- package/dist/esm/funcs/cctpCCTPMint.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/lib/encodings.d.ts +1 -0
- package/dist/esm/lib/encodings.d.ts.map +1 -1
- package/dist/esm/lib/encodings.js +9 -0
- package/dist/esm/lib/encodings.js.map +1 -1
- package/dist/esm/models/components/depositforburnrequest.d.ts +109 -0
- package/dist/esm/models/components/depositforburnrequest.d.ts.map +1 -0
- package/dist/esm/models/components/depositforburnrequest.js +58 -0
- package/dist/esm/models/components/depositforburnrequest.js.map +1 -0
- package/dist/esm/models/components/depositforburnresponse.d.ts +66 -0
- package/dist/esm/models/components/depositforburnresponse.d.ts.map +1 -0
- package/dist/esm/models/components/depositforburnresponse.js +37 -0
- package/dist/esm/models/components/depositforburnresponse.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +5 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +5 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/mintpreparependingresponse.d.ts +43 -0
- package/dist/esm/models/components/mintpreparependingresponse.d.ts.map +1 -0
- package/dist/esm/models/components/mintpreparependingresponse.js +27 -0
- package/dist/esm/models/components/mintpreparependingresponse.js.map +1 -0
- package/dist/esm/models/components/mintpreparereadyresponse.d.ts +41 -0
- package/dist/esm/models/components/mintpreparereadyresponse.d.ts.map +1 -0
- package/dist/esm/models/components/mintpreparereadyresponse.js +27 -0
- package/dist/esm/models/components/mintpreparereadyresponse.js.map +1 -0
- package/dist/esm/models/components/mintpreparerequest.d.ts +39 -0
- package/dist/esm/models/components/mintpreparerequest.d.ts.map +1 -0
- package/dist/esm/models/components/mintpreparerequest.js +20 -0
- package/dist/esm/models/components/mintpreparerequest.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/v2cctpmint.d.ts +9 -0
- package/dist/esm/models/operations/v2cctpmint.d.ts.map +1 -0
- package/dist/esm/models/operations/v2cctpmint.js +15 -0
- package/dist/esm/models/operations/v2cctpmint.js.map +1 -0
- package/dist/esm/sdk/cctp.d.ts +78 -0
- package/dist/esm/sdk/cctp.d.ts.map +1 -0
- package/dist/esm/sdk/cctp.js +86 -0
- package/dist/esm/sdk/cctp.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/dist/esm/types/unrecognized.d.ts +7 -1
- package/dist/esm/types/unrecognized.d.ts.map +1 -1
- package/dist/esm/types/unrecognized.js +9 -1
- package/dist/esm/types/unrecognized.js.map +1 -1
- package/package.json +1 -1
- package/src/funcs/cctpCCTPBurn.ts +194 -0
- package/src/funcs/cctpCCTPMint.ts +204 -0
- package/src/lib/config.ts +2 -2
- package/src/lib/encodings.ts +13 -0
- package/src/models/components/depositforburnrequest.ts +172 -0
- package/src/models/components/depositforburnresponse.ts +112 -0
- package/src/models/components/index.ts +5 -0
- package/src/models/components/mintpreparependingresponse.ts +78 -0
- package/src/models/components/mintpreparereadyresponse.ts +80 -0
- package/src/models/components/mintpreparerequest.ts +66 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/v2cctpmint.ts +33 -0
- package/src/sdk/cctp.ts +104 -0
- package/src/sdk/sdk.ts +6 -0
- package/src/types/unrecognized.ts +9 -1
- package/tsconfig.json +0 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import { cctpCCTPBurn } from "../funcs/cctpCCTPBurn.js";
|
|
5
|
+
import { cctpCCTPMint } from "../funcs/cctpCCTPMint.js";
|
|
6
|
+
import { ClientSDK } from "../lib/sdks.js";
|
|
7
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
8
|
+
export class Cctp extends ClientSDK {
|
|
9
|
+
/**
|
|
10
|
+
* Build depositForBurn transaction for Earn Account (CCTP V2)
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Build a transaction to burn USDC from an Earn Account (Safe) on the source chain
|
|
14
|
+
* and initiate a cross-chain transfer via Circle's CCTP V2 (Cross-Chain Transfer Protocol).
|
|
15
|
+
*
|
|
16
|
+
* **Transfer modes:**
|
|
17
|
+
* - `standard` (default): ~15-19 minute transfers, **free** (no fee)
|
|
18
|
+
* - `fast`: ~30 second transfers, requires a small fee (typically ~0.01%)
|
|
19
|
+
*
|
|
20
|
+
* The fee for fast mode is automatically calculated based on Circle's current rates.
|
|
21
|
+
*
|
|
22
|
+
* **Flow:**
|
|
23
|
+
* 1. Call this endpoint with `gas_sponsorship=false` to get an unsigned transaction,
|
|
24
|
+
* or `gas_sponsorship=true` to get EIP-712 typed data for gas-sponsored execution
|
|
25
|
+
* 2. Owner signs the transaction or typed data
|
|
26
|
+
* 3. Broadcast the transaction on the source chain (or submit to `/gas_sponsorship/prepare`)
|
|
27
|
+
* 4. Wait for Circle's attestation service to attest the burn
|
|
28
|
+
* 5. Call the mint endpoint to receive USDC on the destination chain
|
|
29
|
+
*
|
|
30
|
+
* **Supported chains:**
|
|
31
|
+
* - Ethereum (domain 0)
|
|
32
|
+
* - Arbitrum (domain 3)
|
|
33
|
+
* - Base (domain 6)
|
|
34
|
+
*
|
|
35
|
+
* **Note:** The USDC must already be deposited in the Earn Account. If approval is needed
|
|
36
|
+
* for the TokenMessengerV2 contract, it will be included in the transaction automatically.
|
|
37
|
+
*
|
|
38
|
+
* **Gas estimate:** ~200,000 gas units (includes Safe execTransaction overhead)
|
|
39
|
+
*/
|
|
40
|
+
async cctpBurn(request, options) {
|
|
41
|
+
return unwrapAsync(cctpCCTPBurn(this, request, options));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Prepare mint transaction for Earn Account on destination chain
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* Prepare a receiveMessage transaction to mint USDC to an Earn Account (Safe) on the
|
|
48
|
+
* destination chain.
|
|
49
|
+
*
|
|
50
|
+
* **How it works:**
|
|
51
|
+
*
|
|
52
|
+
* This endpoint uses the `bridge_id` from `/burn` to:
|
|
53
|
+
* 1. Look up the bridge session (no burn tx hash needed!)
|
|
54
|
+
* 2. Find the DepositForBurn event on the source chain using stored nonce
|
|
55
|
+
* 3. Extract the CCTP message and compute its hash
|
|
56
|
+
* 4. Check if Circle's attestation is ready
|
|
57
|
+
* 5. Return the mint transaction wrapped in Safe execTransaction
|
|
58
|
+
*
|
|
59
|
+
* **Request parameters:**
|
|
60
|
+
*
|
|
61
|
+
* - `bridge_id`: The bridge ID returned from `/burn`
|
|
62
|
+
* - `owner`: The wallet address that owns the Earn Account (Safe) on the destination chain
|
|
63
|
+
* - `gas_sponsorship`: If true, returns EIP-712 typed data for gas-sponsored execution
|
|
64
|
+
*
|
|
65
|
+
* **Response codes:**
|
|
66
|
+
*
|
|
67
|
+
* - **200 OK**: Attestation is ready, mint transaction is included
|
|
68
|
+
* - **202 Accepted**: Attestation is pending, SSE URL for real-time updates is included
|
|
69
|
+
* - **400 Bad Request**: Bridge not found, or burn event not found yet
|
|
70
|
+
*
|
|
71
|
+
* **After receiving 202:**
|
|
72
|
+
*
|
|
73
|
+
* Either:
|
|
74
|
+
* - Connect to the SSE stream at `sse_url` and wait for `attestation_ready` event
|
|
75
|
+
* - Poll this endpoint periodically until you get 200
|
|
76
|
+
*
|
|
77
|
+
* **After receiving 200:**
|
|
78
|
+
*
|
|
79
|
+
* Sign and broadcast the returned transaction on the destination chain to mint USDC
|
|
80
|
+
* to your Earn Account.
|
|
81
|
+
*/
|
|
82
|
+
async cctpMint(request, options) {
|
|
83
|
+
return unwrapAsync(cctpCCTPMint(this, request, options));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=cctp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cctp.js","sourceRoot":"","sources":["../../../src/sdk/cctp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAAO,IAAK,SAAQ,SAAS;IACjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,KAAK,CAAC,QAAQ,CACZ,OAAyC,EACzC,OAAwB;QAExB,OAAO,WAAW,CAAC,YAAY,CAC7B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,KAAK,CAAC,QAAQ,CACZ,OAAsC,EACtC,OAAwB;QAExB,OAAO,WAAW,CAAC,YAAY,CAC7B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/esm/sdk/sdk.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ClientSDK } from "../lib/sdks.js";
|
|
2
2
|
import { AaveV3 } from "./aavev3.js";
|
|
3
3
|
import { AerodromeSlipstream } from "./aerodromeslipstream.js";
|
|
4
|
+
import { Cctp } from "./cctp.js";
|
|
4
5
|
import { Earn } from "./earn.js";
|
|
5
6
|
import { Erc4626Vaults } from "./erc4626vaults.js";
|
|
6
7
|
import { Ethena } from "./ethena.js";
|
|
@@ -48,5 +49,7 @@ export declare class CompassApiSDK extends ClientSDK {
|
|
|
48
49
|
get gasSponsorship(): GasSponsorship;
|
|
49
50
|
private _earn?;
|
|
50
51
|
get earn(): Earn;
|
|
52
|
+
private _cctp?;
|
|
53
|
+
get cctp(): Cctp;
|
|
51
54
|
}
|
|
52
55
|
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/sdk/sdk.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC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O,CAAC,IAAI,CAAC,CAAM;IACnB,IAAI,GAAG,IAAI,GAAG,CAEb;IAED,OAAO,CAAC,MAAM,CAAC,CAAQ;IACvB,IAAI,KAAK,IAAI,KAAK,CAEjB;IAED,OAAO,CAAC,UAAU,CAAC,CAAY;IAC/B,IAAI,SAAS,IAAI,SAAS,CAEzB;IAED,OAAO,CAAC,UAAU,CAAC,CAAY;IAC/B,IAAI,SAAS,IAAI,SAAS,CAEzB;IAED,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,OAAO,CAAC,KAAK,CAAC,CAAO;IACrB,IAAI,IAAI,IAAI,IAAI,CAEf;IAED,OAAO,CAAC,mBAAmB,CAAC,CAAqB;IACjD,IAAI,kBAAkB,IAAI,kBAAkB,CAE3C;IAED,OAAO,CAAC,aAAa,CAAC,CAAe;IACrC,IAAI,YAAY,IAAI,YAAY,CAE/B;IAED,OAAO,CAAC,cAAc,CAAC,CAAgB;IACvC,IAAI,aAAa,IAAI,aAAa,CAEjC;IAED,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,OAAO,CAAC,QAAQ,CAAC,CAAU;IAC3B,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,OAAO,CAAC,eAAe,CAAC,CAAiB;IACzC,IAAI,cAAc,IAAI,cAAc,CAEnC;IAED,OAAO,CAAC,KAAK,CAAC,CAAO;IACrB,IAAI,IAAI,IAAI,IAAI,CAEf;IAED,OAAO,CAAC,KAAK,CAAC,CAAO;IACrB,IAAI,IAAI,IAAI,IAAI,CAEf;CACF"}
|
package/dist/esm/sdk/sdk.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { ClientSDK } from "../lib/sdks.js";
|
|
5
5
|
import { AaveV3 } from "./aavev3.js";
|
|
6
6
|
import { AerodromeSlipstream } from "./aerodromeslipstream.js";
|
|
7
|
+
import { Cctp } from "./cctp.js";
|
|
7
8
|
import { Earn } from "./earn.js";
|
|
8
9
|
import { Erc4626Vaults } from "./erc4626vaults.js";
|
|
9
10
|
import { Ethena } from "./ethena.js";
|
|
@@ -67,5 +68,8 @@ export class CompassApiSDK extends ClientSDK {
|
|
|
67
68
|
get earn() {
|
|
68
69
|
return (this._earn ?? (this._earn = new Earn(this._options)));
|
|
69
70
|
}
|
|
71
|
+
get cctp() {
|
|
72
|
+
return (this._cctp ?? (this._cctp = new Cctp(this._options)));
|
|
73
|
+
}
|
|
70
74
|
}
|
|
71
75
|
//# sourceMappingURL=sdk.js.map
|
package/dist/esm/sdk/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../../src/sdk/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,SAAS,E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C,KAAK,GAAK,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAC,CAAC;IAClD,CAAC;CACF"}
|
|
@@ -4,7 +4,13 @@ export type Unrecognized<T> = T & {
|
|
|
4
4
|
};
|
|
5
5
|
declare function unrecognized<T>(value: T): Unrecognized<T>;
|
|
6
6
|
export declare function startCountingUnrecognized(): {
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Ends counting and returns the delta.
|
|
9
|
+
* @param delta - If provided, only this amount is added to the parent counter
|
|
10
|
+
* (used for nested unions where we only want to record the winning option's count).
|
|
11
|
+
* If not provided, records all counts since start().
|
|
12
|
+
*/
|
|
13
|
+
end: (delta?: number) => number;
|
|
8
14
|
};
|
|
9
15
|
export { unrecognized };
|
|
10
16
|
//# sourceMappingURL=unrecognized.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unrecognized.d.ts","sourceRoot":"","sources":["../../../src/types/unrecognized.ts"],"names":[],"mappings":"AAIA,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AACrC,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,CAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC;AAEhE,iBAAS,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAGlD;AAID,wBAAgB,yBAAyB
|
|
1
|
+
{"version":3,"file":"unrecognized.d.ts","sourceRoot":"","sources":["../../../src/types/unrecognized.ts"],"names":[],"mappings":"AAIA,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AACrC,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,CAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC;AAEhE,iBAAS,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAGlD;AAID,wBAAgB,yBAAyB;IAIrC;;;;;OAKG;kBACW,MAAM;EAQvB;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -11,8 +11,16 @@ export function startCountingUnrecognized() {
|
|
|
11
11
|
refCount++;
|
|
12
12
|
const start = globalCount;
|
|
13
13
|
return {
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Ends counting and returns the delta.
|
|
16
|
+
* @param delta - If provided, only this amount is added to the parent counter
|
|
17
|
+
* (used for nested unions where we only want to record the winning option's count).
|
|
18
|
+
* If not provided, records all counts since start().
|
|
19
|
+
*/
|
|
20
|
+
end: (delta) => {
|
|
15
21
|
const count = globalCount - start;
|
|
22
|
+
// Reset globalCount back to start, then add only the specified delta
|
|
23
|
+
globalCount = start + (delta ?? count);
|
|
16
24
|
if (--refCount === 0)
|
|
17
25
|
globalCount = 0;
|
|
18
26
|
return count;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unrecognized.js","sourceRoot":"","sources":["../../../src/types/unrecognized.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,SAAS,YAAY,CAAI,KAAQ;IAC/B,WAAW,EAAE,CAAC;IACd,OAAO,KAAwB,CAAC;AAClC,CAAC;AAED,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,QAAQ,GAAG,CAAC,CAAC;AACjB,MAAM,UAAU,yBAAyB;IACvC,QAAQ,EAAE,CAAC;IACX,MAAM,KAAK,GAAG,WAAW,CAAC;IAC1B,OAAO;QACL,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"unrecognized.js","sourceRoot":"","sources":["../../../src/types/unrecognized.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,SAAS,YAAY,CAAI,KAAQ;IAC/B,WAAW,EAAE,CAAC;IACd,OAAO,KAAwB,CAAC;AAClC,CAAC;AAED,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,QAAQ,GAAG,CAAC,CAAC;AACjB,MAAM,UAAU,yBAAyB;IACvC,QAAQ,EAAE,CAAC;IACX,MAAM,KAAK,GAAG,WAAW,CAAC;IAC1B,OAAO;QACL;;;;;WAKG;QACH,GAAG,EAAE,CAAC,KAAc,EAAE,EAAE;YACtB,MAAM,KAAK,GAAG,WAAW,GAAG,KAAK,CAAC;YAClC,qEAAqE;YACrE,WAAW,GAAG,KAAK,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC;YACvC,IAAI,EAAE,QAAQ,KAAK,CAAC;gBAAE,WAAW,GAAG,CAAC,CAAC;YACtC,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,194 @@
|
|
|
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
|
+
* Build depositForBurn transaction for Earn Account (CCTP V2)
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
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 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.
|
|
40
|
+
*
|
|
41
|
+
* **Flow:**
|
|
42
|
+
* 1. Call this endpoint with `gas_sponsorship=false` to get an unsigned transaction,
|
|
43
|
+
* or `gas_sponsorship=true` to get EIP-712 typed data for gas-sponsored execution
|
|
44
|
+
* 2. Owner signs the transaction or typed data
|
|
45
|
+
* 3. Broadcast the transaction on the source chain (or submit to `/gas_sponsorship/prepare`)
|
|
46
|
+
* 4. Wait for Circle's attestation service to attest the burn
|
|
47
|
+
* 5. Call the mint endpoint to receive USDC on the destination chain
|
|
48
|
+
*
|
|
49
|
+
* **Supported chains:**
|
|
50
|
+
* - Ethereum (domain 0)
|
|
51
|
+
* - Arbitrum (domain 3)
|
|
52
|
+
* - Base (domain 6)
|
|
53
|
+
*
|
|
54
|
+
* **Note:** The USDC must already be deposited in the Earn Account. If approval is needed
|
|
55
|
+
* for the TokenMessengerV2 contract, it will be included in the transaction automatically.
|
|
56
|
+
*
|
|
57
|
+
* **Gas estimate:** ~200,000 gas units (includes Safe execTransaction overhead)
|
|
58
|
+
*/
|
|
59
|
+
export function cctpCCTPBurn(
|
|
60
|
+
client: CompassApiSDKCore,
|
|
61
|
+
request: components.DepositForBurnRequest,
|
|
62
|
+
options?: RequestOptions,
|
|
63
|
+
): APIPromise<
|
|
64
|
+
Result<
|
|
65
|
+
components.DepositForBurnResponse,
|
|
66
|
+
| errors.HTTPValidationError
|
|
67
|
+
| CompassAPISDKError
|
|
68
|
+
| ResponseValidationError
|
|
69
|
+
| ConnectionError
|
|
70
|
+
| RequestAbortedError
|
|
71
|
+
| RequestTimeoutError
|
|
72
|
+
| InvalidRequestError
|
|
73
|
+
| UnexpectedClientError
|
|
74
|
+
| SDKValidationError
|
|
75
|
+
>
|
|
76
|
+
> {
|
|
77
|
+
return new APIPromise($do(
|
|
78
|
+
client,
|
|
79
|
+
request,
|
|
80
|
+
options,
|
|
81
|
+
));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function $do(
|
|
85
|
+
client: CompassApiSDKCore,
|
|
86
|
+
request: components.DepositForBurnRequest,
|
|
87
|
+
options?: RequestOptions,
|
|
88
|
+
): Promise<
|
|
89
|
+
[
|
|
90
|
+
Result<
|
|
91
|
+
components.DepositForBurnResponse,
|
|
92
|
+
| errors.HTTPValidationError
|
|
93
|
+
| CompassAPISDKError
|
|
94
|
+
| ResponseValidationError
|
|
95
|
+
| ConnectionError
|
|
96
|
+
| RequestAbortedError
|
|
97
|
+
| RequestTimeoutError
|
|
98
|
+
| InvalidRequestError
|
|
99
|
+
| UnexpectedClientError
|
|
100
|
+
| SDKValidationError
|
|
101
|
+
>,
|
|
102
|
+
APICall,
|
|
103
|
+
]
|
|
104
|
+
> {
|
|
105
|
+
const parsed = safeParse(
|
|
106
|
+
request,
|
|
107
|
+
(value) => components.DepositForBurnRequest$outboundSchema.parse(value),
|
|
108
|
+
"Input validation failed",
|
|
109
|
+
);
|
|
110
|
+
if (!parsed.ok) {
|
|
111
|
+
return [parsed, { status: "invalid" }];
|
|
112
|
+
}
|
|
113
|
+
const payload = parsed.value;
|
|
114
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
115
|
+
|
|
116
|
+
const path = pathToFunc("/v2/cctp/burn")();
|
|
117
|
+
|
|
118
|
+
const headers = new Headers(compactMap({
|
|
119
|
+
"Content-Type": "application/json",
|
|
120
|
+
Accept: "application/json",
|
|
121
|
+
}));
|
|
122
|
+
|
|
123
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
124
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
125
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
126
|
+
|
|
127
|
+
const context = {
|
|
128
|
+
options: client._options,
|
|
129
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
130
|
+
operationID: "v2_cctp_burn",
|
|
131
|
+
oAuth2Scopes: null,
|
|
132
|
+
|
|
133
|
+
resolvedSecurity: requestSecurity,
|
|
134
|
+
|
|
135
|
+
securitySource: client._options.apiKeyAuth,
|
|
136
|
+
retryConfig: options?.retries
|
|
137
|
+
|| client._options.retryConfig
|
|
138
|
+
|| { strategy: "none" },
|
|
139
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const requestRes = client._createRequest(context, {
|
|
143
|
+
security: requestSecurity,
|
|
144
|
+
method: "POST",
|
|
145
|
+
baseURL: options?.serverURL,
|
|
146
|
+
path: path,
|
|
147
|
+
headers: headers,
|
|
148
|
+
body: body,
|
|
149
|
+
userAgent: client._options.userAgent,
|
|
150
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
151
|
+
}, options);
|
|
152
|
+
if (!requestRes.ok) {
|
|
153
|
+
return [requestRes, { status: "invalid" }];
|
|
154
|
+
}
|
|
155
|
+
const req = requestRes.value;
|
|
156
|
+
|
|
157
|
+
const doResult = await client._do(req, {
|
|
158
|
+
context,
|
|
159
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
160
|
+
retryConfig: context.retryConfig,
|
|
161
|
+
retryCodes: context.retryCodes,
|
|
162
|
+
});
|
|
163
|
+
if (!doResult.ok) {
|
|
164
|
+
return [doResult, { status: "request-error", request: req }];
|
|
165
|
+
}
|
|
166
|
+
const response = doResult.value;
|
|
167
|
+
|
|
168
|
+
const responseFields = {
|
|
169
|
+
HttpMeta: { Response: response, Request: req },
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const [result] = await M.match<
|
|
173
|
+
components.DepositForBurnResponse,
|
|
174
|
+
| errors.HTTPValidationError
|
|
175
|
+
| CompassAPISDKError
|
|
176
|
+
| ResponseValidationError
|
|
177
|
+
| ConnectionError
|
|
178
|
+
| RequestAbortedError
|
|
179
|
+
| RequestTimeoutError
|
|
180
|
+
| InvalidRequestError
|
|
181
|
+
| UnexpectedClientError
|
|
182
|
+
| SDKValidationError
|
|
183
|
+
>(
|
|
184
|
+
M.json(200, components.DepositForBurnResponse$inboundSchema),
|
|
185
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
186
|
+
M.fail("4XX"),
|
|
187
|
+
M.fail("5XX"),
|
|
188
|
+
)(response, req, { extraFields: responseFields });
|
|
189
|
+
if (!result.ok) {
|
|
190
|
+
return [result, { status: "complete", request: req, response }];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return [result, { status: "complete", request: req, response }];
|
|
194
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
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 * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Prepare mint transaction for Earn Account on destination chain
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Prepare a receiveMessage transaction to mint USDC to an Earn Account (Safe) on the
|
|
34
|
+
* destination chain.
|
|
35
|
+
*
|
|
36
|
+
* **How it works:**
|
|
37
|
+
*
|
|
38
|
+
* This endpoint uses the `bridge_id` from `/burn` to:
|
|
39
|
+
* 1. Look up the bridge session (no burn tx hash needed!)
|
|
40
|
+
* 2. Find the DepositForBurn event on the source chain using stored nonce
|
|
41
|
+
* 3. Extract the CCTP message and compute its hash
|
|
42
|
+
* 4. Check if Circle's attestation is ready
|
|
43
|
+
* 5. Return the mint transaction wrapped in Safe execTransaction
|
|
44
|
+
*
|
|
45
|
+
* **Request parameters:**
|
|
46
|
+
*
|
|
47
|
+
* - `bridge_id`: The bridge ID returned from `/burn`
|
|
48
|
+
* - `owner`: The wallet address that owns the Earn Account (Safe) on the destination chain
|
|
49
|
+
* - `gas_sponsorship`: If true, returns EIP-712 typed data for gas-sponsored execution
|
|
50
|
+
*
|
|
51
|
+
* **Response codes:**
|
|
52
|
+
*
|
|
53
|
+
* - **200 OK**: Attestation is ready, mint transaction is included
|
|
54
|
+
* - **202 Accepted**: Attestation is pending, SSE URL for real-time updates is included
|
|
55
|
+
* - **400 Bad Request**: Bridge not found, or burn event not found yet
|
|
56
|
+
*
|
|
57
|
+
* **After receiving 202:**
|
|
58
|
+
*
|
|
59
|
+
* Either:
|
|
60
|
+
* - Connect to the SSE stream at `sse_url` and wait for `attestation_ready` event
|
|
61
|
+
* - Poll this endpoint periodically until you get 200
|
|
62
|
+
*
|
|
63
|
+
* **After receiving 200:**
|
|
64
|
+
*
|
|
65
|
+
* Sign and broadcast the returned transaction on the destination chain to mint USDC
|
|
66
|
+
* to your Earn Account.
|
|
67
|
+
*/
|
|
68
|
+
export function cctpCCTPMint(
|
|
69
|
+
client: CompassApiSDKCore,
|
|
70
|
+
request: components.MintPrepareRequest,
|
|
71
|
+
options?: RequestOptions,
|
|
72
|
+
): APIPromise<
|
|
73
|
+
Result<
|
|
74
|
+
operations.V2CctpMintResponse,
|
|
75
|
+
| errors.HTTPValidationError
|
|
76
|
+
| CompassAPISDKError
|
|
77
|
+
| ResponseValidationError
|
|
78
|
+
| ConnectionError
|
|
79
|
+
| RequestAbortedError
|
|
80
|
+
| RequestTimeoutError
|
|
81
|
+
| InvalidRequestError
|
|
82
|
+
| UnexpectedClientError
|
|
83
|
+
| SDKValidationError
|
|
84
|
+
>
|
|
85
|
+
> {
|
|
86
|
+
return new APIPromise($do(
|
|
87
|
+
client,
|
|
88
|
+
request,
|
|
89
|
+
options,
|
|
90
|
+
));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async function $do(
|
|
94
|
+
client: CompassApiSDKCore,
|
|
95
|
+
request: components.MintPrepareRequest,
|
|
96
|
+
options?: RequestOptions,
|
|
97
|
+
): Promise<
|
|
98
|
+
[
|
|
99
|
+
Result<
|
|
100
|
+
operations.V2CctpMintResponse,
|
|
101
|
+
| errors.HTTPValidationError
|
|
102
|
+
| CompassAPISDKError
|
|
103
|
+
| ResponseValidationError
|
|
104
|
+
| ConnectionError
|
|
105
|
+
| RequestAbortedError
|
|
106
|
+
| RequestTimeoutError
|
|
107
|
+
| InvalidRequestError
|
|
108
|
+
| UnexpectedClientError
|
|
109
|
+
| SDKValidationError
|
|
110
|
+
>,
|
|
111
|
+
APICall,
|
|
112
|
+
]
|
|
113
|
+
> {
|
|
114
|
+
const parsed = safeParse(
|
|
115
|
+
request,
|
|
116
|
+
(value) => components.MintPrepareRequest$outboundSchema.parse(value),
|
|
117
|
+
"Input validation failed",
|
|
118
|
+
);
|
|
119
|
+
if (!parsed.ok) {
|
|
120
|
+
return [parsed, { status: "invalid" }];
|
|
121
|
+
}
|
|
122
|
+
const payload = parsed.value;
|
|
123
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
124
|
+
|
|
125
|
+
const path = pathToFunc("/v2/cctp/mint")();
|
|
126
|
+
|
|
127
|
+
const headers = new Headers(compactMap({
|
|
128
|
+
"Content-Type": "application/json",
|
|
129
|
+
Accept: "application/json",
|
|
130
|
+
}));
|
|
131
|
+
|
|
132
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
133
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
134
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
135
|
+
|
|
136
|
+
const context = {
|
|
137
|
+
options: client._options,
|
|
138
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
139
|
+
operationID: "v2_cctp_mint",
|
|
140
|
+
oAuth2Scopes: null,
|
|
141
|
+
|
|
142
|
+
resolvedSecurity: requestSecurity,
|
|
143
|
+
|
|
144
|
+
securitySource: client._options.apiKeyAuth,
|
|
145
|
+
retryConfig: options?.retries
|
|
146
|
+
|| client._options.retryConfig
|
|
147
|
+
|| { strategy: "none" },
|
|
148
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const requestRes = client._createRequest(context, {
|
|
152
|
+
security: requestSecurity,
|
|
153
|
+
method: "POST",
|
|
154
|
+
baseURL: options?.serverURL,
|
|
155
|
+
path: path,
|
|
156
|
+
headers: headers,
|
|
157
|
+
body: body,
|
|
158
|
+
userAgent: client._options.userAgent,
|
|
159
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
160
|
+
}, options);
|
|
161
|
+
if (!requestRes.ok) {
|
|
162
|
+
return [requestRes, { status: "invalid" }];
|
|
163
|
+
}
|
|
164
|
+
const req = requestRes.value;
|
|
165
|
+
|
|
166
|
+
const doResult = await client._do(req, {
|
|
167
|
+
context,
|
|
168
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
169
|
+
retryConfig: context.retryConfig,
|
|
170
|
+
retryCodes: context.retryCodes,
|
|
171
|
+
});
|
|
172
|
+
if (!doResult.ok) {
|
|
173
|
+
return [doResult, { status: "request-error", request: req }];
|
|
174
|
+
}
|
|
175
|
+
const response = doResult.value;
|
|
176
|
+
|
|
177
|
+
const responseFields = {
|
|
178
|
+
HttpMeta: { Response: response, Request: req },
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const [result] = await M.match<
|
|
182
|
+
operations.V2CctpMintResponse,
|
|
183
|
+
| errors.HTTPValidationError
|
|
184
|
+
| CompassAPISDKError
|
|
185
|
+
| ResponseValidationError
|
|
186
|
+
| ConnectionError
|
|
187
|
+
| RequestAbortedError
|
|
188
|
+
| RequestTimeoutError
|
|
189
|
+
| InvalidRequestError
|
|
190
|
+
| UnexpectedClientError
|
|
191
|
+
| SDKValidationError
|
|
192
|
+
>(
|
|
193
|
+
M.json(200, operations.V2CctpMintResponse$inboundSchema),
|
|
194
|
+
M.json(202, operations.V2CctpMintResponse$inboundSchema),
|
|
195
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
196
|
+
M.fail("4XX"),
|
|
197
|
+
M.fail("5XX"),
|
|
198
|
+
)(response, req, { extraFields: responseFields });
|
|
199
|
+
if (!result.ok) {
|
|
200
|
+
return [result, { status: "complete", request: req, response }];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return [result, { status: "complete", request: req, response }];
|
|
204
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -62,7 +62,7 @@ export const SDK_METADATA = {
|
|
|
62
62
|
language: "typescript",
|
|
63
63
|
openapiDocVersion: "0.0.1",
|
|
64
64
|
sdkVersion: "2.0.0",
|
|
65
|
-
genVersion: "2.
|
|
65
|
+
genVersion: "2.767.2",
|
|
66
66
|
userAgent:
|
|
67
|
-
"speakeasy-sdk/typescript 2.0.0 2.
|
|
67
|
+
"speakeasy-sdk/typescript 2.0.0 2.767.2 0.0.1 @compass-labs/api-sdk",
|
|
68
68
|
} as const;
|
package/src/lib/encodings.ts
CHANGED
|
@@ -427,6 +427,7 @@ export function queryJoin(...args: (string | undefined)[]): string {
|
|
|
427
427
|
type QueryEncoderOptions = {
|
|
428
428
|
explode?: boolean;
|
|
429
429
|
charEncoding?: "percent" | "none";
|
|
430
|
+
allowEmptyValue?: string[];
|
|
430
431
|
};
|
|
431
432
|
|
|
432
433
|
type QueryEncoder = (
|
|
@@ -451,7 +452,19 @@ export function queryEncoder(f: QueryEncoder): BulkQueryEncoder {
|
|
|
451
452
|
charEncoding: options?.charEncoding ?? "percent",
|
|
452
453
|
};
|
|
453
454
|
|
|
455
|
+
const allowEmptySet = new Set(options?.allowEmptyValue ?? []);
|
|
456
|
+
|
|
454
457
|
const encoded = Object.entries(values).map(([key, value]) => {
|
|
458
|
+
if (allowEmptySet.has(key)) {
|
|
459
|
+
if (
|
|
460
|
+
value === undefined
|
|
461
|
+
|| value === null
|
|
462
|
+
|| value === ""
|
|
463
|
+
|| (Array.isArray(value) && value.length === 0)
|
|
464
|
+
) {
|
|
465
|
+
return `${encodeURIComponent(key)}=`;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
455
468
|
return f(key, value, opts);
|
|
456
469
|
});
|
|
457
470
|
return queryJoin(...encoded);
|