@compass-labs/api-sdk 2.2.32 → 2.2.33-rc.1
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 +3 -1
- package/codeSamples_typescript.yaml +6 -0
- package/dist/commonjs/funcs/creditCreditBalances.d.ts +22 -0
- package/dist/commonjs/funcs/creditCreditBalances.d.ts.map +1 -0
- package/dist/commonjs/funcs/creditCreditBalances.js +126 -0
- package/dist/commonjs/funcs/creditCreditBalances.js.map +1 -0
- package/dist/commonjs/models/components/{compassapibackendv2modelsearnreadresponsebalancestokenbalance.d.ts → compassapibackendv2modelsbalancestokenbalance.d.ts} +4 -4
- package/dist/commonjs/models/components/compassapibackendv2modelsbalancestokenbalance.d.ts.map +1 -0
- package/dist/commonjs/models/components/{compassapibackendv2modelsearnreadresponsebalancestokenbalance.js → compassapibackendv2modelsbalancestokenbalance.js} +6 -7
- package/dist/commonjs/models/components/compassapibackendv2modelsbalancestokenbalance.js.map +1 -0
- package/dist/commonjs/models/components/creditbalancesresponse.d.ts +27 -0
- package/dist/commonjs/models/components/creditbalancesresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/creditbalancesresponse.js +59 -0
- package/dist/commonjs/models/components/creditbalancesresponse.js.map +1 -0
- package/dist/commonjs/models/components/earnbalancesresponse.d.ts +2 -2
- package/dist/commonjs/models/components/earnbalancesresponse.d.ts.map +1 -1
- package/dist/commonjs/models/components/earnbalancesresponse.js +2 -2
- package/dist/commonjs/models/components/earnbalancesresponse.js.map +1 -1
- package/dist/commonjs/models/components/index.d.ts +2 -1
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +2 -1
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/tokentransfer.d.ts +3 -3
- package/dist/commonjs/models/components/tokentransfer.js +1 -1
- 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/v2creditbalances.d.ts +26 -0
- package/dist/commonjs/models/operations/v2creditbalances.d.ts.map +1 -0
- package/dist/commonjs/models/operations/v2creditbalances.js +57 -0
- package/dist/commonjs/models/operations/v2creditbalances.js.map +1 -0
- package/dist/commonjs/sdk/credit.d.ts +10 -0
- package/dist/commonjs/sdk/credit.d.ts.map +1 -1
- package/dist/commonjs/sdk/credit.js +13 -0
- package/dist/commonjs/sdk/credit.js.map +1 -1
- package/dist/esm/funcs/creditCreditBalances.d.ts +22 -0
- package/dist/esm/funcs/creditCreditBalances.d.ts.map +1 -0
- package/dist/esm/funcs/creditCreditBalances.js +90 -0
- package/dist/esm/funcs/creditCreditBalances.js.map +1 -0
- package/dist/esm/models/components/{compassapibackendv2modelsearnreadresponsebalancestokenbalance.d.ts → compassapibackendv2modelsbalancestokenbalance.d.ts} +4 -4
- package/dist/esm/models/components/compassapibackendv2modelsbalancestokenbalance.d.ts.map +1 -0
- package/dist/esm/models/components/{compassapibackendv2modelsearnreadresponsebalancestokenbalance.js → compassapibackendv2modelsbalancestokenbalance.js} +4 -5
- package/dist/esm/models/components/compassapibackendv2modelsbalancestokenbalance.js.map +1 -0
- package/dist/esm/models/components/creditbalancesresponse.d.ts +27 -0
- package/dist/esm/models/components/creditbalancesresponse.d.ts.map +1 -0
- package/dist/esm/models/components/creditbalancesresponse.js +22 -0
- package/dist/esm/models/components/creditbalancesresponse.js.map +1 -0
- package/dist/esm/models/components/earnbalancesresponse.d.ts +2 -2
- package/dist/esm/models/components/earnbalancesresponse.d.ts.map +1 -1
- package/dist/esm/models/components/earnbalancesresponse.js +2 -2
- package/dist/esm/models/components/earnbalancesresponse.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +2 -1
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +2 -1
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/tokentransfer.d.ts +3 -3
- package/dist/esm/models/components/tokentransfer.js +1 -1
- 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/v2creditbalances.d.ts +26 -0
- package/dist/esm/models/operations/v2creditbalances.d.ts.map +1 -0
- package/dist/esm/models/operations/v2creditbalances.js +20 -0
- package/dist/esm/models/operations/v2creditbalances.js.map +1 -0
- package/dist/esm/sdk/credit.d.ts +10 -0
- package/dist/esm/sdk/credit.d.ts.map +1 -1
- package/dist/esm/sdk/credit.js +13 -0
- package/dist/esm/sdk/credit.js.map +1 -1
- package/docs/models/components/{compassapibackendv2modelsearnreadresponsebalancestokenbalance.md → compassapibackendv2modelsbalancestokenbalance.md} +4 -4
- package/docs/models/components/creditbalancesresponse.md +21 -0
- package/docs/models/components/direction.md +1 -1
- package/docs/models/components/earnbalancesresponse.md +5 -5
- package/docs/models/components/tokentransfer.md +1 -1
- package/docs/models/operations/v2creditbalanceschain.md +15 -0
- package/docs/models/operations/v2creditbalancesrequest.md +19 -0
- package/docs/sdks/credit/README.md +80 -0
- package/package.json +1 -1
- package/src/funcs/creditCreditBalances.ts +178 -0
- package/src/models/components/{compassapibackendv2modelsearnreadresponsebalancestokenbalance.ts → compassapibackendv2modelsbalancestokenbalance.ts} +9 -8
- package/src/models/components/creditbalancesresponse.ts +61 -0
- package/src/models/components/earnbalancesresponse.ts +7 -7
- package/src/models/components/index.ts +2 -1
- package/src/models/components/tokentransfer.ts +3 -3
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/v2creditbalances.ts +50 -0
- package/src/sdk/credit.ts +21 -0
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsebalancestokenbalance.d.ts.map +0 -1
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsebalancestokenbalance.js.map +0 -1
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsebalancestokenbalance.d.ts.map +0 -1
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsebalancestokenbalance.js.map +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as z from "zod/v3";
|
|
2
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
3
|
+
export declare const V2CreditBalancesChain: {
|
|
4
|
+
readonly Arbitrum: "arbitrum";
|
|
5
|
+
readonly Base: "base";
|
|
6
|
+
readonly Ethereum: "ethereum";
|
|
7
|
+
};
|
|
8
|
+
export type V2CreditBalancesChain = ClosedEnum<typeof V2CreditBalancesChain>;
|
|
9
|
+
export type V2CreditBalancesRequest = {
|
|
10
|
+
chain: V2CreditBalancesChain;
|
|
11
|
+
/**
|
|
12
|
+
* The address of the owner of the credit account.
|
|
13
|
+
*/
|
|
14
|
+
owner: string;
|
|
15
|
+
};
|
|
16
|
+
/** @internal */
|
|
17
|
+
export declare const V2CreditBalancesChain$outboundSchema: z.ZodNativeEnum<typeof V2CreditBalancesChain>;
|
|
18
|
+
/** @internal */
|
|
19
|
+
export type V2CreditBalancesRequest$Outbound = {
|
|
20
|
+
chain: string;
|
|
21
|
+
owner: string;
|
|
22
|
+
};
|
|
23
|
+
/** @internal */
|
|
24
|
+
export declare const V2CreditBalancesRequest$outboundSchema: z.ZodType<V2CreditBalancesRequest$Outbound, z.ZodTypeDef, V2CreditBalancesRequest>;
|
|
25
|
+
export declare function v2CreditBalancesRequestToJSON(v2CreditBalancesRequest: V2CreditBalancesRequest): string;
|
|
26
|
+
//# sourceMappingURL=v2creditbalances.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2creditbalances.d.ts","sourceRoot":"","sources":["../../../../src/models/operations/v2creditbalances.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,eAAO,MAAM,qBAAqB;;;;CAIxB,CAAC;AACX,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE7E,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,qBAAqB,CAAC;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,oCAAoC,EAAE,CAAC,CAAC,aAAa,CAChE,OAAO,qBAAqB,CACS,CAAC;AAExC,gBAAgB;AAChB,MAAM,MAAM,gCAAgC,GAAG;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,sCAAsC,EAAE,CAAC,CAAC,OAAO,CAC5D,gCAAgC,EAChC,CAAC,CAAC,UAAU,EACZ,uBAAuB,CAIvB,CAAC;AAEH,wBAAgB,6BAA6B,CAC3C,uBAAuB,EAAE,uBAAuB,GAC/C,MAAM,CAIR"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v3";
|
|
5
|
+
export const V2CreditBalancesChain = {
|
|
6
|
+
Arbitrum: "arbitrum",
|
|
7
|
+
Base: "base",
|
|
8
|
+
Ethereum: "ethereum",
|
|
9
|
+
};
|
|
10
|
+
/** @internal */
|
|
11
|
+
export const V2CreditBalancesChain$outboundSchema = z.nativeEnum(V2CreditBalancesChain);
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const V2CreditBalancesRequest$outboundSchema = z.object({
|
|
14
|
+
chain: V2CreditBalancesChain$outboundSchema,
|
|
15
|
+
owner: z.string(),
|
|
16
|
+
});
|
|
17
|
+
export function v2CreditBalancesRequestToJSON(v2CreditBalancesRequest) {
|
|
18
|
+
return JSON.stringify(V2CreditBalancesRequest$outboundSchema.parse(v2CreditBalancesRequest));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=v2creditbalances.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2creditbalances.js","sourceRoot":"","sources":["../../../../src/models/operations/v2creditbalances.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;CACZ,CAAC;AAWX,gBAAgB;AAChB,MAAM,CAAC,MAAM,oCAAoC,GAE7C,CAAC,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;AAQxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,sCAAsC,GAI/C,CAAC,CAAC,MAAM,CAAC;IACX,KAAK,EAAE,oCAAoC;IAC3C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC;AAEH,MAAM,UAAU,6BAA6B,CAC3C,uBAAgD;IAEhD,OAAO,IAAI,CAAC,SAAS,CACnB,sCAAsC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CACtE,CAAC;AACJ,CAAC"}
|
package/dist/esm/sdk/credit.d.ts
CHANGED
|
@@ -12,6 +12,16 @@ export declare class Credit extends ClientSDK {
|
|
|
12
12
|
* with health factor and LTV. Each position includes event history.
|
|
13
13
|
*/
|
|
14
14
|
creditPositions(request: operations.V2CreditPositionsRequest, options?: RequestOptions): Promise<components.CreditPositionsResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Get credit account token balances
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Get token balances and transfer history for a credit account.
|
|
20
|
+
*
|
|
21
|
+
* Returns all token balances held by the credit account derived from the owner address,
|
|
22
|
+
* along with complete transfer history and USD valuations.
|
|
23
|
+
*/
|
|
24
|
+
creditBalances(request: operations.V2CreditBalancesRequest, options?: RequestOptions): Promise<components.CreditBalancesResponse>;
|
|
15
25
|
/**
|
|
16
26
|
* Create credit account
|
|
17
27
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credit.d.ts","sourceRoot":"","sources":["../../../src/sdk/credit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"credit.d.ts","sourceRoot":"","sources":["../../../src/sdk/credit.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAG5D,qBAAa,MAAO,SAAQ,SAAS;IACnC;;;;;;;;OAQG;IACG,eAAe,CACnB,OAAO,EAAE,UAAU,CAAC,wBAAwB,EAC5C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,uBAAuB,CAAC;IAQ9C;;;;;;;;OAQG;IACG,cAAc,CAClB,OAAO,EAAE,UAAU,CAAC,uBAAuB,EAC3C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,sBAAsB,CAAC;IAQ7C;;;;;;;;;;;;;OAaG;IACG,mBAAmB,CACvB,OAAO,EAAE,UAAU,CAAC,0BAA0B,EAC9C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,2BAA2B,CAAC;IAQlD;;;;;;;;;;;;OAYG;IACG,YAAY,CAChB,OAAO,EAAE,UAAU,CAAC,mBAAmB,EACvC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAAC;IAQ3C;;;;;;;;;;;;;;;OAeG;IACG,cAAc,CAClB,OAAO,EAAE,UAAU,CAAC,qBAAqB,EACzC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,sBAAsB,CAAC;IAQ7C;;;;;;;;;;;;;OAaG;IACG,WAAW,CACf,OAAO,EAAE,UAAU,CAAC,kBAAkB,EACtC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC;IAQ1C;;;;;;;;OAQG;IACG,YAAY,CAChB,OAAO,EAAE,UAAU,CAAC,mBAAmB,EACvC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAAC;CAO5C"}
|
package/dist/esm/sdk/credit.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
|
+
import { creditCreditBalances } from "../funcs/creditCreditBalances.js";
|
|
4
5
|
import { creditCreditBorrow } from "../funcs/creditCreditBorrow.js";
|
|
5
6
|
import { creditCreditBundle } from "../funcs/creditCreditBundle.js";
|
|
6
7
|
import { creditCreditCreateAccount } from "../funcs/creditCreditCreateAccount.js";
|
|
@@ -22,6 +23,18 @@ export class Credit extends ClientSDK {
|
|
|
22
23
|
async creditPositions(request, options) {
|
|
23
24
|
return unwrapAsync(creditCreditPositions(this, request, options));
|
|
24
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Get credit account token balances
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Get token balances and transfer history for a credit account.
|
|
31
|
+
*
|
|
32
|
+
* Returns all token balances held by the credit account derived from the owner address,
|
|
33
|
+
* along with complete transfer history and USD valuations.
|
|
34
|
+
*/
|
|
35
|
+
async creditBalances(request, options) {
|
|
36
|
+
return unwrapAsync(creditCreditBalances(this, request, options));
|
|
37
|
+
}
|
|
25
38
|
/**
|
|
26
39
|
* Create credit account
|
|
27
40
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credit.js","sourceRoot":"","sources":["../../../src/sdk/credit.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAAO,MAAO,SAAQ,SAAS;IACnC;;;;;;;;OAQG;IACH,KAAK,CAAC,eAAe,CACnB,OAA4C,EAC5C,OAAwB;QAExB,OAAO,WAAW,CAAC,qBAAqB,CACtC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,mBAAmB,CACvB,OAA8C,EAC9C,OAAwB;QAExB,OAAO,WAAW,CAAC,yBAAyB,CAC1C,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,YAAY,CAChB,OAAuC,EACvC,OAAwB;QAExB,OAAO,WAAW,CAAC,kBAAkB,CACnC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,cAAc,CAClB,OAAyC,EACzC,OAAwB;QAExB,OAAO,WAAW,CAAC,oBAAoB,CACrC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,WAAW,CACf,OAAsC,EACtC,OAAwB;QAExB,OAAO,WAAW,CAAC,iBAAiB,CAClC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,YAAY,CAChB,OAAuC,EACvC,OAAwB;QAExB,OAAO,WAAW,CAAC,kBAAkB,CACnC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"credit.js","sourceRoot":"","sources":["../../../src/sdk/credit.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAAO,MAAO,SAAQ,SAAS;IACnC;;;;;;;;OAQG;IACH,KAAK,CAAC,eAAe,CACnB,OAA4C,EAC5C,OAAwB;QAExB,OAAO,WAAW,CAAC,qBAAqB,CACtC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,cAAc,CAClB,OAA2C,EAC3C,OAAwB;QAExB,OAAO,WAAW,CAAC,oBAAoB,CACrC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,mBAAmB,CACvB,OAA8C,EAC9C,OAAwB;QAExB,OAAO,WAAW,CAAC,yBAAyB,CAC1C,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,YAAY,CAChB,OAAuC,EACvC,OAAwB;QAExB,OAAO,WAAW,CAAC,kBAAkB,CACnC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,cAAc,CAClB,OAAyC,EACzC,OAAwB;QAExB,OAAO,WAAW,CAAC,oBAAoB,CACrC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,WAAW,CACf,OAAsC,EACtC,OAAwB;QAExB,OAAO,WAAW,CAAC,iBAAiB,CAClC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,YAAY,CAChB,OAAuC,EACvC,OAAwB;QAExB,OAAO,WAAW,CAAC,kBAAkB,CACnC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CompassApiBackendV2ModelsBalancesTokenBalance
|
|
2
2
|
|
|
3
3
|
Balance and transfer history for a single token.
|
|
4
4
|
|
|
5
5
|
## Example Usage
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
|
-
import {
|
|
8
|
+
import { CompassApiBackendV2ModelsBalancesTokenBalance } from "@compass-labs/api-sdk/models/components";
|
|
9
9
|
|
|
10
|
-
let value:
|
|
10
|
+
let value: CompassApiBackendV2ModelsBalancesTokenBalance = {
|
|
11
11
|
tokenAddress: "<value>",
|
|
12
12
|
tokenSymbol: "<value>",
|
|
13
|
-
tokenDecimals:
|
|
13
|
+
tokenDecimals: 624919,
|
|
14
14
|
balance: "<value>",
|
|
15
15
|
balanceFormatted: "<value>",
|
|
16
16
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# CreditBalancesResponse
|
|
2
|
+
|
|
3
|
+
Response containing credit account balances and transfer history.
|
|
4
|
+
|
|
5
|
+
## Example Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { CreditBalancesResponse } from "@compass-labs/api-sdk/models/components";
|
|
9
|
+
|
|
10
|
+
let value: CreditBalancesResponse = {
|
|
11
|
+
creditAccountAddress: "<value>",
|
|
12
|
+
};
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Fields
|
|
16
|
+
|
|
17
|
+
| Field | Type | Required | Description |
|
|
18
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
19
|
+
| `creditAccountAddress` | *string* | :heavy_check_mark: | The derived credit account address. |
|
|
20
|
+
| `balances` | Record<string, [components.CompassApiBackendV2ModelsBalancesTokenBalance](../../models/components/compassapibackendv2modelsbalancestokenbalance.md)> | :heavy_minus_sign: | Token balances keyed by token symbol. |
|
|
21
|
+
| `totalUsdValue` | *string* | :heavy_minus_sign: | Total USD value of all balances (sum of available values). |
|
|
@@ -14,8 +14,8 @@ let value: EarnBalancesResponse = {
|
|
|
14
14
|
|
|
15
15
|
## Fields
|
|
16
16
|
|
|
17
|
-
| Field
|
|
18
|
-
|
|
|
19
|
-
| `earnAccountAddress`
|
|
20
|
-
| `balances`
|
|
21
|
-
| `totalUsdValue`
|
|
17
|
+
| Field | Type | Required | Description |
|
|
18
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
19
|
+
| `earnAccountAddress` | *string* | :heavy_check_mark: | The derived earn account address. |
|
|
20
|
+
| `balances` | Record<string, [components.CompassApiBackendV2ModelsBalancesTokenBalance](../../models/components/compassapibackendv2modelsbalancestokenbalance.md)> | :heavy_minus_sign: | Token balances keyed by token symbol. |
|
|
21
|
+
| `totalUsdValue` | *string* | :heavy_minus_sign: | Total USD value of all balances (sum of available values). |
|
|
@@ -30,4 +30,4 @@ let value: TokenTransfer = {
|
|
|
30
30
|
| `blockNumber` | *number* | :heavy_check_mark: | The block number of the transfer. |
|
|
31
31
|
| `blockTimestamp` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | The timestamp of the transfer. |
|
|
32
32
|
| `transactionHash` | *string* | :heavy_check_mark: | The transaction hash of the transfer. |
|
|
33
|
-
| `direction` | [components.Direction](../../models/components/direction.md) | :heavy_check_mark: | Direction relative to the
|
|
33
|
+
| `direction` | [components.Direction](../../models/components/direction.md) | :heavy_check_mark: | Direction relative to the product account: 'in' for received, 'out' for sent. |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# V2CreditBalancesChain
|
|
2
|
+
|
|
3
|
+
## Example Usage
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import { V2CreditBalancesChain } from "@compass-labs/api-sdk/models/operations";
|
|
7
|
+
|
|
8
|
+
let value: V2CreditBalancesChain = "base";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Values
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
"arbitrum" | "base" | "ethereum"
|
|
15
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# V2CreditBalancesRequest
|
|
2
|
+
|
|
3
|
+
## Example Usage
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import { V2CreditBalancesRequest } from "@compass-labs/api-sdk/models/operations";
|
|
7
|
+
|
|
8
|
+
let value: V2CreditBalancesRequest = {
|
|
9
|
+
chain: "base",
|
|
10
|
+
owner: "0x01E62835dd7F52173546A325294762143eE4a882",
|
|
11
|
+
};
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Fields
|
|
15
|
+
|
|
16
|
+
| Field | Type | Required | Description | Example |
|
|
17
|
+
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
|
|
18
|
+
| `chain` | [operations.V2CreditBalancesChain](../../models/operations/v2creditbalanceschain.md) | :heavy_check_mark: | N/A | base |
|
|
19
|
+
| `owner` | *string* | :heavy_check_mark: | The address of the owner of the credit account. | 0x01E62835dd7F52173546A325294762143eE4a882 |
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
### Available Operations
|
|
6
6
|
|
|
7
7
|
* [creditPositions](#creditpositions) - List credit positions
|
|
8
|
+
* [creditBalances](#creditbalances) - Get credit account token balances
|
|
8
9
|
* [creditCreateAccount](#creditcreateaccount) - Create credit account
|
|
9
10
|
* [creditBorrow](#creditborrow) - Borrow against collateral
|
|
10
11
|
* [creditTransfer](#credittransfer) - Transfer tokens to/from Credit Account
|
|
@@ -90,6 +91,85 @@ run();
|
|
|
90
91
|
| errors.HTTPValidationError | 422 | application/json |
|
|
91
92
|
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
92
93
|
|
|
94
|
+
## creditBalances
|
|
95
|
+
|
|
96
|
+
Get token balances and transfer history for a credit account.
|
|
97
|
+
|
|
98
|
+
Returns all token balances held by the credit account derived from the owner address,
|
|
99
|
+
along with complete transfer history and USD valuations.
|
|
100
|
+
|
|
101
|
+
### Example Usage
|
|
102
|
+
|
|
103
|
+
<!-- UsageSnippet language="typescript" operationID="v2_credit_balances" method="get" path="/v2/credit/balances" -->
|
|
104
|
+
```typescript
|
|
105
|
+
import { CompassApiSDK } from "@compass-labs/api-sdk";
|
|
106
|
+
|
|
107
|
+
const compassApiSDK = new CompassApiSDK({
|
|
108
|
+
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
async function run() {
|
|
112
|
+
const result = await compassApiSDK.credit.creditBalances({
|
|
113
|
+
chain: "base",
|
|
114
|
+
owner: "0x01E62835dd7F52173546A325294762143eE4a882",
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
console.log(result);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
run();
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Standalone function
|
|
124
|
+
|
|
125
|
+
The standalone function version of this method:
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
|
|
129
|
+
import { creditCreditBalances } from "@compass-labs/api-sdk/funcs/creditCreditBalances.js";
|
|
130
|
+
|
|
131
|
+
// Use `CompassApiSDKCore` for best tree-shaking performance.
|
|
132
|
+
// You can create one instance of it to use across an application.
|
|
133
|
+
const compassApiSDK = new CompassApiSDKCore({
|
|
134
|
+
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
async function run() {
|
|
138
|
+
const res = await creditCreditBalances(compassApiSDK, {
|
|
139
|
+
chain: "base",
|
|
140
|
+
owner: "0x01E62835dd7F52173546A325294762143eE4a882",
|
|
141
|
+
});
|
|
142
|
+
if (res.ok) {
|
|
143
|
+
const { value: result } = res;
|
|
144
|
+
console.log(result);
|
|
145
|
+
} else {
|
|
146
|
+
console.log("creditCreditBalances failed:", res.error);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
run();
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Parameters
|
|
154
|
+
|
|
155
|
+
| Parameter | Type | Required | Description |
|
|
156
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
157
|
+
| `request` | [operations.V2CreditBalancesRequest](../../models/operations/v2creditbalancesrequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
158
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
159
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
160
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
161
|
+
|
|
162
|
+
### Response
|
|
163
|
+
|
|
164
|
+
**Promise\<[components.CreditBalancesResponse](../../models/components/creditbalancesresponse.md)\>**
|
|
165
|
+
|
|
166
|
+
### Errors
|
|
167
|
+
|
|
168
|
+
| Error Type | Status Code | Content Type |
|
|
169
|
+
| -------------------------- | -------------------------- | -------------------------- |
|
|
170
|
+
| errors.HTTPValidationError | 422 | application/json |
|
|
171
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
172
|
+
|
|
93
173
|
## creditCreateAccount
|
|
94
174
|
|
|
95
175
|
Create a Credit Account for a wallet address.
|
package/package.json
CHANGED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CompassApiSDKCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery } 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
|
+
* Get credit account token balances
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Get token balances and transfer history for a credit account.
|
|
34
|
+
*
|
|
35
|
+
* Returns all token balances held by the credit account derived from the owner address,
|
|
36
|
+
* along with complete transfer history and USD valuations.
|
|
37
|
+
*/
|
|
38
|
+
export function creditCreditBalances(
|
|
39
|
+
client: CompassApiSDKCore,
|
|
40
|
+
request: operations.V2CreditBalancesRequest,
|
|
41
|
+
options?: RequestOptions,
|
|
42
|
+
): APIPromise<
|
|
43
|
+
Result<
|
|
44
|
+
components.CreditBalancesResponse,
|
|
45
|
+
| errors.HTTPValidationError
|
|
46
|
+
| CompassAPISDKError
|
|
47
|
+
| ResponseValidationError
|
|
48
|
+
| ConnectionError
|
|
49
|
+
| RequestAbortedError
|
|
50
|
+
| RequestTimeoutError
|
|
51
|
+
| InvalidRequestError
|
|
52
|
+
| UnexpectedClientError
|
|
53
|
+
| SDKValidationError
|
|
54
|
+
>
|
|
55
|
+
> {
|
|
56
|
+
return new APIPromise($do(
|
|
57
|
+
client,
|
|
58
|
+
request,
|
|
59
|
+
options,
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function $do(
|
|
64
|
+
client: CompassApiSDKCore,
|
|
65
|
+
request: operations.V2CreditBalancesRequest,
|
|
66
|
+
options?: RequestOptions,
|
|
67
|
+
): Promise<
|
|
68
|
+
[
|
|
69
|
+
Result<
|
|
70
|
+
components.CreditBalancesResponse,
|
|
71
|
+
| errors.HTTPValidationError
|
|
72
|
+
| CompassAPISDKError
|
|
73
|
+
| ResponseValidationError
|
|
74
|
+
| ConnectionError
|
|
75
|
+
| RequestAbortedError
|
|
76
|
+
| RequestTimeoutError
|
|
77
|
+
| InvalidRequestError
|
|
78
|
+
| UnexpectedClientError
|
|
79
|
+
| SDKValidationError
|
|
80
|
+
>,
|
|
81
|
+
APICall,
|
|
82
|
+
]
|
|
83
|
+
> {
|
|
84
|
+
const parsed = safeParse(
|
|
85
|
+
request,
|
|
86
|
+
(value) => operations.V2CreditBalancesRequest$outboundSchema.parse(value),
|
|
87
|
+
"Input validation failed",
|
|
88
|
+
);
|
|
89
|
+
if (!parsed.ok) {
|
|
90
|
+
return [parsed, { status: "invalid" }];
|
|
91
|
+
}
|
|
92
|
+
const payload = parsed.value;
|
|
93
|
+
const body = null;
|
|
94
|
+
|
|
95
|
+
const path = pathToFunc("/v2/credit/balances")();
|
|
96
|
+
|
|
97
|
+
const query = encodeFormQuery({
|
|
98
|
+
"chain": payload.chain,
|
|
99
|
+
"owner": payload.owner,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const headers = new Headers(compactMap({
|
|
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_credit_balances",
|
|
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: "GET",
|
|
128
|
+
baseURL: options?.serverURL,
|
|
129
|
+
path: path,
|
|
130
|
+
headers: headers,
|
|
131
|
+
query: query,
|
|
132
|
+
body: body,
|
|
133
|
+
userAgent: client._options.userAgent,
|
|
134
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
135
|
+
}, options);
|
|
136
|
+
if (!requestRes.ok) {
|
|
137
|
+
return [requestRes, { status: "invalid" }];
|
|
138
|
+
}
|
|
139
|
+
const req = requestRes.value;
|
|
140
|
+
|
|
141
|
+
const doResult = await client._do(req, {
|
|
142
|
+
context,
|
|
143
|
+
errorCodes: ["422", "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.CreditBalancesResponse,
|
|
158
|
+
| errors.HTTPValidationError
|
|
159
|
+
| CompassAPISDKError
|
|
160
|
+
| ResponseValidationError
|
|
161
|
+
| ConnectionError
|
|
162
|
+
| RequestAbortedError
|
|
163
|
+
| RequestTimeoutError
|
|
164
|
+
| InvalidRequestError
|
|
165
|
+
| UnexpectedClientError
|
|
166
|
+
| SDKValidationError
|
|
167
|
+
>(
|
|
168
|
+
M.json(200, components.CreditBalancesResponse$inboundSchema),
|
|
169
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
170
|
+
M.fail("4XX"),
|
|
171
|
+
M.fail("5XX"),
|
|
172
|
+
)(response, req, { extraFields: responseFields });
|
|
173
|
+
if (!result.ok) {
|
|
174
|
+
return [result, { status: "complete", request: req, response }];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return [result, { status: "complete", request: req, response }];
|
|
178
|
+
}
|
|
@@ -12,7 +12,7 @@ import { TokenTransfer, TokenTransfer$inboundSchema } from "./tokentransfer.js";
|
|
|
12
12
|
/**
|
|
13
13
|
* Balance and transfer history for a single token.
|
|
14
14
|
*/
|
|
15
|
-
export type
|
|
15
|
+
export type CompassApiBackendV2ModelsBalancesTokenBalance = {
|
|
16
16
|
/**
|
|
17
17
|
* The token contract address.
|
|
18
18
|
*/
|
|
@@ -44,9 +44,9 @@ export type CompassApiBackendV2ModelsEarnReadResponseBalancesTokenBalance = {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
/** @internal */
|
|
47
|
-
export const
|
|
47
|
+
export const CompassApiBackendV2ModelsBalancesTokenBalance$inboundSchema:
|
|
48
48
|
z.ZodType<
|
|
49
|
-
|
|
49
|
+
CompassApiBackendV2ModelsBalancesTokenBalance,
|
|
50
50
|
z.ZodTypeDef,
|
|
51
51
|
unknown
|
|
52
52
|
> = z.object({
|
|
@@ -67,17 +67,18 @@ export const CompassApiBackendV2ModelsEarnReadResponseBalancesTokenBalance$inbou
|
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
export function
|
|
70
|
+
export function compassApiBackendV2ModelsBalancesTokenBalanceFromJSON(
|
|
71
71
|
jsonString: string,
|
|
72
72
|
): SafeParseResult<
|
|
73
|
-
|
|
73
|
+
CompassApiBackendV2ModelsBalancesTokenBalance,
|
|
74
74
|
SDKValidationError
|
|
75
75
|
> {
|
|
76
76
|
return safeParse(
|
|
77
77
|
jsonString,
|
|
78
78
|
(x) =>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
CompassApiBackendV2ModelsBalancesTokenBalance$inboundSchema.parse(
|
|
80
|
+
JSON.parse(x),
|
|
81
|
+
),
|
|
82
|
+
`Failed to parse 'CompassApiBackendV2ModelsBalancesTokenBalance' from JSON`,
|
|
82
83
|
);
|
|
83
84
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
CompassApiBackendV2ModelsBalancesTokenBalance,
|
|
12
|
+
CompassApiBackendV2ModelsBalancesTokenBalance$inboundSchema,
|
|
13
|
+
} from "./compassapibackendv2modelsbalancestokenbalance.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Response containing credit account balances and transfer history.
|
|
17
|
+
*/
|
|
18
|
+
export type CreditBalancesResponse = {
|
|
19
|
+
/**
|
|
20
|
+
* The derived credit account address.
|
|
21
|
+
*/
|
|
22
|
+
creditAccountAddress: string;
|
|
23
|
+
/**
|
|
24
|
+
* Token balances keyed by token symbol.
|
|
25
|
+
*/
|
|
26
|
+
balances?:
|
|
27
|
+
| { [k: string]: CompassApiBackendV2ModelsBalancesTokenBalance }
|
|
28
|
+
| undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Total USD value of all balances (sum of available values).
|
|
31
|
+
*/
|
|
32
|
+
totalUsdValue?: string | null | undefined;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** @internal */
|
|
36
|
+
export const CreditBalancesResponse$inboundSchema: z.ZodType<
|
|
37
|
+
CreditBalancesResponse,
|
|
38
|
+
z.ZodTypeDef,
|
|
39
|
+
unknown
|
|
40
|
+
> = z.object({
|
|
41
|
+
credit_account_address: z.string(),
|
|
42
|
+
balances: z.record(
|
|
43
|
+
CompassApiBackendV2ModelsBalancesTokenBalance$inboundSchema,
|
|
44
|
+
).optional(),
|
|
45
|
+
total_usd_value: z.nullable(z.string()).optional(),
|
|
46
|
+
}).transform((v) => {
|
|
47
|
+
return remap$(v, {
|
|
48
|
+
"credit_account_address": "creditAccountAddress",
|
|
49
|
+
"total_usd_value": "totalUsdValue",
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export function creditBalancesResponseFromJSON(
|
|
54
|
+
jsonString: string,
|
|
55
|
+
): SafeParseResult<CreditBalancesResponse, SDKValidationError> {
|
|
56
|
+
return safeParse(
|
|
57
|
+
jsonString,
|
|
58
|
+
(x) => CreditBalancesResponse$inboundSchema.parse(JSON.parse(x)),
|
|
59
|
+
`Failed to parse 'CreditBalancesResponse' from JSON`,
|
|
60
|
+
);
|
|
61
|
+
}
|