@soroswap/sdk 0.0.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 +389 -0
- package/dist/auth/auth-manager.d.ts +57 -0
- package/dist/auth/auth-manager.d.ts.map +1 -0
- package/dist/auth/auth-manager.js +165 -0
- package/dist/auth/auth-manager.js.map +1 -0
- package/dist/cache/token-cache.d.ts +48 -0
- package/dist/cache/token-cache.d.ts.map +1 -0
- package/dist/cache/token-cache.js +88 -0
- package/dist/cache/token-cache.js.map +1 -0
- package/dist/clients/http-client.d.ts +41 -0
- package/dist/clients/http-client.d.ts.map +1 -0
- package/dist/clients/http-client.js +121 -0
- package/dist/clients/http-client.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/soroswap-sdk.d.ts +78 -0
- package/dist/soroswap-sdk.d.ts.map +1 -0
- package/dist/soroswap-sdk.js +173 -0
- package/dist/soroswap-sdk.js.map +1 -0
- package/dist/types/auth.d.ts +16 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +3 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/common.d.ts +24 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +31 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/index.d.ts +184 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +48 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/quote.d.ts +78 -0
- package/dist/types/quote.d.ts.map +1 -0
- package/dist/types/quote.js +3 -0
- package/dist/types/quote.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SupportedProtocols = exports.SupportedNetworks = exports.SupportedPlatforms = exports.SupportedAssetLists = void 0;
|
|
4
|
+
// Asset list types
|
|
5
|
+
var SupportedAssetLists;
|
|
6
|
+
(function (SupportedAssetLists) {
|
|
7
|
+
SupportedAssetLists["SOROSWAP"] = "https://raw.githubusercontent.com/soroswap/token-list/main/tokenList.json";
|
|
8
|
+
SupportedAssetLists["STELLAR_EXPERT"] = "https://api.stellar.expert/explorer/public/asset-list/top50";
|
|
9
|
+
SupportedAssetLists["LOBSTR"] = "https://lobstr.co/api/v1/sep/assets/curated.json";
|
|
10
|
+
SupportedAssetLists["AQUA"] = "https://amm-api.aqua.network/tokens/?format=json&pooled=true&size=200";
|
|
11
|
+
})(SupportedAssetLists || (exports.SupportedAssetLists = SupportedAssetLists = {}));
|
|
12
|
+
var SupportedPlatforms;
|
|
13
|
+
(function (SupportedPlatforms) {
|
|
14
|
+
SupportedPlatforms["SDEX"] = "sdex";
|
|
15
|
+
SupportedPlatforms["AGGREGATOR"] = "aggregator";
|
|
16
|
+
SupportedPlatforms["ROUTER"] = "router";
|
|
17
|
+
})(SupportedPlatforms || (exports.SupportedPlatforms = SupportedPlatforms = {}));
|
|
18
|
+
var SupportedNetworks;
|
|
19
|
+
(function (SupportedNetworks) {
|
|
20
|
+
SupportedNetworks["TESTNET"] = "testnet";
|
|
21
|
+
SupportedNetworks["MAINNET"] = "mainnet";
|
|
22
|
+
})(SupportedNetworks || (exports.SupportedNetworks = SupportedNetworks = {}));
|
|
23
|
+
var SupportedProtocols;
|
|
24
|
+
(function (SupportedProtocols) {
|
|
25
|
+
SupportedProtocols["SOROSWAP"] = "soroswap";
|
|
26
|
+
SupportedProtocols["PHOENIX"] = "phoenix";
|
|
27
|
+
SupportedProtocols["AQUA"] = "aqua";
|
|
28
|
+
SupportedProtocols["COMET"] = "comet";
|
|
29
|
+
SupportedProtocols["SDEX"] = "sdex";
|
|
30
|
+
})(SupportedProtocols || (exports.SupportedProtocols = SupportedProtocols = {}));
|
|
31
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":";;;AAGA,mBAAmB;AACnB,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,6GAAsF,CAAA;IACtF,qGAA8E,CAAA;IAC9E,kFAA2D,CAAA;IAC3D,qGAA8E,CAAA;AAChF,CAAC,EALW,mBAAmB,mCAAnB,mBAAmB,QAK9B;AAED,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,+CAAyB,CAAA;IACzB,uCAAiB,CAAA;AACnB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B;AAED,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,wCAAmB,CAAA;AACrB,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B;AAED,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,2CAAqB,CAAA;IACrB,yCAAmB,CAAA;IACnB,mCAAa,CAAA;IACb,qCAAe,CAAA;IACf,mCAAa,CAAA;AACf,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
export * from './auth';
|
|
2
|
+
export * from './common';
|
|
3
|
+
export * from './quote';
|
|
4
|
+
export type Network = 'mainnet' | 'testnet';
|
|
5
|
+
export type TradeType = 'EXACT_IN' | 'EXACT_OUT';
|
|
6
|
+
export declare enum SupportedAssetLists {
|
|
7
|
+
SOROSWAP = "https://raw.githubusercontent.com/soroswap/token-list/main/tokenList.json",
|
|
8
|
+
STELLAR_EXPERT = "https://api.stellar.expert/explorer/public/asset-list/top50",
|
|
9
|
+
LOBSTR = "https://lobstr.co/api/v1/sep/assets/curated.json",
|
|
10
|
+
AQUA = "https://amm-api.aqua.network/tokens/?format=json&pooled=true&size=200"
|
|
11
|
+
}
|
|
12
|
+
export declare enum SupportedPlatforms {
|
|
13
|
+
SDEX = "sdex",
|
|
14
|
+
AGGREGATOR = "aggregator",
|
|
15
|
+
ROUTER = "router"
|
|
16
|
+
}
|
|
17
|
+
export declare enum SupportedNetworks {
|
|
18
|
+
TESTNET = "testnet",
|
|
19
|
+
MAINNET = "mainnet"
|
|
20
|
+
}
|
|
21
|
+
export declare enum SupportedProtocols {
|
|
22
|
+
SOROSWAP = "soroswap",
|
|
23
|
+
PHOENIX = "phoenix",
|
|
24
|
+
AQUA = "aqua",
|
|
25
|
+
COMET = "comet",
|
|
26
|
+
SDEX = "sdex"
|
|
27
|
+
}
|
|
28
|
+
export interface AuthRegisterDto {
|
|
29
|
+
username: string;
|
|
30
|
+
password: string;
|
|
31
|
+
email: string;
|
|
32
|
+
}
|
|
33
|
+
export interface AuthLoginDto {
|
|
34
|
+
email: string;
|
|
35
|
+
password: string;
|
|
36
|
+
}
|
|
37
|
+
export interface AuthResponse {
|
|
38
|
+
username: string;
|
|
39
|
+
role: string;
|
|
40
|
+
access_token: string;
|
|
41
|
+
refresh_token: string;
|
|
42
|
+
}
|
|
43
|
+
export interface QuoteRequest {
|
|
44
|
+
assetIn: string;
|
|
45
|
+
assetOut: string;
|
|
46
|
+
amount: bigint;
|
|
47
|
+
tradeType: TradeType;
|
|
48
|
+
protocols: SupportedProtocols[];
|
|
49
|
+
parts?: number;
|
|
50
|
+
slippageTolerance?: string;
|
|
51
|
+
maxHops?: number;
|
|
52
|
+
assetList?: SupportedAssetLists[];
|
|
53
|
+
feeBps?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface BuildQuoteDto {
|
|
56
|
+
quote: QuoteResponse;
|
|
57
|
+
referralId?: string;
|
|
58
|
+
from?: string;
|
|
59
|
+
to?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface PriceImpact {
|
|
62
|
+
numerator: string;
|
|
63
|
+
denominator: string;
|
|
64
|
+
}
|
|
65
|
+
export interface TradeDistribution {
|
|
66
|
+
protocol_id: string;
|
|
67
|
+
path: string[];
|
|
68
|
+
parts: number;
|
|
69
|
+
is_exact_in: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface Trade {
|
|
72
|
+
amountIn: string;
|
|
73
|
+
amountOutMin: string;
|
|
74
|
+
expectedAmountOut: string;
|
|
75
|
+
distribution: TradeDistribution[];
|
|
76
|
+
}
|
|
77
|
+
export interface QuoteResponse {
|
|
78
|
+
assetIn: string;
|
|
79
|
+
assetOut: string;
|
|
80
|
+
tradeType: TradeType;
|
|
81
|
+
priceImpact: PriceImpact;
|
|
82
|
+
trade: Trade;
|
|
83
|
+
feeBps?: number;
|
|
84
|
+
feeAmount?: string;
|
|
85
|
+
xdr?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface SendXdrDto {
|
|
88
|
+
xdr: string;
|
|
89
|
+
fee: number;
|
|
90
|
+
}
|
|
91
|
+
export interface SendResponse {
|
|
92
|
+
hash: string;
|
|
93
|
+
status: string;
|
|
94
|
+
}
|
|
95
|
+
export interface Pool {
|
|
96
|
+
protocol: string;
|
|
97
|
+
address: string;
|
|
98
|
+
tokenA: string;
|
|
99
|
+
tokenB: string;
|
|
100
|
+
reserveA: string;
|
|
101
|
+
reserveB: string;
|
|
102
|
+
ledger: number;
|
|
103
|
+
}
|
|
104
|
+
export interface Asset {
|
|
105
|
+
name: string;
|
|
106
|
+
contract: string;
|
|
107
|
+
code: string;
|
|
108
|
+
icon: string;
|
|
109
|
+
decimals: number;
|
|
110
|
+
issuer?: string;
|
|
111
|
+
}
|
|
112
|
+
export interface TokensByNetwork {
|
|
113
|
+
network: string;
|
|
114
|
+
assets: Asset[];
|
|
115
|
+
}
|
|
116
|
+
export interface AddLiquidityDto {
|
|
117
|
+
assetA: string;
|
|
118
|
+
assetB: string;
|
|
119
|
+
amountA: string;
|
|
120
|
+
amountB: string;
|
|
121
|
+
to: string;
|
|
122
|
+
slippageTolerance?: string;
|
|
123
|
+
}
|
|
124
|
+
export interface RemoveLiquidityDto {
|
|
125
|
+
assetA: string;
|
|
126
|
+
assetB: string;
|
|
127
|
+
liquidity: string;
|
|
128
|
+
amountA: string;
|
|
129
|
+
amountB: string;
|
|
130
|
+
to: string;
|
|
131
|
+
slippageTolerance?: string;
|
|
132
|
+
}
|
|
133
|
+
export interface UserPosition {
|
|
134
|
+
poolInfo: Pool;
|
|
135
|
+
userPosition: string;
|
|
136
|
+
}
|
|
137
|
+
export interface HealthStatus {
|
|
138
|
+
indexer: {
|
|
139
|
+
mainnet: string[];
|
|
140
|
+
testnet: string[];
|
|
141
|
+
};
|
|
142
|
+
reachable: boolean;
|
|
143
|
+
}
|
|
144
|
+
export interface HealthResponse {
|
|
145
|
+
status: HealthStatus;
|
|
146
|
+
}
|
|
147
|
+
export interface ContractResponse {
|
|
148
|
+
address: string;
|
|
149
|
+
}
|
|
150
|
+
export interface AssetListMetadata {
|
|
151
|
+
name: string;
|
|
152
|
+
url: string;
|
|
153
|
+
}
|
|
154
|
+
export interface AssetListDetail {
|
|
155
|
+
name: string;
|
|
156
|
+
provider: string;
|
|
157
|
+
description: string;
|
|
158
|
+
assets: Asset[];
|
|
159
|
+
}
|
|
160
|
+
export interface PriceData {
|
|
161
|
+
asset: string;
|
|
162
|
+
referenceCurrency: string;
|
|
163
|
+
price: string;
|
|
164
|
+
}
|
|
165
|
+
export interface SoroswapSDKConfig {
|
|
166
|
+
email: string;
|
|
167
|
+
password: string;
|
|
168
|
+
defaultNetwork?: Network;
|
|
169
|
+
timeout?: number;
|
|
170
|
+
}
|
|
171
|
+
export interface APIError {
|
|
172
|
+
message: string;
|
|
173
|
+
statusCode: number;
|
|
174
|
+
timestamp?: string;
|
|
175
|
+
path?: string;
|
|
176
|
+
}
|
|
177
|
+
export interface TokenData {
|
|
178
|
+
access_token: string;
|
|
179
|
+
refresh_token: string;
|
|
180
|
+
expires_at: number;
|
|
181
|
+
username: string;
|
|
182
|
+
role: string;
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":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;CACtB;AAGD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;CACjB;AAGD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB;AAGD,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.SupportedProtocols = exports.SupportedNetworks = exports.SupportedPlatforms = exports.SupportedAssetLists = void 0;
|
|
18
|
+
__exportStar(require("./auth"), exports);
|
|
19
|
+
__exportStar(require("./common"), exports);
|
|
20
|
+
__exportStar(require("./quote"), exports);
|
|
21
|
+
// Asset list types
|
|
22
|
+
var SupportedAssetLists;
|
|
23
|
+
(function (SupportedAssetLists) {
|
|
24
|
+
SupportedAssetLists["SOROSWAP"] = "https://raw.githubusercontent.com/soroswap/token-list/main/tokenList.json";
|
|
25
|
+
SupportedAssetLists["STELLAR_EXPERT"] = "https://api.stellar.expert/explorer/public/asset-list/top50";
|
|
26
|
+
SupportedAssetLists["LOBSTR"] = "https://lobstr.co/api/v1/sep/assets/curated.json";
|
|
27
|
+
SupportedAssetLists["AQUA"] = "https://amm-api.aqua.network/tokens/?format=json&pooled=true&size=200";
|
|
28
|
+
})(SupportedAssetLists || (exports.SupportedAssetLists = SupportedAssetLists = {}));
|
|
29
|
+
var SupportedPlatforms;
|
|
30
|
+
(function (SupportedPlatforms) {
|
|
31
|
+
SupportedPlatforms["SDEX"] = "sdex";
|
|
32
|
+
SupportedPlatforms["AGGREGATOR"] = "aggregator";
|
|
33
|
+
SupportedPlatforms["ROUTER"] = "router";
|
|
34
|
+
})(SupportedPlatforms || (exports.SupportedPlatforms = SupportedPlatforms = {}));
|
|
35
|
+
var SupportedNetworks;
|
|
36
|
+
(function (SupportedNetworks) {
|
|
37
|
+
SupportedNetworks["TESTNET"] = "testnet";
|
|
38
|
+
SupportedNetworks["MAINNET"] = "mainnet";
|
|
39
|
+
})(SupportedNetworks || (exports.SupportedNetworks = SupportedNetworks = {}));
|
|
40
|
+
var SupportedProtocols;
|
|
41
|
+
(function (SupportedProtocols) {
|
|
42
|
+
SupportedProtocols["SOROSWAP"] = "soroswap";
|
|
43
|
+
SupportedProtocols["PHOENIX"] = "phoenix";
|
|
44
|
+
SupportedProtocols["AQUA"] = "aqua";
|
|
45
|
+
SupportedProtocols["COMET"] = "comet";
|
|
46
|
+
SupportedProtocols["SDEX"] = "sdex";
|
|
47
|
+
})(SupportedProtocols || (exports.SupportedProtocols = SupportedProtocols = {}));
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,2CAAyB;AACzB,0CAAwB;AAQxB,mBAAmB;AACnB,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,6GAAsF,CAAA;IACtF,qGAA8E,CAAA;IAC9E,kFAA2D,CAAA;IAC3D,qGAA8E,CAAA;AAChF,CAAC,EALW,mBAAmB,mCAAnB,mBAAmB,QAK9B;AAED,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,+CAAyB,CAAA;IACzB,uCAAiB,CAAA;AACnB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B;AAED,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,wCAAmB,CAAA;AACrB,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B;AAED,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,2CAAqB,CAAA;IACrB,yCAAmB,CAAA;IACnB,mCAAa,CAAA;IACb,qCAAe,CAAA;IACf,mCAAa,CAAA;AACf,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { SupportedAssetLists, SupportedPlatforms, SupportedProtocols, TradeType } from "./common";
|
|
2
|
+
export interface QuoteRequest {
|
|
3
|
+
assetIn: string;
|
|
4
|
+
assetOut: string;
|
|
5
|
+
amount: bigint;
|
|
6
|
+
tradeType: TradeType;
|
|
7
|
+
protocols: SupportedProtocols[];
|
|
8
|
+
parts?: number;
|
|
9
|
+
slippageTolerance?: string;
|
|
10
|
+
maxHops?: number;
|
|
11
|
+
assetList?: SupportedAssetLists[];
|
|
12
|
+
feeBps?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface BuildQuoteRequest {
|
|
15
|
+
quote: BuildSplitTradeReturn | BuildTradeReturn;
|
|
16
|
+
from?: string;
|
|
17
|
+
to?: string;
|
|
18
|
+
referralId?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface CommonBuildTradeReturnFields {
|
|
21
|
+
assetIn: string;
|
|
22
|
+
assetOut: string;
|
|
23
|
+
priceImpact: {
|
|
24
|
+
numerator: bigint;
|
|
25
|
+
denominator: bigint;
|
|
26
|
+
};
|
|
27
|
+
platform: SupportedPlatforms;
|
|
28
|
+
feeBps?: number;
|
|
29
|
+
feeAmount?: bigint;
|
|
30
|
+
}
|
|
31
|
+
export interface ExactInBuildTradeReturn extends CommonBuildTradeReturnFields {
|
|
32
|
+
tradeType: 'EXACT_IN';
|
|
33
|
+
trade: {
|
|
34
|
+
amountIn: bigint;
|
|
35
|
+
amountOutMin: bigint;
|
|
36
|
+
expectedAmountOut?: bigint;
|
|
37
|
+
path: string[];
|
|
38
|
+
poolHashes?: string[];
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface ExactOutBuildTradeReturn extends CommonBuildTradeReturnFields {
|
|
42
|
+
tradeType: 'EXACT_OUT';
|
|
43
|
+
trade: {
|
|
44
|
+
amountOut: bigint;
|
|
45
|
+
amountInMax: bigint;
|
|
46
|
+
expectedAmountIn?: bigint;
|
|
47
|
+
path: string[];
|
|
48
|
+
poolHashes?: string[];
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export interface DistributionReturn {
|
|
52
|
+
protocol_id: SupportedProtocols;
|
|
53
|
+
path: string[];
|
|
54
|
+
parts: number;
|
|
55
|
+
is_exact_in: boolean;
|
|
56
|
+
poolHashes?: string[];
|
|
57
|
+
}
|
|
58
|
+
export interface ExactInSplitBuildTradeReturn extends CommonBuildTradeReturnFields {
|
|
59
|
+
tradeType: 'EXACT_IN';
|
|
60
|
+
trade: {
|
|
61
|
+
amountIn: bigint;
|
|
62
|
+
amountOutMin: bigint;
|
|
63
|
+
expectedAmountOut?: bigint;
|
|
64
|
+
distribution: DistributionReturn[];
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface ExactOutSplitBuildTradeReturn extends CommonBuildTradeReturnFields {
|
|
68
|
+
tradeType: 'EXACT_OUT';
|
|
69
|
+
trade: {
|
|
70
|
+
amountOut: bigint;
|
|
71
|
+
amountInMax: bigint;
|
|
72
|
+
expectedAmountIn?: bigint;
|
|
73
|
+
distribution: DistributionReturn[];
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export type BuildTradeReturn = ExactInBuildTradeReturn | ExactOutBuildTradeReturn;
|
|
77
|
+
export type BuildSplitTradeReturn = ExactInSplitBuildTradeReturn | ExactOutSplitBuildTradeReturn;
|
|
78
|
+
//# sourceMappingURL=quote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote.d.ts","sourceRoot":"","sources":["../../src/types/quote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGlG,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,M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ACzB,IAAI,EAAE,MAAM,EAAE,CAAA;QACd,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;KACtB,CAAA;CACF;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB;AAED,MAAM,WAAW,4BAA6B,SAAQ,4BAA4B;IAChF,SAAS,EAAE,UAAU,CAAA;IACrB,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM,CAAA;QAChB,YAAY,EAAE,MAAM,CAAA;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAA;QAC1B,YAAY,EAAE,kBAAkB,EAAE,CAAA;KACnC,CAAA;CACF;AAED,MAAM,WAAW,6BAA8B,SAAQ,4BAA4B;IACjF,SAAS,EAAE,WAAW,CAAA;IACtB,KAAK,EAAE;QACL,SAAS,EAAE,MAAM,CAAA;QACjB,WAAW,EAAE,MAAM,CAAA;QACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;QACzB,YAAY,EAAE,kBAAkB,EAAE,CAAA;KACnC,CAAA;CACF;AAED,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,GAAG,wBAAwB,CAAA;AAEjF,MAAM,MAAM,qBAAqB,GAAG,4BAA4B,GAAG,6BAA6B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote.js","sourceRoot":"","sources":["../../src/types/quote.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@soroswap/sdk",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Official TypeScript SDK for Soroswap.Finance API - DEX and exchange aggregator on Stellar",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/**/*",
|
|
9
|
+
"README.md",
|
|
10
|
+
"LICENSE"
|
|
11
|
+
],
|
|
12
|
+
"keywords": [
|
|
13
|
+
"soroswap",
|
|
14
|
+
"stellar",
|
|
15
|
+
"soroban",
|
|
16
|
+
"dex",
|
|
17
|
+
"defi",
|
|
18
|
+
"aggregator",
|
|
19
|
+
"swap",
|
|
20
|
+
"liquidity",
|
|
21
|
+
"sdk",
|
|
22
|
+
"typescript"
|
|
23
|
+
],
|
|
24
|
+
"author": "Soroswap Team",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/soroswap/sdk.git"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/soroswap/sdk/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://soroswap.finance",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
36
|
+
"@eslint/js": "^9.30.0",
|
|
37
|
+
"@types/jest": "^30.0.0",
|
|
38
|
+
"@types/node": "^24.0.4",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^8.35.0",
|
|
40
|
+
"@typescript-eslint/parser": "^8.35.0",
|
|
41
|
+
"dotenv": "^16.5.0",
|
|
42
|
+
"eslint": "^9.29.0",
|
|
43
|
+
"globals": "^16.2.0",
|
|
44
|
+
"jest": "^30.0.3",
|
|
45
|
+
"rimraf": "^6.0.1",
|
|
46
|
+
"ts-jest": "^29.4.0",
|
|
47
|
+
"typescript": "^5.8.3"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"axios": "^1.10.0"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=16.0.0"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsc",
|
|
57
|
+
"build:watch": "tsc --watch",
|
|
58
|
+
"test": "jest",
|
|
59
|
+
"test:unit": "jest",
|
|
60
|
+
"test:integration": "jest --config=jest.integration.config.js",
|
|
61
|
+
"test:all": "pnpm run test:unit && pnpm run test:integration",
|
|
62
|
+
"test:watch": "jest --watch",
|
|
63
|
+
"test:coverage": "jest --coverage",
|
|
64
|
+
"lint": "eslint src/**/*.ts",
|
|
65
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
66
|
+
"clean": "rimraf dist"
|
|
67
|
+
}
|
|
68
|
+
}
|