@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("@solana/web3.js"), require("bignumber.js"), require("algosdk"));
|
|
4
|
-
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define(["buffer", "ethereumjs-util", "bs58", "@solana/web3.js", "bignumber.js", "algosdk"], factory);
|
|
6
|
-
else {
|
|
7
|
-
var a = typeof exports === 'object' ? factory(require("buffer"), require("ethereumjs-util"), require("bs58"), require("@solana/web3.js"), require("bignumber.js"), require("algosdk")) : factory(root["buffer"], root["ethereumjs-util"], root["bs58"], root["@solana/web3.js"], 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__5783__, __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;
|
|
@@ -335,7 +315,6 @@ function groupTickersByInterval(tickers, newIntervalInSec, endTimeInSec) {
|
|
|
335
315
|
const newGroupedTickers = [];
|
|
336
316
|
let timestamp = endTimeInSec - newIntervalInSec;
|
|
337
317
|
let slot = null;
|
|
338
|
-
// desc direction by timestamp
|
|
339
318
|
const sortedTickers = tickers.sort((a, b) => b.t - a.t);
|
|
340
319
|
for (let i = 0; i < sortedTickers.length; i++) {
|
|
341
320
|
const element = sortedTickers[i];
|
|
@@ -647,7 +626,7 @@ exports.bn_operation = bn_operation;
|
|
|
647
626
|
exports.roundNumber = roundNumber;
|
|
648
627
|
exports.convertFromBaseUnits = convertFromBaseUnits;
|
|
649
628
|
exports.convertToBaseUnits = convertToBaseUnits;
|
|
650
|
-
const bignumber_js_1 = __importDefault(__webpack_require__(
|
|
629
|
+
const bignumber_js_1 = __importDefault(__webpack_require__(4978));
|
|
651
630
|
bignumber_js_1.default.config({ DECIMAL_PLACES: 40, EXPONENTIAL_AT: 45 });
|
|
652
631
|
var Operations;
|
|
653
632
|
(function (Operations) {
|
|
@@ -665,7 +644,6 @@ var Operations;
|
|
|
665
644
|
function absolute(value) {
|
|
666
645
|
let x = new bignumber_js_1.default(value);
|
|
667
646
|
const res = x.abs().toString();
|
|
668
|
-
// console.log('Absolute value', { value, res })
|
|
669
647
|
return res;
|
|
670
648
|
}
|
|
671
649
|
function ceil(value) {
|
|
@@ -805,17 +783,10 @@ function roundNumber({ decimalPlaces = 0 }, x) {
|
|
|
805
783
|
}
|
|
806
784
|
function convertFromBaseUnits(assetDecimals, quantity) {
|
|
807
785
|
const decimals = Number(assetDecimals);
|
|
808
|
-
return roundNumber({ decimalPlaces: decimals },
|
|
809
|
-
// eslint-disable-next-line no-magic-numbers
|
|
810
|
-
Math.pow(10, -decimals) * Number(quantity));
|
|
786
|
+
return roundNumber({ decimalPlaces: decimals }, Math.pow(10, -decimals) * Number(quantity));
|
|
811
787
|
}
|
|
812
|
-
/**
|
|
813
|
-
* Computs quantity * 10^(assetDecimals) and rounds the result
|
|
814
|
-
*/
|
|
815
788
|
function convertToBaseUnits(assetDecimals, quantity) {
|
|
816
|
-
// eslint-disable-next-line no-magic-numbers
|
|
817
789
|
const baseAmount = Math.pow(10, Number(assetDecimals)) * Number(quantity);
|
|
818
|
-
// 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
|
|
819
790
|
return roundNumber({ decimalPlaces: 0 }, baseAmount);
|
|
820
791
|
}
|
|
821
792
|
|
|
@@ -840,13 +811,6 @@ var StateType;
|
|
|
840
811
|
})(StateType || (exports.StateType = StateType = {}));
|
|
841
812
|
|
|
842
813
|
|
|
843
|
-
/***/ }),
|
|
844
|
-
|
|
845
|
-
/***/ 1297:
|
|
846
|
-
/***/ ((module) => {
|
|
847
|
-
|
|
848
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__1297__;
|
|
849
|
-
|
|
850
814
|
/***/ }),
|
|
851
815
|
|
|
852
816
|
/***/ 1492:
|
|
@@ -1257,6 +1221,13 @@ __exportStar(__webpack_require__(1710), exports);
|
|
|
1257
1221
|
__exportStar(__webpack_require__(2577), exports);
|
|
1258
1222
|
|
|
1259
1223
|
|
|
1224
|
+
/***/ }),
|
|
1225
|
+
|
|
1226
|
+
/***/ 2493:
|
|
1227
|
+
/***/ ((module) => {
|
|
1228
|
+
|
|
1229
|
+
module.exports = require("@solana/web3.js");
|
|
1230
|
+
|
|
1260
1231
|
/***/ }),
|
|
1261
1232
|
|
|
1262
1233
|
/***/ 2562:
|
|
@@ -1467,7 +1438,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
1467
1438
|
};
|
|
1468
1439
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1469
1440
|
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;
|
|
1470
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
1441
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
1471
1442
|
const enums_1 = __webpack_require__(9965);
|
|
1472
1443
|
const codex_helper_1 = __webpack_require__(3955);
|
|
1473
1444
|
const Encoding_1 = __webpack_require__(8593);
|
|
@@ -1519,7 +1490,6 @@ const makeDtwMsg = (data) => {
|
|
|
1519
1490
|
const bs64OrderBytes = (0, codex_helper_1.getBase64EncodedData)(dataBytes);
|
|
1520
1491
|
console.log(`Dtw data should be ${exports.DTW_DATA_BYTES_LENGTH} bytes`, bs64OrderBytes.length, bs64OrderBytes);
|
|
1521
1492
|
return bs64OrderBytes;
|
|
1522
|
-
// return makeSigningMessage(JSON.stringify(data), dataBytes);
|
|
1523
1493
|
};
|
|
1524
1494
|
exports.makeDtwMsg = makeDtwMsg;
|
|
1525
1495
|
const decodeTransferMsg = (message, encoding = 'hex') => {
|
|
@@ -1556,7 +1526,6 @@ const makeTransferMsg = (data) => {
|
|
|
1556
1526
|
const bs64OrderBytes = (0, codex_helper_1.getBase64EncodedData)(dataBytes);
|
|
1557
1527
|
console.log(`Transfer data should be ${exports.TRANSFER_DATA_BYTES_LENGTH} bytes`, bs64OrderBytes.length, bs64OrderBytes);
|
|
1558
1528
|
return bs64OrderBytes;
|
|
1559
|
-
// return makeSigningMessage(JSON.stringify(data), dataBytes);
|
|
1560
1529
|
};
|
|
1561
1530
|
exports.makeTransferMsg = makeTransferMsg;
|
|
1562
1531
|
const makeTransferTxn = async ({ data, message, signature }, dtw, options) => {
|
|
@@ -1606,7 +1575,6 @@ const makeTransferTxn = async ({ data, message, signature }, dtw, options) => {
|
|
|
1606
1575
|
foreignApps,
|
|
1607
1576
|
boxes: allBoxes,
|
|
1608
1577
|
});
|
|
1609
|
-
// console.log('directTransfer txn', appCallTxn);
|
|
1610
1578
|
return appCallTxn;
|
|
1611
1579
|
};
|
|
1612
1580
|
exports.makeTransferTxn = makeTransferTxn;
|
|
@@ -1816,8 +1784,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1816
1784
|
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;
|
|
1817
1785
|
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;
|
|
1818
1786
|
exports.getTokenFromNormalized = getTokenFromNormalized;
|
|
1819
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
1820
|
-
const bs58 = __importStar(__webpack_require__(
|
|
1787
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
1788
|
+
const bs58 = __importStar(__webpack_require__(5316));
|
|
1821
1789
|
const big_number_helper_1 = __webpack_require__(1174);
|
|
1822
1790
|
const utils_1 = __webpack_require__(8398);
|
|
1823
1791
|
const codex_1 = __webpack_require__(430);
|
|
@@ -1861,7 +1829,6 @@ function getTokenFromNormalized(token, chainId) {
|
|
|
1861
1829
|
return (0, exports.getAddressFromNormalized)(token, Number(chainId));
|
|
1862
1830
|
}
|
|
1863
1831
|
const encode = (value, type, chain) => {
|
|
1864
|
-
// console.log('encode', JSON.stringify({ value: typeof value === "bigint" ? `${value}n` : value, type, chain }));
|
|
1865
1832
|
switch (type) {
|
|
1866
1833
|
case '8B': return algosdk_1.default.encodeUint64(Number(value));
|
|
1867
1834
|
case '32B': return (0, eth_helper_1.encode32Bytes)(value);
|
|
@@ -1964,13 +1931,6 @@ const encodeToken = (token, chain) => {
|
|
|
1964
1931
|
exports.encodeToken = encodeToken;
|
|
1965
1932
|
const getCodexStateValue = async (algoClient, appId) => {
|
|
1966
1933
|
const globalState = await (0, algo_helper_1.getAppGlobalState)(algoClient, appId);
|
|
1967
|
-
// console.log('codexState', appId, globalState);
|
|
1968
|
-
// if (globalState["MNA"]) {
|
|
1969
|
-
// console.log('MNA', decodeAddress(Buffer.from(globalState["MNA"]), 8));
|
|
1970
|
-
// }
|
|
1971
|
-
// if (globalState["BKA"]) {
|
|
1972
|
-
// console.log('BKA', decodeAddress(Buffer.from(globalState["BKA"]), 8));
|
|
1973
|
-
// }
|
|
1974
1934
|
const msgProcId = globalState["MSG_PROCESSOR"];
|
|
1975
1935
|
const superAppId = globalState["UL_SUPERADMIN_APP"];
|
|
1976
1936
|
let superWallet = globalState["UL_SUPERADMIN_WALLET"];
|
|
@@ -2100,7 +2060,6 @@ const getAccountBalanceBoxValue = async (algoClient, appId, login, token) => {
|
|
|
2100
2060
|
};
|
|
2101
2061
|
exports.getAccountBalanceBoxValue = getAccountBalanceBoxValue;
|
|
2102
2062
|
const getAccountBoxValue = async (algoClient, appId, loginAddress, loginChainId, tokenAddress, tokenChainId) => {
|
|
2103
|
-
// console.log('getAccountBoxValue', { loginAddress, loginChainId, tokenAddress, tokenChainId });
|
|
2104
2063
|
const boxName = (0, eth_helper_1.keccak256)((0, exports.getAccountBalanceBoxName)(loginAddress, loginChainId, tokenAddress, tokenChainId));
|
|
2105
2064
|
const boxValue = await getAccountBox(algoClient, appId, boxName);
|
|
2106
2065
|
console.log('Box account value', loginAddress.substring(0, 8), tokenAddress, boxValue, Buffer.from(boxName).toString('hex'));
|
|
@@ -2296,7 +2255,7 @@ const makeCreateOrderMsg = (data) => {
|
|
|
2296
2255
|
(0, exports.encode)(data.companyId, '2B'),
|
|
2297
2256
|
(0, exports.encode)(data.random, '8B'),
|
|
2298
2257
|
(0, exports.encode)(data.decimalPrice, 'float'),
|
|
2299
|
-
Buffer.alloc(50),
|
|
2258
|
+
Buffer.alloc(50),
|
|
2300
2259
|
]);
|
|
2301
2260
|
const bs64OrderBytes = new Uint8Array(Buffer.from((0, Encoding_1.encodeBase64)(orderBytes)));
|
|
2302
2261
|
const messageBytes = new Uint8Array([
|
|
@@ -2377,14 +2336,13 @@ const decodeCreateOrderMsg = (message, encoding = 'hex') => {
|
|
|
2377
2336
|
return {
|
|
2378
2337
|
...orderData,
|
|
2379
2338
|
expiredDate: String(orderData.expiredTime).length > 10
|
|
2380
|
-
? new Date(orderData.expiredTime)
|
|
2339
|
+
? new Date(orderData.expiredTime)
|
|
2381
2340
|
: new Date(orderData.expiredTime * 1000)
|
|
2382
2341
|
};
|
|
2383
2342
|
};
|
|
2384
2343
|
exports.decodeCreateOrderMsg = decodeCreateOrderMsg;
|
|
2385
2344
|
const getMatchOrderArgs = (order) => {
|
|
2386
2345
|
const { id, address, chain, message, encoding, signature, tradingKey } = order;
|
|
2387
|
-
// console.log('getMatchOrderArgs', JSON.stringify(order));
|
|
2388
2346
|
const signAddress = tradingKey || address;
|
|
2389
2347
|
const signChain = tradingKey ? enums_1.Chains.Algorand : chain;
|
|
2390
2348
|
return [
|
|
@@ -2413,8 +2371,6 @@ const createBoxes = (appIndex, boxNames, encode = eth_helper_1.keccak256) => {
|
|
|
2413
2371
|
appIndex,
|
|
2414
2372
|
name: encode(boxName)
|
|
2415
2373
|
}));
|
|
2416
|
-
// console.log('createBoxes', boxes.map(b => Buffer.from(b.name).toString('hex')))
|
|
2417
|
-
// console.log(`createBoxesBytes`, boxes.map(b => Array.apply([], Array.from(b.name)).join(", ")));
|
|
2418
2374
|
return boxes;
|
|
2419
2375
|
};
|
|
2420
2376
|
exports.createBoxes = createBoxes;
|
|
@@ -2508,7 +2464,7 @@ const makeMatchTxns = (appId, args, params, sender, encoding = 'hex') => {
|
|
|
2508
2464
|
getShareWalletBoxKey(afTaker, baseAsset),
|
|
2509
2465
|
getShareWalletBoxKey(afTaker, priceAsset),
|
|
2510
2466
|
]
|
|
2511
|
-
.filter(Boolean)
|
|
2467
|
+
.filter(Boolean)
|
|
2512
2468
|
.map(o => Buffer.from(o).toString('hex')))
|
|
2513
2469
|
].map(o => Buffer.from(o, 'hex'));
|
|
2514
2470
|
const allBoxes = [
|
|
@@ -2522,7 +2478,6 @@ const makeMatchTxns = (appId, args, params, sender, encoding = 'hex') => {
|
|
|
2522
2478
|
];
|
|
2523
2479
|
const allBoxesUnique = [...new Set(allBoxes.map(o => Buffer.from(o.name).toString('hex')))];
|
|
2524
2480
|
console.log(`[TradeID: ${id}] All boxes`, JSON.stringify(allBoxesUnique));
|
|
2525
|
-
// allBoxes = allBoxesUnique.map(o => Buffer.from(o.name))
|
|
2526
2481
|
const foreignApps = [superAppId];
|
|
2527
2482
|
const MAX_REFS = 8;
|
|
2528
2483
|
const mainTxnBoxes = allBoxes.slice(0, MAX_REFS - foreignApps.length);
|
|
@@ -2547,12 +2502,6 @@ const makeMatchTxns = (appId, args, params, sender, encoding = 'hex') => {
|
|
|
2547
2502
|
};
|
|
2548
2503
|
exports.makeMatchTxns = makeMatchTxns;
|
|
2549
2504
|
const makeLoginMsg = (data, signingMessage) => {
|
|
2550
|
-
// const dataBytes = concatArrays([
|
|
2551
|
-
// encode(data.address, 'address', data.chainId),
|
|
2552
|
-
// encode(data.chainId, '8B'),
|
|
2553
|
-
// encode(data.provider, 'str'),
|
|
2554
|
-
// ]);
|
|
2555
|
-
// return makeSigningMessage(data.signingMessage, dataBytes);
|
|
2556
2505
|
const { address, technology } = data;
|
|
2557
2506
|
return (0, exports.getUtf8EncodedData)(signingMessage || JSON.stringify({ address, technology }));
|
|
2558
2507
|
};
|
|
@@ -2586,9 +2535,7 @@ const decodeTradingKeyMsg = (message, encoding = 'hex') => {
|
|
|
2586
2535
|
};
|
|
2587
2536
|
};
|
|
2588
2537
|
exports.decodeTradingKeyMsg = decodeTradingKeyMsg;
|
|
2589
|
-
const makeAddTradingKeyTxn = async (algoClient, appId, superId, sender, { loginAddress, loginChainId, }, message,
|
|
2590
|
-
// encoding: BufferEncoding | undefined,
|
|
2591
|
-
signature) => {
|
|
2538
|
+
const makeAddTradingKeyTxn = async (algoClient, appId, superId, sender, { loginAddress, loginChainId, }, message, signature) => {
|
|
2592
2539
|
const msgArgs = (0, codex_1.getMsgArgs)(message, signature, loginAddress, loginChainId);
|
|
2593
2540
|
const appArgs = (0, codex_1.getAppArgs)("manageTradingKey(byte[],byte[],byte[],byte[])uint64", [
|
|
2594
2541
|
(0, exports.encode)('add', 'str'),
|
|
@@ -2609,9 +2556,7 @@ signature) => {
|
|
|
2609
2556
|
return txn;
|
|
2610
2557
|
};
|
|
2611
2558
|
exports.makeAddTradingKeyTxn = makeAddTradingKeyTxn;
|
|
2612
|
-
const makeRevokeTradingKeyTxn = async (algoClient, appId, superId, sender, { loginAddress, loginChainId, }, message,
|
|
2613
|
-
// encoding: BufferEncoding | undefined,
|
|
2614
|
-
signature) => {
|
|
2559
|
+
const makeRevokeTradingKeyTxn = async (algoClient, appId, superId, sender, { loginAddress, loginChainId, }, message, signature) => {
|
|
2615
2560
|
const msgArgs = (0, codex_1.getMsgArgs)(message, signature, loginAddress, loginChainId);
|
|
2616
2561
|
const appArgs = (0, codex_1.getAppArgs)("manageTradingKey(byte[],byte[],byte[],byte[])uint64", [
|
|
2617
2562
|
(0, exports.encode)('delete', 'str'),
|
|
@@ -2636,7 +2581,6 @@ const makeSetCollectionWalletMsg = (data) => {
|
|
|
2636
2581
|
const chainIdBytes = algosdk_1.default.encodeUint64(loginChainId);
|
|
2637
2582
|
const dataBytes = (0, Encoding_1.concatArrays)([senderBytes, chainIdBytes, companyIdBytes]);
|
|
2638
2583
|
const messageBytes = new Uint8Array([
|
|
2639
|
-
// ...getUtf8EncodedData(JSON.stringify(data)),
|
|
2640
2584
|
...(0, exports.getBase64EncodedData)(dataBytes),
|
|
2641
2585
|
]);
|
|
2642
2586
|
console.log('MESSAGE LENGTH: ', messageBytes);
|
|
@@ -2651,14 +2595,10 @@ const getUtf8EncodedData = (jsonData) => new Uint8Array(Buffer.from((jsonData +
|
|
|
2651
2595
|
exports.getUtf8EncodedData = getUtf8EncodedData;
|
|
2652
2596
|
const getBase64EncodedData = (data) => new Uint8Array(Buffer.from((0, Encoding_1.encodeBase64)(data)));
|
|
2653
2597
|
exports.getBase64EncodedData = getBase64EncodedData;
|
|
2654
|
-
const makeWithdrawTxns = async (algoClient, { loginAddress, loginChainId, tokenIndex, recipient, recipientChainId }, message, signature,
|
|
2655
|
-
// encoding: BufferEncoding | undefined,
|
|
2656
|
-
sender, options) => {
|
|
2598
|
+
const makeWithdrawTxns = async (algoClient, { loginAddress, loginChainId, tokenIndex, recipient, recipientChainId }, message, signature, sender, options) => {
|
|
2657
2599
|
const msgArgs = (0, codex_1.getMsgArgs)(message, signature, loginAddress, loginChainId);
|
|
2658
2600
|
const appArgs = (0, codex_1.getAppArgs)("withdraw(byte[],byte[],byte[])uint64", msgArgs);
|
|
2659
2601
|
const isAlgoChain = recipientChainId === enums_1.Chains.Algorand;
|
|
2660
|
-
// TODO: calc actual txn fee
|
|
2661
|
-
// const params = await getTxnParams(algoClient, 7);
|
|
2662
2602
|
const params = await (0, algo_helper_1.getTxnParams)(algoClient, isAlgoChain ? 6 : 2);
|
|
2663
2603
|
params.fee = params.fee + (algosdk_1.default.ALGORAND_MIN_TX_FEE * 5);
|
|
2664
2604
|
const { appId, coreId, lsaAddress, msgProcessorId, unifiedChainId, cctpSupportedChains, superWallet } = options;
|
|
@@ -2917,13 +2857,6 @@ const messageForSigning = (signingAddress) => `By signing this message, you conf
|
|
|
2917
2857
|
exports.messageForSigning = messageForSigning;
|
|
2918
2858
|
|
|
2919
2859
|
|
|
2920
|
-
/***/ }),
|
|
2921
|
-
|
|
2922
|
-
/***/ 4578:
|
|
2923
|
-
/***/ ((module) => {
|
|
2924
|
-
|
|
2925
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__4578__;
|
|
2926
|
-
|
|
2927
2860
|
/***/ }),
|
|
2928
2861
|
|
|
2929
2862
|
/***/ 4881:
|
|
@@ -2951,6 +2884,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
2951
2884
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2952
2885
|
|
|
2953
2886
|
|
|
2887
|
+
/***/ }),
|
|
2888
|
+
|
|
2889
|
+
/***/ 4978:
|
|
2890
|
+
/***/ ((module) => {
|
|
2891
|
+
|
|
2892
|
+
module.exports = require("bignumber.js");
|
|
2893
|
+
|
|
2954
2894
|
/***/ }),
|
|
2955
2895
|
|
|
2956
2896
|
/***/ 5146:
|
|
@@ -2976,6 +2916,13 @@ var UpgradeStatus;
|
|
|
2976
2916
|
})(UpgradeStatus || (exports.UpgradeStatus = UpgradeStatus = {}));
|
|
2977
2917
|
|
|
2978
2918
|
|
|
2919
|
+
/***/ }),
|
|
2920
|
+
|
|
2921
|
+
/***/ 5316:
|
|
2922
|
+
/***/ ((module) => {
|
|
2923
|
+
|
|
2924
|
+
module.exports = require("bs58");
|
|
2925
|
+
|
|
2979
2926
|
/***/ }),
|
|
2980
2927
|
|
|
2981
2928
|
/***/ 5386:
|
|
@@ -3021,7 +2968,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
3021
2968
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3022
2969
|
exports.createWithdrawalWalletMsg = exports.makeWithdrawMsg = exports.decodeWithdrawMsg = exports.calcWithdrawHash = exports.getWithdrawBytesFromMsg = exports.isSolanaCctp = exports.SOLANA_USDC = exports.getSolanaUsdc = exports.ASSOCIATED_TOKEN_PROGRAM_ID = exports.TOKEN_PROGRAM_ID = void 0;
|
|
3023
2970
|
exports.getAssociatedTokenAddressSync = getAssociatedTokenAddressSync;
|
|
3024
|
-
const web3_js_1 = __webpack_require__(
|
|
2971
|
+
const web3_js_1 = __webpack_require__(2493);
|
|
3025
2972
|
const cctp_1 = __webpack_require__(9862);
|
|
3026
2973
|
const codex_1 = __webpack_require__(661);
|
|
3027
2974
|
const chains_enum_1 = __webpack_require__(2228);
|
|
@@ -3117,13 +3064,6 @@ const createWithdrawalWalletMsg = (data) => {
|
|
|
3117
3064
|
exports.createWithdrawalWalletMsg = createWithdrawalWalletMsg;
|
|
3118
3065
|
|
|
3119
3066
|
|
|
3120
|
-
/***/ }),
|
|
3121
|
-
|
|
3122
|
-
/***/ 5783:
|
|
3123
|
-
/***/ ((module) => {
|
|
3124
|
-
|
|
3125
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__5783__;
|
|
3126
|
-
|
|
3127
3067
|
/***/ }),
|
|
3128
3068
|
|
|
3129
3069
|
/***/ 5874:
|
|
@@ -3166,7 +3106,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3166
3106
|
};
|
|
3167
3107
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3168
3108
|
exports.makeRemoveExpiredOrderTxn = exports.calcOrderHash = exports.getOrderBoxKeyFromHash = exports.getOrderBoxKey = exports.getOrderBytesFromMsg = void 0;
|
|
3169
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
3109
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
3170
3110
|
const common_helper_1 = __webpack_require__(223);
|
|
3171
3111
|
const Encoding_1 = __webpack_require__(8593);
|
|
3172
3112
|
const constants_1 = __webpack_require__(6450);
|
|
@@ -3230,25 +3170,25 @@ function getDatepartValue(value) {
|
|
|
3230
3170
|
if (!units) {
|
|
3231
3171
|
return mapWithTimeframe(datepart, 1);
|
|
3232
3172
|
}
|
|
3233
|
-
if (datepart === 'minute' && units % (7 * 24 * 60) === 0) {
|
|
3173
|
+
if (datepart === 'minute' && units % (7 * 24 * 60) === 0) {
|
|
3234
3174
|
return mapWithTimeframe('week', units / (7 * 24 * 60));
|
|
3235
3175
|
}
|
|
3236
|
-
if (datepart === 'minute' && units % (24 * 60) === 0) {
|
|
3176
|
+
if (datepart === 'minute' && units % (24 * 60) === 0) {
|
|
3237
3177
|
return mapWithTimeframe('day', units / (24 * 60));
|
|
3238
3178
|
}
|
|
3239
|
-
if (datepart === 'minute' && units % 60 === 0) {
|
|
3179
|
+
if (datepart === 'minute' && units % 60 === 0) {
|
|
3240
3180
|
return mapWithTimeframe('hour', units / 60);
|
|
3241
3181
|
}
|
|
3242
|
-
if (datepart === 'hour' && units % (7 * 24) === 0) {
|
|
3182
|
+
if (datepart === 'hour' && units % (7 * 24) === 0) {
|
|
3243
3183
|
return mapWithTimeframe('week', units / (7 * 24));
|
|
3244
3184
|
}
|
|
3245
|
-
if (datepart === 'hour' && units % 24 === 0) {
|
|
3185
|
+
if (datepart === 'hour' && units % 24 === 0) {
|
|
3246
3186
|
return mapWithTimeframe(units === 24 ? 'hour' : 'day', units === 24 ? 24 : units / 24);
|
|
3247
3187
|
}
|
|
3248
|
-
if (datepart === 'day' && units % 7 === 0) {
|
|
3188
|
+
if (datepart === 'day' && units % 7 === 0) {
|
|
3249
3189
|
return mapWithTimeframe('week', units / 7);
|
|
3250
3190
|
}
|
|
3251
|
-
if (datepart === 'month' && units % 12 === 0) {
|
|
3191
|
+
if (datepart === 'month' && units % 12 === 0) {
|
|
3252
3192
|
return mapWithTimeframe('year', units / 12);
|
|
3253
3193
|
}
|
|
3254
3194
|
return mapWithTimeframe(datepart, units);
|
|
@@ -3318,13 +3258,6 @@ var TwitterAccessScopeEnum;
|
|
|
3318
3258
|
})(TwitterAccessScopeEnum || (exports.TwitterAccessScopeEnum = TwitterAccessScopeEnum = {}));
|
|
3319
3259
|
|
|
3320
3260
|
|
|
3321
|
-
/***/ }),
|
|
3322
|
-
|
|
3323
|
-
/***/ 6168:
|
|
3324
|
-
/***/ ((module) => {
|
|
3325
|
-
|
|
3326
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__6168__;
|
|
3327
|
-
|
|
3328
3261
|
/***/ }),
|
|
3329
3262
|
|
|
3330
3263
|
/***/ 6450:
|
|
@@ -3399,7 +3332,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3399
3332
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3400
3333
|
exports.verifySignature = exports.decodeAndNormalizeAddress = exports.isAssetOptedIn = exports.getTxnParams = exports.getBoxByName = exports.getAppBoxes = exports.getAppGlobalState = exports.getAccountAssetBalances = exports.createBoxes = void 0;
|
|
3401
3334
|
exports.decodeStateArray = decodeStateArray;
|
|
3402
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
3335
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
3403
3336
|
const Encoding_1 = __webpack_require__(8593);
|
|
3404
3337
|
const helpers_1 = __webpack_require__(9730);
|
|
3405
3338
|
const createBoxes = (appIndex, foreignApps) => {
|
|
@@ -3459,7 +3392,6 @@ const getAppBoxes = async (algodClient, appId) => {
|
|
|
3459
3392
|
exports.getAppBoxes = getAppBoxes;
|
|
3460
3393
|
const getBoxByName = async (algoClient, appId, boxName) => {
|
|
3461
3394
|
try {
|
|
3462
|
-
// console.log('Get box by name', boxName);
|
|
3463
3395
|
const { value } = await algoClient.getApplicationBoxByName(appId, boxName).do();
|
|
3464
3396
|
const box = value;
|
|
3465
3397
|
return box;
|
|
@@ -3668,23 +3600,19 @@ var SmallTimeframeEnum;
|
|
|
3668
3600
|
SmallTimeframeEnum["last_year"] = "last_year";
|
|
3669
3601
|
})(SmallTimeframeEnum || (exports.SmallTimeframeEnum = SmallTimeframeEnum = {}));
|
|
3670
3602
|
class PairsQueryDto {
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
this.page = 1;
|
|
3677
|
-
}
|
|
3603
|
+
timeRange = SmallTimeframeEnum.last_30_days;
|
|
3604
|
+
sortBy = 'volume_usd';
|
|
3605
|
+
order = 'desc';
|
|
3606
|
+
limit = 20;
|
|
3607
|
+
page = 1;
|
|
3678
3608
|
}
|
|
3679
3609
|
exports.PairsQueryDto = PairsQueryDto;
|
|
3680
3610
|
class UsersQueryDto {
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
this.page = 1;
|
|
3687
|
-
}
|
|
3611
|
+
timeRange = SmallTimeframeEnum.last_30_days;
|
|
3612
|
+
sortBy = 'volume_usd';
|
|
3613
|
+
order = 'desc';
|
|
3614
|
+
limit = 20;
|
|
3615
|
+
page = 1;
|
|
3688
3616
|
}
|
|
3689
3617
|
exports.UsersQueryDto = UsersQueryDto;
|
|
3690
3618
|
var StatisticTypeQuery;
|
|
@@ -3695,10 +3623,8 @@ var StatisticTypeQuery;
|
|
|
3695
3623
|
StatisticTypeQuery["dau"] = "dau";
|
|
3696
3624
|
})(StatisticTypeQuery || (exports.StatisticTypeQuery = StatisticTypeQuery = {}));
|
|
3697
3625
|
class ChartQueryDto {
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
this.timeRange = SmallTimeframeEnum.last_7_days;
|
|
3701
|
-
}
|
|
3626
|
+
type = StatisticTypeQuery.volume;
|
|
3627
|
+
timeRange = SmallTimeframeEnum.last_7_days;
|
|
3702
3628
|
}
|
|
3703
3629
|
exports.ChartQueryDto = ChartQueryDto;
|
|
3704
3630
|
|
|
@@ -3888,6 +3814,13 @@ exports.QueueOptions = {
|
|
|
3888
3814
|
};
|
|
3889
3815
|
|
|
3890
3816
|
|
|
3817
|
+
/***/ }),
|
|
3818
|
+
|
|
3819
|
+
/***/ 7835:
|
|
3820
|
+
/***/ ((module) => {
|
|
3821
|
+
|
|
3822
|
+
module.exports = require("ethereumjs-util");
|
|
3823
|
+
|
|
3891
3824
|
/***/ }),
|
|
3892
3825
|
|
|
3893
3826
|
/***/ 7979:
|
|
@@ -3908,7 +3841,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3908
3841
|
};
|
|
3909
3842
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3910
3843
|
exports.makeGroupTxnsWithDummy = exports.makeDummyTxn = void 0;
|
|
3911
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
3844
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
3912
3845
|
const common_helper_1 = __webpack_require__(223);
|
|
3913
3846
|
const makeDummyTxn = (appIndex, sender, params, boxes, note, foreignApps) => {
|
|
3914
3847
|
const appArgs = (0, common_helper_1.getAppArgs)("dummy(uint64)void", [1]);
|
|
@@ -3948,8 +3881,6 @@ const makeGroupTxnsWithDummy = (id, mainTxnBody) => {
|
|
|
3948
3881
|
dummyTxnIndex++;
|
|
3949
3882
|
}
|
|
3950
3883
|
}
|
|
3951
|
-
// TODO: check this dummy txn
|
|
3952
|
-
// additional dummy txn for withdrawal
|
|
3953
3884
|
dummyTxns2.push((0, exports.makeDummyTxn)(appIndex, from, suggestedParams, [], `${id}_${++dummyTxnIndex}`, foreignApps));
|
|
3954
3885
|
console.log("dummy count", dummyTxns2.length);
|
|
3955
3886
|
return [mainTxn, ...dummyTxns2];
|
|
@@ -3957,6 +3888,13 @@ const makeGroupTxnsWithDummy = (id, mainTxnBody) => {
|
|
|
3957
3888
|
exports.makeGroupTxnsWithDummy = makeGroupTxnsWithDummy;
|
|
3958
3889
|
|
|
3959
3890
|
|
|
3891
|
+
/***/ }),
|
|
3892
|
+
|
|
3893
|
+
/***/ 8115:
|
|
3894
|
+
/***/ ((module) => {
|
|
3895
|
+
|
|
3896
|
+
module.exports = require("algosdk");
|
|
3897
|
+
|
|
3960
3898
|
/***/ }),
|
|
3961
3899
|
|
|
3962
3900
|
/***/ 8212:
|
|
@@ -4074,7 +4012,7 @@ function removeField(obj, fieldToRemove) {
|
|
|
4074
4012
|
.filter(([key]) => key !== fieldToRemove)
|
|
4075
4013
|
.map(([key, value]) => [key, removeField(value, fieldToRemove)]));
|
|
4076
4014
|
}
|
|
4077
|
-
return obj;
|
|
4015
|
+
return obj;
|
|
4078
4016
|
}
|
|
4079
4017
|
function removeUndefined(obj) {
|
|
4080
4018
|
return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== undefined));
|
|
@@ -4090,6 +4028,14 @@ function removeUndefined(obj) {
|
|
|
4090
4028
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4091
4029
|
exports.ISetting = void 0;
|
|
4092
4030
|
class ISetting {
|
|
4031
|
+
id;
|
|
4032
|
+
description;
|
|
4033
|
+
hint;
|
|
4034
|
+
help_url;
|
|
4035
|
+
type;
|
|
4036
|
+
allowed_values;
|
|
4037
|
+
settings;
|
|
4038
|
+
public;
|
|
4093
4039
|
}
|
|
4094
4040
|
exports.ISetting = ISetting;
|
|
4095
4041
|
|
|
@@ -4151,9 +4097,8 @@ exports.getDeltaUint = getDeltaUint;
|
|
|
4151
4097
|
exports.getDeltaBytes = getDeltaBytes;
|
|
4152
4098
|
exports.toUnix = toUnix;
|
|
4153
4099
|
exports.fromUnix = fromUnix;
|
|
4154
|
-
const algosdk_1 = __importStar(__webpack_require__(
|
|
4155
|
-
|
|
4156
|
-
const buffer_1 = __webpack_require__(18);
|
|
4100
|
+
const algosdk_1 = __importStar(__webpack_require__(8115));
|
|
4101
|
+
const buffer_1 = __webpack_require__(9428);
|
|
4157
4102
|
function concatArrays(arrays) {
|
|
4158
4103
|
return arrays.reduce((a, b) => Uint8Array.from([...a, ...b]));
|
|
4159
4104
|
}
|
|
@@ -4306,15 +4251,6 @@ function encodeBase64(value) {
|
|
|
4306
4251
|
function decodeBase64(value) {
|
|
4307
4252
|
return buffer_1.Buffer.from(value, 'base64');
|
|
4308
4253
|
}
|
|
4309
|
-
// export const sha256HashLength = 32
|
|
4310
|
-
// export function sha256Hash(arr: sha512.Message): Uint8Array {
|
|
4311
|
-
// return new Uint8Array(sha512.sha512_256.arrayBuffer(arr))
|
|
4312
|
-
// }
|
|
4313
|
-
// export function encodeApplicationAddress(id: number): Address {
|
|
4314
|
-
// const APP_ID_PREFIX = Buffer.from('appID');
|
|
4315
|
-
// const toBeSigned = concatArrays([APP_ID_PREFIX, encodeUint64(BigInt(id))]);
|
|
4316
|
-
// return encodeAddress(sha256Hash(toBeSigned));
|
|
4317
|
-
// }
|
|
4318
4254
|
function compareArrays(a, b) {
|
|
4319
4255
|
return a.length === b.length && a.reduce((equal, item, index) => equal && item === b[index], true);
|
|
4320
4256
|
}
|
|
@@ -4342,7 +4278,7 @@ function toUnix(date) {
|
|
|
4342
4278
|
function fromUnix(timestamp) {
|
|
4343
4279
|
return new Date(timestamp * 1000);
|
|
4344
4280
|
}
|
|
4345
|
-
var algosdk_2 = __webpack_require__(
|
|
4281
|
+
var algosdk_2 = __webpack_require__(8115);
|
|
4346
4282
|
Object.defineProperty(exports, "encodeAddress", ({ enumerable: true, get: function () { return algosdk_2.encodeAddress; } }));
|
|
4347
4283
|
Object.defineProperty(exports, "decodeAddress", ({ enumerable: true, get: function () { return algosdk_2.decodeAddress; } }));
|
|
4348
4284
|
|
|
@@ -4391,11 +4327,10 @@ exports.keccak256 = exports.verifyMessage = exports.verifySignature = exports.re
|
|
|
4391
4327
|
exports.decode32Bytes = decode32Bytes;
|
|
4392
4328
|
exports.encodeBigNumber = encodeBigNumber;
|
|
4393
4329
|
exports.encode32Bytes = encode32Bytes;
|
|
4394
|
-
const ethUtil = __importStar(__webpack_require__(
|
|
4330
|
+
const ethUtil = __importStar(__webpack_require__(7835));
|
|
4395
4331
|
const common_helper_1 = __webpack_require__(223);
|
|
4396
4332
|
function decode32Bytes(value) {
|
|
4397
4333
|
const bnValue = ethUtil.fromSigned(Buffer.from(value));
|
|
4398
|
-
// console.log('bnValue', value, bnValue, bnValue.toString())
|
|
4399
4334
|
return BigInt(bnValue.toString());
|
|
4400
4335
|
}
|
|
4401
4336
|
function encodeBigNumber(value) {
|
|
@@ -4439,9 +4374,8 @@ exports.unpadHexPrefix = unpadHexPrefix;
|
|
|
4439
4374
|
const isAddress = (address) => ethUtil.isValidAddress(address);
|
|
4440
4375
|
exports.isAddress = isAddress;
|
|
4441
4376
|
const recoverPublicKey = (message, signature) => {
|
|
4442
|
-
const messageHash = ethUtil.keccak256(message);
|
|
4377
|
+
const messageHash = ethUtil.keccak256(message);
|
|
4443
4378
|
const { r, s, v } = ethUtil.fromRpcSig(signature);
|
|
4444
|
-
// Recover the public key
|
|
4445
4379
|
return ethUtil.ecrecover(messageHash, v, r, s);
|
|
4446
4380
|
};
|
|
4447
4381
|
exports.recoverPublicKey = recoverPublicKey;
|
|
@@ -4481,7 +4415,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4481
4415
|
};
|
|
4482
4416
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4483
4417
|
exports.makeSetManagerKeyTxn = void 0;
|
|
4484
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
4418
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
4485
4419
|
const algo_helper_1 = __webpack_require__(6897);
|
|
4486
4420
|
const codex_helper_1 = __webpack_require__(3955);
|
|
4487
4421
|
const common_helper_1 = __webpack_require__(223);
|
|
@@ -4493,14 +4427,12 @@ const makeSetManagerKeyTxn = async (algoClient, superAppId, sender, mnaKey) => {
|
|
|
4493
4427
|
console.log("new MNA key:", mnaKey);
|
|
4494
4428
|
console.log("sender:", sender);
|
|
4495
4429
|
console.log("superAppId:", superAppId);
|
|
4496
|
-
// return makeSetGlobalTxn(algoClient, superAppId, sender, AppGlobalParamName.MNA, mnaKey, AppGlobalParamType.STRING);
|
|
4497
4430
|
const txn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
4498
4431
|
appIndex: superAppId,
|
|
4499
4432
|
from: sender,
|
|
4500
4433
|
suggestedParams: params,
|
|
4501
4434
|
appArgs: (0, common_helper_1.getAppArgs)("set_global(byte[],byte[],byte[])void", [
|
|
4502
4435
|
(0, codex_helper_1.encode)("MNA", 'str'),
|
|
4503
|
-
// encode(mnaKey, 'str'),
|
|
4504
4436
|
algosdk_1.default.decodeAddress(mnaKey).publicKey,
|
|
4505
4437
|
(0, codex_helper_1.encode)('S', 'str')
|
|
4506
4438
|
]),
|
|
@@ -4516,7 +4448,6 @@ exports.makeSetManagerKeyTxn = makeSetManagerKeyTxn;
|
|
|
4516
4448
|
/***/ ((__unused_webpack_module, exports) => {
|
|
4517
4449
|
|
|
4518
4450
|
|
|
4519
|
-
//--import { Asset } from "@ultrade/shared/db/entities/market/asset.entity";
|
|
4520
4451
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4521
4452
|
exports.AmmBucketKeys = exports.VALIDATOR_APP_ID = exports.CONTRACT_VERSION = exports.AmmForeignResources = exports.AmmChars = exports.AmmIds = exports.PoolType = void 0;
|
|
4522
4453
|
var PoolType;
|
|
@@ -4583,7 +4514,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4583
4514
|
};
|
|
4584
4515
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4585
4516
|
exports.makeUpdateMbrTxn = exports.getMbrBoxValue = void 0;
|
|
4586
|
-
const algosdk_1 = __importDefault(__webpack_require__(
|
|
4517
|
+
const algosdk_1 = __importDefault(__webpack_require__(8115));
|
|
4587
4518
|
const algo_helper_1 = __webpack_require__(6897);
|
|
4588
4519
|
const common_helper_1 = __webpack_require__(223);
|
|
4589
4520
|
const Encoding_1 = __webpack_require__(8593);
|
|
@@ -4635,19 +4566,19 @@ exports.makeUpdateMbrTxn = makeUpdateMbrTxn;
|
|
|
4635
4566
|
|
|
4636
4567
|
/***/ }),
|
|
4637
4568
|
|
|
4638
|
-
/***/
|
|
4639
|
-
/***/ ((
|
|
4569
|
+
/***/ 9428:
|
|
4570
|
+
/***/ ((module) => {
|
|
4640
4571
|
|
|
4572
|
+
module.exports = require("buffer");
|
|
4641
4573
|
|
|
4642
|
-
|
|
4574
|
+
/***/ }),
|
|
4643
4575
|
|
|
4576
|
+
/***/ 9610:
|
|
4577
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
4644
4578
|
|
|
4645
|
-
/***/ }),
|
|
4646
4579
|
|
|
4647
|
-
|
|
4648
|
-
/***/ ((module) => {
|
|
4580
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4649
4581
|
|
|
4650
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__9709__;
|
|
4651
4582
|
|
|
4652
4583
|
/***/ }),
|
|
4653
4584
|
|
|
@@ -4777,8 +4708,7 @@ Object.defineProperty(exports, "WithdrawalWalletType", ({ enumerable: true, get:
|
|
|
4777
4708
|
/******/ // Load entry module and return exports
|
|
4778
4709
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
4779
4710
|
/******/ var __webpack_exports__ = __webpack_require__(5782);
|
|
4711
|
+
/******/ module.exports = __webpack_exports__;
|
|
4780
4712
|
/******/
|
|
4781
|
-
/******/ return __webpack_exports__;
|
|
4782
4713
|
/******/ })()
|
|
4783
|
-
;
|
|
4784
|
-
});
|
|
4714
|
+
;
|