@compass-labs/api-sdk 2.2.13-rc.0 → 2.2.13-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.
package/README.md
CHANGED
|
@@ -577,19 +577,23 @@ The `HTTPClient` constructor takes an optional `fetcher` argument that can be
|
|
|
577
577
|
used to integrate a third-party HTTP client or when writing tests to mock out
|
|
578
578
|
the HTTP client and feed in fixtures.
|
|
579
579
|
|
|
580
|
-
The following example shows how to
|
|
581
|
-
|
|
582
|
-
to
|
|
580
|
+
The following example shows how to:
|
|
581
|
+
- route requests through a proxy server using [undici](https://www.npmjs.com/package/undici)'s ProxyAgent
|
|
582
|
+
- use the `"beforeRequest"` hook to add a custom header and a timeout to requests
|
|
583
|
+
- use the `"requestError"` hook to log errors
|
|
583
584
|
|
|
584
585
|
```typescript
|
|
585
586
|
import { CompassApiSDK } from "@compass-labs/api-sdk";
|
|
587
|
+
import { ProxyAgent } from "undici";
|
|
586
588
|
import { HTTPClient } from "@compass-labs/api-sdk/lib/http";
|
|
587
589
|
|
|
590
|
+
const dispatcher = new ProxyAgent("http://proxy.example.com:8080");
|
|
591
|
+
|
|
588
592
|
const httpClient = new HTTPClient({
|
|
589
|
-
// fetcher takes a function that has the same signature as native
|
|
590
|
-
fetcher: (
|
|
591
|
-
|
|
592
|
-
|
|
593
|
+
// 'fetcher' takes a function that has the same signature as native 'fetch'.
|
|
594
|
+
fetcher: (input, init) =>
|
|
595
|
+
// 'dispatcher' is specific to undici and not part of the standard Fetch API.
|
|
596
|
+
fetch(input, { ...init, dispatcher } as RequestInit),
|
|
593
597
|
});
|
|
594
598
|
|
|
595
599
|
httpClient.addHook("beforeRequest", (request) => {
|
|
@@ -122,7 +122,7 @@ actions:
|
|
|
122
122
|
"x-codeSamples":
|
|
123
123
|
- "lang": "typescript"
|
|
124
124
|
"label": "Typescript (SDK)"
|
|
125
|
-
"source": "import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.aerodromeSlipstream.aerodromeSlipstreamPoolPrice({\n chain: \"base\",\n tokenIn: \"USDC\",\n tokenOut: \"
|
|
125
|
+
"source": "import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.aerodromeSlipstream.aerodromeSlipstreamPoolPrice({\n chain: \"base\",\n tokenIn: \"USDC\",\n tokenOut: \"USDC\",\n tickSpacing: 100,\n });\n\n console.log(result);\n}\n\nrun();"
|
|
126
126
|
- target: $["paths"]["/v1/aerodrome_slipstream/swap/buy_exactly"]["post"]
|
|
127
127
|
update:
|
|
128
128
|
"x-codeSamples":
|
|
@@ -218,7 +218,7 @@ actions:
|
|
|
218
218
|
"x-codeSamples":
|
|
219
219
|
- "lang": "typescript"
|
|
220
220
|
"label": "Typescript (SDK)"
|
|
221
|
-
"source": "import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.morpho.morphoMarkets({\n chain: \"base\",\n collateralToken: \"USDC\",\n loanToken: \"
|
|
221
|
+
"source": "import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.morpho.morphoMarkets({\n chain: \"base\",\n collateralToken: \"USDC\",\n loanToken: \"USDC\",\n });\n\n console.log(result);\n}\n\nrun();"
|
|
222
222
|
- target: $["paths"]["/v1/morpho/repay"]["post"]
|
|
223
223
|
update:
|
|
224
224
|
"x-codeSamples":
|
|
@@ -338,7 +338,7 @@ actions:
|
|
|
338
338
|
"x-codeSamples":
|
|
339
339
|
- "lang": "typescript"
|
|
340
340
|
"label": "Typescript (SDK)"
|
|
341
|
-
"source": "import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.smartAccount.smartAccountBatchedUserOperations({\n chain: \"arbitrum\",\n sender: \"
|
|
341
|
+
"source": "import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.smartAccount.smartAccountBatchedUserOperations({\n chain: \"arbitrum\",\n sender: \"0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B\",\n estimateGas: true,\n operations: [\n {\n body: {\n actionType: \"SET_ALLOWANCE\",\n token: \"USDC\",\n contract: \"UniswapV3Router\",\n amount: \"1000\",\n },\n },\n ],\n });\n\n console.log(result);\n}\n\nrun();"
|
|
342
342
|
- target: $["paths"]["/v1/swap/odos"]["post"]
|
|
343
343
|
update:
|
|
344
344
|
"x-codeSamples":
|
|
@@ -362,7 +362,7 @@ actions:
|
|
|
362
362
|
"x-codeSamples":
|
|
363
363
|
- "lang": "typescript"
|
|
364
364
|
"label": "Typescript (SDK)"
|
|
365
|
-
"source": "import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.token.tokenPrice({\n chain: \"ethereum\",\n token: \"
|
|
365
|
+
"source": "import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.token.tokenPrice({\n chain: \"ethereum\",\n token: \"USDC\",\n });\n\n console.log(result);\n}\n\nrun();"
|
|
366
366
|
- target: $["paths"]["/v1/token/transfer"]["post"]
|
|
367
367
|
update:
|
|
368
368
|
"x-codeSamples":
|
|
@@ -434,19 +434,19 @@ actions:
|
|
|
434
434
|
"x-codeSamples":
|
|
435
435
|
- "lang": "typescript"
|
|
436
436
|
"label": "Typescript (SDK)"
|
|
437
|
-
"source": "import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.uniswapV3.uniswapPoolPrice({\n chain: \"arbitrum\",\n tokenIn: \"USDC\",\n tokenOut: \"
|
|
437
|
+
"source": "import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.uniswapV3.uniswapPoolPrice({\n chain: \"arbitrum\",\n tokenIn: \"USDC\",\n tokenOut: \"USDC\",\n fee: \"0.01\",\n });\n\n console.log(result);\n}\n\nrun();"
|
|
438
438
|
- target: $["paths"]["/v1/uniswap/quote/buy_exactly"]["get"]
|
|
439
439
|
update:
|
|
440
440
|
"x-codeSamples":
|
|
441
441
|
- "lang": "typescript"
|
|
442
442
|
"label": "Typescript (SDK)"
|
|
443
|
-
"source": "import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.uniswapV3.uniswapQuoteBuyExactly({\n chain: \"arbitrum\",\n tokenIn: \"USDC\",\n tokenOut: \"
|
|
443
|
+
"source": "import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.uniswapV3.uniswapQuoteBuyExactly({\n chain: \"arbitrum\",\n tokenIn: \"USDC\",\n tokenOut: \"USDC\",\n fee: \"0.01\",\n amountOut: 1,\n });\n\n console.log(result);\n}\n\nrun();"
|
|
444
444
|
- target: $["paths"]["/v1/uniswap/quote/sell_exactly"]["get"]
|
|
445
445
|
update:
|
|
446
446
|
"x-codeSamples":
|
|
447
447
|
- "lang": "typescript"
|
|
448
448
|
"label": "Typescript (SDK)"
|
|
449
|
-
"source": "import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.uniswapV3.uniswapQuoteSellExactly({\n chain: \"arbitrum\",\n tokenIn: \"USDC\",\n tokenOut: \"
|
|
449
|
+
"source": "import { CompassApiSDK } from \"@compass-labs/api-sdk\";\n\nconst compassApiSDK = new CompassApiSDK({\n apiKeyAuth: \"<YOUR_API_KEY_HERE>\",\n});\n\nasync function run() {\n const result = await compassApiSDK.uniswapV3.uniswapQuoteSellExactly({\n chain: \"arbitrum\",\n tokenIn: \"USDC\",\n tokenOut: \"USDC\",\n fee: \"0.01\",\n amountIn: 1,\n });\n\n console.log(result);\n}\n\nrun();"
|
|
450
450
|
- target: $["paths"]["/v1/uniswap/swap/buy_exactly"]["post"]
|
|
451
451
|
update:
|
|
452
452
|
"x-codeSamples":
|
|
@@ -32,7 +32,7 @@ export declare const SDK_METADATA: {
|
|
|
32
32
|
readonly language: "typescript";
|
|
33
33
|
readonly openapiDocVersion: "0.0.1";
|
|
34
34
|
readonly sdkVersion: "2.0.0";
|
|
35
|
-
readonly genVersion: "2.
|
|
36
|
-
readonly userAgent: "speakeasy-sdk/typescript 2.0.0 2.
|
|
35
|
+
readonly genVersion: "2.821.4";
|
|
36
|
+
readonly userAgent: "speakeasy-sdk/typescript 2.0.0 2.821.4 0.0.1 @compass-labs/api-sdk";
|
|
37
37
|
};
|
|
38
38
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -32,7 +32,7 @@ exports.SDK_METADATA = {
|
|
|
32
32
|
language: "typescript",
|
|
33
33
|
openapiDocVersion: "0.0.1",
|
|
34
34
|
sdkVersion: "2.0.0",
|
|
35
|
-
genVersion: "2.
|
|
36
|
-
userAgent: "speakeasy-sdk/typescript 2.0.0 2.
|
|
35
|
+
genVersion: "2.821.4",
|
|
36
|
+
userAgent: "speakeasy-sdk/typescript 2.0.0 2.821.4 0.0.1 @compass-labs/api-sdk",
|
|
37
37
|
};
|
|
38
38
|
//# sourceMappingURL=config.js.map
|
package/dist/esm/lib/config.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare const SDK_METADATA: {
|
|
|
32
32
|
readonly language: "typescript";
|
|
33
33
|
readonly openapiDocVersion: "0.0.1";
|
|
34
34
|
readonly sdkVersion: "2.0.0";
|
|
35
|
-
readonly genVersion: "2.
|
|
36
|
-
readonly userAgent: "speakeasy-sdk/typescript 2.0.0 2.
|
|
35
|
+
readonly genVersion: "2.821.4";
|
|
36
|
+
readonly userAgent: "speakeasy-sdk/typescript 2.0.0 2.821.4 0.0.1 @compass-labs/api-sdk";
|
|
37
37
|
};
|
|
38
38
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/esm/lib/config.js
CHANGED
|
@@ -28,7 +28,7 @@ export const SDK_METADATA = {
|
|
|
28
28
|
language: "typescript",
|
|
29
29
|
openapiDocVersion: "0.0.1",
|
|
30
30
|
sdkVersion: "2.0.0",
|
|
31
|
-
genVersion: "2.
|
|
32
|
-
userAgent: "speakeasy-sdk/typescript 2.0.0 2.
|
|
31
|
+
genVersion: "2.821.4",
|
|
32
|
+
userAgent: "speakeasy-sdk/typescript 2.0.0 2.821.4 0.0.1 @compass-labs/api-sdk",
|
|
33
33
|
};
|
|
34
34
|
//# sourceMappingURL=config.js.map
|
package/package.json
CHANGED
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.821.4",
|
|
66
66
|
userAgent:
|
|
67
|
-
"speakeasy-sdk/typescript 2.0.0 2.
|
|
67
|
+
"speakeasy-sdk/typescript 2.0.0 2.821.4 0.0.1 @compass-labs/api-sdk",
|
|
68
68
|
} as const;
|