@cityofzion/blockchain-service 1.2.0 → 1.3.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/dist/interfaces.d.ts +22 -22
- package/package.json +1 -1
package/dist/interfaces.d.ts
CHANGED
|
@@ -227,12 +227,12 @@ export interface LedgerService {
|
|
|
227
227
|
getPublicKey(transport: Transport): Promise<string>;
|
|
228
228
|
}
|
|
229
229
|
export type SwapRoute = {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
230
|
+
tokenToUse: Token;
|
|
231
|
+
reserveTokenToUse: string;
|
|
232
|
+
tokenToReceive: Token;
|
|
233
|
+
reserveTokenToReceive: string;
|
|
234
234
|
};
|
|
235
|
-
export type
|
|
235
|
+
export type SwapServiceEvents = {
|
|
236
236
|
accountToUse: (account: Account | null) => void | Promise<void>;
|
|
237
237
|
amountToUse: (amount: string | null) => void | Promise<void>;
|
|
238
238
|
tokenToUse: (token: Token | null) => void | Promise<void>;
|
|
@@ -247,38 +247,38 @@ export type SwapControllerServiceEvents = {
|
|
|
247
247
|
liquidityProviderFee: (liquidityProviderFee: string | null) => void | Promise<void>;
|
|
248
248
|
priceImpact: (priceImpact: string | null) => void | Promise<void>;
|
|
249
249
|
priceInverse: (priceInverse: string | null) => void | Promise<void>;
|
|
250
|
-
|
|
250
|
+
route: (route: SwapRoute[] | null) => void | Promise<void>;
|
|
251
251
|
lastAmountChanged: (lastAmountChanged: 'amountToUse' | 'amountToReceive' | null) => void | Promise<void>;
|
|
252
252
|
};
|
|
253
|
-
export type
|
|
254
|
-
amountToUse: string;
|
|
255
|
-
amountToReceive: string;
|
|
256
|
-
tokenToUse: Token;
|
|
257
|
-
tokenToReceive: Token;
|
|
253
|
+
export type SwapServiceSwapArgs<T extends string> = {
|
|
258
254
|
address: string;
|
|
255
|
+
routePath: Token[];
|
|
259
256
|
deadline: string;
|
|
260
257
|
network: Network<T>;
|
|
261
258
|
};
|
|
262
|
-
export type
|
|
259
|
+
export type SwapServiceSwapToUseArgs<T extends string> = {
|
|
260
|
+
amountToUse: string;
|
|
263
261
|
minimumReceived: string;
|
|
264
262
|
type: 'swapTokenToUse';
|
|
265
|
-
} &
|
|
266
|
-
export type
|
|
263
|
+
} & SwapServiceSwapArgs<T>;
|
|
264
|
+
export type SwapServiceSwapToReceiveArgs<T extends string> = {
|
|
265
|
+
amountToReceive: string;
|
|
267
266
|
maximumSelling: string;
|
|
268
267
|
type: 'swapTokenToReceive';
|
|
269
|
-
} &
|
|
270
|
-
export
|
|
271
|
-
|
|
268
|
+
} & SwapServiceSwapArgs<T>;
|
|
269
|
+
export type PoolGraph = Record<string, string[]>;
|
|
270
|
+
export interface SwapService<AvailableNetworkIds extends string> {
|
|
271
|
+
eventEmitter: TypedEmitter<SwapServiceEvents>;
|
|
272
|
+
buildSwapInvocationArgs(): SwapServiceSwapToUseArgs<AvailableNetworkIds> | SwapServiceSwapToReceiveArgs<AvailableNetworkIds>;
|
|
272
273
|
setAccountToUse(account: Account | null): void;
|
|
273
274
|
setAmountToUse(amount: string | null): void;
|
|
274
|
-
setTokenToUse(token: Token | null): void;
|
|
275
275
|
setAmountToReceive(amount: string | null): void;
|
|
276
|
-
setTokenToReceive(token: Token | null): void;
|
|
277
276
|
setDeadline(deadline: string): void;
|
|
278
277
|
setSlippage(slippage: number): void;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
setReserves(): void;
|
|
278
|
+
setTokenToUse(token: Token | null): void;
|
|
279
|
+
setTokenToReceive(token: Token | null): void;
|
|
282
280
|
startListeningBlockGeneration(): void;
|
|
283
281
|
stopListeningBlockGeneration(): void;
|
|
282
|
+
listSwappableTokens(network: Network<AvailableNetworkIds>): PoolGraph;
|
|
283
|
+
swap(isLedger?: boolean): void;
|
|
284
284
|
}
|