@pioneer-platform/rango-client 8.4.0 → 8.4.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/CHANGELOG.md +10 -0
- package/package.json +12 -12
- package/lib/index.d.ts +0 -68
- package/lib/index.js +0 -190
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @pioneer-platform/rango-client
|
|
2
2
|
|
|
3
|
+
## 8.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Automated patch version bump for all packages
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @pioneer-platform/loggerdog@8.4.1
|
|
10
|
+
- @pioneer-platform/pioneer-coins@9.4.1
|
|
11
|
+
- @pioneer-platform/pioneer-caip@9.3.1
|
|
12
|
+
|
|
3
13
|
## 8.4.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pioneer-platform/rango-client",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.1",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@pioneer-platform/loggerdog": "^8.4.
|
|
8
|
-
"@pioneer-platform/pioneer-caip": "9.3.
|
|
9
|
-
"@pioneer-platform/pioneer-coins": "^9.4.
|
|
7
|
+
"@pioneer-platform/loggerdog": "^8.4.1",
|
|
8
|
+
"@pioneer-platform/pioneer-caip": "9.3.1",
|
|
9
|
+
"@pioneer-platform/pioneer-coins": "^9.4.1",
|
|
10
10
|
"axios": "^1.6.0",
|
|
11
11
|
"dotenv": "^8.2.0",
|
|
12
12
|
"rango-sdk": "^0.1.45"
|
|
13
13
|
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"npm": "pnpm i",
|
|
16
|
+
"test": "pnpm run build && node __tests__/test-module.js",
|
|
17
|
+
"build": "tsc -p .",
|
|
18
|
+
"prepublish": "pnpm run build",
|
|
19
|
+
"refresh": "rm -rf ./node_modules ./package-lock.json && pnpm install"
|
|
20
|
+
},
|
|
14
21
|
"devDependencies": {
|
|
15
22
|
"@types/jest": "^25.2.3",
|
|
16
23
|
"@types/node": "^18.16.0",
|
|
@@ -21,12 +28,5 @@
|
|
|
21
28
|
"ts-jest": "^29.0.5",
|
|
22
29
|
"typescript": "^5.0.4"
|
|
23
30
|
},
|
|
24
|
-
"gitHead": "a76012f6693a12181c4744e53e977a9eaeef0ed3"
|
|
25
|
-
"scripts": {
|
|
26
|
-
"npm": "pnpm i",
|
|
27
|
-
"test": "pnpm run build && node __tests__/test-module.js",
|
|
28
|
-
"build": "tsc -p .",
|
|
29
|
-
"prepublish": "pnpm run build",
|
|
30
|
-
"refresh": "rm -rf ./node_modules ./package-lock.json && pnpm install"
|
|
31
|
-
}
|
|
31
|
+
"gitHead": "a76012f6693a12181c4744e53e977a9eaeef0ed3"
|
|
32
32
|
}
|
package/lib/index.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
declare const TAG = " | rango | ";
|
|
2
|
-
type BestRouteResponse = any;
|
|
3
|
-
type EvmTransaction = any;
|
|
4
|
-
type MetaResponse = any;
|
|
5
|
-
type TransactionStatus = any;
|
|
6
|
-
type TransactionStatusResponse = any;
|
|
7
|
-
type WalletRequiredAssets = any;
|
|
8
|
-
declare let getRangoBlockchainName: any;
|
|
9
|
-
declare const log: any;
|
|
10
|
-
declare let shortListSymbolToCaip: any, caipToNetworkId: any;
|
|
11
|
-
declare const mockRangoClient: {
|
|
12
|
-
getAllMetadata: () => Promise<{}>;
|
|
13
|
-
getBestRoute: () => Promise<{
|
|
14
|
-
requestId: string;
|
|
15
|
-
result: {
|
|
16
|
-
outputAmount: string;
|
|
17
|
-
};
|
|
18
|
-
}>;
|
|
19
|
-
createTransaction: () => Promise<{
|
|
20
|
-
transaction: {
|
|
21
|
-
to: string;
|
|
22
|
-
from: string;
|
|
23
|
-
};
|
|
24
|
-
}>;
|
|
25
|
-
checkStatus: () => Promise<{
|
|
26
|
-
status: string;
|
|
27
|
-
}>;
|
|
28
|
-
};
|
|
29
|
-
declare let rango: {
|
|
30
|
-
getAllMetadata: () => Promise<{}>;
|
|
31
|
-
getBestRoute: () => Promise<{
|
|
32
|
-
requestId: string;
|
|
33
|
-
result: {
|
|
34
|
-
outputAmount: string;
|
|
35
|
-
};
|
|
36
|
-
}>;
|
|
37
|
-
createTransaction: () => Promise<{
|
|
38
|
-
transaction: {
|
|
39
|
-
to: string;
|
|
40
|
-
from: string;
|
|
41
|
-
};
|
|
42
|
-
}>;
|
|
43
|
-
checkStatus: () => Promise<{
|
|
44
|
-
status: string;
|
|
45
|
-
}>;
|
|
46
|
-
};
|
|
47
|
-
declare let networkSupport: any[];
|
|
48
|
-
declare let assetSupport: any[];
|
|
49
|
-
declare const get_transaction_status: (requestId: string, step: number, txid: string) => Promise<{
|
|
50
|
-
status: string;
|
|
51
|
-
txId: string;
|
|
52
|
-
requestId: string;
|
|
53
|
-
step: number;
|
|
54
|
-
} | undefined>;
|
|
55
|
-
declare const create_transaction: (id: any, step: number, validateBalance?: boolean, validateFee?: boolean) => Promise<{
|
|
56
|
-
transaction: {
|
|
57
|
-
to: string;
|
|
58
|
-
from: string;
|
|
59
|
-
data: string;
|
|
60
|
-
value: string;
|
|
61
|
-
gasLimit: string;
|
|
62
|
-
gasPrice: string;
|
|
63
|
-
maxPriorityFeePerGas: string;
|
|
64
|
-
maxFeePerGas: string;
|
|
65
|
-
nonce: number;
|
|
66
|
-
};
|
|
67
|
-
} | undefined>;
|
|
68
|
-
declare const get_quote: (quote: any) => Promise<any>;
|
package/lib/index.js
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Rango Integration
|
|
4
|
-
- Highlander
|
|
5
|
-
*/
|
|
6
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
16
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
17
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
18
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
19
|
-
function step(op) {
|
|
20
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
21
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
22
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
23
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
24
|
-
switch (op[0]) {
|
|
25
|
-
case 0: case 1: t = op; break;
|
|
26
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
27
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
28
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
29
|
-
default:
|
|
30
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
31
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
32
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
33
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
34
|
-
if (t[2]) _.ops.pop();
|
|
35
|
-
_.trys.pop(); continue;
|
|
36
|
-
}
|
|
37
|
-
op = body.call(thisArg, _);
|
|
38
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
39
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
var TAG = " | rango | ";
|
|
43
|
-
var getRangoBlockchainName = require('@pioneer-platform/pioneer-coins').getRangoBlockchainName;
|
|
44
|
-
var log = require('@pioneer-platform/loggerdog')();
|
|
45
|
-
var _a = require("@pioneer-platform/pioneer-caip"), shortListSymbolToCaip = _a.shortListSymbolToCaip, caipToNetworkId = _a.caipToNetworkId;
|
|
46
|
-
// Mock rango client
|
|
47
|
-
var mockRangoClient = {
|
|
48
|
-
getAllMetadata: function () { return Promise.resolve({}); },
|
|
49
|
-
getBestRoute: function () { return Promise.resolve({ requestId: 'mock-id', result: { outputAmount: "1.23" } }); },
|
|
50
|
-
createTransaction: function () { return Promise.resolve({ transaction: { to: '0x123...', from: '0x456...' } }); },
|
|
51
|
-
checkStatus: function () { return Promise.resolve({ status: 'SUCCESS' }); }
|
|
52
|
-
};
|
|
53
|
-
var rango = mockRangoClient;
|
|
54
|
-
var networkSupport = [
|
|
55
|
-
caipToNetworkId(shortListSymbolToCaip["BASE"]),
|
|
56
|
-
caipToNetworkId(shortListSymbolToCaip["ARB"]),
|
|
57
|
-
caipToNetworkId(shortListSymbolToCaip["DOGE"]),
|
|
58
|
-
caipToNetworkId(shortListSymbolToCaip["BTC"]),
|
|
59
|
-
caipToNetworkId(shortListSymbolToCaip["ETH"]),
|
|
60
|
-
caipToNetworkId(shortListSymbolToCaip["BCH"]),
|
|
61
|
-
caipToNetworkId(shortListSymbolToCaip["GNO"]),
|
|
62
|
-
caipToNetworkId(shortListSymbolToCaip["MATIC"]),
|
|
63
|
-
caipToNetworkId(shortListSymbolToCaip["AVAX"]),
|
|
64
|
-
];
|
|
65
|
-
var assetSupport = [
|
|
66
|
-
shortListSymbolToCaip["SOLANA"],
|
|
67
|
-
shortListSymbolToCaip["BTC"],
|
|
68
|
-
shortListSymbolToCaip["ETH"],
|
|
69
|
-
shortListSymbolToCaip["BASE"],
|
|
70
|
-
shortListSymbolToCaip["GNO"],
|
|
71
|
-
shortListSymbolToCaip["MATIC"],
|
|
72
|
-
shortListSymbolToCaip["AVAX"],
|
|
73
|
-
shortListSymbolToCaip["DOGE"],
|
|
74
|
-
shortListSymbolToCaip["BCH"],
|
|
75
|
-
];
|
|
76
|
-
module.exports = {
|
|
77
|
-
init: function (settings) {
|
|
78
|
-
// Just return true, no need to initialize real client
|
|
79
|
-
return true;
|
|
80
|
-
},
|
|
81
|
-
networkSupport: function () {
|
|
82
|
-
return networkSupport;
|
|
83
|
-
},
|
|
84
|
-
assetSupport: function () {
|
|
85
|
-
return assetSupport;
|
|
86
|
-
},
|
|
87
|
-
getChains: function () {
|
|
88
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
-
return __generator(this, function (_a) {
|
|
90
|
-
return [2 /*return*/, { chains: [] }]; // Mock response
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
},
|
|
94
|
-
getQuote: function (quote) {
|
|
95
|
-
return get_quote(quote);
|
|
96
|
-
},
|
|
97
|
-
createTransaction: function (id, step, validateBalance, validateFee) {
|
|
98
|
-
return create_transaction(id, step, validateBalance, validateFee);
|
|
99
|
-
},
|
|
100
|
-
getTransactionStatus: function (requestId, step, txid) {
|
|
101
|
-
return get_transaction_status(requestId, step, txid);
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
var get_transaction_status = function (requestId, step, txid) {
|
|
105
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
-
var tag;
|
|
107
|
-
return __generator(this, function (_a) {
|
|
108
|
-
tag = TAG + " | get_transaction_status | ";
|
|
109
|
-
try {
|
|
110
|
-
// Return mock status
|
|
111
|
-
return [2 /*return*/, { status: 'SUCCESS', txId: txid, requestId: requestId, step: step }];
|
|
112
|
-
}
|
|
113
|
-
catch (e) {
|
|
114
|
-
console.error(tag, "e: ", e);
|
|
115
|
-
}
|
|
116
|
-
return [2 /*return*/];
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
var create_transaction = function (id, step, validateBalance, validateFee) {
|
|
121
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
122
|
-
var tag;
|
|
123
|
-
return __generator(this, function (_a) {
|
|
124
|
-
tag = TAG + " | create_transaction | ";
|
|
125
|
-
try {
|
|
126
|
-
// Return mock transaction
|
|
127
|
-
return [2 /*return*/, {
|
|
128
|
-
transaction: {
|
|
129
|
-
to: '0x1234567890123456789012345678901234567890',
|
|
130
|
-
from: '0x0987654321098765432109876543210987654321',
|
|
131
|
-
data: '0x',
|
|
132
|
-
value: '0x0',
|
|
133
|
-
gasLimit: '0x1',
|
|
134
|
-
gasPrice: '0x1',
|
|
135
|
-
maxPriorityFeePerGas: '0x1',
|
|
136
|
-
maxFeePerGas: '0x1',
|
|
137
|
-
nonce: 0
|
|
138
|
-
}
|
|
139
|
-
}];
|
|
140
|
-
}
|
|
141
|
-
catch (e) {
|
|
142
|
-
console.error(tag, "e: ", e);
|
|
143
|
-
}
|
|
144
|
-
return [2 /*return*/];
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
var get_quote = function (quote) {
|
|
149
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
-
var tag, output, mockRequestId;
|
|
151
|
-
var _a;
|
|
152
|
-
return __generator(this, function (_b) {
|
|
153
|
-
tag = TAG + " | get_quote | ";
|
|
154
|
-
try {
|
|
155
|
-
output = {};
|
|
156
|
-
mockRequestId = 'mock-' + Math.random().toString(36).substring(2, 15);
|
|
157
|
-
output.meta = {
|
|
158
|
-
quoteMode: "RANGO"
|
|
159
|
-
};
|
|
160
|
-
output.id = mockRequestId;
|
|
161
|
-
output.source = 'rango';
|
|
162
|
-
output.complete = true;
|
|
163
|
-
output.amountOut = "1.23"; // Mock amount
|
|
164
|
-
output.inboundAddress = '0x1234567890123456789012345678901234567890';
|
|
165
|
-
// Create mock transaction
|
|
166
|
-
output.txs = [{
|
|
167
|
-
type: "evm",
|
|
168
|
-
chain: caipToNetworkId(((_a = quote.from) === null || _a === void 0 ? void 0 : _a.blockchain) ? shortListSymbolToCaip[quote.from.blockchain] : shortListSymbolToCaip["ETH"]),
|
|
169
|
-
txParams: {
|
|
170
|
-
to: '0x1234567890123456789012345678901234567890',
|
|
171
|
-
from: '0x0987654321098765432109876543210987654321',
|
|
172
|
-
data: '0x',
|
|
173
|
-
value: '0x0',
|
|
174
|
-
gasLimit: '0x1',
|
|
175
|
-
gasPrice: '0x1',
|
|
176
|
-
maxPriorityFeePerGas: '0x1',
|
|
177
|
-
maxFeePerGas: '0x1',
|
|
178
|
-
nonce: 0
|
|
179
|
-
}
|
|
180
|
-
}];
|
|
181
|
-
return [2 /*return*/, output];
|
|
182
|
-
}
|
|
183
|
-
catch (e) {
|
|
184
|
-
console.error(tag, "e: ", e);
|
|
185
|
-
throw e;
|
|
186
|
-
}
|
|
187
|
-
return [2 /*return*/];
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
};
|