@ultrade/shared 1.0.0 → 1.0.2
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/common/auth.helper.js +16 -37
- package/dist/common/awsKms.js +9 -19
- package/dist/common/big-number.helper.d.ts +0 -3
- package/dist/common/big-number.helper.js +7 -26
- package/dist/common/index.js +65 -107
- package/dist/common/indexer.helper.js +9 -19
- package/dist/common/logger.js +6 -16
- package/dist/common/mappers/codexAsset.mapper.js +3 -14
- package/dist/common/mappers/codexBalance.mapper.js +3 -14
- package/dist/common/mappers/index.js +15 -35
- package/dist/common/mappers/trade.mapper.js +15 -35
- package/dist/common/migration.helpers.js +3 -14
- package/dist/common/redis.helper.js +20 -40
- package/dist/common/secret.helper.js +11 -26
- package/dist/common/timestamp.helper.js +3 -14
- package/dist/common/utils/assert.js +3 -14
- package/dist/common/utils/decode.js +6 -17
- package/dist/common/utils/index.js +4 -15
- package/dist/common/utils/social.js +3 -14
- package/dist/common/utils/stat.js +7 -26
- package/dist/constants/index.js +3 -14
- package/dist/enums/index.js +3 -14
- package/dist/helpers/Encoding.js +10 -31
- package/dist/helpers/algo.helper.js +44 -82
- package/dist/helpers/assert.helper.js +13 -34
- package/dist/helpers/atomic.helper.d.ts +0 -17
- package/dist/helpers/atomic.helper.js +7 -43
- package/dist/helpers/balance.helper.js +71 -166
- package/dist/helpers/codex/common.helper.js +71 -149
- package/dist/helpers/codex/index.js +71 -149
- package/dist/helpers/codex/mbr.helper.js +71 -149
- package/dist/helpers/codex/mna.helper.js +71 -149
- package/dist/helpers/codex/order.helper.js +71 -149
- package/dist/helpers/codex/setGlobal.helper.js +73 -151
- package/dist/helpers/codex/transfer.helper.js +71 -149
- package/dist/helpers/codex/txn.helper.js +71 -149
- package/dist/helpers/codex.helper.js +71 -149
- package/dist/helpers/email.helper.js +6 -17
- package/dist/helpers/eth.helper.js +71 -149
- package/dist/helpers/hummingbots.helper.js +11 -22
- package/dist/helpers/index.js +31 -58
- package/dist/helpers/interval.helpers.js +10 -21
- package/dist/helpers/liquidity.helper.js +6 -17
- package/dist/helpers/order.helper.js +3 -14
- package/dist/helpers/pair.helper.js +3 -14
- package/dist/helpers/pointSystem.helper.js +15 -33
- package/dist/helpers/ticker.helpers.js +7 -27
- package/dist/helpers/vaa.helper.js +97 -175
- package/dist/helpers/withdraw.helper.js +97 -167
- package/dist/interfaces/db/market/index.d.ts +34 -6
- package/dist/interfaces/db/white_label/index.d.ts +3 -3
- package/dist/interfaces/index.js +11 -14
- package/dist/types/index.js +15 -33
- package/package.json +16 -8
- package/dist/baseModel/base.model.d.ts +0 -26
- package/dist/baseModel/index.d.ts +0 -2
- package/dist/helpers/api.helper.d.ts +0 -16
- package/dist/helpers/api.helper.js +0 -1652
|
@@ -1,24 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory(require("buffer"), require("ethereumjs-util"), require("bs58"), require("bignumber.js"), require("algosdk"));
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define(["buffer", "ethereumjs-util", "bs58", "bignumber.js", "algosdk"], factory);
|
|
6
|
-
else {
|
|
7
|
-
var a = typeof exports === 'object' ? factory(require("buffer"), require("ethereumjs-util"), require("bs58"), require("bignumber.js"), require("algosdk")) : factory(root["buffer"], root["ethereumjs-util"], root["bs58"], root["bignumber.js"], root["algosdk"]);
|
|
8
|
-
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
|
-
}
|
|
10
|
-
})(global, (__WEBPACK_EXTERNAL_MODULE__18__, __WEBPACK_EXTERNAL_MODULE__1297__, __WEBPACK_EXTERNAL_MODULE__4578__, __WEBPACK_EXTERNAL_MODULE__6168__, __WEBPACK_EXTERNAL_MODULE__9709__) => {
|
|
11
|
-
return /******/ (() => { // webpackBootstrap
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
12
2
|
/******/ "use strict";
|
|
13
3
|
/******/ var __webpack_modules__ = ({
|
|
14
4
|
|
|
15
|
-
/***/ 18:
|
|
16
|
-
/***/ ((module) => {
|
|
17
|
-
|
|
18
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__18__;
|
|
19
|
-
|
|
20
|
-
/***/ }),
|
|
21
|
-
|
|
22
5
|
/***/ 223:
|
|
23
6
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
24
7
|
|
|
@@ -63,8 +46,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
63
46
|
exports.unified_CCTP_ChainID = exports.unified_CCTP_token = exports.encodeAddress = exports.getProviderChainId = exports.getPrefixedMessage = exports.getPublicKey = exports.decodeSignature = exports.getMsgArgs = exports.getDataBytesFromMsg = exports.getAppArgs = exports.getBoxKeyFromHash = exports.getBoxKey = exports.generateHash = void 0;
|
|
64
47
|
exports.getUnifiedUSDC = getUnifiedUSDC;
|
|
65
48
|
exports.getUnifiedUSDCToken = getUnifiedUSDCToken;
|
|
66
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
67
|
-
const bs58 = __importStar(__webpack_require__(
|
|
49
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
50
|
+
const bs58 = __importStar(__webpack_require__(5316));
|
|
68
51
|
const algoHelper = __importStar(__webpack_require__(6897));
|
|
69
52
|
const ethHelper = __importStar(__webpack_require__(9019));
|
|
70
53
|
const codex_helper_1 = __webpack_require__(3955);
|
|
@@ -100,8 +83,6 @@ const getAppArgs = (methodSignature, args) => {
|
|
|
100
83
|
txnArgsLog[`txnArgs${index}`] = Array.apply([], Array.from(v)).join(", ");
|
|
101
84
|
return v;
|
|
102
85
|
});
|
|
103
|
-
// console.log('getAppArgs', methodSignature, JSON.stringify(txnArgsLog));
|
|
104
|
-
// console.log('TOTAL TXN ARGS BYTES', txnArgs.reduce((prev, curr: Uint8Array | Buffer) => curr.length + prev, 0));
|
|
105
86
|
return [selector, ...txnArgs];
|
|
106
87
|
};
|
|
107
88
|
exports.getAppArgs = getAppArgs;
|
|
@@ -119,7 +100,6 @@ const getMsgArgs = (message, signature, signerAddress, signerChainId, encoding =
|
|
|
119
100
|
(0, exports.decodeSignature)(signature, signerChainId),
|
|
120
101
|
(0, exports.getPublicKey)(signerAddress, signerChainId, message, signature, encoding),
|
|
121
102
|
];
|
|
122
|
-
// console.log('MSG ARGS', msgArgs)
|
|
123
103
|
return msgArgs;
|
|
124
104
|
};
|
|
125
105
|
exports.getMsgArgs = getMsgArgs;
|
|
@@ -317,7 +297,6 @@ function groupTickersByInterval(tickers, newIntervalInSec, endTimeInSec) {
|
|
|
317
297
|
const newGroupedTickers = [];
|
|
318
298
|
let timestamp = endTimeInSec - newIntervalInSec;
|
|
319
299
|
let slot = null;
|
|
320
|
-
// desc direction by timestamp
|
|
321
300
|
const sortedTickers = tickers.sort((a, b) => b.t - a.t);
|
|
322
301
|
for (let i = 0; i < sortedTickers.length; i++) {
|
|
323
302
|
const element = sortedTickers[i];
|
|
@@ -629,7 +608,7 @@ exports.bn_operation = bn_operation;
|
|
|
629
608
|
exports.roundNumber = roundNumber;
|
|
630
609
|
exports.convertFromBaseUnits = convertFromBaseUnits;
|
|
631
610
|
exports.convertToBaseUnits = convertToBaseUnits;
|
|
632
|
-
const bignumber_js_1 = __importDefault(__webpack_require__(
|
|
611
|
+
const bignumber_js_1 = __importDefault(__webpack_require__(4978));
|
|
633
612
|
bignumber_js_1.default.config({ DECIMAL_PLACES: 40, EXPONENTIAL_AT: 45 });
|
|
634
613
|
var Operations;
|
|
635
614
|
(function (Operations) {
|
|
@@ -647,7 +626,6 @@ var Operations;
|
|
|
647
626
|
function absolute(value) {
|
|
648
627
|
let x = new bignumber_js_1.default(value);
|
|
649
628
|
const res = x.abs().toString();
|
|
650
|
-
// console.log('Absolute value', { value, res })
|
|
651
629
|
return res;
|
|
652
630
|
}
|
|
653
631
|
function ceil(value) {
|
|
@@ -787,17 +765,10 @@ function roundNumber({ decimalPlaces = 0 }, x) {
|
|
|
787
765
|
}
|
|
788
766
|
function convertFromBaseUnits(assetDecimals, quantity) {
|
|
789
767
|
const decimals = Number(assetDecimals);
|
|
790
|
-
return roundNumber({ decimalPlaces: decimals },
|
|
791
|
-
// eslint-disable-next-line no-magic-numbers
|
|
792
|
-
Math.pow(10, -decimals) * Number(quantity));
|
|
768
|
+
return roundNumber({ decimalPlaces: decimals }, Math.pow(10, -decimals) * Number(quantity));
|
|
793
769
|
}
|
|
794
|
-
/**
|
|
795
|
-
* Computs quantity * 10^(assetDecimals) and rounds the result
|
|
796
|
-
*/
|
|
797
770
|
function convertToBaseUnits(assetDecimals, quantity) {
|
|
798
|
-
// eslint-disable-next-line no-magic-numbers
|
|
799
771
|
const baseAmount = Math.pow(10, Number(assetDecimals)) * Number(quantity);
|
|
800
|
-
// make sure the final value is an integer. This prevents this kind of computation errors: 0.0012 * 100000 = 119.99999999999999 and rounds this result into 120
|
|
801
772
|
return roundNumber({ decimalPlaces: 0 }, baseAmount);
|
|
802
773
|
}
|
|
803
774
|
|
|
@@ -822,13 +793,6 @@ var StateType;
|
|
|
822
793
|
})(StateType || (exports.StateType = StateType = {}));
|
|
823
794
|
|
|
824
795
|
|
|
825
|
-
/***/ }),
|
|
826
|
-
|
|
827
|
-
/***/ 1297:
|
|
828
|
-
/***/ ((module) => {
|
|
829
|
-
|
|
830
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__1297__;
|
|
831
|
-
|
|
832
796
|
/***/ }),
|
|
833
797
|
|
|
834
798
|
/***/ 1492:
|
|
@@ -1318,7 +1282,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
1318
1282
|
};
|
|
1319
1283
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1320
1284
|
exports.makeTransferTxn = exports.makeTransferMsg = exports.decodeTransferMsg = exports.makeDtwMsg = exports.decodeDtwMsg = exports.getTransferBytesFromMsg = exports.calcTransferHash = exports.getTransferBoxKeyFromHash = exports.getTransferBoxKey = exports.TRANSFER_DATA_BYTES_LENGTH = exports.DTW_DATA_BYTES_LENGTH = void 0;
|
|
1321
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
1285
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
1322
1286
|
const enums_1 = __webpack_require__(9965);
|
|
1323
1287
|
const codex_helper_1 = __webpack_require__(3955);
|
|
1324
1288
|
const Encoding_1 = __webpack_require__(8593);
|
|
@@ -1370,7 +1334,6 @@ const makeDtwMsg = (data) => {
|
|
|
1370
1334
|
const bs64OrderBytes = (0, codex_helper_1.getBase64EncodedData)(dataBytes);
|
|
1371
1335
|
console.log(`Dtw data should be ${exports.DTW_DATA_BYTES_LENGTH} bytes`, bs64OrderBytes.length, bs64OrderBytes);
|
|
1372
1336
|
return bs64OrderBytes;
|
|
1373
|
-
// return makeSigningMessage(JSON.stringify(data), dataBytes);
|
|
1374
1337
|
};
|
|
1375
1338
|
exports.makeDtwMsg = makeDtwMsg;
|
|
1376
1339
|
const decodeTransferMsg = (message, encoding = 'hex') => {
|
|
@@ -1407,7 +1370,6 @@ const makeTransferMsg = (data) => {
|
|
|
1407
1370
|
const bs64OrderBytes = (0, codex_helper_1.getBase64EncodedData)(dataBytes);
|
|
1408
1371
|
console.log(`Transfer data should be ${exports.TRANSFER_DATA_BYTES_LENGTH} bytes`, bs64OrderBytes.length, bs64OrderBytes);
|
|
1409
1372
|
return bs64OrderBytes;
|
|
1410
|
-
// return makeSigningMessage(JSON.stringify(data), dataBytes);
|
|
1411
1373
|
};
|
|
1412
1374
|
exports.makeTransferMsg = makeTransferMsg;
|
|
1413
1375
|
const makeTransferTxn = async ({ data, message, signature }, dtw, options) => {
|
|
@@ -1457,7 +1419,6 @@ const makeTransferTxn = async ({ data, message, signature }, dtw, options) => {
|
|
|
1457
1419
|
foreignApps,
|
|
1458
1420
|
boxes: allBoxes,
|
|
1459
1421
|
});
|
|
1460
|
-
// console.log('directTransfer txn', appCallTxn);
|
|
1461
1422
|
return appCallTxn;
|
|
1462
1423
|
};
|
|
1463
1424
|
exports.makeTransferTxn = makeTransferTxn;
|
|
@@ -1477,31 +1438,14 @@ const factorPrice = (price) => {
|
|
|
1477
1438
|
return (0, big_number_helper_1.multiply)(price, 10 ** constants_1.FACTOR_PRICE_DECIMAL);
|
|
1478
1439
|
};
|
|
1479
1440
|
exports.factorPrice = factorPrice;
|
|
1480
|
-
/**
|
|
1481
|
-
* Convert a factored atomic value to a non-factored atomic value
|
|
1482
|
-
* @param price - The price to convert
|
|
1483
|
-
* @param decimal - The number of decimal places
|
|
1484
|
-
* @returns The price converted to a non factored atomic value
|
|
1485
|
-
*/
|
|
1486
1441
|
const defactorPrice = (price, decimal) => {
|
|
1487
1442
|
return (0, big_number_helper_1.divide)(price, 10 ** (constants_1.FACTOR_PRICE_DECIMAL - decimal));
|
|
1488
1443
|
};
|
|
1489
1444
|
exports.defactorPrice = defactorPrice;
|
|
1490
|
-
/**
|
|
1491
|
-
* Convert an atomic value to a decimal value. ONLY for non-factored atomic values
|
|
1492
|
-
* @param amount - The number to convert
|
|
1493
|
-
* @param decimal - The number of decimal places
|
|
1494
|
-
* @returns The number converted to a decimal
|
|
1495
|
-
*/
|
|
1496
1445
|
const toDecimal = (amount, decimal) => {
|
|
1497
1446
|
return (0, big_number_helper_1.divide)(amount, 10 ** decimal);
|
|
1498
1447
|
};
|
|
1499
1448
|
exports.toDecimal = toDecimal;
|
|
1500
|
-
/**
|
|
1501
|
-
* Convert a factored atomic value to a decimal value
|
|
1502
|
-
* @param price - The price to convert
|
|
1503
|
-
* @returns The price converted to a decimal
|
|
1504
|
-
*/
|
|
1505
1449
|
const toDecimalPrice = (price) => {
|
|
1506
1450
|
return (0, exports.toDecimal)(price, constants_1.FACTOR_PRICE_DECIMAL);
|
|
1507
1451
|
};
|
|
@@ -1676,8 +1620,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1676
1620
|
exports.createBoxes = exports.getTokenBoxKey = exports.getPairBoxKey = exports.decodeCreateOrderMsg = exports.getCancelOrderDataJsonBytes = exports.makeCreateOrderMsg = exports.makeDepositMsg = exports.makeDepositTxns = exports.makeAssetOptInTxn = exports.getTokenBoxValue = exports.getOrderBoxValue = exports.getPairBoxValue = exports.getCompanyBoxValue = exports.getCompanyBoxName = exports.getAccountBoxByHash = exports.getAccountBoxValue = exports.getAccountBalanceBoxValue = exports.getBoxes = exports.getAssetBalancesByAppAddress = exports.getAssetBalancesByAppIndex = exports.getTradingKeyBoxValue = exports.getTradingKeyBoxName = exports.getTmcBoxValue = exports.getTmcBoxName = exports.getRebalanceBoxName = exports.getCCTPBalancesBoxValue = exports.getCCTPBalanceBoxValue = exports.getCCTPBalanceBoxName = exports.getAccountBalanceBoxName = exports.getAccountBalanceBoxNameHash = exports.getCodexAccountInfo = exports.getCodexStateValue = exports.encodeToken = exports.checkIfAddressIsNormalized = exports.normalizeAddress = exports.decodeToken = exports.decodeAddress = exports.extractUint256 = exports.extractUint64 = exports.extractUint32 = exports.extractUint16 = exports.extractStr = exports.extractDouble = exports.extractToken = exports.extractAddress = exports.decode = exports.encode = exports.getAddressFromNormalized = exports.getAddressChainFromNormalized = exports.encodeAddress = void 0;
|
|
1677
1621
|
exports.getUpgradeImpMsg = exports.makeUpdatePairInfoTxn = exports.makeUpdateTokenInfoTxns = exports.makeSetCompanyFeeTxn = exports.makeSetSuperAppTxns = exports.makeSetSuperCollectionWalletTxns = exports.makeSetCollectionWalletTxn = exports.makeWithdrawTxns = exports.getBase64EncodedData = exports.getUtf8EncodedData = exports.makeSigningMessage = exports.makeSetCollectionWalletMsg = exports.makeRevokeTradingKeyTxn = exports.makeAddTradingKeyTxn = exports.decodeTradingKeyMsg = exports.makeTradingKeyMsg = exports.makeLoginMsg = exports.makeMatchTxns = void 0;
|
|
1678
1622
|
exports.getTokenFromNormalized = getTokenFromNormalized;
|
|
1679
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
1680
|
-
const bs58 = __importStar(__webpack_require__(
|
|
1623
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
1624
|
+
const bs58 = __importStar(__webpack_require__(5316));
|
|
1681
1625
|
const big_number_helper_1 = __webpack_require__(1174);
|
|
1682
1626
|
const utils_1 = __webpack_require__(8398);
|
|
1683
1627
|
const codex_1 = __webpack_require__(430);
|
|
@@ -1721,7 +1665,6 @@ function getTokenFromNormalized(token, chainId) {
|
|
|
1721
1665
|
return (0, exports.getAddressFromNormalized)(token, Number(chainId));
|
|
1722
1666
|
}
|
|
1723
1667
|
const encode = (value, type, chain) => {
|
|
1724
|
-
// console.log('encode', JSON.stringify({ value: typeof value === "bigint" ? `${value}n` : value, type, chain }));
|
|
1725
1668
|
switch (type) {
|
|
1726
1669
|
case '8B': return algosdk_1.default.encodeUint64(Number(value));
|
|
1727
1670
|
case '32B': return (0, eth_helper_1.encode32Bytes)(value);
|
|
@@ -1824,13 +1767,6 @@ const encodeToken = (token, chain) => {
|
|
|
1824
1767
|
exports.encodeToken = encodeToken;
|
|
1825
1768
|
const getCodexStateValue = async (algoClient, appId) => {
|
|
1826
1769
|
const globalState = await (0, algo_helper_1.getAppGlobalState)(algoClient, appId);
|
|
1827
|
-
// console.log('codexState', appId, globalState);
|
|
1828
|
-
// if (globalState["MNA"]) {
|
|
1829
|
-
// console.log('MNA', decodeAddress(Buffer.from(globalState["MNA"]), 8));
|
|
1830
|
-
// }
|
|
1831
|
-
// if (globalState["BKA"]) {
|
|
1832
|
-
// console.log('BKA', decodeAddress(Buffer.from(globalState["BKA"]), 8));
|
|
1833
|
-
// }
|
|
1834
1770
|
const msgProcId = globalState["MSG_PROCESSOR"];
|
|
1835
1771
|
const superAppId = globalState["UL_SUPERADMIN_APP"];
|
|
1836
1772
|
let superWallet = globalState["UL_SUPERADMIN_WALLET"];
|
|
@@ -1960,7 +1896,6 @@ const getAccountBalanceBoxValue = async (algoClient, appId, login, token) => {
|
|
|
1960
1896
|
};
|
|
1961
1897
|
exports.getAccountBalanceBoxValue = getAccountBalanceBoxValue;
|
|
1962
1898
|
const getAccountBoxValue = async (algoClient, appId, loginAddress, loginChainId, tokenAddress, tokenChainId) => {
|
|
1963
|
-
// console.log('getAccountBoxValue', { loginAddress, loginChainId, tokenAddress, tokenChainId });
|
|
1964
1899
|
const boxName = (0, eth_helper_1.keccak256)((0, exports.getAccountBalanceBoxName)(loginAddress, loginChainId, tokenAddress, tokenChainId));
|
|
1965
1900
|
const boxValue = await getAccountBox(algoClient, appId, boxName);
|
|
1966
1901
|
console.log('Box account value', loginAddress.substring(0, 8), tokenAddress, boxValue, Buffer.from(boxName).toString('hex'));
|
|
@@ -2156,7 +2091,7 @@ const makeCreateOrderMsg = (data) => {
|
|
|
2156
2091
|
(0, exports.encode)(data.companyId, '2B'),
|
|
2157
2092
|
(0, exports.encode)(data.random, '8B'),
|
|
2158
2093
|
(0, exports.encode)(data.decimalPrice, 'float'),
|
|
2159
|
-
Buffer.alloc(50),
|
|
2094
|
+
Buffer.alloc(50),
|
|
2160
2095
|
]);
|
|
2161
2096
|
const bs64OrderBytes = new Uint8Array(Buffer.from((0, Encoding_1.encodeBase64)(orderBytes)));
|
|
2162
2097
|
const messageBytes = new Uint8Array([
|
|
@@ -2237,14 +2172,13 @@ const decodeCreateOrderMsg = (message, encoding = 'hex') => {
|
|
|
2237
2172
|
return {
|
|
2238
2173
|
...orderData,
|
|
2239
2174
|
expiredDate: String(orderData.expiredTime).length > 10
|
|
2240
|
-
? new Date(orderData.expiredTime)
|
|
2175
|
+
? new Date(orderData.expiredTime)
|
|
2241
2176
|
: new Date(orderData.expiredTime * 1000)
|
|
2242
2177
|
};
|
|
2243
2178
|
};
|
|
2244
2179
|
exports.decodeCreateOrderMsg = decodeCreateOrderMsg;
|
|
2245
2180
|
const getMatchOrderArgs = (order) => {
|
|
2246
2181
|
const { id, address, chain, message, encoding, signature, tradingKey } = order;
|
|
2247
|
-
// console.log('getMatchOrderArgs', JSON.stringify(order));
|
|
2248
2182
|
const signAddress = tradingKey || address;
|
|
2249
2183
|
const signChain = tradingKey ? enums_1.Chains.Algorand : chain;
|
|
2250
2184
|
return [
|
|
@@ -2273,8 +2207,6 @@ const createBoxes = (appIndex, boxNames, encode = eth_helper_1.keccak256) => {
|
|
|
2273
2207
|
appIndex,
|
|
2274
2208
|
name: encode(boxName)
|
|
2275
2209
|
}));
|
|
2276
|
-
// console.log('createBoxes', boxes.map(b => Buffer.from(b.name).toString('hex')))
|
|
2277
|
-
// console.log(`createBoxesBytes`, boxes.map(b => Array.apply([], Array.from(b.name)).join(", ")));
|
|
2278
2210
|
return boxes;
|
|
2279
2211
|
};
|
|
2280
2212
|
exports.createBoxes = createBoxes;
|
|
@@ -2368,7 +2300,7 @@ const makeMatchTxns = (appId, args, params, sender, encoding = 'hex') => {
|
|
|
2368
2300
|
getShareWalletBoxKey(afTaker, baseAsset),
|
|
2369
2301
|
getShareWalletBoxKey(afTaker, priceAsset),
|
|
2370
2302
|
]
|
|
2371
|
-
.filter(Boolean)
|
|
2303
|
+
.filter(Boolean)
|
|
2372
2304
|
.map(o => Buffer.from(o).toString('hex')))
|
|
2373
2305
|
].map(o => Buffer.from(o, 'hex'));
|
|
2374
2306
|
const allBoxes = [
|
|
@@ -2382,7 +2314,6 @@ const makeMatchTxns = (appId, args, params, sender, encoding = 'hex') => {
|
|
|
2382
2314
|
];
|
|
2383
2315
|
const allBoxesUnique = [...new Set(allBoxes.map(o => Buffer.from(o.name).toString('hex')))];
|
|
2384
2316
|
console.log(`[TradeID: ${id}] All boxes`, JSON.stringify(allBoxesUnique));
|
|
2385
|
-
// allBoxes = allBoxesUnique.map(o => Buffer.from(o.name))
|
|
2386
2317
|
const foreignApps = [superAppId];
|
|
2387
2318
|
const MAX_REFS = 8;
|
|
2388
2319
|
const mainTxnBoxes = allBoxes.slice(0, MAX_REFS - foreignApps.length);
|
|
@@ -2407,12 +2338,6 @@ const makeMatchTxns = (appId, args, params, sender, encoding = 'hex') => {
|
|
|
2407
2338
|
};
|
|
2408
2339
|
exports.makeMatchTxns = makeMatchTxns;
|
|
2409
2340
|
const makeLoginMsg = (data, signingMessage) => {
|
|
2410
|
-
// const dataBytes = concatArrays([
|
|
2411
|
-
// encode(data.address, 'address', data.chainId),
|
|
2412
|
-
// encode(data.chainId, '8B'),
|
|
2413
|
-
// encode(data.provider, 'str'),
|
|
2414
|
-
// ]);
|
|
2415
|
-
// return makeSigningMessage(data.signingMessage, dataBytes);
|
|
2416
2341
|
const { address, technology } = data;
|
|
2417
2342
|
return (0, exports.getUtf8EncodedData)(signingMessage || JSON.stringify({ address, technology }));
|
|
2418
2343
|
};
|
|
@@ -2446,9 +2371,7 @@ const decodeTradingKeyMsg = (message, encoding = 'hex') => {
|
|
|
2446
2371
|
};
|
|
2447
2372
|
};
|
|
2448
2373
|
exports.decodeTradingKeyMsg = decodeTradingKeyMsg;
|
|
2449
|
-
const makeAddTradingKeyTxn = async (algoClient, appId, superId, sender, { loginAddress, loginChainId, }, message,
|
|
2450
|
-
// encoding: BufferEncoding | undefined,
|
|
2451
|
-
signature) => {
|
|
2374
|
+
const makeAddTradingKeyTxn = async (algoClient, appId, superId, sender, { loginAddress, loginChainId, }, message, signature) => {
|
|
2452
2375
|
const msgArgs = (0, codex_1.getMsgArgs)(message, signature, loginAddress, loginChainId);
|
|
2453
2376
|
const appArgs = (0, codex_1.getAppArgs)("manageTradingKey(byte[],byte[],byte[],byte[])uint64", [
|
|
2454
2377
|
(0, exports.encode)('add', 'str'),
|
|
@@ -2469,9 +2392,7 @@ signature) => {
|
|
|
2469
2392
|
return txn;
|
|
2470
2393
|
};
|
|
2471
2394
|
exports.makeAddTradingKeyTxn = makeAddTradingKeyTxn;
|
|
2472
|
-
const makeRevokeTradingKeyTxn = async (algoClient, appId, superId, sender, { loginAddress, loginChainId, }, message,
|
|
2473
|
-
// encoding: BufferEncoding | undefined,
|
|
2474
|
-
signature) => {
|
|
2395
|
+
const makeRevokeTradingKeyTxn = async (algoClient, appId, superId, sender, { loginAddress, loginChainId, }, message, signature) => {
|
|
2475
2396
|
const msgArgs = (0, codex_1.getMsgArgs)(message, signature, loginAddress, loginChainId);
|
|
2476
2397
|
const appArgs = (0, codex_1.getAppArgs)("manageTradingKey(byte[],byte[],byte[],byte[])uint64", [
|
|
2477
2398
|
(0, exports.encode)('delete', 'str'),
|
|
@@ -2496,7 +2417,6 @@ const makeSetCollectionWalletMsg = (data) => {
|
|
|
2496
2417
|
const chainIdBytes = algosdk_1.default.encodeUint64(loginChainId);
|
|
2497
2418
|
const dataBytes = (0, Encoding_1.concatArrays)([senderBytes, chainIdBytes, companyIdBytes]);
|
|
2498
2419
|
const messageBytes = new Uint8Array([
|
|
2499
|
-
// ...getUtf8EncodedData(JSON.stringify(data)),
|
|
2500
2420
|
...(0, exports.getBase64EncodedData)(dataBytes),
|
|
2501
2421
|
]);
|
|
2502
2422
|
console.log('MESSAGE LENGTH: ', messageBytes);
|
|
@@ -2511,14 +2431,10 @@ const getUtf8EncodedData = (jsonData) => new Uint8Array(Buffer.from((jsonData +
|
|
|
2511
2431
|
exports.getUtf8EncodedData = getUtf8EncodedData;
|
|
2512
2432
|
const getBase64EncodedData = (data) => new Uint8Array(Buffer.from((0, Encoding_1.encodeBase64)(data)));
|
|
2513
2433
|
exports.getBase64EncodedData = getBase64EncodedData;
|
|
2514
|
-
const makeWithdrawTxns = async (algoClient, { loginAddress, loginChainId, tokenIndex, recipient, recipientChainId }, message, signature,
|
|
2515
|
-
// encoding: BufferEncoding | undefined,
|
|
2516
|
-
sender, options) => {
|
|
2434
|
+
const makeWithdrawTxns = async (algoClient, { loginAddress, loginChainId, tokenIndex, recipient, recipientChainId }, message, signature, sender, options) => {
|
|
2517
2435
|
const msgArgs = (0, codex_1.getMsgArgs)(message, signature, loginAddress, loginChainId);
|
|
2518
2436
|
const appArgs = (0, codex_1.getAppArgs)("withdraw(byte[],byte[],byte[])uint64", msgArgs);
|
|
2519
2437
|
const isAlgoChain = recipientChainId === enums_1.Chains.Algorand;
|
|
2520
|
-
// TODO: calc actual txn fee
|
|
2521
|
-
// const params = await getTxnParams(algoClient, 7);
|
|
2522
2438
|
const params = await (0, algo_helper_1.getTxnParams)(algoClient, isAlgoChain ? 6 : 2);
|
|
2523
2439
|
params.fee = params.fee + (algosdk_1.default.ALGORAND_MIN_TX_FEE * 5);
|
|
2524
2440
|
const { appId, coreId, lsaAddress, msgProcessorId, unifiedChainId, cctpSupportedChains, superWallet } = options;
|
|
@@ -2769,10 +2685,10 @@ exports.messageForSigning = messageForSigning;
|
|
|
2769
2685
|
|
|
2770
2686
|
/***/ }),
|
|
2771
2687
|
|
|
2772
|
-
/***/
|
|
2688
|
+
/***/ 4978:
|
|
2773
2689
|
/***/ ((module) => {
|
|
2774
2690
|
|
|
2775
|
-
module.exports =
|
|
2691
|
+
module.exports = require("bignumber.js");
|
|
2776
2692
|
|
|
2777
2693
|
/***/ }),
|
|
2778
2694
|
|
|
@@ -2790,6 +2706,13 @@ var UpgradeStatus;
|
|
|
2790
2706
|
})(UpgradeStatus || (exports.UpgradeStatus = UpgradeStatus = {}));
|
|
2791
2707
|
|
|
2792
2708
|
|
|
2709
|
+
/***/ }),
|
|
2710
|
+
|
|
2711
|
+
/***/ 5316:
|
|
2712
|
+
/***/ ((module) => {
|
|
2713
|
+
|
|
2714
|
+
module.exports = require("bs58");
|
|
2715
|
+
|
|
2793
2716
|
/***/ }),
|
|
2794
2717
|
|
|
2795
2718
|
/***/ 5386:
|
|
@@ -2810,7 +2733,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
2810
2733
|
};
|
|
2811
2734
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2812
2735
|
exports.makeRemoveExpiredOrderTxn = exports.calcOrderHash = exports.getOrderBoxKeyFromHash = exports.getOrderBoxKey = exports.getOrderBytesFromMsg = void 0;
|
|
2813
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
2736
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
2814
2737
|
const common_helper_1 = __webpack_require__(223);
|
|
2815
2738
|
const Encoding_1 = __webpack_require__(8593);
|
|
2816
2739
|
const constants_1 = __webpack_require__(6450);
|
|
@@ -2874,25 +2797,25 @@ function getDatepartValue(value) {
|
|
|
2874
2797
|
if (!units) {
|
|
2875
2798
|
return mapWithTimeframe(datepart, 1);
|
|
2876
2799
|
}
|
|
2877
|
-
if (datepart === 'minute' && units % (7 * 24 * 60) === 0) {
|
|
2800
|
+
if (datepart === 'minute' && units % (7 * 24 * 60) === 0) {
|
|
2878
2801
|
return mapWithTimeframe('week', units / (7 * 24 * 60));
|
|
2879
2802
|
}
|
|
2880
|
-
if (datepart === 'minute' && units % (24 * 60) === 0) {
|
|
2803
|
+
if (datepart === 'minute' && units % (24 * 60) === 0) {
|
|
2881
2804
|
return mapWithTimeframe('day', units / (24 * 60));
|
|
2882
2805
|
}
|
|
2883
|
-
if (datepart === 'minute' && units % 60 === 0) {
|
|
2806
|
+
if (datepart === 'minute' && units % 60 === 0) {
|
|
2884
2807
|
return mapWithTimeframe('hour', units / 60);
|
|
2885
2808
|
}
|
|
2886
|
-
if (datepart === 'hour' && units % (7 * 24) === 0) {
|
|
2809
|
+
if (datepart === 'hour' && units % (7 * 24) === 0) {
|
|
2887
2810
|
return mapWithTimeframe('week', units / (7 * 24));
|
|
2888
2811
|
}
|
|
2889
|
-
if (datepart === 'hour' && units % 24 === 0) {
|
|
2812
|
+
if (datepart === 'hour' && units % 24 === 0) {
|
|
2890
2813
|
return mapWithTimeframe(units === 24 ? 'hour' : 'day', units === 24 ? 24 : units / 24);
|
|
2891
2814
|
}
|
|
2892
|
-
if (datepart === 'day' && units % 7 === 0) {
|
|
2815
|
+
if (datepart === 'day' && units % 7 === 0) {
|
|
2893
2816
|
return mapWithTimeframe('week', units / 7);
|
|
2894
2817
|
}
|
|
2895
|
-
if (datepart === 'month' && units % 12 === 0) {
|
|
2818
|
+
if (datepart === 'month' && units % 12 === 0) {
|
|
2896
2819
|
return mapWithTimeframe('year', units / 12);
|
|
2897
2820
|
}
|
|
2898
2821
|
return mapWithTimeframe(datepart, units);
|
|
@@ -2962,13 +2885,6 @@ var TwitterAccessScopeEnum;
|
|
|
2962
2885
|
})(TwitterAccessScopeEnum || (exports.TwitterAccessScopeEnum = TwitterAccessScopeEnum = {}));
|
|
2963
2886
|
|
|
2964
2887
|
|
|
2965
|
-
/***/ }),
|
|
2966
|
-
|
|
2967
|
-
/***/ 6168:
|
|
2968
|
-
/***/ ((module) => {
|
|
2969
|
-
|
|
2970
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__6168__;
|
|
2971
|
-
|
|
2972
2888
|
/***/ }),
|
|
2973
2889
|
|
|
2974
2890
|
/***/ 6450:
|
|
@@ -3043,7 +2959,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3043
2959
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3044
2960
|
exports.verifySignature = exports.decodeAndNormalizeAddress = exports.isAssetOptedIn = exports.getTxnParams = exports.getBoxByName = exports.getAppBoxes = exports.getAppGlobalState = exports.getAccountAssetBalances = exports.createBoxes = void 0;
|
|
3045
2961
|
exports.decodeStateArray = decodeStateArray;
|
|
3046
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
2962
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
3047
2963
|
const Encoding_1 = __webpack_require__(8593);
|
|
3048
2964
|
const helpers_1 = __webpack_require__(9730);
|
|
3049
2965
|
const createBoxes = (appIndex, foreignApps) => {
|
|
@@ -3103,7 +3019,6 @@ const getAppBoxes = async (algodClient, appId) => {
|
|
|
3103
3019
|
exports.getAppBoxes = getAppBoxes;
|
|
3104
3020
|
const getBoxByName = async (algoClient, appId, boxName) => {
|
|
3105
3021
|
try {
|
|
3106
|
-
// console.log('Get box by name', boxName);
|
|
3107
3022
|
const { value } = await algoClient.getApplicationBoxByName(appId, boxName).do();
|
|
3108
3023
|
const box = value;
|
|
3109
3024
|
return box;
|
|
@@ -3303,23 +3218,19 @@ var SmallTimeframeEnum;
|
|
|
3303
3218
|
SmallTimeframeEnum["last_year"] = "last_year";
|
|
3304
3219
|
})(SmallTimeframeEnum || (exports.SmallTimeframeEnum = SmallTimeframeEnum = {}));
|
|
3305
3220
|
class PairsQueryDto {
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
this.page = 1;
|
|
3312
|
-
}
|
|
3221
|
+
timeRange = SmallTimeframeEnum.last_30_days;
|
|
3222
|
+
sortBy = 'volume_usd';
|
|
3223
|
+
order = 'desc';
|
|
3224
|
+
limit = 20;
|
|
3225
|
+
page = 1;
|
|
3313
3226
|
}
|
|
3314
3227
|
exports.PairsQueryDto = PairsQueryDto;
|
|
3315
3228
|
class UsersQueryDto {
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
this.page = 1;
|
|
3322
|
-
}
|
|
3229
|
+
timeRange = SmallTimeframeEnum.last_30_days;
|
|
3230
|
+
sortBy = 'volume_usd';
|
|
3231
|
+
order = 'desc';
|
|
3232
|
+
limit = 20;
|
|
3233
|
+
page = 1;
|
|
3323
3234
|
}
|
|
3324
3235
|
exports.UsersQueryDto = UsersQueryDto;
|
|
3325
3236
|
var StatisticTypeQuery;
|
|
@@ -3330,10 +3241,8 @@ var StatisticTypeQuery;
|
|
|
3330
3241
|
StatisticTypeQuery["dau"] = "dau";
|
|
3331
3242
|
})(StatisticTypeQuery || (exports.StatisticTypeQuery = StatisticTypeQuery = {}));
|
|
3332
3243
|
class ChartQueryDto {
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
this.timeRange = SmallTimeframeEnum.last_7_days;
|
|
3336
|
-
}
|
|
3244
|
+
type = StatisticTypeQuery.volume;
|
|
3245
|
+
timeRange = SmallTimeframeEnum.last_7_days;
|
|
3337
3246
|
}
|
|
3338
3247
|
exports.ChartQueryDto = ChartQueryDto;
|
|
3339
3248
|
|
|
@@ -3474,6 +3383,13 @@ exports.QueueOptions = {
|
|
|
3474
3383
|
};
|
|
3475
3384
|
|
|
3476
3385
|
|
|
3386
|
+
/***/ }),
|
|
3387
|
+
|
|
3388
|
+
/***/ 7835:
|
|
3389
|
+
/***/ ((module) => {
|
|
3390
|
+
|
|
3391
|
+
module.exports = require("ethereumjs-util");
|
|
3392
|
+
|
|
3477
3393
|
/***/ }),
|
|
3478
3394
|
|
|
3479
3395
|
/***/ 8060:
|
|
@@ -3485,7 +3401,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3485
3401
|
};
|
|
3486
3402
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3487
3403
|
exports.makeGroupTxnsWithDummy = exports.makeDummyTxn = void 0;
|
|
3488
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
3404
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
3489
3405
|
const common_helper_1 = __webpack_require__(223);
|
|
3490
3406
|
const makeDummyTxn = (appIndex, sender, params, boxes, note, foreignApps) => {
|
|
3491
3407
|
const appArgs = (0, common_helper_1.getAppArgs)("dummy(uint64)void", [1]);
|
|
@@ -3525,8 +3441,6 @@ const makeGroupTxnsWithDummy = (id, mainTxnBody) => {
|
|
|
3525
3441
|
dummyTxnIndex++;
|
|
3526
3442
|
}
|
|
3527
3443
|
}
|
|
3528
|
-
// TODO: check this dummy txn
|
|
3529
|
-
// additional dummy txn for withdrawal
|
|
3530
3444
|
dummyTxns2.push((0, exports.makeDummyTxn)(appIndex, from, suggestedParams, [], `${id}_${++dummyTxnIndex}`, foreignApps));
|
|
3531
3445
|
console.log("dummy count", dummyTxns2.length);
|
|
3532
3446
|
return [mainTxn, ...dummyTxns2];
|
|
@@ -3534,6 +3448,13 @@ const makeGroupTxnsWithDummy = (id, mainTxnBody) => {
|
|
|
3534
3448
|
exports.makeGroupTxnsWithDummy = makeGroupTxnsWithDummy;
|
|
3535
3449
|
|
|
3536
3450
|
|
|
3451
|
+
/***/ }),
|
|
3452
|
+
|
|
3453
|
+
/***/ 8115:
|
|
3454
|
+
/***/ ((module) => {
|
|
3455
|
+
|
|
3456
|
+
module.exports = require("algosdk");
|
|
3457
|
+
|
|
3537
3458
|
/***/ }),
|
|
3538
3459
|
|
|
3539
3460
|
/***/ 8398:
|
|
@@ -3633,7 +3554,7 @@ function removeField(obj, fieldToRemove) {
|
|
|
3633
3554
|
.filter(([key]) => key !== fieldToRemove)
|
|
3634
3555
|
.map(([key, value]) => [key, removeField(value, fieldToRemove)]));
|
|
3635
3556
|
}
|
|
3636
|
-
return obj;
|
|
3557
|
+
return obj;
|
|
3637
3558
|
}
|
|
3638
3559
|
function removeUndefined(obj) {
|
|
3639
3560
|
return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== undefined));
|
|
@@ -3697,9 +3618,8 @@ exports.getDeltaUint = getDeltaUint;
|
|
|
3697
3618
|
exports.getDeltaBytes = getDeltaBytes;
|
|
3698
3619
|
exports.toUnix = toUnix;
|
|
3699
3620
|
exports.fromUnix = fromUnix;
|
|
3700
|
-
const algosdk_1 = __importStar(__webpack_require__(
|
|
3701
|
-
|
|
3702
|
-
const buffer_1 = __webpack_require__(18);
|
|
3621
|
+
const algosdk_1 = __importStar(__webpack_require__(8115));
|
|
3622
|
+
const buffer_1 = __webpack_require__(9428);
|
|
3703
3623
|
function concatArrays(arrays) {
|
|
3704
3624
|
return arrays.reduce((a, b) => Uint8Array.from([...a, ...b]));
|
|
3705
3625
|
}
|
|
@@ -3852,15 +3772,6 @@ function encodeBase64(value) {
|
|
|
3852
3772
|
function decodeBase64(value) {
|
|
3853
3773
|
return buffer_1.Buffer.from(value, 'base64');
|
|
3854
3774
|
}
|
|
3855
|
-
// export const sha256HashLength = 32
|
|
3856
|
-
// export function sha256Hash(arr: sha512.Message): Uint8Array {
|
|
3857
|
-
// return new Uint8Array(sha512.sha512_256.arrayBuffer(arr))
|
|
3858
|
-
// }
|
|
3859
|
-
// export function encodeApplicationAddress(id: number): Address {
|
|
3860
|
-
// const APP_ID_PREFIX = Buffer.from('appID');
|
|
3861
|
-
// const toBeSigned = concatArrays([APP_ID_PREFIX, encodeUint64(BigInt(id))]);
|
|
3862
|
-
// return encodeAddress(sha256Hash(toBeSigned));
|
|
3863
|
-
// }
|
|
3864
3775
|
function compareArrays(a, b) {
|
|
3865
3776
|
return a.length === b.length && a.reduce((equal, item, index) => equal && item === b[index], true);
|
|
3866
3777
|
}
|
|
@@ -3888,7 +3799,7 @@ function toUnix(date) {
|
|
|
3888
3799
|
function fromUnix(timestamp) {
|
|
3889
3800
|
return new Date(timestamp * 1000);
|
|
3890
3801
|
}
|
|
3891
|
-
var algosdk_2 = __webpack_require__(
|
|
3802
|
+
var algosdk_2 = __webpack_require__(8115);
|
|
3892
3803
|
Object.defineProperty(exports, "encodeAddress", ({ enumerable: true, get: function () { return algosdk_2.encodeAddress; } }));
|
|
3893
3804
|
Object.defineProperty(exports, "decodeAddress", ({ enumerable: true, get: function () { return algosdk_2.decodeAddress; } }));
|
|
3894
3805
|
|
|
@@ -3937,11 +3848,10 @@ exports.keccak256 = exports.verifyMessage = exports.verifySignature = exports.re
|
|
|
3937
3848
|
exports.decode32Bytes = decode32Bytes;
|
|
3938
3849
|
exports.encodeBigNumber = encodeBigNumber;
|
|
3939
3850
|
exports.encode32Bytes = encode32Bytes;
|
|
3940
|
-
const ethUtil = __importStar(__webpack_require__(
|
|
3851
|
+
const ethUtil = __importStar(__webpack_require__(7835));
|
|
3941
3852
|
const common_helper_1 = __webpack_require__(223);
|
|
3942
3853
|
function decode32Bytes(value) {
|
|
3943
3854
|
const bnValue = ethUtil.fromSigned(Buffer.from(value));
|
|
3944
|
-
// console.log('bnValue', value, bnValue, bnValue.toString())
|
|
3945
3855
|
return BigInt(bnValue.toString());
|
|
3946
3856
|
}
|
|
3947
3857
|
function encodeBigNumber(value) {
|
|
@@ -3985,9 +3895,8 @@ exports.unpadHexPrefix = unpadHexPrefix;
|
|
|
3985
3895
|
const isAddress = (address) => ethUtil.isValidAddress(address);
|
|
3986
3896
|
exports.isAddress = isAddress;
|
|
3987
3897
|
const recoverPublicKey = (message, signature) => {
|
|
3988
|
-
const messageHash = ethUtil.keccak256(message);
|
|
3898
|
+
const messageHash = ethUtil.keccak256(message);
|
|
3989
3899
|
const { r, s, v } = ethUtil.fromRpcSig(signature);
|
|
3990
|
-
// Recover the public key
|
|
3991
3900
|
return ethUtil.ecrecover(messageHash, v, r, s);
|
|
3992
3901
|
};
|
|
3993
3902
|
exports.recoverPublicKey = recoverPublicKey;
|
|
@@ -4018,7 +3927,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4018
3927
|
};
|
|
4019
3928
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4020
3929
|
exports.makeSetManagerKeyTxn = void 0;
|
|
4021
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
3930
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
4022
3931
|
const algo_helper_1 = __webpack_require__(6897);
|
|
4023
3932
|
const codex_helper_1 = __webpack_require__(3955);
|
|
4024
3933
|
const common_helper_1 = __webpack_require__(223);
|
|
@@ -4030,14 +3939,12 @@ const makeSetManagerKeyTxn = async (algoClient, superAppId, sender, mnaKey) => {
|
|
|
4030
3939
|
console.log("new MNA key:", mnaKey);
|
|
4031
3940
|
console.log("sender:", sender);
|
|
4032
3941
|
console.log("superAppId:", superAppId);
|
|
4033
|
-
// return makeSetGlobalTxn(algoClient, superAppId, sender, AppGlobalParamName.MNA, mnaKey, AppGlobalParamType.STRING);
|
|
4034
3942
|
const txn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
4035
3943
|
appIndex: superAppId,
|
|
4036
3944
|
from: sender,
|
|
4037
3945
|
suggestedParams: params,
|
|
4038
3946
|
appArgs: (0, common_helper_1.getAppArgs)("set_global(byte[],byte[],byte[])void", [
|
|
4039
3947
|
(0, codex_helper_1.encode)("MNA", 'str'),
|
|
4040
|
-
// encode(mnaKey, 'str'),
|
|
4041
3948
|
algosdk_1.default.decodeAddress(mnaKey).publicKey,
|
|
4042
3949
|
(0, codex_helper_1.encode)('S', 'str')
|
|
4043
3950
|
]),
|
|
@@ -4053,7 +3960,6 @@ exports.makeSetManagerKeyTxn = makeSetManagerKeyTxn;
|
|
|
4053
3960
|
/***/ ((__unused_webpack_module, exports) => {
|
|
4054
3961
|
|
|
4055
3962
|
|
|
4056
|
-
//--import { Asset } from "@ultrade/shared/db/entities/market/asset.entity";
|
|
4057
3963
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4058
3964
|
exports.AmmBucketKeys = exports.VALIDATOR_APP_ID = exports.CONTRACT_VERSION = exports.AmmForeignResources = exports.AmmChars = exports.AmmIds = exports.PoolType = void 0;
|
|
4059
3965
|
var PoolType;
|
|
@@ -4120,7 +4026,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4120
4026
|
};
|
|
4121
4027
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4122
4028
|
exports.makeUpdateMbrTxn = exports.getMbrBoxValue = void 0;
|
|
4123
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
4029
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
4124
4030
|
const algo_helper_1 = __webpack_require__(6897);
|
|
4125
4031
|
const common_helper_1 = __webpack_require__(223);
|
|
4126
4032
|
const Encoding_1 = __webpack_require__(8593);
|
|
@@ -4172,10 +4078,10 @@ exports.makeUpdateMbrTxn = makeUpdateMbrTxn;
|
|
|
4172
4078
|
|
|
4173
4079
|
/***/ }),
|
|
4174
4080
|
|
|
4175
|
-
/***/
|
|
4081
|
+
/***/ 9428:
|
|
4176
4082
|
/***/ ((module) => {
|
|
4177
4083
|
|
|
4178
|
-
module.exports =
|
|
4084
|
+
module.exports = require("buffer");
|
|
4179
4085
|
|
|
4180
4086
|
/***/ }),
|
|
4181
4087
|
|
|
@@ -4324,7 +4230,6 @@ exports.mapToCodexBalance = mapToCodexBalance;
|
|
|
4324
4230
|
|
|
4325
4231
|
})();
|
|
4326
4232
|
|
|
4327
|
-
|
|
4233
|
+
module.exports = __webpack_exports__;
|
|
4328
4234
|
/******/ })()
|
|
4329
|
-
;
|
|
4330
|
-
});
|
|
4235
|
+
;
|