@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.
@@ -227,12 +227,12 @@ export interface LedgerService {
227
227
  getPublicKey(transport: Transport): Promise<string>;
228
228
  }
229
229
  export type SwapRoute = {
230
- assetToUseSymbol: string;
231
- reservesToUse: string;
232
- assetToReceiveSymbol: string;
233
- reservesToReceive: string;
230
+ tokenToUse: Token;
231
+ reserveTokenToUse: string;
232
+ tokenToReceive: Token;
233
+ reserveTokenToReceive: string;
234
234
  };
235
- export type SwapControllerServiceEvents = {
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
- routes: (routes: SwapRoute[] | null) => void | Promise<void>;
250
+ route: (route: SwapRoute[] | null) => void | Promise<void>;
251
251
  lastAmountChanged: (lastAmountChanged: 'amountToUse' | 'amountToReceive' | null) => void | Promise<void>;
252
252
  };
253
- export type SwapControllerServiceSwapArgs<T extends string> = {
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 SwapControllerServiceSwapToUseArgs<T extends string> = {
259
+ export type SwapServiceSwapToUseArgs<T extends string> = {
260
+ amountToUse: string;
263
261
  minimumReceived: string;
264
262
  type: 'swapTokenToUse';
265
- } & SwapControllerServiceSwapArgs<T>;
266
- export type SwapControllerServiceSwapToReceiveArgs<T extends string> = {
263
+ } & SwapServiceSwapArgs<T>;
264
+ export type SwapServiceSwapToReceiveArgs<T extends string> = {
265
+ amountToReceive: string;
267
266
  maximumSelling: string;
268
267
  type: 'swapTokenToReceive';
269
- } & SwapControllerServiceSwapArgs<T>;
270
- export interface SwapControllerService<AvailableNetworkIds extends string> {
271
- eventEmitter: TypedEmitter<SwapControllerServiceEvents>;
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
- swap(isLedger?: boolean): void;
280
- buildSwapArgs(): SwapControllerServiceSwapToUseArgs<AvailableNetworkIds> | SwapControllerServiceSwapToReceiveArgs<AvailableNetworkIds>;
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/blockchain-service",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": "https://github.com/CityOfZion/blockchain-services",