@cityofzion/blockchain-service 1.1.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.
@@ -70,10 +70,10 @@ class BSAggregator {
70
70
  }
71
71
  if (index !== 0) {
72
72
  try {
73
- const { totalCount } = yield service.blockchainDataService.getTransactionsByAddress({
73
+ const { transactions } = yield service.blockchainDataService.getTransactionsByAddress({
74
74
  address: generatedAccount.address,
75
75
  });
76
- if (!totalCount || totalCount <= 0)
76
+ if (!transactions || transactions.length <= 0)
77
77
  hasError = true;
78
78
  }
79
79
  catch (_a) {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './interfaces';
2
1
  export * from './BSAggregator';
3
- export * from './functions';
4
2
  export * from './CryptoCompareEDS';
3
+ export * from './functions';
4
+ export * from './interfaces';
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./interfaces"), exports);
18
17
  __exportStar(require("./BSAggregator"), exports);
19
- __exportStar(require("./functions"), exports);
20
18
  __exportStar(require("./CryptoCompareEDS"), exports);
19
+ __exportStar(require("./functions"), exports);
20
+ __exportStar(require("./interfaces"), exports);
@@ -109,15 +109,12 @@ export type ContractParameter = {
109
109
  type: string;
110
110
  };
111
111
  export type TransactionsByAddressResponse = {
112
- totalCount?: number;
113
- limit?: number;
114
- nextCursor?: string;
115
112
  transactions: TransactionResponse[];
113
+ nextPageParams?: any;
116
114
  };
117
115
  export type TransactionsByAddressParams = {
118
116
  address: string;
119
- page?: number;
120
- cursor?: string;
117
+ nextPageParams?: any;
121
118
  };
122
119
  export type ContractMethod = {
123
120
  name: string;
@@ -230,12 +227,12 @@ export interface LedgerService {
230
227
  getPublicKey(transport: Transport): Promise<string>;
231
228
  }
232
229
  export type SwapRoute = {
233
- assetToUseSymbol: string;
234
- reservesToUse: string;
235
- assetToReceiveSymbol: string;
236
- reservesToReceive: string;
230
+ tokenToUse: Token;
231
+ reserveTokenToUse: string;
232
+ tokenToReceive: Token;
233
+ reserveTokenToReceive: string;
237
234
  };
238
- export type SwapControllerServiceEvents = {
235
+ export type SwapServiceEvents = {
239
236
  accountToUse: (account: Account | null) => void | Promise<void>;
240
237
  amountToUse: (amount: string | null) => void | Promise<void>;
241
238
  tokenToUse: (token: Token | null) => void | Promise<void>;
@@ -250,38 +247,38 @@ export type SwapControllerServiceEvents = {
250
247
  liquidityProviderFee: (liquidityProviderFee: string | null) => void | Promise<void>;
251
248
  priceImpact: (priceImpact: string | null) => void | Promise<void>;
252
249
  priceInverse: (priceInverse: string | null) => void | Promise<void>;
253
- routes: (routes: SwapRoute[] | null) => void | Promise<void>;
250
+ route: (route: SwapRoute[] | null) => void | Promise<void>;
254
251
  lastAmountChanged: (lastAmountChanged: 'amountToUse' | 'amountToReceive' | null) => void | Promise<void>;
255
252
  };
256
- export type SwapControllerServiceSwapArgs<T extends string> = {
257
- amountToUse: string;
258
- amountToReceive: string;
259
- tokenToUse: Token;
260
- tokenToReceive: Token;
253
+ export type SwapServiceSwapArgs<T extends string> = {
261
254
  address: string;
255
+ routePath: Token[];
262
256
  deadline: string;
263
257
  network: Network<T>;
264
258
  };
265
- export type SwapControllerServiceSwapToUseArgs<T extends string> = {
259
+ export type SwapServiceSwapToUseArgs<T extends string> = {
260
+ amountToUse: string;
266
261
  minimumReceived: string;
267
262
  type: 'swapTokenToUse';
268
- } & SwapControllerServiceSwapArgs<T>;
269
- export type SwapControllerServiceSwapToReceiveArgs<T extends string> = {
263
+ } & SwapServiceSwapArgs<T>;
264
+ export type SwapServiceSwapToReceiveArgs<T extends string> = {
265
+ amountToReceive: string;
270
266
  maximumSelling: string;
271
267
  type: 'swapTokenToReceive';
272
- } & SwapControllerServiceSwapArgs<T>;
273
- export interface SwapControllerService<AvailableNetworkIds extends string> {
274
- 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>;
275
273
  setAccountToUse(account: Account | null): void;
276
274
  setAmountToUse(amount: string | null): void;
277
- setTokenToUse(token: Token | null): void;
278
275
  setAmountToReceive(amount: string | null): void;
279
- setTokenToReceive(token: Token | null): void;
280
276
  setDeadline(deadline: string): void;
281
277
  setSlippage(slippage: number): void;
282
- swap(isLedger?: boolean): void;
283
- buildSwapArgs(): SwapControllerServiceSwapToUseArgs<AvailableNetworkIds> | SwapControllerServiceSwapToReceiveArgs<AvailableNetworkIds>;
284
- setReserves(): void;
278
+ setTokenToUse(token: Token | null): void;
279
+ setTokenToReceive(token: Token | null): void;
285
280
  startListeningBlockGeneration(): void;
286
281
  stopListeningBlockGeneration(): void;
282
+ listSwappableTokens(network: Network<AvailableNetworkIds>): PoolGraph;
283
+ swap(isLedger?: boolean): void;
287
284
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/blockchain-service",
3
- "version": "1.1.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",