@compass-labs/api-sdk 2.2.55 → 2.2.56-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/codeSamples_typescript.yaml +6 -0
- package/dist/commonjs/funcs/globalMarketsPerpsGlobalMarketsPerpsDeposit.d.ts +4 -2
- package/dist/commonjs/funcs/globalMarketsPerpsGlobalMarketsPerpsDeposit.d.ts.map +1 -1
- package/dist/commonjs/funcs/globalMarketsPerpsGlobalMarketsPerpsDeposit.js +4 -2
- package/dist/commonjs/funcs/globalMarketsPerpsGlobalMarketsPerpsDeposit.js.map +1 -1
- package/dist/commonjs/funcs/globalMarketsPerpsGlobalMarketsPerpsDepositSponsorPrepare.d.ts +23 -0
- package/dist/commonjs/funcs/globalMarketsPerpsGlobalMarketsPerpsDepositSponsorPrepare.d.ts.map +1 -0
- package/dist/commonjs/funcs/globalMarketsPerpsGlobalMarketsPerpsDepositSponsorPrepare.js +125 -0
- package/dist/commonjs/funcs/globalMarketsPerpsGlobalMarketsPerpsDepositSponsorPrepare.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/config.js.map +1 -1
- package/dist/commonjs/models/components/globalmarketsperpsdepositresponse.d.ts +6 -5
- package/dist/commonjs/models/components/globalmarketsperpsdepositresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/globalmarketsperpsdepositresponse.js.map +1 -1
- package/dist/commonjs/models/components/globalmarketsperpsdepositsponsorpreparerequest.d.ts +44 -0
- package/dist/commonjs/models/components/globalmarketsperpsdepositsponsorpreparerequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/globalmarketsperpsdepositsponsorpreparerequest.js +58 -0
- package/dist/commonjs/models/components/globalmarketsperpsdepositsponsorpreparerequest.js.map +1 -0
- package/dist/commonjs/models/components/globalmarketsperpsdepositsponsorprepareresponse.d.ts +20 -0
- package/dist/commonjs/models/components/globalmarketsperpsdepositsponsorprepareresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/globalmarketsperpsdepositsponsorprepareresponse.js +51 -0
- package/dist/commonjs/models/components/globalmarketsperpsdepositsponsorprepareresponse.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +2 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +2 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/sdk/globalmarketsperps.d.ts +16 -2
- package/dist/commonjs/sdk/globalmarketsperps.d.ts.map +1 -1
- package/dist/commonjs/sdk/globalmarketsperps.js +19 -2
- package/dist/commonjs/sdk/globalmarketsperps.js.map +1 -1
- package/dist/commonjs/types/async.d.ts.map +1 -1
- package/dist/commonjs/types/async.js +8 -7
- package/dist/commonjs/types/async.js.map +1 -1
- package/dist/esm/funcs/globalMarketsPerpsGlobalMarketsPerpsDeposit.d.ts +4 -2
- package/dist/esm/funcs/globalMarketsPerpsGlobalMarketsPerpsDeposit.d.ts.map +1 -1
- package/dist/esm/funcs/globalMarketsPerpsGlobalMarketsPerpsDeposit.js +4 -2
- package/dist/esm/funcs/globalMarketsPerpsGlobalMarketsPerpsDeposit.js.map +1 -1
- package/dist/esm/funcs/globalMarketsPerpsGlobalMarketsPerpsDepositSponsorPrepare.d.ts +23 -0
- package/dist/esm/funcs/globalMarketsPerpsGlobalMarketsPerpsDepositSponsorPrepare.d.ts.map +1 -0
- package/dist/esm/funcs/globalMarketsPerpsGlobalMarketsPerpsDepositSponsorPrepare.js +89 -0
- package/dist/esm/funcs/globalMarketsPerpsGlobalMarketsPerpsDepositSponsorPrepare.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/config.js.map +1 -1
- package/dist/esm/models/components/globalmarketsperpsdepositresponse.d.ts +6 -5
- package/dist/esm/models/components/globalmarketsperpsdepositresponse.d.ts.map +1 -1
- package/dist/esm/models/components/globalmarketsperpsdepositresponse.js.map +1 -1
- package/dist/esm/models/components/globalmarketsperpsdepositsponsorpreparerequest.d.ts +44 -0
- package/dist/esm/models/components/globalmarketsperpsdepositsponsorpreparerequest.d.ts.map +1 -0
- package/dist/esm/models/components/globalmarketsperpsdepositsponsorpreparerequest.js +21 -0
- package/dist/esm/models/components/globalmarketsperpsdepositsponsorpreparerequest.js.map +1 -0
- package/dist/esm/models/components/globalmarketsperpsdepositsponsorprepareresponse.d.ts +20 -0
- package/dist/esm/models/components/globalmarketsperpsdepositsponsorprepareresponse.d.ts.map +1 -0
- package/dist/esm/models/components/globalmarketsperpsdepositsponsorprepareresponse.js +14 -0
- package/dist/esm/models/components/globalmarketsperpsdepositsponsorprepareresponse.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +2 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +2 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/sdk/globalmarketsperps.d.ts +16 -2
- package/dist/esm/sdk/globalmarketsperps.d.ts.map +1 -1
- package/dist/esm/sdk/globalmarketsperps.js +19 -2
- package/dist/esm/sdk/globalmarketsperps.js.map +1 -1
- package/dist/esm/types/async.d.ts.map +1 -1
- package/dist/esm/types/async.js +8 -7
- package/dist/esm/types/async.js.map +1 -1
- package/docs/models/components/globalmarketsperpsdepositresponse.md +9 -8
- package/docs/models/components/globalmarketsperpsdepositsponsorpreparerequest.md +32 -0
- package/docs/models/components/globalmarketsperpsdepositsponsorprepareresponse.md +33 -0
- package/docs/sdks/globalmarketsperps/README.md +92 -2
- package/openapi_prepped_for_speakeasy.json +115 -5
- package/package.json +1 -1
- package/src/funcs/globalMarketsPerpsGlobalMarketsPerpsDeposit.ts +4 -2
- package/src/funcs/globalMarketsPerpsGlobalMarketsPerpsDepositSponsorPrepare.ts +181 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/globalmarketsperpsdepositresponse.ts +6 -5
- package/src/models/components/globalmarketsperpsdepositsponsorpreparerequest.ts +76 -0
- package/src/models/components/globalmarketsperpsdepositsponsorprepareresponse.ts +51 -0
- package/src/models/components/index.ts +2 -0
- package/src/sdk/globalmarketsperps.ts +29 -2
- package/src/types/async.ts +8 -7
|
@@ -6455,7 +6455,7 @@
|
|
|
6455
6455
|
"Global Markets Perps"
|
|
6456
6456
|
],
|
|
6457
6457
|
"summary": "Deposit USDC to global markets perps account",
|
|
6458
|
-
"description": "Prepare a USDC deposit from Arbitrum via EIP-2612 Permit.\n\nReturns EIP-712 typed data for the user to sign off-chain (no gas needed).\
|
|
6458
|
+
"description": "Prepare a USDC deposit from Arbitrum via EIP-2612 Permit.\n\nReturns EIP-712 typed data for the user to sign off-chain (no gas needed).\nCompass does NOT broadcast the bridge tx \u2014 the integrator's own sponsor\nwallet calls batchedDepositWithPermit on the HL Bridge2 contract on\nArbitrum after the user signs. See api_docs/v2/Products/Global-Markets.mdx\n\"Deposit USDC\" section for the bridge-broadcast code.",
|
|
6459
6459
|
"operationId": "v2_global_markets_perps_deposit",
|
|
6460
6460
|
"requestBody": {
|
|
6461
6461
|
"content": {
|
|
@@ -6492,6 +6492,49 @@
|
|
|
6492
6492
|
"x-speakeasy-name-override": "global_markets_perps_deposit"
|
|
6493
6493
|
}
|
|
6494
6494
|
},
|
|
6495
|
+
"/v2/global_markets_perps/deposit/sponsor_prepare": {
|
|
6496
|
+
"post": {
|
|
6497
|
+
"tags": [
|
|
6498
|
+
"Global Markets Perps"
|
|
6499
|
+
],
|
|
6500
|
+
"summary": "Build the Bridge2 deposit tx from a signed permit",
|
|
6501
|
+
"description": "Build the Arbitrum tx that completes a USDC deposit to HL.\n\nTakes the EIP-2612 permit signature returned by /deposit and returns\na fully-encoded `Bridge2.batchedDepositWithPermit` call. The integrator's\nsponsor wallet (`sender`) broadcasts the returned tx \u2014 Compass does not\nbroadcast and does not hold gas keys.",
|
|
6502
|
+
"operationId": "v2_global_markets_perps_deposit_sponsor_prepare",
|
|
6503
|
+
"requestBody": {
|
|
6504
|
+
"content": {
|
|
6505
|
+
"application/json": {
|
|
6506
|
+
"schema": {
|
|
6507
|
+
"$ref": "#/components/schemas/GlobalMarketsPerpsDepositSponsorPrepareRequest"
|
|
6508
|
+
}
|
|
6509
|
+
}
|
|
6510
|
+
},
|
|
6511
|
+
"required": true
|
|
6512
|
+
},
|
|
6513
|
+
"responses": {
|
|
6514
|
+
"200": {
|
|
6515
|
+
"description": "Successful Response",
|
|
6516
|
+
"content": {
|
|
6517
|
+
"application/json": {
|
|
6518
|
+
"schema": {
|
|
6519
|
+
"$ref": "#/components/schemas/GlobalMarketsPerpsDepositSponsorPrepareResponse"
|
|
6520
|
+
}
|
|
6521
|
+
}
|
|
6522
|
+
}
|
|
6523
|
+
},
|
|
6524
|
+
"422": {
|
|
6525
|
+
"description": "Validation Error",
|
|
6526
|
+
"content": {
|
|
6527
|
+
"application/json": {
|
|
6528
|
+
"schema": {
|
|
6529
|
+
"$ref": "#/components/schemas/HTTPValidationError"
|
|
6530
|
+
}
|
|
6531
|
+
}
|
|
6532
|
+
}
|
|
6533
|
+
}
|
|
6534
|
+
},
|
|
6535
|
+
"x-speakeasy-name-override": "global_markets_perps_deposit_sponsor_prepare"
|
|
6536
|
+
}
|
|
6537
|
+
},
|
|
6495
6538
|
"/v2/global_markets_perps/withdraw": {
|
|
6496
6539
|
"post": {
|
|
6497
6540
|
"tags": [
|
|
@@ -14134,17 +14177,17 @@
|
|
|
14134
14177
|
"properties": {
|
|
14135
14178
|
"permit": {
|
|
14136
14179
|
"$ref": "#/components/schemas/PermitTypedDataResponse-Output",
|
|
14137
|
-
"description": "EIP-712 typed data for the USDC permit \u2014 user signs this off-chain"
|
|
14180
|
+
"description": "EIP-712 typed data for the USDC permit \u2014 user signs this off-chain."
|
|
14138
14181
|
},
|
|
14139
14182
|
"amount_raw": {
|
|
14140
14183
|
"type": "integer",
|
|
14141
14184
|
"title": "Amount Raw",
|
|
14142
|
-
"description": "USDC amount in raw units
|
|
14185
|
+
"description": "USDC amount in raw 6-decimal units. Pass this and the signature to /deposit/sponsor_prepare."
|
|
14143
14186
|
},
|
|
14144
14187
|
"destination": {
|
|
14145
14188
|
"type": "string",
|
|
14146
14189
|
"title": "Destination",
|
|
14147
|
-
"description": "
|
|
14190
|
+
"description": "Address that will be credited on Hyperliquid (equals the deposit owner EOA \u2014 HL keys accounts by EVM address)."
|
|
14148
14191
|
}
|
|
14149
14192
|
},
|
|
14150
14193
|
"type": "object",
|
|
@@ -14154,7 +14197,74 @@
|
|
|
14154
14197
|
"destination"
|
|
14155
14198
|
],
|
|
14156
14199
|
"title": "GlobalMarketsPerpsDepositResponse",
|
|
14157
|
-
"description": "EIP-2612 permit data
|
|
14200
|
+
"description": "EIP-2612 permit data the user signs to authorize a USDC bridge deposit.\n\nAfter signing, submit the signature to /v2/global_markets_perps/deposit/sponsor_prepare\nto get a ready-to-broadcast Arbitrum tx that calls Bridge2.batchedDepositWithPermit.\nThe integrator's sponsor wallet broadcasts that tx \u2014 Compass does not broadcast."
|
|
14201
|
+
},
|
|
14202
|
+
"GlobalMarketsPerpsDepositSponsorPrepareRequest": {
|
|
14203
|
+
"properties": {
|
|
14204
|
+
"owner": {
|
|
14205
|
+
"type": "string",
|
|
14206
|
+
"title": "Owner",
|
|
14207
|
+
"description": "The user's EOA address on Arbitrum (the permit signer).",
|
|
14208
|
+
"example": "0x01E62835dd7F52173546A325294762143eE4a882"
|
|
14209
|
+
},
|
|
14210
|
+
"amount_raw": {
|
|
14211
|
+
"type": "integer",
|
|
14212
|
+
"exclusiveMinimum": 0.0,
|
|
14213
|
+
"title": "Amount Raw",
|
|
14214
|
+
"description": "USDC amount in raw 6-decimal units, as returned by /deposit.",
|
|
14215
|
+
"example": 100000000
|
|
14216
|
+
},
|
|
14217
|
+
"deadline": {
|
|
14218
|
+
"type": "integer",
|
|
14219
|
+
"exclusiveMinimum": 0.0,
|
|
14220
|
+
"title": "Deadline",
|
|
14221
|
+
"description": "Permit deadline (unix seconds), as returned in the permit.message from /deposit.",
|
|
14222
|
+
"example": 1747097383
|
|
14223
|
+
},
|
|
14224
|
+
"signature": {
|
|
14225
|
+
"type": "string",
|
|
14226
|
+
"title": "Signature",
|
|
14227
|
+
"description": "The user's EIP-2612 permit signature (65-byte hex, 0x-prefixed or raw).",
|
|
14228
|
+
"example": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
|
14229
|
+
},
|
|
14230
|
+
"sender": {
|
|
14231
|
+
"type": "string",
|
|
14232
|
+
"title": "Sender",
|
|
14233
|
+
"description": "Sponsor wallet address that will broadcast the returned tx (used for `from` and nonce).",
|
|
14234
|
+
"example": "0x4A83b4413CF41C3244027e1590E35a0F48403F0c"
|
|
14235
|
+
}
|
|
14236
|
+
},
|
|
14237
|
+
"type": "object",
|
|
14238
|
+
"required": [
|
|
14239
|
+
"owner",
|
|
14240
|
+
"amount_raw",
|
|
14241
|
+
"deadline",
|
|
14242
|
+
"signature",
|
|
14243
|
+
"sender"
|
|
14244
|
+
],
|
|
14245
|
+
"title": "GlobalMarketsPerpsDepositSponsorPrepareRequest",
|
|
14246
|
+
"description": "Take a user's signed EIP-2612 USDC permit and build an Arbitrum tx\nthat calls Bridge2.batchedDepositWithPermit.\n\nThe customer broadcasts the returned tx from their own sponsor wallet \u2014\nCompass does not hold gas keys (non-custodial).",
|
|
14247
|
+
"example": {
|
|
14248
|
+
"owner": "0x01E62835dd7F52173546A325294762143eE4a882",
|
|
14249
|
+
"amount_raw": 100000000,
|
|
14250
|
+
"deadline": 1747097383,
|
|
14251
|
+
"signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
|
14252
|
+
"sender": "0x4A83b4413CF41C3244027e1590E35a0F48403F0c"
|
|
14253
|
+
}
|
|
14254
|
+
},
|
|
14255
|
+
"GlobalMarketsPerpsDepositSponsorPrepareResponse": {
|
|
14256
|
+
"properties": {
|
|
14257
|
+
"transaction": {
|
|
14258
|
+
"$ref": "#/components/schemas/UnsignedTransaction",
|
|
14259
|
+
"description": "Unsigned Arbitrum tx calling Bridge2.batchedDepositWithPermit. Sign and broadcast from `sender`."
|
|
14260
|
+
}
|
|
14261
|
+
},
|
|
14262
|
+
"type": "object",
|
|
14263
|
+
"required": [
|
|
14264
|
+
"transaction"
|
|
14265
|
+
],
|
|
14266
|
+
"title": "GlobalMarketsPerpsDepositSponsorPrepareResponse",
|
|
14267
|
+
"description": "Fully-encoded Arbitrum tx that completes a HL Bridge2 deposit.\n\nBroadcast `transaction` from the `sender` wallet supplied in the request.\nAfter the receipt confirms, verify a USDC `Transfer` event was emitted \u2014\nBridge2 can silently no-op without reverting."
|
|
14158
14268
|
},
|
|
14159
14269
|
"GlobalMarketsPerpsEnableUnifiedAccountRequest": {
|
|
14160
14270
|
"properties": {
|
package/package.json
CHANGED
|
@@ -33,8 +33,10 @@ import { Result } from "../types/fp.js";
|
|
|
33
33
|
* Prepare a USDC deposit from Arbitrum via EIP-2612 Permit.
|
|
34
34
|
*
|
|
35
35
|
* Returns EIP-712 typed data for the user to sign off-chain (no gas needed).
|
|
36
|
-
*
|
|
37
|
-
*
|
|
36
|
+
* Compass does NOT broadcast the bridge tx — the integrator's own sponsor
|
|
37
|
+
* wallet calls batchedDepositWithPermit on the HL Bridge2 contract on
|
|
38
|
+
* Arbitrum after the user signs. See api_docs/v2/Products/Global-Markets.mdx
|
|
39
|
+
* "Deposit USDC" section for the bridge-broadcast code.
|
|
38
40
|
*/
|
|
39
41
|
export function globalMarketsPerpsGlobalMarketsPerpsDeposit(
|
|
40
42
|
client: CompassApiSDKCore,
|
|
@@ -0,0 +1,181 @@
|
|
|
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 { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import * as components from "../models/components/index.js";
|
|
15
|
+
import { CompassAPISDKError } from "../models/errors/compassapisdkerror.js";
|
|
16
|
+
import {
|
|
17
|
+
ConnectionError,
|
|
18
|
+
InvalidRequestError,
|
|
19
|
+
RequestAbortedError,
|
|
20
|
+
RequestTimeoutError,
|
|
21
|
+
UnexpectedClientError,
|
|
22
|
+
} from "../models/errors/httpclienterrors.js";
|
|
23
|
+
import * as errors from "../models/errors/index.js";
|
|
24
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Build the Bridge2 deposit tx from a signed permit
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Build the Arbitrum tx that completes a USDC deposit to HL.
|
|
34
|
+
*
|
|
35
|
+
* Takes the EIP-2612 permit signature returned by /deposit and returns
|
|
36
|
+
* a fully-encoded `Bridge2.batchedDepositWithPermit` call. The integrator's
|
|
37
|
+
* sponsor wallet (`sender`) broadcasts the returned tx — Compass does not
|
|
38
|
+
* broadcast and does not hold gas keys.
|
|
39
|
+
*/
|
|
40
|
+
export function globalMarketsPerpsGlobalMarketsPerpsDepositSponsorPrepare(
|
|
41
|
+
client: CompassApiSDKCore,
|
|
42
|
+
request: components.GlobalMarketsPerpsDepositSponsorPrepareRequest,
|
|
43
|
+
options?: RequestOptions,
|
|
44
|
+
): APIPromise<
|
|
45
|
+
Result<
|
|
46
|
+
components.GlobalMarketsPerpsDepositSponsorPrepareResponse,
|
|
47
|
+
| errors.HTTPValidationError
|
|
48
|
+
| CompassAPISDKError
|
|
49
|
+
| ResponseValidationError
|
|
50
|
+
| ConnectionError
|
|
51
|
+
| RequestAbortedError
|
|
52
|
+
| RequestTimeoutError
|
|
53
|
+
| InvalidRequestError
|
|
54
|
+
| UnexpectedClientError
|
|
55
|
+
| SDKValidationError
|
|
56
|
+
>
|
|
57
|
+
> {
|
|
58
|
+
return new APIPromise($do(
|
|
59
|
+
client,
|
|
60
|
+
request,
|
|
61
|
+
options,
|
|
62
|
+
));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function $do(
|
|
66
|
+
client: CompassApiSDKCore,
|
|
67
|
+
request: components.GlobalMarketsPerpsDepositSponsorPrepareRequest,
|
|
68
|
+
options?: RequestOptions,
|
|
69
|
+
): Promise<
|
|
70
|
+
[
|
|
71
|
+
Result<
|
|
72
|
+
components.GlobalMarketsPerpsDepositSponsorPrepareResponse,
|
|
73
|
+
| errors.HTTPValidationError
|
|
74
|
+
| CompassAPISDKError
|
|
75
|
+
| ResponseValidationError
|
|
76
|
+
| ConnectionError
|
|
77
|
+
| RequestAbortedError
|
|
78
|
+
| RequestTimeoutError
|
|
79
|
+
| InvalidRequestError
|
|
80
|
+
| UnexpectedClientError
|
|
81
|
+
| SDKValidationError
|
|
82
|
+
>,
|
|
83
|
+
APICall,
|
|
84
|
+
]
|
|
85
|
+
> {
|
|
86
|
+
const parsed = safeParse(
|
|
87
|
+
request,
|
|
88
|
+
(value) =>
|
|
89
|
+
components.GlobalMarketsPerpsDepositSponsorPrepareRequest$outboundSchema
|
|
90
|
+
.parse(value),
|
|
91
|
+
"Input validation failed",
|
|
92
|
+
);
|
|
93
|
+
if (!parsed.ok) {
|
|
94
|
+
return [parsed, { status: "invalid" }];
|
|
95
|
+
}
|
|
96
|
+
const payload = parsed.value;
|
|
97
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
98
|
+
|
|
99
|
+
const path = pathToFunc("/v2/global_markets_perps/deposit/sponsor_prepare")();
|
|
100
|
+
|
|
101
|
+
const headers = new Headers(compactMap({
|
|
102
|
+
"Content-Type": "application/json",
|
|
103
|
+
Accept: "application/json",
|
|
104
|
+
}));
|
|
105
|
+
|
|
106
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
107
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
108
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
109
|
+
|
|
110
|
+
const context = {
|
|
111
|
+
options: client._options,
|
|
112
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
113
|
+
operationID: "v2_global_markets_perps_deposit_sponsor_prepare",
|
|
114
|
+
oAuth2Scopes: null,
|
|
115
|
+
|
|
116
|
+
resolvedSecurity: requestSecurity,
|
|
117
|
+
|
|
118
|
+
securitySource: client._options.apiKeyAuth,
|
|
119
|
+
retryConfig: options?.retries
|
|
120
|
+
|| client._options.retryConfig
|
|
121
|
+
|| { strategy: "none" },
|
|
122
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const requestRes = client._createRequest(context, {
|
|
126
|
+
security: requestSecurity,
|
|
127
|
+
method: "POST",
|
|
128
|
+
baseURL: options?.serverURL,
|
|
129
|
+
path: path,
|
|
130
|
+
headers: headers,
|
|
131
|
+
body: body,
|
|
132
|
+
userAgent: client._options.userAgent,
|
|
133
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
134
|
+
}, options);
|
|
135
|
+
if (!requestRes.ok) {
|
|
136
|
+
return [requestRes, { status: "invalid" }];
|
|
137
|
+
}
|
|
138
|
+
const req = requestRes.value;
|
|
139
|
+
|
|
140
|
+
const doResult = await client._do(req, {
|
|
141
|
+
context,
|
|
142
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
143
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
144
|
+
retryConfig: context.retryConfig,
|
|
145
|
+
retryCodes: context.retryCodes,
|
|
146
|
+
});
|
|
147
|
+
if (!doResult.ok) {
|
|
148
|
+
return [doResult, { status: "request-error", request: req }];
|
|
149
|
+
}
|
|
150
|
+
const response = doResult.value;
|
|
151
|
+
|
|
152
|
+
const responseFields = {
|
|
153
|
+
HttpMeta: { Response: response, Request: req },
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const [result] = await M.match<
|
|
157
|
+
components.GlobalMarketsPerpsDepositSponsorPrepareResponse,
|
|
158
|
+
| errors.HTTPValidationError
|
|
159
|
+
| CompassAPISDKError
|
|
160
|
+
| ResponseValidationError
|
|
161
|
+
| ConnectionError
|
|
162
|
+
| RequestAbortedError
|
|
163
|
+
| RequestTimeoutError
|
|
164
|
+
| InvalidRequestError
|
|
165
|
+
| UnexpectedClientError
|
|
166
|
+
| SDKValidationError
|
|
167
|
+
>(
|
|
168
|
+
M.json(
|
|
169
|
+
200,
|
|
170
|
+
components.GlobalMarketsPerpsDepositSponsorPrepareResponse$inboundSchema,
|
|
171
|
+
),
|
|
172
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
173
|
+
M.fail("4XX"),
|
|
174
|
+
M.fail("5XX"),
|
|
175
|
+
)(response, req, { extraFields: responseFields });
|
|
176
|
+
if (!result.ok) {
|
|
177
|
+
return [result, { status: "complete", request: req, response }];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return [result, { status: "complete", request: req, response }];
|
|
181
|
+
}
|
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.885.0",
|
|
66
66
|
userAgent:
|
|
67
|
-
"speakeasy-sdk/typescript 2.0.0 2.
|
|
67
|
+
"speakeasy-sdk/typescript 2.0.0 2.885.0 0.0.1 @compass-labs/api-sdk",
|
|
68
68
|
} as const;
|
|
@@ -13,12 +13,13 @@ import {
|
|
|
13
13
|
} from "./permittypeddataresponseoutput.js";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* EIP-2612 permit data
|
|
16
|
+
* EIP-2612 permit data the user signs to authorize a USDC bridge deposit.
|
|
17
17
|
*
|
|
18
18
|
* @remarks
|
|
19
19
|
*
|
|
20
|
-
* After
|
|
21
|
-
*
|
|
20
|
+
* After signing, submit the signature to /v2/global_markets_perps/deposit/sponsor_prepare
|
|
21
|
+
* to get a ready-to-broadcast Arbitrum tx that calls Bridge2.batchedDepositWithPermit.
|
|
22
|
+
* The integrator's sponsor wallet broadcasts that tx — Compass does not broadcast.
|
|
22
23
|
*/
|
|
23
24
|
export type GlobalMarketsPerpsDepositResponse = {
|
|
24
25
|
/**
|
|
@@ -26,11 +27,11 @@ export type GlobalMarketsPerpsDepositResponse = {
|
|
|
26
27
|
*/
|
|
27
28
|
permit: PermitTypedDataResponseOutput;
|
|
28
29
|
/**
|
|
29
|
-
* USDC amount in raw units
|
|
30
|
+
* USDC amount in raw 6-decimal units. Pass this and the signature to /deposit/sponsor_prepare.
|
|
30
31
|
*/
|
|
31
32
|
amountRaw: number;
|
|
32
33
|
/**
|
|
33
|
-
*
|
|
34
|
+
* Address that will be credited on Hyperliquid (equals the deposit owner EOA — HL keys accounts by EVM address).
|
|
34
35
|
*/
|
|
35
36
|
destination: string;
|
|
36
37
|
};
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
* Take a user's signed EIP-2612 USDC permit and build an Arbitrum tx
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* that calls Bridge2.batchedDepositWithPermit.
|
|
13
|
+
*
|
|
14
|
+
* The customer broadcasts the returned tx from their own sponsor wallet —
|
|
15
|
+
* Compass does not hold gas keys (non-custodial).
|
|
16
|
+
*/
|
|
17
|
+
export type GlobalMarketsPerpsDepositSponsorPrepareRequest = {
|
|
18
|
+
/**
|
|
19
|
+
* The user's EOA address on Arbitrum (the permit signer).
|
|
20
|
+
*/
|
|
21
|
+
owner: string;
|
|
22
|
+
/**
|
|
23
|
+
* USDC amount in raw 6-decimal units, as returned by /deposit.
|
|
24
|
+
*/
|
|
25
|
+
amountRaw: number;
|
|
26
|
+
/**
|
|
27
|
+
* Permit deadline (unix seconds), as returned in the permit.message from /deposit.
|
|
28
|
+
*/
|
|
29
|
+
deadline: number;
|
|
30
|
+
/**
|
|
31
|
+
* The user's EIP-2612 permit signature (65-byte hex, 0x-prefixed or raw).
|
|
32
|
+
*/
|
|
33
|
+
signature: string;
|
|
34
|
+
/**
|
|
35
|
+
* Sponsor wallet address that will broadcast the returned tx (used for `from` and nonce).
|
|
36
|
+
*/
|
|
37
|
+
sender: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
export type GlobalMarketsPerpsDepositSponsorPrepareRequest$Outbound = {
|
|
42
|
+
owner: string;
|
|
43
|
+
amount_raw: number;
|
|
44
|
+
deadline: number;
|
|
45
|
+
signature: string;
|
|
46
|
+
sender: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** @internal */
|
|
50
|
+
export const GlobalMarketsPerpsDepositSponsorPrepareRequest$outboundSchema:
|
|
51
|
+
z.ZodType<
|
|
52
|
+
GlobalMarketsPerpsDepositSponsorPrepareRequest$Outbound,
|
|
53
|
+
z.ZodTypeDef,
|
|
54
|
+
GlobalMarketsPerpsDepositSponsorPrepareRequest
|
|
55
|
+
> = z.object({
|
|
56
|
+
owner: z.string(),
|
|
57
|
+
amountRaw: z.number().int(),
|
|
58
|
+
deadline: z.number().int(),
|
|
59
|
+
signature: z.string(),
|
|
60
|
+
sender: z.string(),
|
|
61
|
+
}).transform((v) => {
|
|
62
|
+
return remap$(v, {
|
|
63
|
+
amountRaw: "amount_raw",
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export function globalMarketsPerpsDepositSponsorPrepareRequestToJSON(
|
|
68
|
+
globalMarketsPerpsDepositSponsorPrepareRequest:
|
|
69
|
+
GlobalMarketsPerpsDepositSponsorPrepareRequest,
|
|
70
|
+
): string {
|
|
71
|
+
return JSON.stringify(
|
|
72
|
+
GlobalMarketsPerpsDepositSponsorPrepareRequest$outboundSchema.parse(
|
|
73
|
+
globalMarketsPerpsDepositSponsorPrepareRequest,
|
|
74
|
+
),
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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 { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
UnsignedTransaction,
|
|
11
|
+
UnsignedTransaction$inboundSchema,
|
|
12
|
+
} from "./unsignedtransaction.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Fully-encoded Arbitrum tx that completes a HL Bridge2 deposit.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
*
|
|
19
|
+
* Broadcast `transaction` from the `sender` wallet supplied in the request.
|
|
20
|
+
* After the receipt confirms, verify a USDC `Transfer` event was emitted —
|
|
21
|
+
* Bridge2 can silently no-op without reverting.
|
|
22
|
+
*/
|
|
23
|
+
export type GlobalMarketsPerpsDepositSponsorPrepareResponse = {
|
|
24
|
+
transaction: UnsignedTransaction;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
export const GlobalMarketsPerpsDepositSponsorPrepareResponse$inboundSchema:
|
|
29
|
+
z.ZodType<
|
|
30
|
+
GlobalMarketsPerpsDepositSponsorPrepareResponse,
|
|
31
|
+
z.ZodTypeDef,
|
|
32
|
+
unknown
|
|
33
|
+
> = z.object({
|
|
34
|
+
transaction: UnsignedTransaction$inboundSchema,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export function globalMarketsPerpsDepositSponsorPrepareResponseFromJSON(
|
|
38
|
+
jsonString: string,
|
|
39
|
+
): SafeParseResult<
|
|
40
|
+
GlobalMarketsPerpsDepositSponsorPrepareResponse,
|
|
41
|
+
SDKValidationError
|
|
42
|
+
> {
|
|
43
|
+
return safeParse(
|
|
44
|
+
jsonString,
|
|
45
|
+
(x) =>
|
|
46
|
+
GlobalMarketsPerpsDepositSponsorPrepareResponse$inboundSchema.parse(
|
|
47
|
+
JSON.parse(x),
|
|
48
|
+
),
|
|
49
|
+
`Failed to parse 'GlobalMarketsPerpsDepositSponsorPrepareResponse' from JSON`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -154,6 +154,8 @@ export * from "./globalmarketsperpscandlesresponse.js";
|
|
|
154
154
|
export * from "./globalmarketsperpscategory.js";
|
|
155
155
|
export * from "./globalmarketsperpsdepositrequest.js";
|
|
156
156
|
export * from "./globalmarketsperpsdepositresponse.js";
|
|
157
|
+
export * from "./globalmarketsperpsdepositsponsorpreparerequest.js";
|
|
158
|
+
export * from "./globalmarketsperpsdepositsponsorprepareresponse.js";
|
|
157
159
|
export * from "./globalmarketsperpsenableunifiedaccountrequest.js";
|
|
158
160
|
export * from "./globalmarketsperpsenableunifiedaccountresponse.js";
|
|
159
161
|
export * from "./globalmarketsperpsensureleveragerequest.js";
|
|
@@ -7,6 +7,7 @@ import { globalMarketsPerpsGlobalMarketsPerpsApproveBuilderFee } from "../funcs/
|
|
|
7
7
|
import { globalMarketsPerpsGlobalMarketsPerpsCancelOrder } from "../funcs/globalMarketsPerpsGlobalMarketsPerpsCancelOrder.js";
|
|
8
8
|
import { globalMarketsPerpsGlobalMarketsPerpsCandles } from "../funcs/globalMarketsPerpsGlobalMarketsPerpsCandles.js";
|
|
9
9
|
import { globalMarketsPerpsGlobalMarketsPerpsDeposit } from "../funcs/globalMarketsPerpsGlobalMarketsPerpsDeposit.js";
|
|
10
|
+
import { globalMarketsPerpsGlobalMarketsPerpsDepositSponsorPrepare } from "../funcs/globalMarketsPerpsGlobalMarketsPerpsDepositSponsorPrepare.js";
|
|
10
11
|
import { globalMarketsPerpsGlobalMarketsPerpsEnableUnifiedAccount } from "../funcs/globalMarketsPerpsGlobalMarketsPerpsEnableUnifiedAccount.js";
|
|
11
12
|
import { globalMarketsPerpsGlobalMarketsPerpsEnsureLeverage } from "../funcs/globalMarketsPerpsGlobalMarketsPerpsEnsureLeverage.js";
|
|
12
13
|
import { globalMarketsPerpsGlobalMarketsPerpsExecute } from "../funcs/globalMarketsPerpsGlobalMarketsPerpsExecute.js";
|
|
@@ -121,8 +122,10 @@ export class GlobalMarketsPerps extends ClientSDK {
|
|
|
121
122
|
* Prepare a USDC deposit from Arbitrum via EIP-2612 Permit.
|
|
122
123
|
*
|
|
123
124
|
* Returns EIP-712 typed data for the user to sign off-chain (no gas needed).
|
|
124
|
-
*
|
|
125
|
-
*
|
|
125
|
+
* Compass does NOT broadcast the bridge tx — the integrator's own sponsor
|
|
126
|
+
* wallet calls batchedDepositWithPermit on the HL Bridge2 contract on
|
|
127
|
+
* Arbitrum after the user signs. See api_docs/v2/Products/Global-Markets.mdx
|
|
128
|
+
* "Deposit USDC" section for the bridge-broadcast code.
|
|
126
129
|
*/
|
|
127
130
|
async globalMarketsPerpsDeposit(
|
|
128
131
|
request: components.GlobalMarketsPerpsDepositRequest,
|
|
@@ -135,6 +138,30 @@ export class GlobalMarketsPerps extends ClientSDK {
|
|
|
135
138
|
));
|
|
136
139
|
}
|
|
137
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Build the Bridge2 deposit tx from a signed permit
|
|
143
|
+
*
|
|
144
|
+
* @remarks
|
|
145
|
+
* Build the Arbitrum tx that completes a USDC deposit to HL.
|
|
146
|
+
*
|
|
147
|
+
* Takes the EIP-2612 permit signature returned by /deposit and returns
|
|
148
|
+
* a fully-encoded `Bridge2.batchedDepositWithPermit` call. The integrator's
|
|
149
|
+
* sponsor wallet (`sender`) broadcasts the returned tx — Compass does not
|
|
150
|
+
* broadcast and does not hold gas keys.
|
|
151
|
+
*/
|
|
152
|
+
async globalMarketsPerpsDepositSponsorPrepare(
|
|
153
|
+
request: components.GlobalMarketsPerpsDepositSponsorPrepareRequest,
|
|
154
|
+
options?: RequestOptions,
|
|
155
|
+
): Promise<components.GlobalMarketsPerpsDepositSponsorPrepareResponse> {
|
|
156
|
+
return unwrapAsync(
|
|
157
|
+
globalMarketsPerpsGlobalMarketsPerpsDepositSponsorPrepare(
|
|
158
|
+
this,
|
|
159
|
+
request,
|
|
160
|
+
options,
|
|
161
|
+
),
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
138
165
|
/**
|
|
139
166
|
* Withdraw USDC from global markets perps account
|
|
140
167
|
*
|
package/src/types/async.ts
CHANGED
|
@@ -21,16 +21,17 @@ export type APICall =
|
|
|
21
21
|
|
|
22
22
|
export class APIPromise<T> implements Promise<T> {
|
|
23
23
|
readonly #promise: Promise<[T, APICall]>;
|
|
24
|
-
|
|
24
|
+
#unwrapped: Promise<T> | null;
|
|
25
25
|
|
|
26
26
|
readonly [Symbol.toStringTag] = "APIPromise";
|
|
27
27
|
|
|
28
28
|
constructor(p: [T, APICall] | Promise<[T, APICall]>) {
|
|
29
29
|
this.#promise = p instanceof Promise ? p : Promise.resolve(p);
|
|
30
|
-
this.#unwrapped =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
this.#unwrapped = p instanceof Promise ? null : Promise.resolve(p[0]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#getUnwrapped(): Promise<T> {
|
|
34
|
+
return (this.#unwrapped ??= this.#promise.then(([value]) => value));
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
then<TResult1 = T, TResult2 = never>(
|
|
@@ -55,11 +56,11 @@ export class APIPromise<T> implements Promise<T> {
|
|
|
55
56
|
| null
|
|
56
57
|
| undefined,
|
|
57
58
|
): Promise<T | TResult> {
|
|
58
|
-
return this.#
|
|
59
|
+
return this.#getUnwrapped().catch(onrejected);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
finally(onfinally?: (() => void) | null | undefined): Promise<T> {
|
|
62
|
-
return this.#
|
|
63
|
+
return this.#getUnwrapped().finally(onfinally);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
$inspect(): Promise<[T, APICall]> {
|