@pioneer-platform/changelly-client 8.3.5 → 8.3.7

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/lib/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  declare let Changelly: any;
2
- declare const TAG = " | blocknative | ";
2
+ declare const TAG = " | Changelly | ";
3
3
  declare const CHANGELLY_API_KEY: string | undefined;
4
4
  declare const CHANGELLY_API_SECRET: string | undefined;
5
5
  declare let changelly: any;
6
- declare let ChainToNetworkId: any;
6
+ declare let ChainToNetworkId: any, caipToNetworkId: any, shortListSymbolToCaip: any;
7
7
  declare let networkSupport: any[];
8
8
  declare function get_currencies(): Promise<any>;
9
9
  declare function create_transaction(from: string, to: string, address: string, amount: number, extraId?: string): Promise<any>;
package/lib/index.js CHANGED
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  var Changelly = require('@bithighlander/changelly');
39
- var TAG = " | blocknative | ";
39
+ var TAG = " | Changelly | ";
40
40
  var CHANGELLY_API_KEY = process.env['CHANGELLY_API_KEY'];
41
41
  var CHANGELLY_API_SECRET = process.env['CHANGELLY_API_SECRET'];
42
42
  if (!CHANGELLY_API_KEY)
@@ -44,7 +44,7 @@ if (!CHANGELLY_API_KEY)
44
44
  if (!CHANGELLY_API_SECRET)
45
45
  throw new Error('CHANGELLY_API_SECRET not set');
46
46
  var changelly;
47
- var ChainToNetworkId = require("@pioneer-platform/pioneer-caip").ChainToNetworkId;
47
+ var _a = require("@pioneer-platform/pioneer-caip"), ChainToNetworkId = _a.ChainToNetworkId, caipToNetworkId = _a.caipToNetworkId, shortListSymbolToCaip = _a.shortListSymbolToCaip;
48
48
  var networkSupport = [
49
49
  ChainToNetworkId["XRP"],
50
50
  ChainToNetworkId["DASH"],
@@ -128,9 +128,22 @@ function create_transaction(from, to, address, amount, extraId) {
128
128
  quoteMode: "CHANGELLY"
129
129
  };
130
130
  output.complete = true;
131
- return [4 /*yield*/, changelly.createTransaction(from, to, address, amount, extraId)];
131
+ return [4 /*yield*/, new Promise(function (resolve, reject) {
132
+ changelly.createTransaction(from, to, address, amount, extraId, function (err, data) {
133
+ if (err) {
134
+ reject(err);
135
+ }
136
+ else {
137
+ resolve(data);
138
+ }
139
+ });
140
+ })];
132
141
  case 1:
133
142
  data = _a.sent();
143
+ console.log("data:", data);
144
+ data = data.result;
145
+ if (!data)
146
+ throw Error("Failed to create quote@changelly");
134
147
  if (!data.payinAddress)
135
148
  throw Error("Failed to create quote@changelly");
136
149
  if (!data.id)
@@ -138,6 +151,7 @@ function create_transaction(from, to, address, amount, extraId) {
138
151
  output.id = data.id;
139
152
  tx = {
140
153
  type: "transfer",
154
+ chain: caipToNetworkId(shortListSymbolToCaip[from]),
141
155
  txParams: {
142
156
  address: data.payinAddress,
143
157
  amount: amount,
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@pioneer-platform/changelly-client",
3
- "version": "8.3.5",
3
+ "version": "8.3.7",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "dependencies": {
7
7
  "@bithighlander/changelly": "^1.0.0",
8
8
  "@pioneer-platform/loggerdog": "^8.3.1",
9
+ "@pioneer-platform/pioneer-caip": "^9.2.13",
9
10
  "axios": "^1.3.4",
10
11
  "dotenv": "^8.2.0",
11
12
  "jayson": "^4.1.0",