@lifi/types 18.8.0-beta.0 → 18.8.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/package.json +1 -1
- package/src/_cjs/earn.js +3 -0
- package/src/_cjs/earn.js.map +1 -0
- package/src/_cjs/index.js +2 -1
- package/src/_cjs/index.js.map +1 -1
- package/src/_esm/earn.js +9 -0
- package/src/_esm/earn.js.map +1 -0
- package/src/_esm/index.js +2 -1
- package/src/_esm/index.js.map +1 -1
- package/src/_types/earn.d.ts +137 -0
- package/src/_types/earn.d.ts.map +1 -0
- package/src/_types/index.d.ts +2 -1
- package/src/_types/index.d.ts.map +1 -1
- package/src/earn.ts +158 -0
- package/src/index.ts +2 -1
package/package.json
CHANGED
package/src/_cjs/earn.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earn.js","sourceRoot":"","sources":["../earn.ts"],"names":[],"mappings":""}
|
package/src/_cjs/index.js
CHANGED
|
@@ -15,12 +15,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./api.js"), exports);
|
|
18
|
+
__exportStar(require("./balance/index.js"), exports);
|
|
18
19
|
__exportStar(require("./bridges.js"), exports);
|
|
19
20
|
__exportStar(require("./chains/index.js"), exports);
|
|
21
|
+
__exportStar(require("./earn.js"), exports);
|
|
20
22
|
__exportStar(require("./errors.js"), exports);
|
|
21
23
|
__exportStar(require("./exchanges.js"), exports);
|
|
22
24
|
__exportStar(require("./step.js"), exports);
|
|
23
25
|
__exportStar(require("./tokens/index.js"), exports);
|
|
24
|
-
__exportStar(require("./balance/index.js"), exports);
|
|
25
26
|
__exportStar(require("./typed-data.js"), exports);
|
|
26
27
|
//# sourceMappingURL=index.js.map
|
package/src/_cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,+CAA4B;AAC5B,oDAAiC;AACjC,8CAA2B;AAC3B,iDAA8B;AAC9B,4CAAyB;AACzB,oDAAiC;AACjC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,qDAAkC;AAClC,+CAA4B;AAC5B,oDAAiC;AACjC,4CAAyB;AACzB,8CAA2B;AAC3B,iDAA8B;AAC9B,4CAAyB;AACzB,oDAAiC;AACjC,kDAA+B"}
|
package/src/_esm/earn.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON response types for the LI.FI Earn Data API (`earn.li.fi/v1`).
|
|
3
|
+
*
|
|
4
|
+
* These describe the current response contract, not historical response shapes
|
|
5
|
+
* or guarantees inferred from a sample of vaults. Timestamps are serialized
|
|
6
|
+
* strings, and token metadata can be absent until it has been resolved.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=earn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earn.js","sourceRoot":"","sources":["../earn.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
package/src/_esm/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export * from './api.js';
|
|
2
|
+
export * from './balance/index.js';
|
|
2
3
|
export * from './bridges.js';
|
|
3
4
|
export * from './chains/index.js';
|
|
5
|
+
export * from './earn.js';
|
|
4
6
|
export * from './errors.js';
|
|
5
7
|
export * from './exchanges.js';
|
|
6
8
|
export * from './step.js';
|
|
7
9
|
export * from './tokens/index.js';
|
|
8
|
-
export * from './balance/index.js';
|
|
9
10
|
export * from './typed-data.js';
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
package/src/_esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON response types for the LI.FI Earn Data API (`earn.li.fi/v1`).
|
|
3
|
+
*
|
|
4
|
+
* These describe the current response contract, not historical response shapes
|
|
5
|
+
* or guarantees inferred from a sample of vaults. Timestamps are serialized
|
|
6
|
+
* strings, and token metadata can be absent until it has been resolved.
|
|
7
|
+
*/
|
|
8
|
+
/** A protocol returned by the API. Use its id when filtering vaults. */
|
|
9
|
+
export interface EarnProtocol {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
url: string;
|
|
13
|
+
logoUri?: string;
|
|
14
|
+
}
|
|
15
|
+
/** A vault token reference. Only its address is guaranteed to be available. */
|
|
16
|
+
export interface EarnToken {
|
|
17
|
+
address: string;
|
|
18
|
+
symbol?: string;
|
|
19
|
+
decimals?: number;
|
|
20
|
+
/** Token price in USD, represented as a decimal string. */
|
|
21
|
+
priceUsd?: string;
|
|
22
|
+
}
|
|
23
|
+
/** An underlying asset held by a vault. */
|
|
24
|
+
export type EarnUnderlyingToken = EarnToken;
|
|
25
|
+
/** An incentive token distributed by a vault. */
|
|
26
|
+
export type EarnRewardToken = EarnToken;
|
|
27
|
+
/** A vault's deposit or redeem route metadata. */
|
|
28
|
+
export interface EarnPack {
|
|
29
|
+
name: string;
|
|
30
|
+
stepsType: 'instant' | 'complex';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* APY values in percentage points: `5.34` means 5.34%, not 534%.
|
|
34
|
+
* A null component is unavailable; callers should not conflate it with zero.
|
|
35
|
+
*/
|
|
36
|
+
export interface EarnApy {
|
|
37
|
+
base: number | null;
|
|
38
|
+
total: number;
|
|
39
|
+
reward: number | null;
|
|
40
|
+
}
|
|
41
|
+
/** Total value locked: USD is a JSON number, native units a decimal string. */
|
|
42
|
+
export interface EarnTvl {
|
|
43
|
+
usd: number;
|
|
44
|
+
native?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface EarnAnalytics {
|
|
47
|
+
apy: EarnApy;
|
|
48
|
+
tvl: EarnTvl;
|
|
49
|
+
apy1d: number | null;
|
|
50
|
+
apy7d: number | null;
|
|
51
|
+
apy30d: number;
|
|
52
|
+
/** ISO timestamp of the analytics observation, not a freshness guarantee. */
|
|
53
|
+
updatedAt: string;
|
|
54
|
+
}
|
|
55
|
+
/** Rule-based screening output, not a security audit or safety guarantee. */
|
|
56
|
+
export type EarnVerificationStatus = 'none' | 'flagged';
|
|
57
|
+
export type EarnVerificationReason = 'none' | 'zero_apy' | 'apy_outlier' | 'stale_data';
|
|
58
|
+
export interface EarnVerificationBreakdown {
|
|
59
|
+
reason: EarnVerificationReason;
|
|
60
|
+
result: EarnVerificationStatus;
|
|
61
|
+
}
|
|
62
|
+
/** Optional deposit capacity limits, represented as decimal strings. */
|
|
63
|
+
export interface EarnCaps {
|
|
64
|
+
totalCap?: string;
|
|
65
|
+
maxCap?: string;
|
|
66
|
+
}
|
|
67
|
+
/** A vault indexed by LI.FI Earn. */
|
|
68
|
+
export interface EarnVault {
|
|
69
|
+
address: string;
|
|
70
|
+
chainId: number;
|
|
71
|
+
name: string;
|
|
72
|
+
slug: string;
|
|
73
|
+
network: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
protocol: EarnProtocol;
|
|
76
|
+
/** ISO timestamp of the vault's sync. */
|
|
77
|
+
syncedAt: string;
|
|
78
|
+
tags: string[];
|
|
79
|
+
underlyingTokens?: EarnUnderlyingToken[];
|
|
80
|
+
lpTokens?: EarnToken[];
|
|
81
|
+
rewardTokens?: EarnRewardToken[];
|
|
82
|
+
analytics: EarnAnalytics;
|
|
83
|
+
/** Capability metadata; a successful executable quote is still required. */
|
|
84
|
+
isTransactional: boolean;
|
|
85
|
+
isRedeemable: boolean;
|
|
86
|
+
depositPacks: EarnPack[];
|
|
87
|
+
redeemPacks: EarnPack[];
|
|
88
|
+
verificationStatus: EarnVerificationStatus;
|
|
89
|
+
verificationStatusBreakdown: EarnVerificationBreakdown[];
|
|
90
|
+
caps?: EarnCaps;
|
|
91
|
+
timeLock?: number;
|
|
92
|
+
kyc?: boolean;
|
|
93
|
+
}
|
|
94
|
+
/** A page from GET /v1/vaults. */
|
|
95
|
+
export interface EarnVaultListResponse {
|
|
96
|
+
data: EarnVault[];
|
|
97
|
+
/** Omitted on the final page. Pass unchanged as the next request's cursor. */
|
|
98
|
+
nextCursor?: string;
|
|
99
|
+
total: number;
|
|
100
|
+
/** ISO timestamp of the catalog normalization. */
|
|
101
|
+
normalizedAt: string;
|
|
102
|
+
}
|
|
103
|
+
/** GET /v1/chains returns a bare array of these objects. */
|
|
104
|
+
export interface EarnChain {
|
|
105
|
+
chainId: number;
|
|
106
|
+
name: string;
|
|
107
|
+
networkCaip: string;
|
|
108
|
+
}
|
|
109
|
+
/** One position returned by GET /v1/portfolio/{userAddress}/positions. */
|
|
110
|
+
export interface EarnPosition {
|
|
111
|
+
chainId: number;
|
|
112
|
+
/** The vault contract address, or null when unresolved. */
|
|
113
|
+
address: string | null;
|
|
114
|
+
protocolName: string | null;
|
|
115
|
+
asset: {
|
|
116
|
+
address: string;
|
|
117
|
+
name: string;
|
|
118
|
+
symbol: string;
|
|
119
|
+
decimals: number;
|
|
120
|
+
};
|
|
121
|
+
balanceUsd: string | null;
|
|
122
|
+
balanceNative: string;
|
|
123
|
+
}
|
|
124
|
+
/** A page from GET /v1/portfolio/{userAddress}/positions. */
|
|
125
|
+
export interface EarnPortfolioResponse {
|
|
126
|
+
data: EarnPosition[];
|
|
127
|
+
/** Omitted on the final page. Continue until no cursor is returned. */
|
|
128
|
+
nextCursor?: string;
|
|
129
|
+
limit: number;
|
|
130
|
+
}
|
|
131
|
+
/** One field-level issue in a validation error response's errors array. */
|
|
132
|
+
export interface EarnApiFieldError {
|
|
133
|
+
code: string;
|
|
134
|
+
message: string;
|
|
135
|
+
path: (string | number)[];
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=earn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earn.d.ts","sourceRoot":"","sources":["../earn.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,+EAA+E;AAC/E,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,2CAA2C;AAC3C,MAAM,MAAM,mBAAmB,GAAG,SAAS,CAAA;AAE3C,iDAAiD;AACjD,MAAM,MAAM,eAAe,GAAG,SAAS,CAAA;AAEvC,kDAAkD;AAClD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;I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;IACzB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,6DAA6D;AAC7D,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,YAAY,EAAE,CAAA;IACpB,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,2EAA2E;AAC3E,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;CAC1B"}
|
package/src/_types/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export * from './api.js';
|
|
2
|
+
export * from './balance/index.js';
|
|
2
3
|
export * from './bridges.js';
|
|
3
4
|
export * from './chains/index.js';
|
|
5
|
+
export * from './earn.js';
|
|
4
6
|
export * from './errors.js';
|
|
5
7
|
export * from './exchanges.js';
|
|
6
8
|
export * from './step.js';
|
|
7
9
|
export * from './tokens/index.js';
|
|
8
|
-
export * from './balance/index.js';
|
|
9
10
|
export * from './typed-data.js';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA"}
|
package/src/earn.ts
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON response types for the LI.FI Earn Data API (`earn.li.fi/v1`).
|
|
3
|
+
*
|
|
4
|
+
* These describe the current response contract, not historical response shapes
|
|
5
|
+
* or guarantees inferred from a sample of vaults. Timestamps are serialized
|
|
6
|
+
* strings, and token metadata can be absent until it has been resolved.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** A protocol returned by the API. Use its id when filtering vaults. */
|
|
10
|
+
export interface EarnProtocol {
|
|
11
|
+
id: string
|
|
12
|
+
name: string
|
|
13
|
+
url: string
|
|
14
|
+
logoUri?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** A vault token reference. Only its address is guaranteed to be available. */
|
|
18
|
+
export interface EarnToken {
|
|
19
|
+
address: string
|
|
20
|
+
symbol?: string
|
|
21
|
+
decimals?: number
|
|
22
|
+
/** Token price in USD, represented as a decimal string. */
|
|
23
|
+
priceUsd?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** An underlying asset held by a vault. */
|
|
27
|
+
export type EarnUnderlyingToken = EarnToken
|
|
28
|
+
|
|
29
|
+
/** An incentive token distributed by a vault. */
|
|
30
|
+
export type EarnRewardToken = EarnToken
|
|
31
|
+
|
|
32
|
+
/** A vault's deposit or redeem route metadata. */
|
|
33
|
+
export interface EarnPack {
|
|
34
|
+
name: string
|
|
35
|
+
stepsType: 'instant' | 'complex'
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* APY values in percentage points: `5.34` means 5.34%, not 534%.
|
|
40
|
+
* A null component is unavailable; callers should not conflate it with zero.
|
|
41
|
+
*/
|
|
42
|
+
export interface EarnApy {
|
|
43
|
+
base: number | null
|
|
44
|
+
total: number
|
|
45
|
+
reward: number | null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Total value locked: USD is a JSON number, native units a decimal string. */
|
|
49
|
+
export interface EarnTvl {
|
|
50
|
+
usd: number
|
|
51
|
+
native?: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface EarnAnalytics {
|
|
55
|
+
apy: EarnApy
|
|
56
|
+
tvl: EarnTvl
|
|
57
|
+
apy1d: number | null
|
|
58
|
+
apy7d: number | null
|
|
59
|
+
apy30d: number
|
|
60
|
+
/** ISO timestamp of the analytics observation, not a freshness guarantee. */
|
|
61
|
+
updatedAt: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Rule-based screening output, not a security audit or safety guarantee. */
|
|
65
|
+
export type EarnVerificationStatus = 'none' | 'flagged'
|
|
66
|
+
|
|
67
|
+
export type EarnVerificationReason =
|
|
68
|
+
| 'none'
|
|
69
|
+
| 'zero_apy'
|
|
70
|
+
| 'apy_outlier'
|
|
71
|
+
| 'stale_data'
|
|
72
|
+
|
|
73
|
+
export interface EarnVerificationBreakdown {
|
|
74
|
+
reason: EarnVerificationReason
|
|
75
|
+
result: EarnVerificationStatus
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Optional deposit capacity limits, represented as decimal strings. */
|
|
79
|
+
export interface EarnCaps {
|
|
80
|
+
totalCap?: string
|
|
81
|
+
maxCap?: string
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** A vault indexed by LI.FI Earn. */
|
|
85
|
+
export interface EarnVault {
|
|
86
|
+
address: string
|
|
87
|
+
chainId: number
|
|
88
|
+
name: string
|
|
89
|
+
slug: string
|
|
90
|
+
network: string
|
|
91
|
+
description?: string
|
|
92
|
+
protocol: EarnProtocol
|
|
93
|
+
/** ISO timestamp of the vault's sync. */
|
|
94
|
+
syncedAt: string
|
|
95
|
+
tags: string[]
|
|
96
|
+
underlyingTokens?: EarnUnderlyingToken[]
|
|
97
|
+
lpTokens?: EarnToken[]
|
|
98
|
+
rewardTokens?: EarnRewardToken[]
|
|
99
|
+
analytics: EarnAnalytics
|
|
100
|
+
/** Capability metadata; a successful executable quote is still required. */
|
|
101
|
+
isTransactional: boolean
|
|
102
|
+
isRedeemable: boolean
|
|
103
|
+
depositPacks: EarnPack[]
|
|
104
|
+
redeemPacks: EarnPack[]
|
|
105
|
+
verificationStatus: EarnVerificationStatus
|
|
106
|
+
verificationStatusBreakdown: EarnVerificationBreakdown[]
|
|
107
|
+
caps?: EarnCaps
|
|
108
|
+
timeLock?: number
|
|
109
|
+
kyc?: boolean
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** A page from GET /v1/vaults. */
|
|
113
|
+
export interface EarnVaultListResponse {
|
|
114
|
+
data: EarnVault[]
|
|
115
|
+
/** Omitted on the final page. Pass unchanged as the next request's cursor. */
|
|
116
|
+
nextCursor?: string
|
|
117
|
+
total: number
|
|
118
|
+
/** ISO timestamp of the catalog normalization. */
|
|
119
|
+
normalizedAt: string
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** GET /v1/chains returns a bare array of these objects. */
|
|
123
|
+
export interface EarnChain {
|
|
124
|
+
chainId: number
|
|
125
|
+
name: string
|
|
126
|
+
networkCaip: string
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** One position returned by GET /v1/portfolio/{userAddress}/positions. */
|
|
130
|
+
export interface EarnPosition {
|
|
131
|
+
chainId: number
|
|
132
|
+
/** The vault contract address, or null when unresolved. */
|
|
133
|
+
address: string | null
|
|
134
|
+
protocolName: string | null
|
|
135
|
+
asset: {
|
|
136
|
+
address: string
|
|
137
|
+
name: string
|
|
138
|
+
symbol: string
|
|
139
|
+
decimals: number
|
|
140
|
+
}
|
|
141
|
+
balanceUsd: string | null
|
|
142
|
+
balanceNative: string
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** A page from GET /v1/portfolio/{userAddress}/positions. */
|
|
146
|
+
export interface EarnPortfolioResponse {
|
|
147
|
+
data: EarnPosition[]
|
|
148
|
+
/** Omitted on the final page. Continue until no cursor is returned. */
|
|
149
|
+
nextCursor?: string
|
|
150
|
+
limit: number
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** One field-level issue in a validation error response's errors array. */
|
|
154
|
+
export interface EarnApiFieldError {
|
|
155
|
+
code: string
|
|
156
|
+
message: string
|
|
157
|
+
path: (string | number)[]
|
|
158
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export * from './api.js'
|
|
2
|
+
export * from './balance/index.js'
|
|
2
3
|
export * from './bridges.js'
|
|
3
4
|
export * from './chains/index.js'
|
|
5
|
+
export * from './earn.js'
|
|
4
6
|
export * from './errors.js'
|
|
5
7
|
export * from './exchanges.js'
|
|
6
8
|
export * from './step.js'
|
|
7
9
|
export * from './tokens/index.js'
|
|
8
|
-
export * from './balance/index.js'
|
|
9
10
|
export * from './typed-data.js'
|