@ultrade/shared 1.0.0 → 1.0.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/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 +15 -7
- 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("crypto-js"), require("@certusone/wormhole-sdk"), require("bs58"), require("bignumber.js"), require("algosdk"), require("@certusone/wormhole-sdk/lib/cjs/solana"));
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define(["buffer", "ethereumjs-util", "crypto-js", "@certusone/wormhole-sdk", "bs58", "bignumber.js", "algosdk", "@certusone/wormhole-sdk/lib/cjs/solana"], factory);
|
|
6
|
-
else {
|
|
7
|
-
var a = typeof exports === 'object' ? factory(require("buffer"), require("ethereumjs-util"), require("crypto-js"), require("@certusone/wormhole-sdk"), require("bs58"), require("bignumber.js"), require("algosdk"), require("@certusone/wormhole-sdk/lib/cjs/solana")) : factory(root["buffer"], root["ethereumjs-util"], root["crypto-js"], root["@certusone/wormhole-sdk"], root["bs58"], root["bignumber.js"], root["algosdk"], root["@certusone/wormhole-sdk/lib/cjs/solana"]);
|
|
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__1475__, __WEBPACK_EXTERNAL_MODULE__3519__, __WEBPACK_EXTERNAL_MODULE__4578__, __WEBPACK_EXTERNAL_MODULE__6168__, __WEBPACK_EXTERNAL_MODULE__9709__, __WEBPACK_EXTERNAL_MODULE__9999__) => {
|
|
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];
|
|
@@ -472,6 +451,13 @@ exports.NON_REPEATABLE_ACTIONS = [
|
|
|
472
451
|
];
|
|
473
452
|
|
|
474
453
|
|
|
454
|
+
/***/ }),
|
|
455
|
+
|
|
456
|
+
/***/ 897:
|
|
457
|
+
/***/ ((module) => {
|
|
458
|
+
|
|
459
|
+
module.exports = require("@certusone/wormhole-sdk/lib/cjs/solana");
|
|
460
|
+
|
|
475
461
|
/***/ }),
|
|
476
462
|
|
|
477
463
|
/***/ 935:
|
|
@@ -629,7 +615,7 @@ exports.bn_operation = bn_operation;
|
|
|
629
615
|
exports.roundNumber = roundNumber;
|
|
630
616
|
exports.convertFromBaseUnits = convertFromBaseUnits;
|
|
631
617
|
exports.convertToBaseUnits = convertToBaseUnits;
|
|
632
|
-
const bignumber_js_1 = __importDefault(__webpack_require__(
|
|
618
|
+
const bignumber_js_1 = __importDefault(__webpack_require__(4978));
|
|
633
619
|
bignumber_js_1.default.config({ DECIMAL_PLACES: 40, EXPONENTIAL_AT: 45 });
|
|
634
620
|
var Operations;
|
|
635
621
|
(function (Operations) {
|
|
@@ -647,7 +633,6 @@ var Operations;
|
|
|
647
633
|
function absolute(value) {
|
|
648
634
|
let x = new bignumber_js_1.default(value);
|
|
649
635
|
const res = x.abs().toString();
|
|
650
|
-
// console.log('Absolute value', { value, res })
|
|
651
636
|
return res;
|
|
652
637
|
}
|
|
653
638
|
function ceil(value) {
|
|
@@ -787,17 +772,10 @@ function roundNumber({ decimalPlaces = 0 }, x) {
|
|
|
787
772
|
}
|
|
788
773
|
function convertFromBaseUnits(assetDecimals, quantity) {
|
|
789
774
|
const decimals = Number(assetDecimals);
|
|
790
|
-
return roundNumber({ decimalPlaces: decimals },
|
|
791
|
-
// eslint-disable-next-line no-magic-numbers
|
|
792
|
-
Math.pow(10, -decimals) * Number(quantity));
|
|
775
|
+
return roundNumber({ decimalPlaces: decimals }, Math.pow(10, -decimals) * Number(quantity));
|
|
793
776
|
}
|
|
794
|
-
/**
|
|
795
|
-
* Computs quantity * 10^(assetDecimals) and rounds the result
|
|
796
|
-
*/
|
|
797
777
|
function convertToBaseUnits(assetDecimals, quantity) {
|
|
798
|
-
// eslint-disable-next-line no-magic-numbers
|
|
799
778
|
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
779
|
return roundNumber({ decimalPlaces: 0 }, baseAmount);
|
|
802
780
|
}
|
|
803
781
|
|
|
@@ -822,20 +800,6 @@ var StateType;
|
|
|
822
800
|
})(StateType || (exports.StateType = StateType = {}));
|
|
823
801
|
|
|
824
802
|
|
|
825
|
-
/***/ }),
|
|
826
|
-
|
|
827
|
-
/***/ 1297:
|
|
828
|
-
/***/ ((module) => {
|
|
829
|
-
|
|
830
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__1297__;
|
|
831
|
-
|
|
832
|
-
/***/ }),
|
|
833
|
-
|
|
834
|
-
/***/ 1475:
|
|
835
|
-
/***/ ((module) => {
|
|
836
|
-
|
|
837
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__1475__;
|
|
838
|
-
|
|
839
803
|
/***/ }),
|
|
840
804
|
|
|
841
805
|
/***/ 1492:
|
|
@@ -873,6 +837,13 @@ var SettingTypeColumn;
|
|
|
873
837
|
})(SettingTypeColumn || (exports.SettingTypeColumn = SettingTypeColumn = {}));
|
|
874
838
|
|
|
875
839
|
|
|
840
|
+
/***/ }),
|
|
841
|
+
|
|
842
|
+
/***/ 2165:
|
|
843
|
+
/***/ ((module) => {
|
|
844
|
+
|
|
845
|
+
module.exports = require("@certusone/wormhole-sdk");
|
|
846
|
+
|
|
876
847
|
/***/ }),
|
|
877
848
|
|
|
878
849
|
/***/ 2169:
|
|
@@ -1325,7 +1296,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
1325
1296
|
};
|
|
1326
1297
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1327
1298
|
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;
|
|
1328
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
1299
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
1329
1300
|
const enums_1 = __webpack_require__(9965);
|
|
1330
1301
|
const codex_helper_1 = __webpack_require__(3955);
|
|
1331
1302
|
const Encoding_1 = __webpack_require__(8593);
|
|
@@ -1377,7 +1348,6 @@ const makeDtwMsg = (data) => {
|
|
|
1377
1348
|
const bs64OrderBytes = (0, codex_helper_1.getBase64EncodedData)(dataBytes);
|
|
1378
1349
|
console.log(`Dtw data should be ${exports.DTW_DATA_BYTES_LENGTH} bytes`, bs64OrderBytes.length, bs64OrderBytes);
|
|
1379
1350
|
return bs64OrderBytes;
|
|
1380
|
-
// return makeSigningMessage(JSON.stringify(data), dataBytes);
|
|
1381
1351
|
};
|
|
1382
1352
|
exports.makeDtwMsg = makeDtwMsg;
|
|
1383
1353
|
const decodeTransferMsg = (message, encoding = 'hex') => {
|
|
@@ -1414,7 +1384,6 @@ const makeTransferMsg = (data) => {
|
|
|
1414
1384
|
const bs64OrderBytes = (0, codex_helper_1.getBase64EncodedData)(dataBytes);
|
|
1415
1385
|
console.log(`Transfer data should be ${exports.TRANSFER_DATA_BYTES_LENGTH} bytes`, bs64OrderBytes.length, bs64OrderBytes);
|
|
1416
1386
|
return bs64OrderBytes;
|
|
1417
|
-
// return makeSigningMessage(JSON.stringify(data), dataBytes);
|
|
1418
1387
|
};
|
|
1419
1388
|
exports.makeTransferMsg = makeTransferMsg;
|
|
1420
1389
|
const makeTransferTxn = async ({ data, message, signature }, dtw, options) => {
|
|
@@ -1464,7 +1433,6 @@ const makeTransferTxn = async ({ data, message, signature }, dtw, options) => {
|
|
|
1464
1433
|
foreignApps,
|
|
1465
1434
|
boxes: allBoxes,
|
|
1466
1435
|
});
|
|
1467
|
-
// console.log('directTransfer txn', appCallTxn);
|
|
1468
1436
|
return appCallTxn;
|
|
1469
1437
|
};
|
|
1470
1438
|
exports.makeTransferTxn = makeTransferTxn;
|
|
@@ -1522,13 +1490,6 @@ var SortDirectionEnum;
|
|
|
1522
1490
|
})(SortDirectionEnum || (exports.SortDirectionEnum = SortDirectionEnum = {}));
|
|
1523
1491
|
|
|
1524
1492
|
|
|
1525
|
-
/***/ }),
|
|
1526
|
-
|
|
1527
|
-
/***/ 3519:
|
|
1528
|
-
/***/ ((module) => {
|
|
1529
|
-
|
|
1530
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__3519__;
|
|
1531
|
-
|
|
1532
1493
|
/***/ }),
|
|
1533
1494
|
|
|
1534
1495
|
/***/ 3574:
|
|
@@ -1645,8 +1606,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1645
1606
|
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;
|
|
1646
1607
|
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;
|
|
1647
1608
|
exports.getTokenFromNormalized = getTokenFromNormalized;
|
|
1648
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
1649
|
-
const bs58 = __importStar(__webpack_require__(
|
|
1609
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
1610
|
+
const bs58 = __importStar(__webpack_require__(5316));
|
|
1650
1611
|
const big_number_helper_1 = __webpack_require__(1174);
|
|
1651
1612
|
const utils_1 = __webpack_require__(8398);
|
|
1652
1613
|
const codex_1 = __webpack_require__(430);
|
|
@@ -1690,7 +1651,6 @@ function getTokenFromNormalized(token, chainId) {
|
|
|
1690
1651
|
return (0, exports.getAddressFromNormalized)(token, Number(chainId));
|
|
1691
1652
|
}
|
|
1692
1653
|
const encode = (value, type, chain) => {
|
|
1693
|
-
// console.log('encode', JSON.stringify({ value: typeof value === "bigint" ? `${value}n` : value, type, chain }));
|
|
1694
1654
|
switch (type) {
|
|
1695
1655
|
case '8B': return algosdk_1.default.encodeUint64(Number(value));
|
|
1696
1656
|
case '32B': return (0, eth_helper_1.encode32Bytes)(value);
|
|
@@ -1793,13 +1753,6 @@ const encodeToken = (token, chain) => {
|
|
|
1793
1753
|
exports.encodeToken = encodeToken;
|
|
1794
1754
|
const getCodexStateValue = async (algoClient, appId) => {
|
|
1795
1755
|
const globalState = await (0, algo_helper_1.getAppGlobalState)(algoClient, appId);
|
|
1796
|
-
// console.log('codexState', appId, globalState);
|
|
1797
|
-
// if (globalState["MNA"]) {
|
|
1798
|
-
// console.log('MNA', decodeAddress(Buffer.from(globalState["MNA"]), 8));
|
|
1799
|
-
// }
|
|
1800
|
-
// if (globalState["BKA"]) {
|
|
1801
|
-
// console.log('BKA', decodeAddress(Buffer.from(globalState["BKA"]), 8));
|
|
1802
|
-
// }
|
|
1803
1756
|
const msgProcId = globalState["MSG_PROCESSOR"];
|
|
1804
1757
|
const superAppId = globalState["UL_SUPERADMIN_APP"];
|
|
1805
1758
|
let superWallet = globalState["UL_SUPERADMIN_WALLET"];
|
|
@@ -1929,7 +1882,6 @@ const getAccountBalanceBoxValue = async (algoClient, appId, login, token) => {
|
|
|
1929
1882
|
};
|
|
1930
1883
|
exports.getAccountBalanceBoxValue = getAccountBalanceBoxValue;
|
|
1931
1884
|
const getAccountBoxValue = async (algoClient, appId, loginAddress, loginChainId, tokenAddress, tokenChainId) => {
|
|
1932
|
-
// console.log('getAccountBoxValue', { loginAddress, loginChainId, tokenAddress, tokenChainId });
|
|
1933
1885
|
const boxName = (0, eth_helper_1.keccak256)((0, exports.getAccountBalanceBoxName)(loginAddress, loginChainId, tokenAddress, tokenChainId));
|
|
1934
1886
|
const boxValue = await getAccountBox(algoClient, appId, boxName);
|
|
1935
1887
|
console.log('Box account value', loginAddress.substring(0, 8), tokenAddress, boxValue, Buffer.from(boxName).toString('hex'));
|
|
@@ -2125,7 +2077,7 @@ const makeCreateOrderMsg = (data) => {
|
|
|
2125
2077
|
(0, exports.encode)(data.companyId, '2B'),
|
|
2126
2078
|
(0, exports.encode)(data.random, '8B'),
|
|
2127
2079
|
(0, exports.encode)(data.decimalPrice, 'float'),
|
|
2128
|
-
Buffer.alloc(50),
|
|
2080
|
+
Buffer.alloc(50),
|
|
2129
2081
|
]);
|
|
2130
2082
|
const bs64OrderBytes = new Uint8Array(Buffer.from((0, Encoding_1.encodeBase64)(orderBytes)));
|
|
2131
2083
|
const messageBytes = new Uint8Array([
|
|
@@ -2206,14 +2158,13 @@ const decodeCreateOrderMsg = (message, encoding = 'hex') => {
|
|
|
2206
2158
|
return {
|
|
2207
2159
|
...orderData,
|
|
2208
2160
|
expiredDate: String(orderData.expiredTime).length > 10
|
|
2209
|
-
? new Date(orderData.expiredTime)
|
|
2161
|
+
? new Date(orderData.expiredTime)
|
|
2210
2162
|
: new Date(orderData.expiredTime * 1000)
|
|
2211
2163
|
};
|
|
2212
2164
|
};
|
|
2213
2165
|
exports.decodeCreateOrderMsg = decodeCreateOrderMsg;
|
|
2214
2166
|
const getMatchOrderArgs = (order) => {
|
|
2215
2167
|
const { id, address, chain, message, encoding, signature, tradingKey } = order;
|
|
2216
|
-
// console.log('getMatchOrderArgs', JSON.stringify(order));
|
|
2217
2168
|
const signAddress = tradingKey || address;
|
|
2218
2169
|
const signChain = tradingKey ? enums_1.Chains.Algorand : chain;
|
|
2219
2170
|
return [
|
|
@@ -2242,8 +2193,6 @@ const createBoxes = (appIndex, boxNames, encode = eth_helper_1.keccak256) => {
|
|
|
2242
2193
|
appIndex,
|
|
2243
2194
|
name: encode(boxName)
|
|
2244
2195
|
}));
|
|
2245
|
-
// console.log('createBoxes', boxes.map(b => Buffer.from(b.name).toString('hex')))
|
|
2246
|
-
// console.log(`createBoxesBytes`, boxes.map(b => Array.apply([], Array.from(b.name)).join(", ")));
|
|
2247
2196
|
return boxes;
|
|
2248
2197
|
};
|
|
2249
2198
|
exports.createBoxes = createBoxes;
|
|
@@ -2337,7 +2286,7 @@ const makeMatchTxns = (appId, args, params, sender, encoding = 'hex') => {
|
|
|
2337
2286
|
getShareWalletBoxKey(afTaker, baseAsset),
|
|
2338
2287
|
getShareWalletBoxKey(afTaker, priceAsset),
|
|
2339
2288
|
]
|
|
2340
|
-
.filter(Boolean)
|
|
2289
|
+
.filter(Boolean)
|
|
2341
2290
|
.map(o => Buffer.from(o).toString('hex')))
|
|
2342
2291
|
].map(o => Buffer.from(o, 'hex'));
|
|
2343
2292
|
const allBoxes = [
|
|
@@ -2351,7 +2300,6 @@ const makeMatchTxns = (appId, args, params, sender, encoding = 'hex') => {
|
|
|
2351
2300
|
];
|
|
2352
2301
|
const allBoxesUnique = [...new Set(allBoxes.map(o => Buffer.from(o.name).toString('hex')))];
|
|
2353
2302
|
console.log(`[TradeID: ${id}] All boxes`, JSON.stringify(allBoxesUnique));
|
|
2354
|
-
// allBoxes = allBoxesUnique.map(o => Buffer.from(o.name))
|
|
2355
2303
|
const foreignApps = [superAppId];
|
|
2356
2304
|
const MAX_REFS = 8;
|
|
2357
2305
|
const mainTxnBoxes = allBoxes.slice(0, MAX_REFS - foreignApps.length);
|
|
@@ -2376,12 +2324,6 @@ const makeMatchTxns = (appId, args, params, sender, encoding = 'hex') => {
|
|
|
2376
2324
|
};
|
|
2377
2325
|
exports.makeMatchTxns = makeMatchTxns;
|
|
2378
2326
|
const makeLoginMsg = (data, signingMessage) => {
|
|
2379
|
-
// const dataBytes = concatArrays([
|
|
2380
|
-
// encode(data.address, 'address', data.chainId),
|
|
2381
|
-
// encode(data.chainId, '8B'),
|
|
2382
|
-
// encode(data.provider, 'str'),
|
|
2383
|
-
// ]);
|
|
2384
|
-
// return makeSigningMessage(data.signingMessage, dataBytes);
|
|
2385
2327
|
const { address, technology } = data;
|
|
2386
2328
|
return (0, exports.getUtf8EncodedData)(signingMessage || JSON.stringify({ address, technology }));
|
|
2387
2329
|
};
|
|
@@ -2415,9 +2357,7 @@ const decodeTradingKeyMsg = (message, encoding = 'hex') => {
|
|
|
2415
2357
|
};
|
|
2416
2358
|
};
|
|
2417
2359
|
exports.decodeTradingKeyMsg = decodeTradingKeyMsg;
|
|
2418
|
-
const makeAddTradingKeyTxn = async (algoClient, appId, superId, sender, { loginAddress, loginChainId, }, message,
|
|
2419
|
-
// encoding: BufferEncoding | undefined,
|
|
2420
|
-
signature) => {
|
|
2360
|
+
const makeAddTradingKeyTxn = async (algoClient, appId, superId, sender, { loginAddress, loginChainId, }, message, signature) => {
|
|
2421
2361
|
const msgArgs = (0, codex_1.getMsgArgs)(message, signature, loginAddress, loginChainId);
|
|
2422
2362
|
const appArgs = (0, codex_1.getAppArgs)("manageTradingKey(byte[],byte[],byte[],byte[])uint64", [
|
|
2423
2363
|
(0, exports.encode)('add', 'str'),
|
|
@@ -2438,9 +2378,7 @@ signature) => {
|
|
|
2438
2378
|
return txn;
|
|
2439
2379
|
};
|
|
2440
2380
|
exports.makeAddTradingKeyTxn = makeAddTradingKeyTxn;
|
|
2441
|
-
const makeRevokeTradingKeyTxn = async (algoClient, appId, superId, sender, { loginAddress, loginChainId, }, message,
|
|
2442
|
-
// encoding: BufferEncoding | undefined,
|
|
2443
|
-
signature) => {
|
|
2381
|
+
const makeRevokeTradingKeyTxn = async (algoClient, appId, superId, sender, { loginAddress, loginChainId, }, message, signature) => {
|
|
2444
2382
|
const msgArgs = (0, codex_1.getMsgArgs)(message, signature, loginAddress, loginChainId);
|
|
2445
2383
|
const appArgs = (0, codex_1.getAppArgs)("manageTradingKey(byte[],byte[],byte[],byte[])uint64", [
|
|
2446
2384
|
(0, exports.encode)('delete', 'str'),
|
|
@@ -2465,7 +2403,6 @@ const makeSetCollectionWalletMsg = (data) => {
|
|
|
2465
2403
|
const chainIdBytes = algosdk_1.default.encodeUint64(loginChainId);
|
|
2466
2404
|
const dataBytes = (0, Encoding_1.concatArrays)([senderBytes, chainIdBytes, companyIdBytes]);
|
|
2467
2405
|
const messageBytes = new Uint8Array([
|
|
2468
|
-
// ...getUtf8EncodedData(JSON.stringify(data)),
|
|
2469
2406
|
...(0, exports.getBase64EncodedData)(dataBytes),
|
|
2470
2407
|
]);
|
|
2471
2408
|
console.log('MESSAGE LENGTH: ', messageBytes);
|
|
@@ -2480,14 +2417,10 @@ const getUtf8EncodedData = (jsonData) => new Uint8Array(Buffer.from((jsonData +
|
|
|
2480
2417
|
exports.getUtf8EncodedData = getUtf8EncodedData;
|
|
2481
2418
|
const getBase64EncodedData = (data) => new Uint8Array(Buffer.from((0, Encoding_1.encodeBase64)(data)));
|
|
2482
2419
|
exports.getBase64EncodedData = getBase64EncodedData;
|
|
2483
|
-
const makeWithdrawTxns = async (algoClient, { loginAddress, loginChainId, tokenIndex, recipient, recipientChainId }, message, signature,
|
|
2484
|
-
// encoding: BufferEncoding | undefined,
|
|
2485
|
-
sender, options) => {
|
|
2420
|
+
const makeWithdrawTxns = async (algoClient, { loginAddress, loginChainId, tokenIndex, recipient, recipientChainId }, message, signature, sender, options) => {
|
|
2486
2421
|
const msgArgs = (0, codex_1.getMsgArgs)(message, signature, loginAddress, loginChainId);
|
|
2487
2422
|
const appArgs = (0, codex_1.getAppArgs)("withdraw(byte[],byte[],byte[])uint64", msgArgs);
|
|
2488
2423
|
const isAlgoChain = recipientChainId === enums_1.Chains.Algorand;
|
|
2489
|
-
// TODO: calc actual txn fee
|
|
2490
|
-
// const params = await getTxnParams(algoClient, 7);
|
|
2491
2424
|
const params = await (0, algo_helper_1.getTxnParams)(algoClient, isAlgoChain ? 6 : 2);
|
|
2492
2425
|
params.fee = params.fee + (algosdk_1.default.ALGORAND_MIN_TX_FEE * 5);
|
|
2493
2426
|
const { appId, coreId, lsaAddress, msgProcessorId, unifiedChainId, cctpSupportedChains, superWallet } = options;
|
|
@@ -2738,10 +2671,17 @@ exports.messageForSigning = messageForSigning;
|
|
|
2738
2671
|
|
|
2739
2672
|
/***/ }),
|
|
2740
2673
|
|
|
2741
|
-
/***/
|
|
2674
|
+
/***/ 4978:
|
|
2675
|
+
/***/ ((module) => {
|
|
2676
|
+
|
|
2677
|
+
module.exports = require("bignumber.js");
|
|
2678
|
+
|
|
2679
|
+
/***/ }),
|
|
2680
|
+
|
|
2681
|
+
/***/ 5213:
|
|
2742
2682
|
/***/ ((module) => {
|
|
2743
2683
|
|
|
2744
|
-
module.exports =
|
|
2684
|
+
module.exports = require("crypto-js");
|
|
2745
2685
|
|
|
2746
2686
|
/***/ }),
|
|
2747
2687
|
|
|
@@ -2759,6 +2699,13 @@ var UpgradeStatus;
|
|
|
2759
2699
|
})(UpgradeStatus || (exports.UpgradeStatus = UpgradeStatus = {}));
|
|
2760
2700
|
|
|
2761
2701
|
|
|
2702
|
+
/***/ }),
|
|
2703
|
+
|
|
2704
|
+
/***/ 5316:
|
|
2705
|
+
/***/ ((module) => {
|
|
2706
|
+
|
|
2707
|
+
module.exports = require("bs58");
|
|
2708
|
+
|
|
2762
2709
|
/***/ }),
|
|
2763
2710
|
|
|
2764
2711
|
/***/ 5386:
|
|
@@ -2809,11 +2756,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
2809
2756
|
})();
|
|
2810
2757
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2811
2758
|
exports.getVaaId = exports.wormholeEmitterFormat = void 0;
|
|
2812
|
-
const CryptoJS = __importStar(__webpack_require__(
|
|
2813
|
-
const algosdk_1 = __webpack_require__(
|
|
2814
|
-
const wormhole_sdk_1 = __webpack_require__(
|
|
2815
|
-
const bs58_1 = __webpack_require__(
|
|
2816
|
-
const solana_1 = __webpack_require__(
|
|
2759
|
+
const CryptoJS = __importStar(__webpack_require__(5213));
|
|
2760
|
+
const algosdk_1 = __webpack_require__(8115);
|
|
2761
|
+
const wormhole_sdk_1 = __webpack_require__(2165);
|
|
2762
|
+
const bs58_1 = __webpack_require__(5316);
|
|
2763
|
+
const solana_1 = __webpack_require__(897);
|
|
2817
2764
|
const codex_helper_1 = __webpack_require__(3955);
|
|
2818
2765
|
const wormholeEmitterFormat = (address, chainId) => {
|
|
2819
2766
|
if ((0, wormhole_sdk_1.isEVMChain)(chainId)) {
|
|
@@ -2862,7 +2809,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
2862
2809
|
};
|
|
2863
2810
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2864
2811
|
exports.makeRemoveExpiredOrderTxn = exports.calcOrderHash = exports.getOrderBoxKeyFromHash = exports.getOrderBoxKey = exports.getOrderBytesFromMsg = void 0;
|
|
2865
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
2812
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
2866
2813
|
const common_helper_1 = __webpack_require__(223);
|
|
2867
2814
|
const Encoding_1 = __webpack_require__(8593);
|
|
2868
2815
|
const constants_1 = __webpack_require__(6450);
|
|
@@ -2926,25 +2873,25 @@ function getDatepartValue(value) {
|
|
|
2926
2873
|
if (!units) {
|
|
2927
2874
|
return mapWithTimeframe(datepart, 1);
|
|
2928
2875
|
}
|
|
2929
|
-
if (datepart === 'minute' && units % (7 * 24 * 60) === 0) {
|
|
2876
|
+
if (datepart === 'minute' && units % (7 * 24 * 60) === 0) {
|
|
2930
2877
|
return mapWithTimeframe('week', units / (7 * 24 * 60));
|
|
2931
2878
|
}
|
|
2932
|
-
if (datepart === 'minute' && units % (24 * 60) === 0) {
|
|
2879
|
+
if (datepart === 'minute' && units % (24 * 60) === 0) {
|
|
2933
2880
|
return mapWithTimeframe('day', units / (24 * 60));
|
|
2934
2881
|
}
|
|
2935
|
-
if (datepart === 'minute' && units % 60 === 0) {
|
|
2882
|
+
if (datepart === 'minute' && units % 60 === 0) {
|
|
2936
2883
|
return mapWithTimeframe('hour', units / 60);
|
|
2937
2884
|
}
|
|
2938
|
-
if (datepart === 'hour' && units % (7 * 24) === 0) {
|
|
2885
|
+
if (datepart === 'hour' && units % (7 * 24) === 0) {
|
|
2939
2886
|
return mapWithTimeframe('week', units / (7 * 24));
|
|
2940
2887
|
}
|
|
2941
|
-
if (datepart === 'hour' && units % 24 === 0) {
|
|
2888
|
+
if (datepart === 'hour' && units % 24 === 0) {
|
|
2942
2889
|
return mapWithTimeframe(units === 24 ? 'hour' : 'day', units === 24 ? 24 : units / 24);
|
|
2943
2890
|
}
|
|
2944
|
-
if (datepart === 'day' && units % 7 === 0) {
|
|
2891
|
+
if (datepart === 'day' && units % 7 === 0) {
|
|
2945
2892
|
return mapWithTimeframe('week', units / 7);
|
|
2946
2893
|
}
|
|
2947
|
-
if (datepart === 'month' && units % 12 === 0) {
|
|
2894
|
+
if (datepart === 'month' && units % 12 === 0) {
|
|
2948
2895
|
return mapWithTimeframe('year', units / 12);
|
|
2949
2896
|
}
|
|
2950
2897
|
return mapWithTimeframe(datepart, units);
|
|
@@ -3014,13 +2961,6 @@ var TwitterAccessScopeEnum;
|
|
|
3014
2961
|
})(TwitterAccessScopeEnum || (exports.TwitterAccessScopeEnum = TwitterAccessScopeEnum = {}));
|
|
3015
2962
|
|
|
3016
2963
|
|
|
3017
|
-
/***/ }),
|
|
3018
|
-
|
|
3019
|
-
/***/ 6168:
|
|
3020
|
-
/***/ ((module) => {
|
|
3021
|
-
|
|
3022
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__6168__;
|
|
3023
|
-
|
|
3024
2964
|
/***/ }),
|
|
3025
2965
|
|
|
3026
2966
|
/***/ 6450:
|
|
@@ -3095,7 +3035,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3095
3035
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3096
3036
|
exports.verifySignature = exports.decodeAndNormalizeAddress = exports.isAssetOptedIn = exports.getTxnParams = exports.getBoxByName = exports.getAppBoxes = exports.getAppGlobalState = exports.getAccountAssetBalances = exports.createBoxes = void 0;
|
|
3097
3037
|
exports.decodeStateArray = decodeStateArray;
|
|
3098
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
3038
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
3099
3039
|
const Encoding_1 = __webpack_require__(8593);
|
|
3100
3040
|
const helpers_1 = __webpack_require__(9730);
|
|
3101
3041
|
const createBoxes = (appIndex, foreignApps) => {
|
|
@@ -3155,7 +3095,6 @@ const getAppBoxes = async (algodClient, appId) => {
|
|
|
3155
3095
|
exports.getAppBoxes = getAppBoxes;
|
|
3156
3096
|
const getBoxByName = async (algoClient, appId, boxName) => {
|
|
3157
3097
|
try {
|
|
3158
|
-
// console.log('Get box by name', boxName);
|
|
3159
3098
|
const { value } = await algoClient.getApplicationBoxByName(appId, boxName).do();
|
|
3160
3099
|
const box = value;
|
|
3161
3100
|
return box;
|
|
@@ -3355,23 +3294,19 @@ var SmallTimeframeEnum;
|
|
|
3355
3294
|
SmallTimeframeEnum["last_year"] = "last_year";
|
|
3356
3295
|
})(SmallTimeframeEnum || (exports.SmallTimeframeEnum = SmallTimeframeEnum = {}));
|
|
3357
3296
|
class PairsQueryDto {
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
this.page = 1;
|
|
3364
|
-
}
|
|
3297
|
+
timeRange = SmallTimeframeEnum.last_30_days;
|
|
3298
|
+
sortBy = 'volume_usd';
|
|
3299
|
+
order = 'desc';
|
|
3300
|
+
limit = 20;
|
|
3301
|
+
page = 1;
|
|
3365
3302
|
}
|
|
3366
3303
|
exports.PairsQueryDto = PairsQueryDto;
|
|
3367
3304
|
class UsersQueryDto {
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
this.page = 1;
|
|
3374
|
-
}
|
|
3305
|
+
timeRange = SmallTimeframeEnum.last_30_days;
|
|
3306
|
+
sortBy = 'volume_usd';
|
|
3307
|
+
order = 'desc';
|
|
3308
|
+
limit = 20;
|
|
3309
|
+
page = 1;
|
|
3375
3310
|
}
|
|
3376
3311
|
exports.UsersQueryDto = UsersQueryDto;
|
|
3377
3312
|
var StatisticTypeQuery;
|
|
@@ -3382,10 +3317,8 @@ var StatisticTypeQuery;
|
|
|
3382
3317
|
StatisticTypeQuery["dau"] = "dau";
|
|
3383
3318
|
})(StatisticTypeQuery || (exports.StatisticTypeQuery = StatisticTypeQuery = {}));
|
|
3384
3319
|
class ChartQueryDto {
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
this.timeRange = SmallTimeframeEnum.last_7_days;
|
|
3388
|
-
}
|
|
3320
|
+
type = StatisticTypeQuery.volume;
|
|
3321
|
+
timeRange = SmallTimeframeEnum.last_7_days;
|
|
3389
3322
|
}
|
|
3390
3323
|
exports.ChartQueryDto = ChartQueryDto;
|
|
3391
3324
|
|
|
@@ -3526,6 +3459,13 @@ exports.QueueOptions = {
|
|
|
3526
3459
|
};
|
|
3527
3460
|
|
|
3528
3461
|
|
|
3462
|
+
/***/ }),
|
|
3463
|
+
|
|
3464
|
+
/***/ 7835:
|
|
3465
|
+
/***/ ((module) => {
|
|
3466
|
+
|
|
3467
|
+
module.exports = require("ethereumjs-util");
|
|
3468
|
+
|
|
3529
3469
|
/***/ }),
|
|
3530
3470
|
|
|
3531
3471
|
/***/ 8060:
|
|
@@ -3537,7 +3477,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3537
3477
|
};
|
|
3538
3478
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3539
3479
|
exports.makeGroupTxnsWithDummy = exports.makeDummyTxn = void 0;
|
|
3540
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
3480
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
3541
3481
|
const common_helper_1 = __webpack_require__(223);
|
|
3542
3482
|
const makeDummyTxn = (appIndex, sender, params, boxes, note, foreignApps) => {
|
|
3543
3483
|
const appArgs = (0, common_helper_1.getAppArgs)("dummy(uint64)void", [1]);
|
|
@@ -3577,8 +3517,6 @@ const makeGroupTxnsWithDummy = (id, mainTxnBody) => {
|
|
|
3577
3517
|
dummyTxnIndex++;
|
|
3578
3518
|
}
|
|
3579
3519
|
}
|
|
3580
|
-
// TODO: check this dummy txn
|
|
3581
|
-
// additional dummy txn for withdrawal
|
|
3582
3520
|
dummyTxns2.push((0, exports.makeDummyTxn)(appIndex, from, suggestedParams, [], `${id}_${++dummyTxnIndex}`, foreignApps));
|
|
3583
3521
|
console.log("dummy count", dummyTxns2.length);
|
|
3584
3522
|
return [mainTxn, ...dummyTxns2];
|
|
@@ -3586,6 +3524,13 @@ const makeGroupTxnsWithDummy = (id, mainTxnBody) => {
|
|
|
3586
3524
|
exports.makeGroupTxnsWithDummy = makeGroupTxnsWithDummy;
|
|
3587
3525
|
|
|
3588
3526
|
|
|
3527
|
+
/***/ }),
|
|
3528
|
+
|
|
3529
|
+
/***/ 8115:
|
|
3530
|
+
/***/ ((module) => {
|
|
3531
|
+
|
|
3532
|
+
module.exports = require("algosdk");
|
|
3533
|
+
|
|
3589
3534
|
/***/ }),
|
|
3590
3535
|
|
|
3591
3536
|
/***/ 8398:
|
|
@@ -3685,7 +3630,7 @@ function removeField(obj, fieldToRemove) {
|
|
|
3685
3630
|
.filter(([key]) => key !== fieldToRemove)
|
|
3686
3631
|
.map(([key, value]) => [key, removeField(value, fieldToRemove)]));
|
|
3687
3632
|
}
|
|
3688
|
-
return obj;
|
|
3633
|
+
return obj;
|
|
3689
3634
|
}
|
|
3690
3635
|
function removeUndefined(obj) {
|
|
3691
3636
|
return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== undefined));
|
|
@@ -3749,9 +3694,8 @@ exports.getDeltaUint = getDeltaUint;
|
|
|
3749
3694
|
exports.getDeltaBytes = getDeltaBytes;
|
|
3750
3695
|
exports.toUnix = toUnix;
|
|
3751
3696
|
exports.fromUnix = fromUnix;
|
|
3752
|
-
const algosdk_1 = __importStar(__webpack_require__(
|
|
3753
|
-
|
|
3754
|
-
const buffer_1 = __webpack_require__(18);
|
|
3697
|
+
const algosdk_1 = __importStar(__webpack_require__(8115));
|
|
3698
|
+
const buffer_1 = __webpack_require__(9428);
|
|
3755
3699
|
function concatArrays(arrays) {
|
|
3756
3700
|
return arrays.reduce((a, b) => Uint8Array.from([...a, ...b]));
|
|
3757
3701
|
}
|
|
@@ -3904,15 +3848,6 @@ function encodeBase64(value) {
|
|
|
3904
3848
|
function decodeBase64(value) {
|
|
3905
3849
|
return buffer_1.Buffer.from(value, 'base64');
|
|
3906
3850
|
}
|
|
3907
|
-
// export const sha256HashLength = 32
|
|
3908
|
-
// export function sha256Hash(arr: sha512.Message): Uint8Array {
|
|
3909
|
-
// return new Uint8Array(sha512.sha512_256.arrayBuffer(arr))
|
|
3910
|
-
// }
|
|
3911
|
-
// export function encodeApplicationAddress(id: number): Address {
|
|
3912
|
-
// const APP_ID_PREFIX = Buffer.from('appID');
|
|
3913
|
-
// const toBeSigned = concatArrays([APP_ID_PREFIX, encodeUint64(BigInt(id))]);
|
|
3914
|
-
// return encodeAddress(sha256Hash(toBeSigned));
|
|
3915
|
-
// }
|
|
3916
3851
|
function compareArrays(a, b) {
|
|
3917
3852
|
return a.length === b.length && a.reduce((equal, item, index) => equal && item === b[index], true);
|
|
3918
3853
|
}
|
|
@@ -3940,7 +3875,7 @@ function toUnix(date) {
|
|
|
3940
3875
|
function fromUnix(timestamp) {
|
|
3941
3876
|
return new Date(timestamp * 1000);
|
|
3942
3877
|
}
|
|
3943
|
-
var algosdk_2 = __webpack_require__(
|
|
3878
|
+
var algosdk_2 = __webpack_require__(8115);
|
|
3944
3879
|
Object.defineProperty(exports, "encodeAddress", ({ enumerable: true, get: function () { return algosdk_2.encodeAddress; } }));
|
|
3945
3880
|
Object.defineProperty(exports, "decodeAddress", ({ enumerable: true, get: function () { return algosdk_2.decodeAddress; } }));
|
|
3946
3881
|
|
|
@@ -3989,11 +3924,10 @@ exports.keccak256 = exports.verifyMessage = exports.verifySignature = exports.re
|
|
|
3989
3924
|
exports.decode32Bytes = decode32Bytes;
|
|
3990
3925
|
exports.encodeBigNumber = encodeBigNumber;
|
|
3991
3926
|
exports.encode32Bytes = encode32Bytes;
|
|
3992
|
-
const ethUtil = __importStar(__webpack_require__(
|
|
3927
|
+
const ethUtil = __importStar(__webpack_require__(7835));
|
|
3993
3928
|
const common_helper_1 = __webpack_require__(223);
|
|
3994
3929
|
function decode32Bytes(value) {
|
|
3995
3930
|
const bnValue = ethUtil.fromSigned(Buffer.from(value));
|
|
3996
|
-
// console.log('bnValue', value, bnValue, bnValue.toString())
|
|
3997
3931
|
return BigInt(bnValue.toString());
|
|
3998
3932
|
}
|
|
3999
3933
|
function encodeBigNumber(value) {
|
|
@@ -4037,9 +3971,8 @@ exports.unpadHexPrefix = unpadHexPrefix;
|
|
|
4037
3971
|
const isAddress = (address) => ethUtil.isValidAddress(address);
|
|
4038
3972
|
exports.isAddress = isAddress;
|
|
4039
3973
|
const recoverPublicKey = (message, signature) => {
|
|
4040
|
-
const messageHash = ethUtil.keccak256(message);
|
|
3974
|
+
const messageHash = ethUtil.keccak256(message);
|
|
4041
3975
|
const { r, s, v } = ethUtil.fromRpcSig(signature);
|
|
4042
|
-
// Recover the public key
|
|
4043
3976
|
return ethUtil.ecrecover(messageHash, v, r, s);
|
|
4044
3977
|
};
|
|
4045
3978
|
exports.recoverPublicKey = recoverPublicKey;
|
|
@@ -4070,7 +4003,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4070
4003
|
};
|
|
4071
4004
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4072
4005
|
exports.makeSetManagerKeyTxn = void 0;
|
|
4073
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
4006
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
4074
4007
|
const algo_helper_1 = __webpack_require__(6897);
|
|
4075
4008
|
const codex_helper_1 = __webpack_require__(3955);
|
|
4076
4009
|
const common_helper_1 = __webpack_require__(223);
|
|
@@ -4082,14 +4015,12 @@ const makeSetManagerKeyTxn = async (algoClient, superAppId, sender, mnaKey) => {
|
|
|
4082
4015
|
console.log("new MNA key:", mnaKey);
|
|
4083
4016
|
console.log("sender:", sender);
|
|
4084
4017
|
console.log("superAppId:", superAppId);
|
|
4085
|
-
// return makeSetGlobalTxn(algoClient, superAppId, sender, AppGlobalParamName.MNA, mnaKey, AppGlobalParamType.STRING);
|
|
4086
4018
|
const txn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
4087
4019
|
appIndex: superAppId,
|
|
4088
4020
|
from: sender,
|
|
4089
4021
|
suggestedParams: params,
|
|
4090
4022
|
appArgs: (0, common_helper_1.getAppArgs)("set_global(byte[],byte[],byte[])void", [
|
|
4091
4023
|
(0, codex_helper_1.encode)("MNA", 'str'),
|
|
4092
|
-
// encode(mnaKey, 'str'),
|
|
4093
4024
|
algosdk_1.default.decodeAddress(mnaKey).publicKey,
|
|
4094
4025
|
(0, codex_helper_1.encode)('S', 'str')
|
|
4095
4026
|
]),
|
|
@@ -4105,7 +4036,6 @@ exports.makeSetManagerKeyTxn = makeSetManagerKeyTxn;
|
|
|
4105
4036
|
/***/ ((__unused_webpack_module, exports) => {
|
|
4106
4037
|
|
|
4107
4038
|
|
|
4108
|
-
//--import { Asset } from "@ultrade/shared/db/entities/market/asset.entity";
|
|
4109
4039
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4110
4040
|
exports.AmmBucketKeys = exports.VALIDATOR_APP_ID = exports.CONTRACT_VERSION = exports.AmmForeignResources = exports.AmmChars = exports.AmmIds = exports.PoolType = void 0;
|
|
4111
4041
|
var PoolType;
|
|
@@ -4172,7 +4102,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4172
4102
|
};
|
|
4173
4103
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4174
4104
|
exports.makeUpdateMbrTxn = exports.getMbrBoxValue = void 0;
|
|
4175
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
4105
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
4176
4106
|
const algo_helper_1 = __webpack_require__(6897);
|
|
4177
4107
|
const common_helper_1 = __webpack_require__(223);
|
|
4178
4108
|
const Encoding_1 = __webpack_require__(8593);
|
|
@@ -4224,10 +4154,10 @@ exports.makeUpdateMbrTxn = makeUpdateMbrTxn;
|
|
|
4224
4154
|
|
|
4225
4155
|
/***/ }),
|
|
4226
4156
|
|
|
4227
|
-
/***/
|
|
4157
|
+
/***/ 9428:
|
|
4228
4158
|
/***/ ((module) => {
|
|
4229
4159
|
|
|
4230
|
-
module.exports =
|
|
4160
|
+
module.exports = require("buffer");
|
|
4231
4161
|
|
|
4232
4162
|
/***/ }),
|
|
4233
4163
|
|
|
@@ -4302,13 +4232,6 @@ __exportStar(__webpack_require__(6119), exports);
|
|
|
4302
4232
|
__exportStar(__webpack_require__(3004), exports);
|
|
4303
4233
|
|
|
4304
4234
|
|
|
4305
|
-
/***/ }),
|
|
4306
|
-
|
|
4307
|
-
/***/ 9999:
|
|
4308
|
-
/***/ ((module) => {
|
|
4309
|
-
|
|
4310
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__9999__;
|
|
4311
|
-
|
|
4312
4235
|
/***/ })
|
|
4313
4236
|
|
|
4314
4237
|
/******/ });
|
|
@@ -4343,8 +4266,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__9999__;
|
|
|
4343
4266
|
/******/ // Load entry module and return exports
|
|
4344
4267
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
4345
4268
|
/******/ var __webpack_exports__ = __webpack_require__(5794);
|
|
4269
|
+
/******/ module.exports = __webpack_exports__;
|
|
4346
4270
|
/******/
|
|
4347
|
-
/******/ return __webpack_exports__;
|
|
4348
4271
|
/******/ })()
|
|
4349
|
-
;
|
|
4350
|
-
});
|
|
4272
|
+
;
|