lcx-liberty-sdk 1.0.1 → 1.0.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 +3 -3
- package/dist/index.cjs +2 -0
- package/dist/resources/tokens.d.ts +5 -1
- package/dist/types.d.ts +26 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ if (required) {
|
|
|
44
44
|
const typedData = await lcx.swap.permit({ chainId: 1, token: WETH, owner: userAddress });
|
|
45
45
|
const signature = await wallet.signTypedData(typedData);
|
|
46
46
|
} catch (e) {
|
|
47
|
-
if (e.code === "PERMIT_UNSUPPORTED") await erc20.approve(spender, rawAmount);
|
|
47
|
+
if (e instanceof LibertyError && e.code === "PERMIT_UNSUPPORTED") await erc20.approve(spender, rawAmount);
|
|
48
48
|
else throw e;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -123,8 +123,8 @@ One router, one address on Ethereum, Base, Arbitrum and Optimism since
|
|
|
123
123
|
|
|
124
124
|
| Contract | Address, every chain |
|
|
125
125
|
|---|---|
|
|
126
|
-
|
|
|
127
|
-
|
|
|
126
|
+
| Router proxy (the `spender`: swaps now, cross-chain from 12 September 2026) | `0x0000000000b1ae06c96aB73FF4360d7AeAaB56F0` |
|
|
127
|
+
| Fee router (deployed, reserved for integrator-fee traffic) | `0xd67aADF902d15890cb11DfB4DA3d3D90b1953Dee` |
|
|
128
128
|
|
|
129
129
|
A wallet that approved the earlier per-chain router is asked for one new
|
|
130
130
|
approval on its next swap.
|
package/dist/index.cjs
ADDED
|
@@ -35,7 +35,11 @@ export declare class TokensResource {
|
|
|
35
35
|
tokens: Token[];
|
|
36
36
|
offset: number;
|
|
37
37
|
limit: number;
|
|
38
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* What the caller asked for. `limit` is what the server served, and the two
|
|
40
|
+
* differ when the request was clamped (200 is the ceiling), so `limit`,
|
|
41
|
+
* not this, is the page size to reason about.
|
|
42
|
+
*/
|
|
39
43
|
requestedLimit: number | null;
|
|
40
44
|
hasMore: boolean;
|
|
41
45
|
/** Pass back as `offset`; null at the end. */
|
package/dist/types.d.ts
CHANGED
|
@@ -73,8 +73,26 @@ export interface Quote {
|
|
|
73
73
|
venues: string[];
|
|
74
74
|
spender: string | null;
|
|
75
75
|
stale: boolean;
|
|
76
|
+
/** The integrator fee this quote was priced with; `bps` is 0 unless an integrator with a fee was named. */
|
|
77
|
+
fee: QuoteFee;
|
|
78
|
+
nativeIn: boolean;
|
|
79
|
+
nativeOut: boolean;
|
|
80
|
+
/** True when the size is large enough that an OTC desk would likely beat the on-chain route. */
|
|
81
|
+
otcRecommended: boolean;
|
|
82
|
+
usdValueIn: number | null;
|
|
83
|
+
usdValueOut: number | null;
|
|
76
84
|
}
|
|
77
85
|
/** Flat and ready for `sendTransaction`. */
|
|
86
|
+
export interface QuoteFee {
|
|
87
|
+
/** Raw units of `token`. */
|
|
88
|
+
amount: string;
|
|
89
|
+
bps: number;
|
|
90
|
+
grossAmount: string;
|
|
91
|
+
integrator: string;
|
|
92
|
+
integratorSource: "none" | "address" | "slug" | string;
|
|
93
|
+
token: string;
|
|
94
|
+
usd: number;
|
|
95
|
+
}
|
|
78
96
|
export interface Transaction {
|
|
79
97
|
to: string;
|
|
80
98
|
data: string;
|
|
@@ -86,6 +104,8 @@ export interface Transaction {
|
|
|
86
104
|
export interface SwapResult {
|
|
87
105
|
quote: Quote;
|
|
88
106
|
transaction: Transaction;
|
|
107
|
+
/** Present when the input token supports EIP-2612 and the caller may sign instead of approving. */
|
|
108
|
+
permitData?: PermitTypedData | null;
|
|
89
109
|
}
|
|
90
110
|
export interface Token {
|
|
91
111
|
address: string;
|
|
@@ -142,13 +162,19 @@ export interface ChainStatus {
|
|
|
142
162
|
export interface Usage {
|
|
143
163
|
plan: string;
|
|
144
164
|
planLabel: string;
|
|
165
|
+
/** False on the anonymous tier: an IP has no account, so the quota fields below are null. */
|
|
166
|
+
authenticated: boolean;
|
|
167
|
+
keyId: number | null;
|
|
145
168
|
rateLimit: {
|
|
146
169
|
perSecond: number;
|
|
147
170
|
perMinute: number;
|
|
148
171
|
};
|
|
172
|
+
/** Null for the anonymous tier and for plans with no monthly cap. */
|
|
149
173
|
monthlyCalls: number | null;
|
|
150
174
|
callsUsed: number | null;
|
|
175
|
+
/** Null when there is no cap to remain under; never a count-down on an unlimited plan. */
|
|
151
176
|
callsRemaining: number | null;
|
|
177
|
+
overagePolicy: string;
|
|
152
178
|
}
|
|
153
179
|
/**
|
|
154
180
|
* Who stands behind the bridge leg. `issuer` — the token's issuer mints on the
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lcx-liberty-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "TypeScript SDK for the LCX Liberty DEX aggregator. Best-execution routing across Ethereum, Base, Arbitrum and OP Mainnet.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
6
|
"module": "./dist/index.js",
|
|
8
7
|
"types": "./dist/index.d.ts",
|
|
9
8
|
"exports": {
|
|
10
9
|
".": {
|
|
11
10
|
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/index.js"
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"node": ">=18"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "tsc -p tsconfig.json",
|
|
24
|
+
"build": "tsc -p tsconfig.json && node ./cjs-stub.mjs",
|
|
25
25
|
"test": "node --test test/*.test.mjs",
|
|
26
26
|
"prepublishOnly": "npm run build && npm test"
|
|
27
27
|
},
|