@sun-protocol/sun-sdk-protocols 0.1.0-beta.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 +30 -0
- package/dist/chunk-5XDX5563.js +99 -0
- package/dist/chunk-5XDX5563.js.map +1 -0
- package/dist/chunk-C2YCVBPI.js +212 -0
- package/dist/chunk-C2YCVBPI.js.map +1 -0
- package/dist/chunk-ECCGOXNA.js +1317 -0
- package/dist/chunk-ECCGOXNA.js.map +1 -0
- package/dist/chunk-HD2S3Q7L.js +746 -0
- package/dist/chunk-HD2S3Q7L.js.map +1 -0
- package/dist/chunk-L5TZCDPH.js +561 -0
- package/dist/chunk-L5TZCDPH.js.map +1 -0
- package/dist/chunk-OM4OW4KB.js +224 -0
- package/dist/chunk-OM4OW4KB.js.map +1 -0
- package/dist/chunk-PEGREDLT.js +935 -0
- package/dist/chunk-PEGREDLT.js.map +1 -0
- package/dist/chunk-TSHXXRH2.js +103 -0
- package/dist/chunk-TSHXXRH2.js.map +1 -0
- package/dist/chunk-VFVKMC4H.js +521 -0
- package/dist/chunk-VFVKMC4H.js.map +1 -0
- package/dist/chunk-YMGZDXI4.js +1209 -0
- package/dist/chunk-YMGZDXI4.js.map +1 -0
- package/dist/common-8VQQ0FSU.d.cts +146 -0
- package/dist/common-8VQQ0FSU.d.ts +146 -0
- package/dist/execute-BNKh6dT6.d.cts +187 -0
- package/dist/execute-CVhcKZxF.d.ts +187 -0
- package/dist/index.cjs +5619 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +139 -0
- package/dist/index.d.ts +139 -0
- package/dist/index.js +200 -0
- package/dist/index.js.map +1 -0
- package/dist/intents-BSXq1HvW.d.cts +200 -0
- package/dist/intents-CwOttD75.d.ts +200 -0
- package/dist/liquidity/index.cjs +2441 -0
- package/dist/liquidity/index.cjs.map +1 -0
- package/dist/liquidity/index.d.cts +83 -0
- package/dist/liquidity/index.d.ts +83 -0
- package/dist/liquidity/index.js +32 -0
- package/dist/liquidity/index.js.map +1 -0
- package/dist/positions/index.cjs +1544 -0
- package/dist/positions/index.cjs.map +1 -0
- package/dist/positions/index.d.cts +159 -0
- package/dist/positions/index.d.ts +159 -0
- package/dist/positions/index.js +25 -0
- package/dist/positions/index.js.map +1 -0
- package/dist/pump/index.cjs +1178 -0
- package/dist/pump/index.cjs.map +1 -0
- package/dist/pump/index.d.cts +16 -0
- package/dist/pump/index.d.ts +16 -0
- package/dist/pump/index.js +29 -0
- package/dist/pump/index.js.map +1 -0
- package/dist/swap/index.cjs +2259 -0
- package/dist/swap/index.cjs.map +1 -0
- package/dist/swap/index.d.cts +33 -0
- package/dist/swap/index.d.ts +33 -0
- package/dist/swap/index.js +61 -0
- package/dist/swap/index.js.map +1 -0
- package/dist/types-BTPdCC7k.d.cts +160 -0
- package/dist/types-BfrouFmO.d.ts +160 -0
- package/package.json +94 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { S as SlippageInput, C as ContractOverrides, P as ProtocolsContext, T as TransactionPlan, a as TransactionPlanExecutionResult, b as TransactionPlanExecutor } from '../common-8VQQ0FSU.js';
|
|
2
|
+
export { A as ApprovalMode } from '../common-8VQQ0FSU.js';
|
|
3
|
+
import { BigintIsh, Percent, ContractCallAction } from '@sun-protocol/sun-sdk-core';
|
|
4
|
+
import { V4PoolKey } from '@sun-protocol/sun-sdk-sunswap-v4';
|
|
5
|
+
import { a as LiquidityPlanOptions, e as V3PoolStateInput, k as V4ExecutionOptions } from '../types-BfrouFmO.js';
|
|
6
|
+
import '@sun-protocol/sun-sdk-api';
|
|
7
|
+
import '@sun-protocol/sun-sdk-chains';
|
|
8
|
+
import '@sun-protocol/sun-sdk-runtime';
|
|
9
|
+
|
|
10
|
+
type PositionLiquidityInput = {
|
|
11
|
+
readonly liquidity: BigintIsh;
|
|
12
|
+
readonly percentage?: never;
|
|
13
|
+
} | {
|
|
14
|
+
readonly liquidity?: never;
|
|
15
|
+
readonly percentage: SlippageInput | Percent;
|
|
16
|
+
};
|
|
17
|
+
interface PositionActionOptions extends LiquidityPlanOptions {
|
|
18
|
+
readonly tokenId: BigintIsh;
|
|
19
|
+
readonly receiveNative?: boolean;
|
|
20
|
+
/** Keep strict SDK guards by default; legacy defers authorization/stale-state failures to the contract. */
|
|
21
|
+
readonly validationMode?: 'strict' | 'legacy';
|
|
22
|
+
}
|
|
23
|
+
type PositionRemoveInput = PositionActionOptions & PositionLiquidityInput;
|
|
24
|
+
type PositionCollectInput = PositionActionOptions;
|
|
25
|
+
interface V3PositionSnapshot {
|
|
26
|
+
readonly protocol: 'sunswap-v3';
|
|
27
|
+
readonly tokenId: string;
|
|
28
|
+
readonly owner: string;
|
|
29
|
+
readonly approved?: string;
|
|
30
|
+
readonly operatorApproved?: boolean;
|
|
31
|
+
readonly token0: string;
|
|
32
|
+
readonly token1: string;
|
|
33
|
+
readonly fee: number;
|
|
34
|
+
readonly tickLower: number;
|
|
35
|
+
readonly tickUpper: number;
|
|
36
|
+
readonly liquidity: string;
|
|
37
|
+
readonly tokensOwed0: string;
|
|
38
|
+
readonly tokensOwed1: string;
|
|
39
|
+
}
|
|
40
|
+
interface V3PositionReadInput {
|
|
41
|
+
readonly tokenId: BigintIsh;
|
|
42
|
+
readonly operator?: string;
|
|
43
|
+
readonly contracts?: ContractOverrides;
|
|
44
|
+
}
|
|
45
|
+
type V3PositionRemoveInput = PositionActionOptions & PositionLiquidityInput & {
|
|
46
|
+
readonly pool?: V3PoolStateInput;
|
|
47
|
+
readonly receiveNative?: boolean;
|
|
48
|
+
readonly burnToken?: boolean;
|
|
49
|
+
readonly expectedCurrencyOwed0?: BigintIsh;
|
|
50
|
+
readonly expectedCurrencyOwed1?: BigintIsh;
|
|
51
|
+
};
|
|
52
|
+
interface V3PositionCollectInput extends PositionActionOptions {
|
|
53
|
+
readonly receiveNative?: boolean;
|
|
54
|
+
readonly expectedCurrencyOwed0?: BigintIsh;
|
|
55
|
+
readonly expectedCurrencyOwed1?: BigintIsh;
|
|
56
|
+
}
|
|
57
|
+
interface V4PositionSnapshot {
|
|
58
|
+
readonly protocol: 'sunswap-v4';
|
|
59
|
+
readonly tokenId: string;
|
|
60
|
+
readonly owner: string;
|
|
61
|
+
readonly approved?: string;
|
|
62
|
+
readonly operatorApproved?: boolean;
|
|
63
|
+
readonly poolKey?: V4PoolKey;
|
|
64
|
+
readonly tickLower?: number;
|
|
65
|
+
readonly tickUpper?: number;
|
|
66
|
+
readonly liquidity: string;
|
|
67
|
+
}
|
|
68
|
+
interface V4PositionReadInput {
|
|
69
|
+
readonly tokenId: BigintIsh;
|
|
70
|
+
readonly operator?: string;
|
|
71
|
+
readonly contracts?: ContractOverrides;
|
|
72
|
+
}
|
|
73
|
+
interface V4PositionFeesSnapshot {
|
|
74
|
+
readonly protocol: 'sunswap-v4';
|
|
75
|
+
readonly tokenId: string;
|
|
76
|
+
readonly feesOwed0: string;
|
|
77
|
+
readonly feesOwed1: string;
|
|
78
|
+
}
|
|
79
|
+
type V4PositionRemoveInput = PositionActionOptions & PositionLiquidityInput & V4ExecutionOptions & {
|
|
80
|
+
readonly poolKey?: V4PoolKey;
|
|
81
|
+
readonly amount0Min?: BigintIsh;
|
|
82
|
+
readonly amount1Min?: BigintIsh;
|
|
83
|
+
/** Optional stale-state guard that must equal the latest on-chain position liquidity. */
|
|
84
|
+
readonly currentLiquidity?: BigintIsh;
|
|
85
|
+
readonly hookData?: string;
|
|
86
|
+
readonly settlementMode?: 'take-pair' | 'close-currency';
|
|
87
|
+
};
|
|
88
|
+
interface V4PositionCollectInput extends PositionActionOptions, V4ExecutionOptions {
|
|
89
|
+
readonly poolKey?: V4PoolKey;
|
|
90
|
+
readonly hookData?: string;
|
|
91
|
+
readonly settlementMode?: 'take-pair' | 'close-currency';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare class V3PositionsClient {
|
|
95
|
+
private readonly context;
|
|
96
|
+
constructor(context: ProtocolsContext);
|
|
97
|
+
read(input: V3PositionReadInput): Promise<V3PositionSnapshot>;
|
|
98
|
+
readonly remove: {
|
|
99
|
+
plan: (input: V3PositionRemoveInput) => Promise<TransactionPlan>;
|
|
100
|
+
execute: (input: V3PositionRemoveInput) => Promise<TransactionPlanExecutionResult>;
|
|
101
|
+
};
|
|
102
|
+
readonly collect: {
|
|
103
|
+
plan: (input: V3PositionCollectInput) => Promise<TransactionPlan>;
|
|
104
|
+
execute: (input: V3PositionCollectInput) => Promise<TransactionPlanExecutionResult>;
|
|
105
|
+
};
|
|
106
|
+
private usdtTransferContext;
|
|
107
|
+
private readAuthorizedPosition;
|
|
108
|
+
private planRemove;
|
|
109
|
+
private planCollect;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
type OptionalV4PoolKey<T> = T extends unknown ? Omit<T, 'poolKey'> & {
|
|
113
|
+
readonly poolKey?: V4PoolKey;
|
|
114
|
+
} : never;
|
|
115
|
+
type V4PositionRemovePlanInput = OptionalV4PoolKey<V4PositionRemoveInput>;
|
|
116
|
+
type V4PositionCollectPlanInput = OptionalV4PoolKey<V4PositionCollectInput>;
|
|
117
|
+
declare class V4PositionsClient {
|
|
118
|
+
private readonly context;
|
|
119
|
+
constructor(context: ProtocolsContext);
|
|
120
|
+
read(input: V4PositionReadInput): Promise<V4PositionSnapshot>;
|
|
121
|
+
fees(input: V4PositionReadInput): Promise<V4PositionFeesSnapshot>;
|
|
122
|
+
readonly remove: {
|
|
123
|
+
plan: (input: V4PositionRemovePlanInput) => Promise<TransactionPlan>;
|
|
124
|
+
execute: (input: V4PositionRemovePlanInput) => Promise<TransactionPlanExecutionResult>;
|
|
125
|
+
};
|
|
126
|
+
readonly collect: {
|
|
127
|
+
plan: (input: V4PositionCollectPlanInput) => Promise<TransactionPlan>;
|
|
128
|
+
execute: (input: V4PositionCollectPlanInput) => Promise<TransactionPlanExecutionResult>;
|
|
129
|
+
};
|
|
130
|
+
private readAuthorizedPosition;
|
|
131
|
+
private planRemove;
|
|
132
|
+
private planCollect;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
declare class PositionsClient {
|
|
136
|
+
readonly v3: {
|
|
137
|
+
readonly read: V3PositionsClient['read'];
|
|
138
|
+
readonly remove: V3PositionsClient['remove'];
|
|
139
|
+
readonly collect: V3PositionsClient['collect'];
|
|
140
|
+
};
|
|
141
|
+
readonly v4: {
|
|
142
|
+
readonly read: V4PositionsClient['read'];
|
|
143
|
+
readonly fees: V4PositionsClient['fees'];
|
|
144
|
+
readonly remove: V4PositionsClient['remove'];
|
|
145
|
+
readonly collect: V4PositionsClient['collect'];
|
|
146
|
+
};
|
|
147
|
+
constructor(context: ProtocolsContext);
|
|
148
|
+
}
|
|
149
|
+
declare function createPositionsClient(context: ProtocolsContext): PositionsClient;
|
|
150
|
+
|
|
151
|
+
declare const SUNSWAP_V3_POSITION_PROTOCOL_ID = "sunswap-v3";
|
|
152
|
+
declare const SUNSWAP_V4_POSITION_PROTOCOL_ID = "sunswap-v4";
|
|
153
|
+
|
|
154
|
+
/** Check an SDK-built V3 remove/collect action immediately before its final send. */
|
|
155
|
+
declare function assertV3PositionUsdtTransfer(context: ProtocolsContext, action: ContractCallAction): Promise<void>;
|
|
156
|
+
/** Use this executor for V3 position plans, including staged execution and retries. */
|
|
157
|
+
declare function createV3PositionsExecutor(context: ProtocolsContext): TransactionPlanExecutor;
|
|
158
|
+
|
|
159
|
+
export { type PositionActionOptions, type PositionCollectInput, type PositionLiquidityInput, type PositionRemoveInput, PositionsClient, SUNSWAP_V3_POSITION_PROTOCOL_ID, SUNSWAP_V4_POSITION_PROTOCOL_ID, TransactionPlan, type V3PositionCollectInput, type V3PositionReadInput, type V3PositionRemoveInput, type V3PositionSnapshot, V3PositionsClient, type V4PositionCollectInput, type V4PositionFeesSnapshot, type V4PositionReadInput, type V4PositionRemoveInput, type V4PositionSnapshot, V4PositionsClient, assertV3PositionUsdtTransfer, createPositionsClient, createV3PositionsExecutor };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PositionsClient,
|
|
3
|
+
SUNSWAP_V3_POSITION_PROTOCOL_ID,
|
|
4
|
+
SUNSWAP_V4_POSITION_PROTOCOL_ID,
|
|
5
|
+
V3PositionsClient,
|
|
6
|
+
V4PositionsClient,
|
|
7
|
+
assertV3PositionUsdtTransfer,
|
|
8
|
+
createPositionsClient,
|
|
9
|
+
createV3PositionsExecutor
|
|
10
|
+
} from "../chunk-PEGREDLT.js";
|
|
11
|
+
import "../chunk-L5TZCDPH.js";
|
|
12
|
+
import "../chunk-5XDX5563.js";
|
|
13
|
+
import "../chunk-C2YCVBPI.js";
|
|
14
|
+
import "../chunk-VFVKMC4H.js";
|
|
15
|
+
export {
|
|
16
|
+
PositionsClient,
|
|
17
|
+
SUNSWAP_V3_POSITION_PROTOCOL_ID,
|
|
18
|
+
SUNSWAP_V4_POSITION_PROTOCOL_ID,
|
|
19
|
+
V3PositionsClient,
|
|
20
|
+
V4PositionsClient,
|
|
21
|
+
assertV3PositionUsdtTransfer,
|
|
22
|
+
createPositionsClient,
|
|
23
|
+
createV3PositionsExecutor
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|