@ultrade/shared 1.0.0
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/baseModel/base.model.d.ts +26 -0
- package/dist/baseModel/index.d.ts +2 -0
- package/dist/common/auth.helper.d.ts +4 -0
- package/dist/common/auth.helper.js +367 -0
- package/dist/common/awsKms.d.ts +2 -0
- package/dist/common/awsKms.js +265 -0
- package/dist/common/big-number.helper.d.ts +38 -0
- package/dist/common/big-number.helper.js +263 -0
- package/dist/common/index.d.ts +11 -0
- package/dist/common/index.js +2541 -0
- package/dist/common/indexer.helper.d.ts +2 -0
- package/dist/common/indexer.helper.js +387 -0
- package/dist/common/logger.d.ts +32 -0
- package/dist/common/logger.js +188 -0
- package/dist/common/mappers/codexAsset.mapper.d.ts +2 -0
- package/dist/common/mappers/codexAsset.mapper.js +40 -0
- package/dist/common/mappers/codexBalance.mapper.d.ts +2 -0
- package/dist/common/mappers/codexBalance.mapper.js +38 -0
- package/dist/common/mappers/index.d.ts +3 -0
- package/dist/common/mappers/index.js +1421 -0
- package/dist/common/mappers/trade.mapper.d.ts +6 -0
- package/dist/common/mappers/trade.mapper.js +1343 -0
- package/dist/common/migration.helpers.d.ts +4 -0
- package/dist/common/migration.helpers.js +44 -0
- package/dist/common/redis.helper.d.ts +27 -0
- package/dist/common/redis.helper.js +269 -0
- package/dist/common/secret.helper.d.ts +28 -0
- package/dist/common/secret.helper.js +144 -0
- package/dist/common/timestamp.helper.d.ts +1 -0
- package/dist/common/timestamp.helper.js +41 -0
- package/dist/common/utils/assert.d.ts +1 -0
- package/dist/common/utils/assert.js +32 -0
- package/dist/common/utils/decode.d.ts +5 -0
- package/dist/common/utils/decode.js +206 -0
- package/dist/common/utils/index.d.ts +9 -0
- package/dist/common/utils/index.js +122 -0
- package/dist/common/utils/social.d.ts +1 -0
- package/dist/common/utils/social.js +30 -0
- package/dist/common/utils/stat.d.ts +1 -0
- package/dist/common/utils/stat.js +274 -0
- package/dist/constants/allowedUrls.d.ts +1 -0
- package/dist/constants/auth.d.ts +2 -0
- package/dist/constants/cctp.d.ts +3 -0
- package/dist/constants/codex.d.ts +11 -0
- package/dist/constants/env.d.ts +6 -0
- package/dist/constants/index.d.ts +7 -0
- package/dist/constants/index.js +455 -0
- package/dist/constants/queue.d.ts +39 -0
- package/dist/constants/response.d.ts +82 -0
- package/dist/constants/settings.d.ts +2 -0
- package/dist/constants/social.d.ts +3 -0
- package/dist/constants/withdrawalWalletsMessage.d.ts +1 -0
- package/dist/enums/chains.enum.d.ts +50 -0
- package/dist/enums/db/account/index.d.ts +19 -0
- package/dist/enums/db/affiliate.enum.d.ts +7 -0
- package/dist/enums/db/available-pair-settings.enum.d.ts +12 -0
- package/dist/enums/db/chains.d.ts +30 -0
- package/dist/enums/db/common.enum.d.ts +4 -0
- package/dist/enums/db/component/index.d.ts +22 -0
- package/dist/enums/db/index.d.ts +21 -0
- package/dist/enums/db/market-maker.enum.d.ts +15 -0
- package/dist/enums/db/notification-center/userNotification.enum.d.ts +36 -0
- package/dist/enums/db/order-side.enum.d.ts +5 -0
- package/dist/enums/db/order-status.enum.d.ts +8 -0
- package/dist/enums/db/order-type.enum.d.ts +7 -0
- package/dist/enums/db/pending-actions.enum.d.ts +6 -0
- package/dist/enums/db/relayer.enum.d.ts +23 -0
- package/dist/enums/db/setting-type.enum.d.ts +8 -0
- package/dist/enums/db/social-action.enum.d.ts +24 -0
- package/dist/enums/db/social-prompt.enum.d.ts +8 -0
- package/dist/enums/db/social.enum.d.ts +10 -0
- package/dist/enums/db/state-type.enum.d.ts +9 -0
- package/dist/enums/db/trade.enums.d.ts +10 -0
- package/dist/enums/db/tradingKeyType.enum.d.ts +4 -0
- package/dist/enums/db/upgrade.enum.d.ts +5 -0
- package/dist/enums/db/withdrawal-wallet.enum.d.ts +5 -0
- package/dist/enums/index.d.ts +5 -0
- package/dist/enums/index.js +893 -0
- package/dist/enums/maintenanceMode.enum.d.ts +10 -0
- package/dist/enums/notification.enum.d.ts +7 -0
- package/dist/enums/social.enum.d.ts +10 -0
- package/dist/helpers/Encoding.d.ts +33 -0
- package/dist/helpers/Encoding.js +318 -0
- package/dist/helpers/algo.helper.d.ts +14 -0
- package/dist/helpers/algo.helper.js +1211 -0
- package/dist/helpers/api.helper.d.ts +16 -0
- package/dist/helpers/api.helper.js +1652 -0
- package/dist/helpers/assert.helper.d.ts +10 -0
- package/dist/helpers/assert.helper.js +1677 -0
- package/dist/helpers/atomic.helper.d.ts +21 -0
- package/dist/helpers/atomic.helper.js +712 -0
- package/dist/helpers/balance.helper.d.ts +13 -0
- package/dist/helpers/balance.helper.js +4330 -0
- package/dist/helpers/codex/common.helper.d.ts +24 -0
- package/dist/helpers/codex/common.helper.js +4246 -0
- package/dist/helpers/codex/index.d.ts +6 -0
- package/dist/helpers/codex/index.js +4246 -0
- package/dist/helpers/codex/mbr.helper.d.ts +6 -0
- package/dist/helpers/codex/mbr.helper.js +4246 -0
- package/dist/helpers/codex/mna.helper.d.ts +2 -0
- package/dist/helpers/codex/mna.helper.js +4246 -0
- package/dist/helpers/codex/order.helper.d.ts +6 -0
- package/dist/helpers/codex/order.helper.js +4246 -0
- package/dist/helpers/codex/setGlobal.helper.d.ts +27 -0
- package/dist/helpers/codex/setGlobal.helper.js +4312 -0
- package/dist/helpers/codex/transfer.helper.d.ts +21 -0
- package/dist/helpers/codex/transfer.helper.js +4246 -0
- package/dist/helpers/codex/txn.helper.d.ts +13 -0
- package/dist/helpers/codex/txn.helper.js +4246 -0
- package/dist/helpers/codex.helper.d.ts +106 -0
- package/dist/helpers/codex.helper.js +4246 -0
- package/dist/helpers/email.helper.d.ts +5 -0
- package/dist/helpers/email.helper.js +112 -0
- package/dist/helpers/eth.helper.d.ts +12 -0
- package/dist/helpers/eth.helper.js +4246 -0
- package/dist/helpers/hummingbots.helper.d.ts +2 -0
- package/dist/helpers/hummingbots.helper.js +163 -0
- package/dist/helpers/index.d.ts +5 -0
- package/dist/helpers/index.js +837 -0
- package/dist/helpers/interval.helpers.d.ts +9 -0
- package/dist/helpers/interval.helpers.js +110 -0
- package/dist/helpers/liquidity.helper.d.ts +6 -0
- package/dist/helpers/liquidity.helper.js +81 -0
- package/dist/helpers/order.helper.d.ts +7 -0
- package/dist/helpers/order.helper.js +946 -0
- package/dist/helpers/pair.helper.d.ts +9 -0
- package/dist/helpers/pair.helper.js +938 -0
- package/dist/helpers/pointSystem.helper.d.ts +14 -0
- package/dist/helpers/pointSystem.helper.js +392 -0
- package/dist/helpers/ticker.helpers.d.ts +8 -0
- package/dist/helpers/ticker.helpers.js +358 -0
- package/dist/helpers/vaa.helper.d.ts +2 -0
- package/dist/helpers/vaa.helper.js +4350 -0
- package/dist/helpers/withdraw.helper.d.ts +14 -0
- package/dist/helpers/withdraw.helper.js +4784 -0
- package/dist/interfaces/accountInfo.interface.d.ts +15 -0
- package/dist/interfaces/algostreamer/index.d.ts +49 -0
- package/dist/interfaces/api/affiliate.interface.d.ts +71 -0
- package/dist/interfaces/cache.interface.d.ts +25 -0
- package/dist/interfaces/confirmed-txn.interface.d.ts +46 -0
- package/dist/interfaces/controller.interface.d.ts +6 -0
- package/dist/interfaces/db/baseModel.interface.d.ts +5 -0
- package/dist/interfaces/db/hummingbot/index.d.ts +18 -0
- package/dist/interfaces/db/index.d.ts +10 -0
- package/dist/interfaces/db/market/index.d.ts +313 -0
- package/dist/interfaces/db/marketing/index.d.ts +48 -0
- package/dist/interfaces/db/notification_center/index.d.ts +33 -0
- package/dist/interfaces/db/relayer/index.d.ts +56 -0
- package/dist/interfaces/db/social/index.d.ts +188 -0
- package/dist/interfaces/db/softDeleteModel.interface.d.ts +4 -0
- package/dist/interfaces/db/white_label/index.d.ts +161 -0
- package/dist/interfaces/db/withdrawal_wallets/index.d.ts +12 -0
- package/dist/interfaces/dto/index.d.ts +62 -0
- package/dist/interfaces/emailService.interface.d.ts +4 -0
- package/dist/interfaces/index.d.ts +17 -0
- package/dist/interfaces/index.js +1319 -0
- package/dist/interfaces/kmsService.interface.d.ts +4 -0
- package/dist/interfaces/last-look-trade.interface.d.ts +10 -0
- package/dist/interfaces/market.interface.d.ts +17 -0
- package/dist/interfaces/order.interface.d.ts +162 -0
- package/dist/interfaces/pair.interface.d.ts +10 -0
- package/dist/interfaces/query.interface.d.ts +6 -0
- package/dist/interfaces/services/accountCache.interface.d.ts +15 -0
- package/dist/interfaces/services/algod.interface.d.ts +5 -0
- package/dist/interfaces/services/balances.interface.d.ts +11 -0
- package/dist/interfaces/services/coin-market-cap.interface.d.ts +124 -0
- package/dist/interfaces/services/index.d.ts +8 -0
- package/dist/interfaces/services/price-model.interface.d.ts +4 -0
- package/dist/interfaces/services/price-service.interface.d.ts +8 -0
- package/dist/interfaces/services/socialActivity.interface.d.ts +48 -0
- package/dist/interfaces/services/tmc.interface.d.ts +9 -0
- package/dist/interfaces/streaming.interface.d.ts +95 -0
- package/dist/interfaces/timestream.interface.d.ts +29 -0
- package/dist/interfaces/trading.interface.d.ts +235 -0
- package/dist/interfaces/tradingKey.interface.d.ts +26 -0
- package/dist/interfaces/transfer.interface.d.ts +12 -0
- package/dist/interfaces/wallet.interface.d.ts +89 -0
- package/dist/interfaces/withdrawalWallets.interface.d.ts +14 -0
- package/dist/types/algo-order.type.d.ts +10 -0
- package/dist/types/amm/amm.d.ts +163 -0
- package/dist/types/api/request.types.d.ts +99 -0
- package/dist/types/codex.types.d.ts +28 -0
- package/dist/types/hummingbots.types.d.ts +23 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.js +362 -0
- package/dist/types/notification.type.d.ts +10 -0
- package/dist/types/settings.type.d.ts +162 -0
- package/dist/types/state.type.d.ts +4 -0
- package/package.json +78 -0
|
@@ -0,0 +1,4246 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
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
|
|
12
|
+
/******/ "use strict";
|
|
13
|
+
/******/ var __webpack_modules__ = ({
|
|
14
|
+
|
|
15
|
+
/***/ 18:
|
|
16
|
+
/***/ ((module) => {
|
|
17
|
+
|
|
18
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__18__;
|
|
19
|
+
|
|
20
|
+
/***/ }),
|
|
21
|
+
|
|
22
|
+
/***/ 223:
|
|
23
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27
|
+
if (k2 === undefined) k2 = k;
|
|
28
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
29
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
30
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(o, k2, desc);
|
|
33
|
+
}) : (function(o, m, k, k2) {
|
|
34
|
+
if (k2 === undefined) k2 = k;
|
|
35
|
+
o[k2] = m[k];
|
|
36
|
+
}));
|
|
37
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
38
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
39
|
+
}) : function(o, v) {
|
|
40
|
+
o["default"] = v;
|
|
41
|
+
});
|
|
42
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
43
|
+
var ownKeys = function(o) {
|
|
44
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
45
|
+
var ar = [];
|
|
46
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
47
|
+
return ar;
|
|
48
|
+
};
|
|
49
|
+
return ownKeys(o);
|
|
50
|
+
};
|
|
51
|
+
return function (mod) {
|
|
52
|
+
if (mod && mod.__esModule) return mod;
|
|
53
|
+
var result = {};
|
|
54
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
55
|
+
__setModuleDefault(result, mod);
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
})();
|
|
59
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
60
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
61
|
+
};
|
|
62
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
63
|
+
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
|
+
exports.getUnifiedUSDC = getUnifiedUSDC;
|
|
65
|
+
exports.getUnifiedUSDCToken = getUnifiedUSDCToken;
|
|
66
|
+
const algosdk_1 = __importDefault(__webpack_require__(9709));
|
|
67
|
+
const bs58 = __importStar(__webpack_require__(4578));
|
|
68
|
+
const algoHelper = __importStar(__webpack_require__(6897));
|
|
69
|
+
const ethHelper = __importStar(__webpack_require__(9019));
|
|
70
|
+
const codex_helper_1 = __webpack_require__(3955);
|
|
71
|
+
const eth_helper_1 = __webpack_require__(9019);
|
|
72
|
+
const Encoding_1 = __webpack_require__(8593);
|
|
73
|
+
const enums_1 = __webpack_require__(9965);
|
|
74
|
+
const generateHash = (message) => {
|
|
75
|
+
return Buffer.from((0, eth_helper_1.keccak256)(message)).toString("hex");
|
|
76
|
+
};
|
|
77
|
+
exports.generateHash = generateHash;
|
|
78
|
+
const getBoxKey = (message, prefix) => {
|
|
79
|
+
const boxName = (0, Encoding_1.concatArrays)([
|
|
80
|
+
(0, codex_helper_1.encode)(prefix, 'str'),
|
|
81
|
+
(0, eth_helper_1.keccak256)(message),
|
|
82
|
+
]);
|
|
83
|
+
return boxName;
|
|
84
|
+
};
|
|
85
|
+
exports.getBoxKey = getBoxKey;
|
|
86
|
+
const getBoxKeyFromHash = (hash, prefix) => {
|
|
87
|
+
const boxName = (0, Encoding_1.concatArrays)([
|
|
88
|
+
(0, codex_helper_1.encode)(prefix, 'str'),
|
|
89
|
+
Buffer.from(hash, 'hex'),
|
|
90
|
+
]);
|
|
91
|
+
return boxName;
|
|
92
|
+
};
|
|
93
|
+
exports.getBoxKeyFromHash = getBoxKeyFromHash;
|
|
94
|
+
const getAppArgs = (methodSignature, args) => {
|
|
95
|
+
const m = algosdk_1.default.ABIMethod.fromSignature(methodSignature);
|
|
96
|
+
const selector = m.getSelector();
|
|
97
|
+
const txnArgsLog = {};
|
|
98
|
+
const txnArgs = args.map((value, index) => {
|
|
99
|
+
const v = m.args[index].type.encode(value);
|
|
100
|
+
txnArgsLog[`txnArgs${index}`] = Array.apply([], Array.from(v)).join(", ");
|
|
101
|
+
return v;
|
|
102
|
+
});
|
|
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
|
+
return [selector, ...txnArgs];
|
|
106
|
+
};
|
|
107
|
+
exports.getAppArgs = getAppArgs;
|
|
108
|
+
const getDataBytesFromMsg = (message, encoding, dataBytesLength) => {
|
|
109
|
+
const bufferMsg = Buffer.from(message, encoding);
|
|
110
|
+
const b64Buffer = bufferMsg.subarray(bufferMsg.length - dataBytesLength);
|
|
111
|
+
const strBuffer = Buffer.from(b64Buffer).toString();
|
|
112
|
+
const buffer = (0, Encoding_1.decodeBase64)(strBuffer);
|
|
113
|
+
return buffer;
|
|
114
|
+
};
|
|
115
|
+
exports.getDataBytesFromMsg = getDataBytesFromMsg;
|
|
116
|
+
const getMsgArgs = (message, signature, signerAddress, signerChainId, encoding = 'hex') => {
|
|
117
|
+
const msgArgs = [
|
|
118
|
+
(0, exports.getPrefixedMessage)(message, encoding, signerChainId),
|
|
119
|
+
(0, exports.decodeSignature)(signature, signerChainId),
|
|
120
|
+
(0, exports.getPublicKey)(signerAddress, signerChainId, message, signature, encoding),
|
|
121
|
+
];
|
|
122
|
+
// console.log('MSG ARGS', msgArgs)
|
|
123
|
+
return msgArgs;
|
|
124
|
+
};
|
|
125
|
+
exports.getMsgArgs = getMsgArgs;
|
|
126
|
+
const decodeSignature = (signature, chain) => {
|
|
127
|
+
if (chain === enums_1.Chains.Algorand) {
|
|
128
|
+
return (0, Encoding_1.decodeBase64)(signature);
|
|
129
|
+
}
|
|
130
|
+
if (chain === enums_1.Chains.Solana) {
|
|
131
|
+
return bs58.decode(signature);
|
|
132
|
+
}
|
|
133
|
+
return (0, eth_helper_1.decodeHexString)(signature);
|
|
134
|
+
};
|
|
135
|
+
exports.decodeSignature = decodeSignature;
|
|
136
|
+
const getPublicKey = (address, chain, message, signature, encoding) => {
|
|
137
|
+
if (chain === enums_1.Chains.Algorand || chain === enums_1.Chains.Solana) {
|
|
138
|
+
return (0, exports.encodeAddress)(address, chain);
|
|
139
|
+
}
|
|
140
|
+
return (0, eth_helper_1.recoverPublicKey)((0, exports.getPrefixedMessage)(message, encoding, chain), signature);
|
|
141
|
+
};
|
|
142
|
+
exports.getPublicKey = getPublicKey;
|
|
143
|
+
const getPrefixMessage = (message, chain) => {
|
|
144
|
+
if (chain === enums_1.Chains.Algorand) {
|
|
145
|
+
return 'MX';
|
|
146
|
+
}
|
|
147
|
+
if (chain === enums_1.Chains.Solana) {
|
|
148
|
+
return '';
|
|
149
|
+
}
|
|
150
|
+
return `\x19Ethereum Signed Message:\n${message.length}`;
|
|
151
|
+
};
|
|
152
|
+
const getPrefixedMessage = (message, encoding, chain) => {
|
|
153
|
+
const messageBytes = Buffer.from(message, encoding);
|
|
154
|
+
return Buffer.concat([(0, Encoding_1.encodeString)(getPrefixMessage(messageBytes, chain)), messageBytes]);
|
|
155
|
+
};
|
|
156
|
+
exports.getPrefixedMessage = getPrefixedMessage;
|
|
157
|
+
const getProviderChainId = (technology) => {
|
|
158
|
+
switch (technology) {
|
|
159
|
+
case "ALGORAND": return enums_1.Chains.Algorand;
|
|
160
|
+
case "SOLANA": return enums_1.Chains.Solana;
|
|
161
|
+
case "EVM": return enums_1.Chains.Polygon;
|
|
162
|
+
default: return enums_1.Chains.Polygon;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
exports.getProviderChainId = getProviderChainId;
|
|
166
|
+
const encodeAddress = (address, chain) => {
|
|
167
|
+
if (chain === enums_1.Chains.Algorand) {
|
|
168
|
+
return algoHelper.decodeAndNormalizeAddress(address);
|
|
169
|
+
}
|
|
170
|
+
if (chain === enums_1.Chains.Solana) {
|
|
171
|
+
return bs58.decode(address);
|
|
172
|
+
}
|
|
173
|
+
return ethHelper.decodeAndNormalizeAddress(address);
|
|
174
|
+
};
|
|
175
|
+
exports.encodeAddress = encodeAddress;
|
|
176
|
+
exports.unified_CCTP_token = 'CCTPUSDC';
|
|
177
|
+
exports.unified_CCTP_ChainID = 65537;
|
|
178
|
+
function getUnifiedUSDC() {
|
|
179
|
+
const unified_buf = Buffer.alloc(32, 0);
|
|
180
|
+
Buffer.from(exports.unified_CCTP_token, 'utf-8').copy(unified_buf);
|
|
181
|
+
return unified_buf;
|
|
182
|
+
}
|
|
183
|
+
function getUnifiedUSDCToken() {
|
|
184
|
+
return {
|
|
185
|
+
address: "0x" + getUnifiedUSDC().toString('hex'),
|
|
186
|
+
chainId: exports.unified_CCTP_ChainID
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
/***/ }),
|
|
192
|
+
|
|
193
|
+
/***/ 430:
|
|
194
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
198
|
+
if (k2 === undefined) k2 = k;
|
|
199
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
200
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
201
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
202
|
+
}
|
|
203
|
+
Object.defineProperty(o, k2, desc);
|
|
204
|
+
}) : (function(o, m, k, k2) {
|
|
205
|
+
if (k2 === undefined) k2 = k;
|
|
206
|
+
o[k2] = m[k];
|
|
207
|
+
}));
|
|
208
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
209
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
210
|
+
};
|
|
211
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
212
|
+
__exportStar(__webpack_require__(223), exports);
|
|
213
|
+
__exportStar(__webpack_require__(9367), exports);
|
|
214
|
+
__exportStar(__webpack_require__(9136), exports);
|
|
215
|
+
__exportStar(__webpack_require__(5882), exports);
|
|
216
|
+
__exportStar(__webpack_require__(3261), exports);
|
|
217
|
+
__exportStar(__webpack_require__(8060), exports);
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
/***/ }),
|
|
221
|
+
|
|
222
|
+
/***/ 573:
|
|
223
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
/***/ }),
|
|
230
|
+
|
|
231
|
+
/***/ 661:
|
|
232
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
236
|
+
exports.WITHDRAW_DATA_BYTES_LENGTH = exports.SHARE_DATA_LENGTH = exports.MAX_TOKEN_DECIMAL = exports.ORDER_MSG_VERSION = exports.ORDER_DATA_BYTES_LENGTH = exports.MIN_ORDER_EXPIRATION_MINS = exports.DEFAULT_ORDER_EXPIRATION_DAYS = exports.DEFAULT_FEE_SHARE = exports.FRONTEND_FEE_SCALE = exports.FEE_SCALE = exports.FACTOR_PRICE_DECIMAL = void 0;
|
|
237
|
+
exports.FACTOR_PRICE_DECIMAL = 18;
|
|
238
|
+
exports.FEE_SCALE = 100000;
|
|
239
|
+
exports.FRONTEND_FEE_SCALE = exports.FEE_SCALE / 100;
|
|
240
|
+
exports.DEFAULT_FEE_SHARE = 90000;
|
|
241
|
+
exports.DEFAULT_ORDER_EXPIRATION_DAYS = 30;
|
|
242
|
+
exports.MIN_ORDER_EXPIRATION_MINS = 60;
|
|
243
|
+
exports.ORDER_DATA_BYTES_LENGTH = 328;
|
|
244
|
+
exports.ORDER_MSG_VERSION = 1;
|
|
245
|
+
exports.MAX_TOKEN_DECIMAL = 18;
|
|
246
|
+
exports.SHARE_DATA_LENGTH = 36;
|
|
247
|
+
exports.WITHDRAW_DATA_BYTES_LENGTH = 248;
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
/***/ }),
|
|
251
|
+
|
|
252
|
+
/***/ 835:
|
|
253
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
257
|
+
var OrderSide;
|
|
258
|
+
(function (OrderSide) {
|
|
259
|
+
OrderSide[OrderSide["Buy"] = 0] = "Buy";
|
|
260
|
+
OrderSide[OrderSide["Sell"] = 1] = "Sell";
|
|
261
|
+
})(OrderSide || (OrderSide = {}));
|
|
262
|
+
exports["default"] = OrderSide;
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
/***/ }),
|
|
266
|
+
|
|
267
|
+
/***/ 839:
|
|
268
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
272
|
+
exports.transformPointSystemSettings = void 0;
|
|
273
|
+
const _types_1 = __webpack_require__(3574);
|
|
274
|
+
const transformPointSystemSettings = (pointSystemSettings) => {
|
|
275
|
+
const settingsObj = {};
|
|
276
|
+
pointSystemSettings.forEach(({ settingId, value, setting }) => {
|
|
277
|
+
if (setting.type === 'boolean') {
|
|
278
|
+
settingsObj[settingId] = value === 'true';
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
settingsObj[settingId] = value;
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
return {
|
|
285
|
+
discordEnabled: settingsObj[_types_1.SettingIds.POINT_SYSTEM_DISCORD_ENABLED],
|
|
286
|
+
telegramBotName: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TELEGRAM_BOT_NAME],
|
|
287
|
+
telegramBotId: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TELEGRAM_BOT_ID],
|
|
288
|
+
telegramEnabled: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TELEGRAM_ENABLED],
|
|
289
|
+
telegramGroupId: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TELEGRAM_GROUP_ID],
|
|
290
|
+
telegramGroupName: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TELEGRAM_GROUP_NAME],
|
|
291
|
+
twitterAccountId: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TWITTER_ACCOUNT_ID],
|
|
292
|
+
twitterAccountName: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TWITTER_ACCOUNT_NAME],
|
|
293
|
+
twitterEnabled: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TWITTER_ENABLED],
|
|
294
|
+
twitterJobEnabled: settingsObj[_types_1.SettingIds.POINT_SYSTEM_TWITTER_JOB_ENABLED],
|
|
295
|
+
guideLink: settingsObj[_types_1.SettingIds.POINT_SYSTEM_GUIDE_LINK],
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
exports.transformPointSystemSettings = transformPointSystemSettings;
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
/***/ }),
|
|
302
|
+
|
|
303
|
+
/***/ 865:
|
|
304
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
308
|
+
exports.groupTickersByInterval = groupTickersByInterval;
|
|
309
|
+
exports.groupTickersByMonthInterval = groupTickersByMonthInterval;
|
|
310
|
+
exports.groupTickersByYearInterval = groupTickersByYearInterval;
|
|
311
|
+
exports.mapCandleToTicker = mapCandleToTicker;
|
|
312
|
+
exports.roundUpSecondsInTimestamp = roundUpSecondsInTimestamp;
|
|
313
|
+
exports.roundUpMinutesInTimestamp = roundUpMinutesInTimestamp;
|
|
314
|
+
exports.roundUpHoursInTimestamp = roundUpHoursInTimestamp;
|
|
315
|
+
const big_number_helper_1 = __webpack_require__(1174);
|
|
316
|
+
function groupTickersByInterval(tickers, newIntervalInSec, endTimeInSec) {
|
|
317
|
+
const newGroupedTickers = [];
|
|
318
|
+
let timestamp = endTimeInSec - newIntervalInSec;
|
|
319
|
+
let slot = null;
|
|
320
|
+
// desc direction by timestamp
|
|
321
|
+
const sortedTickers = tickers.sort((a, b) => b.t - a.t);
|
|
322
|
+
for (let i = 0; i < sortedTickers.length; i++) {
|
|
323
|
+
const element = sortedTickers[i];
|
|
324
|
+
if (element.t < timestamp) {
|
|
325
|
+
if (slot) {
|
|
326
|
+
newGroupedTickers.push({ ...slot });
|
|
327
|
+
slot = null;
|
|
328
|
+
}
|
|
329
|
+
timestamp = timestamp - newIntervalInSec * Math.ceil((timestamp - element.t) / newIntervalInSec);
|
|
330
|
+
}
|
|
331
|
+
if (!slot) {
|
|
332
|
+
slot = { ...element, t: timestamp };
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
if ((0, big_number_helper_1.lessThan)(slot.h, element.h))
|
|
336
|
+
slot.h = element.h;
|
|
337
|
+
if ((0, big_number_helper_1.greaterThan)(slot.l, element.l))
|
|
338
|
+
slot.l = element.l;
|
|
339
|
+
slot.o = element.o;
|
|
340
|
+
slot.v = Number((0, big_number_helper_1.plus)(slot.v, element.v));
|
|
341
|
+
}
|
|
342
|
+
if (i + 1 === sortedTickers.length) {
|
|
343
|
+
newGroupedTickers.push({ ...slot });
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return newGroupedTickers;
|
|
347
|
+
}
|
|
348
|
+
function groupTickersByMonthInterval(tickers, months, endTimeInSec) {
|
|
349
|
+
const sortedTickers = tickers.sort((a, b) => b.t - a.t);
|
|
350
|
+
const yearlyTickers = [];
|
|
351
|
+
const tickersByYear = new Map();
|
|
352
|
+
for (const ticker of sortedTickers) {
|
|
353
|
+
const date = new Date(ticker.t * 1000);
|
|
354
|
+
const year = date.getFullYear();
|
|
355
|
+
if (!tickersByYear.has(year)) {
|
|
356
|
+
tickersByYear.set(year, []);
|
|
357
|
+
}
|
|
358
|
+
tickersByYear.get(year).push(ticker);
|
|
359
|
+
}
|
|
360
|
+
for (const [year, yearTickers] of tickersByYear) {
|
|
361
|
+
if (yearTickers.length === 0)
|
|
362
|
+
continue;
|
|
363
|
+
const sortedYearTickers = yearTickers.sort((a, b) => a.t - b.t);
|
|
364
|
+
const yearlyTicker = {
|
|
365
|
+
t: new Date(year, 0, 1).getTime() / 1000,
|
|
366
|
+
o: sortedYearTickers[0].o,
|
|
367
|
+
h: Math.max(...sortedYearTickers.map(t => t.h)),
|
|
368
|
+
l: Math.min(...sortedYearTickers.map(t => t.l)),
|
|
369
|
+
c: sortedYearTickers[sortedYearTickers.length - 1].c,
|
|
370
|
+
v: sortedYearTickers.reduce((sum, t) => sum + t.v, 0),
|
|
371
|
+
q: sortedYearTickers.reduce((sum, t) => sum + t.q, 0),
|
|
372
|
+
};
|
|
373
|
+
yearlyTickers.push(yearlyTicker);
|
|
374
|
+
}
|
|
375
|
+
return yearlyTickers.sort((a, b) => b.t - a.t);
|
|
376
|
+
}
|
|
377
|
+
function groupTickersByYearInterval(tickers, years, endTimeInSec) {
|
|
378
|
+
throw new Error("groupTickersByYearInterval has not implemented yet");
|
|
379
|
+
}
|
|
380
|
+
function mapCandleToTicker(candle) {
|
|
381
|
+
return {
|
|
382
|
+
t: +(0, big_number_helper_1.divide)(candle.timestamp, 1000),
|
|
383
|
+
o: candle.open,
|
|
384
|
+
h: candle.high,
|
|
385
|
+
l: candle.low,
|
|
386
|
+
c: candle.close,
|
|
387
|
+
v: candle.volume,
|
|
388
|
+
q: candle.quote
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
function roundUpSecondsInTimestamp(timeInSec) {
|
|
392
|
+
return (new Date(timeInSec * 1000).setSeconds(60, 0)) / 1000;
|
|
393
|
+
}
|
|
394
|
+
function roundUpMinutesInTimestamp(timeInSec) {
|
|
395
|
+
return (new Date(timeInSec * 1000).setMinutes(60, 0, 0)) / 1000;
|
|
396
|
+
}
|
|
397
|
+
function roundUpHoursInTimestamp(timeInSec) {
|
|
398
|
+
return (new Date(timeInSec * 1000).setHours(24, 0, 0, 0)) / 1000;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
/***/ }),
|
|
403
|
+
|
|
404
|
+
/***/ 892:
|
|
405
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
409
|
+
exports.PairComponentStatusType = exports.ComponentType = exports.ComponentStatusType = void 0;
|
|
410
|
+
var ComponentStatusType;
|
|
411
|
+
(function (ComponentStatusType) {
|
|
412
|
+
ComponentStatusType["ACTIVE"] = "ACTIVE";
|
|
413
|
+
ComponentStatusType["FAILED"] = "FAILED";
|
|
414
|
+
ComponentStatusType["STARTING"] = "STARTING";
|
|
415
|
+
ComponentStatusType["DRAINING"] = "DRAINING";
|
|
416
|
+
ComponentStatusType["TERMINATING"] = "TERMINATING";
|
|
417
|
+
ComponentStatusType["TERMINATED"] = "TERMINATED";
|
|
418
|
+
})(ComponentStatusType || (exports.ComponentStatusType = ComponentStatusType = {}));
|
|
419
|
+
var ComponentType;
|
|
420
|
+
(function (ComponentType) {
|
|
421
|
+
ComponentType["MATCHING_ENGINE"] = "me";
|
|
422
|
+
ComponentType["ORDER_SERVICE"] = "ors";
|
|
423
|
+
ComponentType["API"] = "api";
|
|
424
|
+
ComponentType["SOCKET_SERVICE"] = "ws";
|
|
425
|
+
ComponentType["TRANSACTION_SERVICE"] = "tns";
|
|
426
|
+
})(ComponentType || (exports.ComponentType = ComponentType = {}));
|
|
427
|
+
var PairComponentStatusType;
|
|
428
|
+
(function (PairComponentStatusType) {
|
|
429
|
+
PairComponentStatusType["ACTIVE"] = "ACTIVE";
|
|
430
|
+
PairComponentStatusType["FAILED"] = "FAILED";
|
|
431
|
+
PairComponentStatusType["UNASSIGNED"] = "UNASSIGNED";
|
|
432
|
+
PairComponentStatusType["ASSIGNED"] = "ASSIGNED";
|
|
433
|
+
PairComponentStatusType["STARTING"] = "STARTING";
|
|
434
|
+
})(PairComponentStatusType || (exports.PairComponentStatusType = PairComponentStatusType = {}));
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
/***/ }),
|
|
438
|
+
|
|
439
|
+
/***/ 893:
|
|
440
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
444
|
+
exports.NON_REPEATABLE_ACTIONS = exports.ActionEnum = exports.ActionSource = void 0;
|
|
445
|
+
var ActionSource;
|
|
446
|
+
(function (ActionSource) {
|
|
447
|
+
ActionSource["COMPANY"] = "COMPANY";
|
|
448
|
+
ActionSource["TWITTER"] = "TWITTER";
|
|
449
|
+
ActionSource["DISCORD"] = "DISCORD";
|
|
450
|
+
ActionSource["TELEGRAM"] = "TELEGRAM";
|
|
451
|
+
})(ActionSource || (exports.ActionSource = ActionSource = {}));
|
|
452
|
+
var ActionEnum;
|
|
453
|
+
(function (ActionEnum) {
|
|
454
|
+
ActionEnum[ActionEnum["TWITTER_FOLLOW"] = 1] = "TWITTER_FOLLOW";
|
|
455
|
+
ActionEnum[ActionEnum["TWITTER_REPLY"] = 2] = "TWITTER_REPLY";
|
|
456
|
+
ActionEnum[ActionEnum["TWITTER_RETWEET"] = 3] = "TWITTER_RETWEET";
|
|
457
|
+
ActionEnum[ActionEnum["TWITTER_LIKE"] = 4] = "TWITTER_LIKE";
|
|
458
|
+
ActionEnum[ActionEnum["COMPANY_FIRST_LOGIN"] = 5] = "COMPANY_FIRST_LOGIN";
|
|
459
|
+
ActionEnum[ActionEnum["COMPANY_CONFIRM_EMAIL"] = 6] = "COMPANY_CONFIRM_EMAIL";
|
|
460
|
+
ActionEnum[ActionEnum["COMPANY_DEPOSIT"] = 7] = "COMPANY_DEPOSIT";
|
|
461
|
+
ActionEnum[ActionEnum["COMPANY_TRADE"] = 8] = "COMPANY_TRADE";
|
|
462
|
+
ActionEnum[ActionEnum["TELEGRAM_JOIN_GROUP"] = 9] = "TELEGRAM_JOIN_GROUP";
|
|
463
|
+
ActionEnum[ActionEnum["DISCORD_JOIN_SERVER"] = 10] = "DISCORD_JOIN_SERVER";
|
|
464
|
+
ActionEnum[ActionEnum["AFFILIATE_POINTS_REWARD"] = 11] = "AFFILIATE_POINTS_REWARD";
|
|
465
|
+
})(ActionEnum || (exports.ActionEnum = ActionEnum = {}));
|
|
466
|
+
exports.NON_REPEATABLE_ACTIONS = [
|
|
467
|
+
ActionEnum.TWITTER_FOLLOW,
|
|
468
|
+
ActionEnum.TELEGRAM_JOIN_GROUP,
|
|
469
|
+
ActionEnum.DISCORD_JOIN_SERVER,
|
|
470
|
+
ActionEnum.COMPANY_CONFIRM_EMAIL,
|
|
471
|
+
ActionEnum.COMPANY_FIRST_LOGIN,
|
|
472
|
+
];
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
/***/ }),
|
|
476
|
+
|
|
477
|
+
/***/ 935:
|
|
478
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
482
|
+
exports.SERVER = exports.CALCULATIONS = exports.BIGNUMBER = exports.RES_MSG = exports.RESPONSES = void 0;
|
|
483
|
+
exports.RESPONSES = {
|
|
484
|
+
SUCCESS: 200,
|
|
485
|
+
CREATED: 201,
|
|
486
|
+
ACCEPTED: 202,
|
|
487
|
+
NOCONTENT: 204,
|
|
488
|
+
BADREQUEST: 400,
|
|
489
|
+
FORBIDDEN: 403,
|
|
490
|
+
NOTFOUND: 404,
|
|
491
|
+
TIMEOUT: 408,
|
|
492
|
+
TOOMANYREQ: 429,
|
|
493
|
+
INTERNALSERVER: 500,
|
|
494
|
+
BADGATEWAYS: 502,
|
|
495
|
+
SERVICEUNAVILABLE: 503,
|
|
496
|
+
GATEWAYTIMEOUT: 504,
|
|
497
|
+
};
|
|
498
|
+
exports.RES_MSG = {
|
|
499
|
+
INSERT: 'Data has been saved successfully.',
|
|
500
|
+
ERROR: 'Some error has been occured. Please try again.',
|
|
501
|
+
SUCCESS: 'Your request is executed successfully!',
|
|
502
|
+
REQUIRED: 'coin_type or price param is required',
|
|
503
|
+
CAPTCHATEXTNOTFOUND: 'Captcha text not found.',
|
|
504
|
+
CAPTCHA_VERIFICATION_FAILED: 'Captcha is not verified.',
|
|
505
|
+
NOTEMPTY: 'coin_type or price should not be empty',
|
|
506
|
+
PAIR_LIST: 'Pair list',
|
|
507
|
+
PAIR_STATUS: 'Pair status has been changed',
|
|
508
|
+
ACTIVE_USERS: 'Active Users',
|
|
509
|
+
SETTINGS_NOT_FOUND: 'No settings found in DB.',
|
|
510
|
+
TRADE_IS_HALT: 'Trading is disabled.',
|
|
511
|
+
KYC_REQUIRED: 'KYC is required for this action.',
|
|
512
|
+
EMAIL_NOT_VERIFIED: 'Your email is not verified.Please verify first.',
|
|
513
|
+
NOT_BETA_USER: 'Trade only works for beta user.',
|
|
514
|
+
WRONG_PAIR_KEY: 'Pair key not found.',
|
|
515
|
+
PAIRDISABLED: 'Temporarily order placement has been disabled for this pair. Please try again later.',
|
|
516
|
+
BALANCE_NOT_SUFFICIENT: 'You have insufficient balance.',
|
|
517
|
+
MIN_TRADE_NOT_MATCHED: 'Minimum trade limit does not matched.',
|
|
518
|
+
ORDER_PLACED_SUCCESSFULLY: 'Order has been placed successfully.',
|
|
519
|
+
ORDER_NOT_FOUND: 'Sorry this order id does not found.',
|
|
520
|
+
ORDER_ALREADY_MATCHED: 'Order already matched.',
|
|
521
|
+
ORDER_ALREADY_CANCELED: 'Order already cancelled.',
|
|
522
|
+
ORDER_CANCELED_SUCCESSFULLY: 'order successfully cancelled',
|
|
523
|
+
ORDER_LIST: 'Order list fetched successfully.',
|
|
524
|
+
ORDER_EXIT: 'Successfully exited from the position.',
|
|
525
|
+
PAIRERR: 'please provide pair param',
|
|
526
|
+
ORDERSIDE: 'side param is required',
|
|
527
|
+
ORDERTYPE: 'type param is required',
|
|
528
|
+
ORDERIDREQ: 'order_id param is required',
|
|
529
|
+
ORDERDETAIL: 'order detail',
|
|
530
|
+
COMMODITYORICE: 'commodity price',
|
|
531
|
+
COMMODITYSPOT: 'commodity spot updated',
|
|
532
|
+
TOKEN_INSERTED: 'ERC token has been added',
|
|
533
|
+
PARAMREQ: 'Parameter missing',
|
|
534
|
+
EXIST: 'Token Already Exist',
|
|
535
|
+
BREACHEDTOKENS: 'List of breached tokens',
|
|
536
|
+
API_EXPOSE: {
|
|
537
|
+
TOKEN_NOT_FOUND: 'Token not found, Please get token and set to header.',
|
|
538
|
+
ERROR: "Something went wrong, Please try again later"
|
|
539
|
+
},
|
|
540
|
+
LIMITED_UNITS: 'ONLY {{units}} units are available. You can place your order with this amount',
|
|
541
|
+
UNITS_UNAVAIL: 'Amount unavailable',
|
|
542
|
+
ORDER: {
|
|
543
|
+
ERROR: 'An error has been occured',
|
|
544
|
+
UNITS_UNAVAIL: 'Amount unavailable',
|
|
545
|
+
LIMITED_UNITS: 'ONLY {{units}} units are available. You can place your order with this amount',
|
|
546
|
+
PLACED: 'Order has been placed',
|
|
547
|
+
NOPARAMS: 'empty body params',
|
|
548
|
+
ORDER_NOT_FOUND: 'Sorry this order id not found.',
|
|
549
|
+
ORDER_ALREADY_MATCHED: 'Order already matched.',
|
|
550
|
+
ORDER_ALREADY_CANCELED: 'Order already cancelled.',
|
|
551
|
+
ORDER_CANCELED_SUCCESSFULLY: 'Order cancelled successfully',
|
|
552
|
+
},
|
|
553
|
+
DOMAIN_NOT_FOUND: 'domain not found',
|
|
554
|
+
};
|
|
555
|
+
exports.BIGNUMBER = {
|
|
556
|
+
SMALLESTUNIT: process.env.SMALLEST_UNIT,
|
|
557
|
+
};
|
|
558
|
+
exports.CALCULATIONS = {
|
|
559
|
+
SMALLEST_UNITS: process.env.SMALLEST_UNIT,
|
|
560
|
+
};
|
|
561
|
+
exports.SERVER = {
|
|
562
|
+
AVAILABLE_ASSETS_PER_USER: 1,
|
|
563
|
+
AVAILABLE_ASSETS_PER_IP: 3,
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
/***/ }),
|
|
568
|
+
|
|
569
|
+
/***/ 1048:
|
|
570
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
574
|
+
exports.WithdrawalWalletType = void 0;
|
|
575
|
+
var WithdrawalWalletType;
|
|
576
|
+
(function (WithdrawalWalletType) {
|
|
577
|
+
WithdrawalWalletType["SOLANA"] = "SOLANA";
|
|
578
|
+
WithdrawalWalletType["ALGORAND"] = "ALGORAND";
|
|
579
|
+
WithdrawalWalletType["EVM"] = "EVM";
|
|
580
|
+
})(WithdrawalWalletType || (exports.WithdrawalWalletType = WithdrawalWalletType = {}));
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
/***/ }),
|
|
584
|
+
|
|
585
|
+
/***/ 1134:
|
|
586
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
590
|
+
var OrderType;
|
|
591
|
+
(function (OrderType) {
|
|
592
|
+
OrderType[OrderType["Limit"] = 0] = "Limit";
|
|
593
|
+
OrderType[OrderType["IOC"] = 1] = "IOC";
|
|
594
|
+
OrderType[OrderType["POST"] = 2] = "POST";
|
|
595
|
+
OrderType[OrderType["Market"] = 3] = "Market";
|
|
596
|
+
})(OrderType || (OrderType = {}));
|
|
597
|
+
exports["default"] = OrderType;
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
/***/ }),
|
|
601
|
+
|
|
602
|
+
/***/ 1174:
|
|
603
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
607
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
608
|
+
};
|
|
609
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
610
|
+
exports.Operations = void 0;
|
|
611
|
+
exports.absolute = absolute;
|
|
612
|
+
exports.ceil = ceil;
|
|
613
|
+
exports.toFixed = toFixed;
|
|
614
|
+
exports.floor = floor;
|
|
615
|
+
exports.round = round;
|
|
616
|
+
exports.plus = plus;
|
|
617
|
+
exports.minus = minus;
|
|
618
|
+
exports.multiply = multiply;
|
|
619
|
+
exports.toUsd = toUsd;
|
|
620
|
+
exports.divide = divide;
|
|
621
|
+
exports.greaterThanOrEqual = greaterThanOrEqual;
|
|
622
|
+
exports.greaterThan = greaterThan;
|
|
623
|
+
exports.lessThanOrEqual = lessThanOrEqual;
|
|
624
|
+
exports.lessThan = lessThan;
|
|
625
|
+
exports.equal = equal;
|
|
626
|
+
exports.mod = mod;
|
|
627
|
+
exports.modZero = modZero;
|
|
628
|
+
exports.bn_operation = bn_operation;
|
|
629
|
+
exports.roundNumber = roundNumber;
|
|
630
|
+
exports.convertFromBaseUnits = convertFromBaseUnits;
|
|
631
|
+
exports.convertToBaseUnits = convertToBaseUnits;
|
|
632
|
+
const bignumber_js_1 = __importDefault(__webpack_require__(6168));
|
|
633
|
+
bignumber_js_1.default.config({ DECIMAL_PLACES: 40, EXPONENTIAL_AT: 45 });
|
|
634
|
+
var Operations;
|
|
635
|
+
(function (Operations) {
|
|
636
|
+
Operations["MINUS"] = "-";
|
|
637
|
+
Operations["PLUS"] = "+";
|
|
638
|
+
Operations["MULTIPLY"] = "*";
|
|
639
|
+
Operations["DIVIDE"] = "/";
|
|
640
|
+
Operations["GREATER_THAN_OR_EQUAL"] = ">=";
|
|
641
|
+
Operations["GREATER_THAN"] = ">";
|
|
642
|
+
Operations["LESS_THAN_OR_EQUAL"] = "<=";
|
|
643
|
+
Operations["LESS_THAN"] = "<";
|
|
644
|
+
Operations["EQUAL"] = "==";
|
|
645
|
+
Operations["MOD"] = "mod";
|
|
646
|
+
})(Operations || (exports.Operations = Operations = {}));
|
|
647
|
+
function absolute(value) {
|
|
648
|
+
let x = new bignumber_js_1.default(value);
|
|
649
|
+
const res = x.abs().toString();
|
|
650
|
+
// console.log('Absolute value', { value, res })
|
|
651
|
+
return res;
|
|
652
|
+
}
|
|
653
|
+
function ceil(value) {
|
|
654
|
+
let x = new bignumber_js_1.default(String(value));
|
|
655
|
+
const res = x.integerValue(bignumber_js_1.default.ROUND_CEIL).toString();
|
|
656
|
+
if (!equal(value, res)) {
|
|
657
|
+
console.log('Ceil value', { value, res });
|
|
658
|
+
}
|
|
659
|
+
return res;
|
|
660
|
+
}
|
|
661
|
+
function toFixed(value, decimalPlaces, roundUpToFirstSignificant = false) {
|
|
662
|
+
const x = new bignumber_js_1.default(String(value));
|
|
663
|
+
let res;
|
|
664
|
+
if (roundUpToFirstSignificant) {
|
|
665
|
+
const valueStr = x.toFixed();
|
|
666
|
+
const decimalIndex = valueStr.indexOf('.');
|
|
667
|
+
if (decimalIndex >= 0) {
|
|
668
|
+
const fractionalPart = valueStr.slice(decimalIndex + 1);
|
|
669
|
+
let leadingZeros = 0;
|
|
670
|
+
for (let char of fractionalPart) {
|
|
671
|
+
if (char === '0') {
|
|
672
|
+
leadingZeros++;
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
break;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
const totalDecimalPlaces = leadingZeros + 1;
|
|
679
|
+
res = x.toFixed(totalDecimalPlaces, bignumber_js_1.default.ROUND_UP);
|
|
680
|
+
}
|
|
681
|
+
else {
|
|
682
|
+
res = x.toFixed(0);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
else {
|
|
686
|
+
res = x.toFixed(decimalPlaces);
|
|
687
|
+
}
|
|
688
|
+
console.log('Fixed value', { value, res });
|
|
689
|
+
return res;
|
|
690
|
+
}
|
|
691
|
+
function floor(value) {
|
|
692
|
+
let x = new bignumber_js_1.default(String(value));
|
|
693
|
+
const res = x.integerValue(bignumber_js_1.default.ROUND_FLOOR).toString();
|
|
694
|
+
console.log('Floor value', { value, res });
|
|
695
|
+
return res;
|
|
696
|
+
}
|
|
697
|
+
function round(value) {
|
|
698
|
+
let x = new bignumber_js_1.default(String(value));
|
|
699
|
+
const res = x.integerValue(bignumber_js_1.default.ROUND_HALF_UP).toString();
|
|
700
|
+
console.log('Round value', { value, res });
|
|
701
|
+
return res;
|
|
702
|
+
}
|
|
703
|
+
function plus(value1, value2) {
|
|
704
|
+
return bn_operation(value1, value2, Operations.PLUS);
|
|
705
|
+
}
|
|
706
|
+
function minus(value1, value2) {
|
|
707
|
+
return bn_operation(value1, value2, Operations.MINUS);
|
|
708
|
+
}
|
|
709
|
+
function multiply(value1, value2) {
|
|
710
|
+
return bn_operation(value1, value2, Operations.MULTIPLY);
|
|
711
|
+
}
|
|
712
|
+
function toUsd(amount, price) {
|
|
713
|
+
return multiply(amount, price || 0);
|
|
714
|
+
}
|
|
715
|
+
;
|
|
716
|
+
function divide(value1, value2) {
|
|
717
|
+
return bn_operation(value1, value2, Operations.DIVIDE);
|
|
718
|
+
}
|
|
719
|
+
function greaterThanOrEqual(value1, value2) {
|
|
720
|
+
return Boolean(bn_operation(value1, value2, Operations.GREATER_THAN_OR_EQUAL));
|
|
721
|
+
}
|
|
722
|
+
function greaterThan(value1, value2) {
|
|
723
|
+
return Boolean(bn_operation(value1, value2, Operations.GREATER_THAN));
|
|
724
|
+
}
|
|
725
|
+
function lessThanOrEqual(value1, value2) {
|
|
726
|
+
return Boolean(bn_operation(value1, value2, Operations.LESS_THAN_OR_EQUAL));
|
|
727
|
+
}
|
|
728
|
+
function lessThan(value1, value2) {
|
|
729
|
+
return Boolean(bn_operation(value1, value2, Operations.LESS_THAN));
|
|
730
|
+
}
|
|
731
|
+
function equal(value1, value2) {
|
|
732
|
+
return Boolean(bn_operation(value1, value2, Operations.EQUAL));
|
|
733
|
+
}
|
|
734
|
+
function mod(value1, value2) {
|
|
735
|
+
return bn_operation(value1, value2, Operations.MOD);
|
|
736
|
+
}
|
|
737
|
+
function modZero(value1, value2) {
|
|
738
|
+
return equal(mod(value1, value2), 0);
|
|
739
|
+
}
|
|
740
|
+
function bn_operation(a, b, operation) {
|
|
741
|
+
a = new bignumber_js_1.default(String(a));
|
|
742
|
+
b = new bignumber_js_1.default(String(b));
|
|
743
|
+
switch (operation.toLowerCase()) {
|
|
744
|
+
case '-':
|
|
745
|
+
return a.minus(b).toString();
|
|
746
|
+
case '+':
|
|
747
|
+
return a.plus(b).toString();
|
|
748
|
+
case '*':
|
|
749
|
+
case 'x':
|
|
750
|
+
return a.multipliedBy(b).toString();
|
|
751
|
+
case '÷':
|
|
752
|
+
case '/':
|
|
753
|
+
return a.dividedBy(b).toString();
|
|
754
|
+
case '>=':
|
|
755
|
+
return a.isGreaterThanOrEqualTo(b);
|
|
756
|
+
case '>':
|
|
757
|
+
return a.isGreaterThan(b);
|
|
758
|
+
case '<=':
|
|
759
|
+
return a.isLessThanOrEqualTo(b);
|
|
760
|
+
case '<':
|
|
761
|
+
return a.isLessThan(b);
|
|
762
|
+
case '==':
|
|
763
|
+
return a.isEqualTo(b);
|
|
764
|
+
case 'mod':
|
|
765
|
+
return a.modulo(b);
|
|
766
|
+
default:
|
|
767
|
+
break;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
function getExponentialNumberComponents(x) {
|
|
771
|
+
if (x.toString().includes('e')) {
|
|
772
|
+
const parts = x.toString().split('e');
|
|
773
|
+
return [parseFloat(parts[0]), parseFloat(parts[1])];
|
|
774
|
+
}
|
|
775
|
+
return [x, 0];
|
|
776
|
+
}
|
|
777
|
+
function generateExponentialNumberFromComponents(decimalPart, exponent) {
|
|
778
|
+
return decimalPart + (exponent < 0 ? `e${exponent}` : `e+${exponent}`);
|
|
779
|
+
}
|
|
780
|
+
function roundNumber({ decimalPlaces = 0 }, x) {
|
|
781
|
+
if (decimalPlaces > 0) {
|
|
782
|
+
const [decimal, decimalExponentialPart] = getExponentialNumberComponents(x);
|
|
783
|
+
const [rounded, roundedExponentialPart] = getExponentialNumberComponents(Math.round(Number(generateExponentialNumberFromComponents(decimal, decimalExponentialPart + decimalPlaces))));
|
|
784
|
+
return Number(generateExponentialNumberFromComponents(rounded, roundedExponentialPart - decimalPlaces));
|
|
785
|
+
}
|
|
786
|
+
return Math.round(x);
|
|
787
|
+
}
|
|
788
|
+
function convertFromBaseUnits(assetDecimals, quantity) {
|
|
789
|
+
const decimals = Number(assetDecimals);
|
|
790
|
+
return roundNumber({ decimalPlaces: decimals },
|
|
791
|
+
// eslint-disable-next-line no-magic-numbers
|
|
792
|
+
Math.pow(10, -decimals) * Number(quantity));
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Computs quantity * 10^(assetDecimals) and rounds the result
|
|
796
|
+
*/
|
|
797
|
+
function convertToBaseUnits(assetDecimals, quantity) {
|
|
798
|
+
// eslint-disable-next-line no-magic-numbers
|
|
799
|
+
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
|
+
return roundNumber({ decimalPlaces: 0 }, baseAmount);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
/***/ }),
|
|
806
|
+
|
|
807
|
+
/***/ 1283:
|
|
808
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
812
|
+
exports.StateType = void 0;
|
|
813
|
+
var StateType;
|
|
814
|
+
(function (StateType) {
|
|
815
|
+
StateType["VERSION"] = "version";
|
|
816
|
+
StateType["LAST_ALGO_BLOCK"] = "last_algo_block";
|
|
817
|
+
StateType["PRICES_PROVIDER_API_KEY"] = "prices_provider_api_key";
|
|
818
|
+
StateType["DEFAULT_API_DOMAIN"] = "default_api_domain";
|
|
819
|
+
StateType["NONCE_ACCOUNTS_SOLANA"] = "nonce_accounts_solana";
|
|
820
|
+
StateType["ARCHIVE_DATA_BATCH_SIZE"] = "archive_data_batch_size";
|
|
821
|
+
StateType["ARCHIVE_TASK_LOCK"] = "archive_task_lock";
|
|
822
|
+
})(StateType || (exports.StateType = StateType = {}));
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
/***/ }),
|
|
826
|
+
|
|
827
|
+
/***/ 1297:
|
|
828
|
+
/***/ ((module) => {
|
|
829
|
+
|
|
830
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__1297__;
|
|
831
|
+
|
|
832
|
+
/***/ }),
|
|
833
|
+
|
|
834
|
+
/***/ 1492:
|
|
835
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
839
|
+
var OrderStatus;
|
|
840
|
+
(function (OrderStatus) {
|
|
841
|
+
OrderStatus[OrderStatus["Open"] = 1] = "Open";
|
|
842
|
+
OrderStatus[OrderStatus["Canceled"] = 2] = "Canceled";
|
|
843
|
+
OrderStatus[OrderStatus["Matched"] = 3] = "Matched";
|
|
844
|
+
OrderStatus[OrderStatus["SelfMatched"] = 4] = "SelfMatched";
|
|
845
|
+
OrderStatus[OrderStatus["Expired"] = 5] = "Expired";
|
|
846
|
+
})(OrderStatus || (OrderStatus = {}));
|
|
847
|
+
exports["default"] = OrderStatus;
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
/***/ }),
|
|
851
|
+
|
|
852
|
+
/***/ 1682:
|
|
853
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
857
|
+
exports.SettingTypeColumn = void 0;
|
|
858
|
+
var SettingTypeColumn;
|
|
859
|
+
(function (SettingTypeColumn) {
|
|
860
|
+
SettingTypeColumn["STRING"] = "string";
|
|
861
|
+
SettingTypeColumn["BOOLEAN"] = "boolean";
|
|
862
|
+
SettingTypeColumn["INT"] = "int";
|
|
863
|
+
SettingTypeColumn["FLOAT"] = "float";
|
|
864
|
+
SettingTypeColumn["SINGLE_CHOICE"] = "single-choice";
|
|
865
|
+
SettingTypeColumn["MULTI_CHOICE"] = "multi-choice";
|
|
866
|
+
})(SettingTypeColumn || (exports.SettingTypeColumn = SettingTypeColumn = {}));
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
/***/ }),
|
|
870
|
+
|
|
871
|
+
/***/ 2169:
|
|
872
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
876
|
+
exports.PointSystemSettingsIds = void 0;
|
|
877
|
+
const settings_type_1 = __webpack_require__(7159);
|
|
878
|
+
exports.PointSystemSettingsIds = [
|
|
879
|
+
settings_type_1.SettingIds.POINT_SYSTEM_DISCORD_ENABLED,
|
|
880
|
+
settings_type_1.SettingIds.POINT_SYSTEM_TELEGRAM_BOT_NAME,
|
|
881
|
+
settings_type_1.SettingIds.POINT_SYSTEM_TELEGRAM_BOT_ID,
|
|
882
|
+
settings_type_1.SettingIds.POINT_SYSTEM_TELEGRAM_ENABLED,
|
|
883
|
+
settings_type_1.SettingIds.POINT_SYSTEM_TELEGRAM_GROUP_ID,
|
|
884
|
+
settings_type_1.SettingIds.POINT_SYSTEM_TELEGRAM_GROUP_NAME,
|
|
885
|
+
settings_type_1.SettingIds.POINT_SYSTEM_TWITTER_ACCOUNT_ID,
|
|
886
|
+
settings_type_1.SettingIds.POINT_SYSTEM_TWITTER_ACCOUNT_NAME,
|
|
887
|
+
settings_type_1.SettingIds.POINT_SYSTEM_TWITTER_ENABLED,
|
|
888
|
+
settings_type_1.SettingIds.POINT_SYSTEM_TWITTER_JOB_ENABLED,
|
|
889
|
+
settings_type_1.SettingIds.POINT_SYSTEM_GUIDE_LINK,
|
|
890
|
+
];
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
/***/ }),
|
|
894
|
+
|
|
895
|
+
/***/ 2224:
|
|
896
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
900
|
+
exports.AffiliateSortByEnum = void 0;
|
|
901
|
+
var AffiliateSortByEnum;
|
|
902
|
+
(function (AffiliateSortByEnum) {
|
|
903
|
+
AffiliateSortByEnum["INVITED_ACCOUNTS_COUNT"] = "invitedAccountsCount";
|
|
904
|
+
AffiliateSortByEnum["CREATED_AT"] = "createdAt";
|
|
905
|
+
AffiliateSortByEnum["FEE_SHARE"] = "feeShare";
|
|
906
|
+
AffiliateSortByEnum["ADDRESS"] = "address";
|
|
907
|
+
AffiliateSortByEnum["REFERRAL_TRADING_VOLUME"] = "referralTradingVolume";
|
|
908
|
+
})(AffiliateSortByEnum || (exports.AffiliateSortByEnum = AffiliateSortByEnum = {}));
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
/***/ }),
|
|
912
|
+
|
|
913
|
+
/***/ 2228:
|
|
914
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
918
|
+
exports.HTTPSRPC_MAINNET = exports.HTTPSRPC_TESTNET = exports.ChainNames = exports.Chains = void 0;
|
|
919
|
+
var Chains;
|
|
920
|
+
(function (Chains) {
|
|
921
|
+
Chains[Chains["Solana"] = 1] = "Solana";
|
|
922
|
+
Chains[Chains["Algorand"] = 8] = "Algorand";
|
|
923
|
+
Chains[Chains["Polygon"] = 5] = "Polygon";
|
|
924
|
+
Chains[Chains["Bsc"] = 4] = "Bsc";
|
|
925
|
+
Chains[Chains["Avalanche"] = 6] = "Avalanche";
|
|
926
|
+
Chains[Chains["Arbitrum"] = 23] = "Arbitrum";
|
|
927
|
+
Chains[Chains["Optimism"] = 24] = "Optimism";
|
|
928
|
+
Chains[Chains["Base"] = 30] = "Base";
|
|
929
|
+
Chains[Chains["Ethereum"] = 2] = "Ethereum";
|
|
930
|
+
Chains[Chains["Sepolia"] = 10002] = "Sepolia";
|
|
931
|
+
Chains[Chains["ArbitrumSepolia"] = 10003] = "ArbitrumSepolia";
|
|
932
|
+
Chains[Chains["BaseSepolia"] = 10004] = "BaseSepolia";
|
|
933
|
+
Chains[Chains["OptimismSepolia"] = 10005] = "OptimismSepolia";
|
|
934
|
+
Chains[Chains["PolygonAmoy"] = 10007] = "PolygonAmoy";
|
|
935
|
+
})(Chains || (exports.Chains = Chains = {}));
|
|
936
|
+
exports.ChainNames = {
|
|
937
|
+
[Chains.Solana]: "Solana",
|
|
938
|
+
[Chains.Ethereum]: "Ethereum",
|
|
939
|
+
[Chains.Polygon]: "Polygon",
|
|
940
|
+
[Chains.Bsc]: "BNB Chain",
|
|
941
|
+
[Chains.Avalanche]: "Avalanche",
|
|
942
|
+
[Chains.Algorand]: "Algorand",
|
|
943
|
+
[Chains.Arbitrum]: "Arbitrum",
|
|
944
|
+
[Chains.Optimism]: "Optimism",
|
|
945
|
+
[Chains.Base]: "Base",
|
|
946
|
+
[Chains.Sepolia]: "Ethereum Sepolia",
|
|
947
|
+
[Chains.ArbitrumSepolia]: "Arbitrum Sepolia",
|
|
948
|
+
[Chains.BaseSepolia]: "Base Sepolia",
|
|
949
|
+
[Chains.OptimismSepolia]: "Optimism Sepolia",
|
|
950
|
+
[Chains.PolygonAmoy]: "Polygon Amoy",
|
|
951
|
+
};
|
|
952
|
+
exports.HTTPSRPC_TESTNET = {
|
|
953
|
+
[Chains.Bsc]: [
|
|
954
|
+
'',
|
|
955
|
+
'https://bsc-testnet.public.blastapi.io',
|
|
956
|
+
'https://bsc-testnet.blockpi.network/v1/rpc/private',
|
|
957
|
+
'https://bsc-testnet-rpc.publicnode.com',
|
|
958
|
+
'https://api.zan.top/bsc-testnet',
|
|
959
|
+
'https://data-seed-prebsc-2-s1.bnbchain.org:8545',
|
|
960
|
+
'https://data-seed-prebsc-2-s2.bnbchain.org:8545',
|
|
961
|
+
'https://data-seed-prebsc-2-s3.bnbchain.org:8545',
|
|
962
|
+
'https://data-seed-prebsc-1-s1.bnbchain.org:8545',
|
|
963
|
+
'https://data-seed-prebsc-1-s2.bnbchain.org:8545',
|
|
964
|
+
'https://data-seed-prebsc-1-s3.bnbchain.org:8545',
|
|
965
|
+
'https://endpoints.omniatech.io/v1/bsc/testnet/public',
|
|
966
|
+
],
|
|
967
|
+
[Chains.Avalanche]: [
|
|
968
|
+
'',
|
|
969
|
+
'https://rpc.ankr.com/avalanche_fuji',
|
|
970
|
+
'https://rpc.ankr.com/avalanche_fuji-c',
|
|
971
|
+
'https://api.avax-test.network/ext/bc/C/rpc',
|
|
972
|
+
'https://ava-testnet.public.blastapi.io/ext/bc/C/rpc',
|
|
973
|
+
'https://endpoints.omniatech.io/v1/avax/fuji/public',
|
|
974
|
+
'https://avalanche-fuji.blockpi.network/v1/rpc/private',
|
|
975
|
+
'https://avalanche-fuji-c-chain-rpc.publicnode.com',
|
|
976
|
+
'https://avalanche-fuji.blockpi.network/v1/rpc/private',
|
|
977
|
+
],
|
|
978
|
+
[Chains.Sepolia]: [
|
|
979
|
+
'https://ethereum-sepolia-rpc.publicnode.com',
|
|
980
|
+
'https://sepolia.gateway.tenderly.co',
|
|
981
|
+
'https://eth-sepolia.public.blastapi.io',
|
|
982
|
+
'https://ethereum-sepolia.blockpi.network/v1/rpc/private',
|
|
983
|
+
'https://sepolia.drpc.org',
|
|
984
|
+
'https://endpoints.omniatech.io/v1/eth/sepolia/public',
|
|
985
|
+
'https://1rpc.io/sepolia',
|
|
986
|
+
'https://gateway.tenderly.co/public/sepolia',
|
|
987
|
+
'https://sepolia.gateway.tenderly.co',
|
|
988
|
+
'https://api.zan.top/eth-sepolia',
|
|
989
|
+
'https://ethereum-sepolia.rpc.subquery.network/public',
|
|
990
|
+
],
|
|
991
|
+
[Chains.ArbitrumSepolia]: [
|
|
992
|
+
'',
|
|
993
|
+
'https://arbitrum-sepolia.blockpi.network/v1/rpc/private ',
|
|
994
|
+
'https://arbitrum-sepolia.gateway.tenderly.co',
|
|
995
|
+
'https://endpoints.omniatech.io/v1/arbitrum/sepolia/public',
|
|
996
|
+
'https://api.zan.top/arb-sepolia',
|
|
997
|
+
'https://sepolia-rollup.arbitrum.io/rpc',
|
|
998
|
+
],
|
|
999
|
+
[Chains.BaseSepolia]: [
|
|
1000
|
+
'',
|
|
1001
|
+
'https://sepolia.base.org',
|
|
1002
|
+
'https://base-sepolia-rpc.publicnode.com',
|
|
1003
|
+
'https://base-sepolia.gateway.tenderly.co',
|
|
1004
|
+
'https://base-sepolia.blockpi.network/v1/rpc/private',
|
|
1005
|
+
'https://node.histori.xyz/base-sepolia/8ry9f6t9dct1se2hlagxnd9n2a',
|
|
1006
|
+
],
|
|
1007
|
+
[Chains.OptimismSepolia]: [
|
|
1008
|
+
'',
|
|
1009
|
+
'https://optimism-sepolia.blockpi.network/v1/rpc/private',
|
|
1010
|
+
'https://sepolia.optimism.io',
|
|
1011
|
+
'https://api.zan.top/opt-sepolia',
|
|
1012
|
+
'https://optimism-sepolia.gateway.tenderly.co',
|
|
1013
|
+
'https://optimism-sepolia.drpc.org',
|
|
1014
|
+
'https://endpoints.omniatech.io/v1/op/sepolia/public',
|
|
1015
|
+
],
|
|
1016
|
+
[Chains.PolygonAmoy]: [
|
|
1017
|
+
'https://rpc-amoy.polygon.technology',
|
|
1018
|
+
'https://polygon-amoy-bor-rpc.publicnode.com',
|
|
1019
|
+
'https://rpc.ankr.com/polygon_amoy',
|
|
1020
|
+
'https://polygon-amoy.drpc.org',
|
|
1021
|
+
'https://api.zan.top/polygon-amoy',
|
|
1022
|
+
'https://polygon-amoy.gateway.tenderly.co',
|
|
1023
|
+
],
|
|
1024
|
+
};
|
|
1025
|
+
exports.HTTPSRPC_MAINNET = {
|
|
1026
|
+
[Chains.Ethereum]: [
|
|
1027
|
+
'',
|
|
1028
|
+
'https://eth.llamarpc.com',
|
|
1029
|
+
'https://ethereum.blockpi.network/v1/rpc/public',
|
|
1030
|
+
'https://eth-mainnet.nodereal.io/v1/1659dfb40aa24bbb8153a677b98064d7',
|
|
1031
|
+
'https://uk.rpc.blxrbdn.com',
|
|
1032
|
+
'https://singapore.rpc.blxrbdn.com',
|
|
1033
|
+
'https://virginia.rpc.blxrbdn.com',
|
|
1034
|
+
'https://eth-mainnet.public.blastapi.io',
|
|
1035
|
+
'https://api.securerpc.com/v1',
|
|
1036
|
+
'https://mainnet.gateway.tenderly.co',
|
|
1037
|
+
'https://eth-pokt.nodies.app',
|
|
1038
|
+
'https://eth.blockrazor.xyz',
|
|
1039
|
+
'https://eth.merkle.io',
|
|
1040
|
+
'https://gateway.tenderly.co/public/mainnet',
|
|
1041
|
+
'https://eth.rpc.blxrbdn.com',
|
|
1042
|
+
],
|
|
1043
|
+
[Chains.Bsc]: [
|
|
1044
|
+
'',
|
|
1045
|
+
'https://bsc.blockrazor.xyz',
|
|
1046
|
+
'https://bscrpc.com',
|
|
1047
|
+
'https://bsc-mainnet.public.blastapi.io',
|
|
1048
|
+
'https://binance.llamarpc.com',
|
|
1049
|
+
'https://go.getblock.io/cc778cdbdf5c4b028ec9456e0e6c0cf3',
|
|
1050
|
+
'https://bsc-pokt.nodies.app',
|
|
1051
|
+
'https://56.rpc.thirdweb.com',
|
|
1052
|
+
'https://bsc.blockpi.network/v1/rpc/private',
|
|
1053
|
+
'https://bsc.rpc.blxrbdn.com',
|
|
1054
|
+
'https://bsc-dataseed.bnbchain.org',
|
|
1055
|
+
'https://endpoints.omniatech.io/v1/bsc/mainnet/public',
|
|
1056
|
+
'https://bsc-dataseed1.ninicoin.io',
|
|
1057
|
+
'https://bsc-dataseed2.defibit.io',
|
|
1058
|
+
'https://bsc-dataseed2.ninicoin.io',
|
|
1059
|
+
'https://0.48.club',
|
|
1060
|
+
'https://bsc-dataseed3.defibit.io',
|
|
1061
|
+
],
|
|
1062
|
+
[Chains.Polygon]: [
|
|
1063
|
+
'',
|
|
1064
|
+
'https://polygon.llamarpc.com',
|
|
1065
|
+
'https://polygon-rpc.com',
|
|
1066
|
+
'https://rpc-mainnet.matic.quiknode.pro',
|
|
1067
|
+
'https://endpoints.omniatech.io/v1/matic/mainnet/public',
|
|
1068
|
+
'https://polygon-pokt.nodies.app',
|
|
1069
|
+
'https://polygon-bor-rpc.publicnode.com',
|
|
1070
|
+
'https://polygon.rpc.subquery.network/public',
|
|
1071
|
+
'https://polygon-bor-rpc.publicnode.com',
|
|
1072
|
+
'https://polygon.blockpi.network/v1/rpc/private',
|
|
1073
|
+
'https://polygon.api.onfinality.io/public',
|
|
1074
|
+
'https://polygon.lava.build',
|
|
1075
|
+
'https://api.zan.top/polygon-mainnet',
|
|
1076
|
+
'https://polygon.meowrpc.com',
|
|
1077
|
+
],
|
|
1078
|
+
[Chains.Avalanche]: [
|
|
1079
|
+
'',
|
|
1080
|
+
'https://avalanche-c-chain-rpc.publicnode.com',
|
|
1081
|
+
'https://ava-mainnet.public.blastapi.io/ext/bc/C/rpc',
|
|
1082
|
+
'https://endpoints.omniatech.io/v1/avax/mainnet/public',
|
|
1083
|
+
'https://avalanche-c-chain-rpc.publicnode.com',
|
|
1084
|
+
'https://avalanche.blockpi.network/v1/rpc/private',
|
|
1085
|
+
'https://avalanche.public-rpc.com',
|
|
1086
|
+
'https://avalanche.drpc.org',
|
|
1087
|
+
'https://avax.meowrpc.com',
|
|
1088
|
+
'https://endpoints.omniatech.io/v1/avax/mainnet/public',
|
|
1089
|
+
'https://api.avax.network/ext/bc/C/rpc',
|
|
1090
|
+
'https://1rpc.io/avax/c',
|
|
1091
|
+
'https://avax-pokt.nodies.app/ext/bc/C/rpc',
|
|
1092
|
+
'https://endpoints.omniatech.io/v1/avax/mainnet/public',
|
|
1093
|
+
'https://api.zan.top/avax-mainnet/ext/bc/C/rpc',
|
|
1094
|
+
],
|
|
1095
|
+
[Chains.Arbitrum]: [
|
|
1096
|
+
'',
|
|
1097
|
+
'https://arbitrum.llamarpc.com',
|
|
1098
|
+
'https://arbitrum.rpc.subquery.network/public',
|
|
1099
|
+
'https://endpoints.omniatech.io/v1/arbitrum/one/public',
|
|
1100
|
+
'https://arbitrum.meowrpc.com',
|
|
1101
|
+
'https://arbitrum.gateway.tenderly.co',
|
|
1102
|
+
'https://arbitrum-one.public.blastapi.io',
|
|
1103
|
+
'https://arb1.lava.build',
|
|
1104
|
+
'https://arbitrum-one.publicnode.com',
|
|
1105
|
+
'https://arbitrum.blockpi.network/v1/rpc/public',
|
|
1106
|
+
'https://arb-pokt.nodies.app',
|
|
1107
|
+
'https://api.zan.top/arb-one',
|
|
1108
|
+
'https://arb1.arbitrum.io/rpc',
|
|
1109
|
+
'https://arbitrum.drpc.org',
|
|
1110
|
+
'https://1rpc.io/arb',
|
|
1111
|
+
],
|
|
1112
|
+
[Chains.Optimism]: [
|
|
1113
|
+
'',
|
|
1114
|
+
'https://optimism.llamarpc.com',
|
|
1115
|
+
'https://op-pokt.nodies.app',
|
|
1116
|
+
'https://optimism-mainnet.public.blastapi.io',
|
|
1117
|
+
'https://optimism.blockpi.network/v1/rpc/public',
|
|
1118
|
+
'https://endpoints.omniatech.io/v1/op/mainnet/public',
|
|
1119
|
+
'https://optimism-rpc.publicnode.com',
|
|
1120
|
+
'https://optimism.drpc.org',
|
|
1121
|
+
'https://1rpc.io/op',
|
|
1122
|
+
'https://optimism.gateway.tenderly.co',
|
|
1123
|
+
'https://optimism.lava.build',
|
|
1124
|
+
'https://optimism.rpc.subquery.network/public',
|
|
1125
|
+
'https://mainnet.optimism.io',
|
|
1126
|
+
'https://optimism-rpc.publicnode.com',
|
|
1127
|
+
'https://gateway.tenderly.co/public/optimism',
|
|
1128
|
+
],
|
|
1129
|
+
[Chains.Base]: [
|
|
1130
|
+
'',
|
|
1131
|
+
'https://base.llamarpc.com',
|
|
1132
|
+
'https://base-mainnet.public.blastapi.io',
|
|
1133
|
+
'https://base-rpc.publicnode.com',
|
|
1134
|
+
'https://base.blockpi.network/v1/rpc/public',
|
|
1135
|
+
'https://base.drpc.org',
|
|
1136
|
+
'https://mainnet.base.org',
|
|
1137
|
+
'https://base.api.onfinality.io/public',
|
|
1138
|
+
'https://base-pokt.nodies.app',
|
|
1139
|
+
'https://1rpc.io/base',
|
|
1140
|
+
'https://developer-access-mainnet.base.org',
|
|
1141
|
+
'https://endpoints.omniatech.io/v1/base/mainnet/public',
|
|
1142
|
+
'https://base.rpc.subquery.network/public',
|
|
1143
|
+
'https://base.api.onfinality.io/public',
|
|
1144
|
+
'https://base.meowrpc.com',
|
|
1145
|
+
'https://base.gateway.tenderly.co',
|
|
1146
|
+
],
|
|
1147
|
+
};
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
/***/ }),
|
|
1151
|
+
|
|
1152
|
+
/***/ 2623:
|
|
1153
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1157
|
+
exports.TransactionType = exports.CCTPStatus = exports.ActionTypeEnum = exports.OperationStatusEnum = void 0;
|
|
1158
|
+
var OperationStatusEnum;
|
|
1159
|
+
(function (OperationStatusEnum) {
|
|
1160
|
+
OperationStatusEnum["Pending"] = "pending";
|
|
1161
|
+
OperationStatusEnum["Completed"] = "completed";
|
|
1162
|
+
OperationStatusEnum["Failed"] = "failed";
|
|
1163
|
+
OperationStatusEnum["Received"] = "received";
|
|
1164
|
+
})(OperationStatusEnum || (exports.OperationStatusEnum = OperationStatusEnum = {}));
|
|
1165
|
+
var ActionTypeEnum;
|
|
1166
|
+
(function (ActionTypeEnum) {
|
|
1167
|
+
ActionTypeEnum["Deposit"] = "deposit";
|
|
1168
|
+
ActionTypeEnum["Withdraw"] = "withdraw";
|
|
1169
|
+
ActionTypeEnum["Rebalance"] = "rebalance";
|
|
1170
|
+
})(ActionTypeEnum || (exports.ActionTypeEnum = ActionTypeEnum = {}));
|
|
1171
|
+
var CCTPStatus;
|
|
1172
|
+
(function (CCTPStatus) {
|
|
1173
|
+
CCTPStatus["PENDING"] = "pending";
|
|
1174
|
+
CCTPStatus["COMPLETED"] = "completed";
|
|
1175
|
+
CCTPStatus["FAILED"] = "failed";
|
|
1176
|
+
})(CCTPStatus || (exports.CCTPStatus = CCTPStatus = {}));
|
|
1177
|
+
var TransactionType;
|
|
1178
|
+
(function (TransactionType) {
|
|
1179
|
+
TransactionType["USER_TO_TMC"] = "user_to_tmc";
|
|
1180
|
+
TransactionType["TMC_TO_USER"] = "tmc_to_user";
|
|
1181
|
+
TransactionType["RELAYER_TO_TMC"] = "relayer_to_tmc";
|
|
1182
|
+
TransactionType["RELAYER_TO_CODEX"] = "relayer_to_codex";
|
|
1183
|
+
TransactionType["RELAYER_TO_CIRCLE"] = "relayer_to_circle";
|
|
1184
|
+
})(TransactionType || (exports.TransactionType = TransactionType = {}));
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
/***/ }),
|
|
1188
|
+
|
|
1189
|
+
/***/ 2739:
|
|
1190
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1191
|
+
|
|
1192
|
+
|
|
1193
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1194
|
+
exports.Notification = void 0;
|
|
1195
|
+
var Notification;
|
|
1196
|
+
(function (Notification) {
|
|
1197
|
+
Notification[Notification["SELF_TRADE"] = 1] = "SELF_TRADE";
|
|
1198
|
+
Notification[Notification["FULL_FILLED"] = 2] = "FULL_FILLED";
|
|
1199
|
+
Notification[Notification["FULL_CANCELLED"] = 3] = "FULL_CANCELLED";
|
|
1200
|
+
Notification[Notification["PARTIALLY_CANCELLED"] = 4] = "PARTIALLY_CANCELLED";
|
|
1201
|
+
Notification[Notification["CREATED"] = 5] = "CREATED";
|
|
1202
|
+
})(Notification || (exports.Notification = Notification = {}));
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
/***/ }),
|
|
1206
|
+
|
|
1207
|
+
/***/ 2797:
|
|
1208
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1209
|
+
|
|
1210
|
+
|
|
1211
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1212
|
+
var AvailablePairSettings;
|
|
1213
|
+
(function (AvailablePairSettings) {
|
|
1214
|
+
AvailablePairSettings["MFT_AUDIO_LINK"] = "mft.audioLink";
|
|
1215
|
+
AvailablePairSettings["MFT_TITLE"] = "mft.title";
|
|
1216
|
+
AvailablePairSettings["MODE_PRE_SALE"] = "mode.preSale";
|
|
1217
|
+
AvailablePairSettings["MAKER_FEE"] = "makerFee";
|
|
1218
|
+
AvailablePairSettings["TAKER_FEE"] = "takerFee";
|
|
1219
|
+
AvailablePairSettings["VIEW_BASE_COIN_ICON_LINK"] = "view.baseCoinIconLink";
|
|
1220
|
+
AvailablePairSettings["VIEW_BASE_COIN_MARKET_LINK"] = "view.baseCoinMarketLink";
|
|
1221
|
+
AvailablePairSettings["VIEW_PRICE_COIN_ICON_LINK"] = "view.priceCoinIconLink";
|
|
1222
|
+
AvailablePairSettings["VIEW_PRICE_COIN_MARKET_LINK"] = "view.priceCoinMarketLink";
|
|
1223
|
+
})(AvailablePairSettings || (AvailablePairSettings = {}));
|
|
1224
|
+
exports["default"] = AvailablePairSettings;
|
|
1225
|
+
|
|
1226
|
+
|
|
1227
|
+
/***/ }),
|
|
1228
|
+
|
|
1229
|
+
/***/ 2806:
|
|
1230
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1234
|
+
exports.EXPIRE_DAYS = exports.DAY_MILLISECONDS = void 0;
|
|
1235
|
+
exports.DAY_MILLISECONDS = 86400000;
|
|
1236
|
+
exports.EXPIRE_DAYS = 30;
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
/***/ }),
|
|
1240
|
+
|
|
1241
|
+
/***/ 3004:
|
|
1242
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
1246
|
+
if (k2 === undefined) k2 = k;
|
|
1247
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1248
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1249
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
1250
|
+
}
|
|
1251
|
+
Object.defineProperty(o, k2, desc);
|
|
1252
|
+
}) : (function(o, m, k, k2) {
|
|
1253
|
+
if (k2 === undefined) k2 = k;
|
|
1254
|
+
o[k2] = m[k];
|
|
1255
|
+
}));
|
|
1256
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
1257
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1258
|
+
};
|
|
1259
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1260
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1261
|
+
};
|
|
1262
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1263
|
+
exports.TradingKeyType = exports.OrderType = exports.OrderStatus = exports.OrderSide = exports.AvailablePairSettings = void 0;
|
|
1264
|
+
const available_pair_settings_enum_1 = __importDefault(__webpack_require__(2797));
|
|
1265
|
+
exports.AvailablePairSettings = available_pair_settings_enum_1.default;
|
|
1266
|
+
const order_side_enum_1 = __importDefault(__webpack_require__(835));
|
|
1267
|
+
exports.OrderSide = order_side_enum_1.default;
|
|
1268
|
+
const order_status_enum_1 = __importDefault(__webpack_require__(1492));
|
|
1269
|
+
exports.OrderStatus = order_status_enum_1.default;
|
|
1270
|
+
const order_type_enum_1 = __importDefault(__webpack_require__(1134));
|
|
1271
|
+
exports.OrderType = order_type_enum_1.default;
|
|
1272
|
+
const tradingKeyType_enum_1 = __webpack_require__(3487);
|
|
1273
|
+
Object.defineProperty(exports, "TradingKeyType", ({ enumerable: true, get: function () { return tradingKeyType_enum_1.TradingKeyType; } }));
|
|
1274
|
+
__exportStar(__webpack_require__(893), exports);
|
|
1275
|
+
__exportStar(__webpack_require__(3338), exports);
|
|
1276
|
+
__exportStar(__webpack_require__(3245), exports);
|
|
1277
|
+
__exportStar(__webpack_require__(6828), exports);
|
|
1278
|
+
__exportStar(__webpack_require__(2224), exports);
|
|
1279
|
+
__exportStar(__webpack_require__(892), exports);
|
|
1280
|
+
__exportStar(__webpack_require__(2623), exports);
|
|
1281
|
+
__exportStar(__webpack_require__(3854), exports);
|
|
1282
|
+
__exportStar(__webpack_require__(4132), exports);
|
|
1283
|
+
__exportStar(__webpack_require__(3516), exports);
|
|
1284
|
+
__exportStar(__webpack_require__(4199), exports);
|
|
1285
|
+
__exportStar(__webpack_require__(1682), exports);
|
|
1286
|
+
__exportStar(__webpack_require__(1283), exports);
|
|
1287
|
+
__exportStar(__webpack_require__(5237), exports);
|
|
1288
|
+
__exportStar(__webpack_require__(1048), exports);
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
/***/ }),
|
|
1292
|
+
|
|
1293
|
+
/***/ 3245:
|
|
1294
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1298
|
+
exports.PromptTypeEnum = void 0;
|
|
1299
|
+
var PromptTypeEnum;
|
|
1300
|
+
(function (PromptTypeEnum) {
|
|
1301
|
+
PromptTypeEnum["INSTRUCTIONS"] = "INSTRUCTIONS";
|
|
1302
|
+
PromptTypeEnum["TEXT_STYLE"] = "TEXT_STYLE";
|
|
1303
|
+
PromptTypeEnum["TEXT_TONE"] = "TEXT_TONE";
|
|
1304
|
+
PromptTypeEnum["REACTION_TYPE"] = "REACTION_TYPE";
|
|
1305
|
+
PromptTypeEnum["COMMENT_LENGTH"] = "COMMENT_LENGTH";
|
|
1306
|
+
PromptTypeEnum["CONTEXT"] = "CONTEXT";
|
|
1307
|
+
})(PromptTypeEnum || (exports.PromptTypeEnum = PromptTypeEnum = {}));
|
|
1308
|
+
|
|
1309
|
+
|
|
1310
|
+
/***/ }),
|
|
1311
|
+
|
|
1312
|
+
/***/ 3261:
|
|
1313
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1317
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1318
|
+
};
|
|
1319
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1320
|
+
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__(9709));
|
|
1322
|
+
const enums_1 = __webpack_require__(9965);
|
|
1323
|
+
const codex_helper_1 = __webpack_require__(3955);
|
|
1324
|
+
const Encoding_1 = __webpack_require__(8593);
|
|
1325
|
+
const utils_1 = __webpack_require__(8398);
|
|
1326
|
+
const common_helper_1 = __webpack_require__(223);
|
|
1327
|
+
const cctp_1 = __webpack_require__(9862);
|
|
1328
|
+
exports.DTW_DATA_BYTES_LENGTH = 160;
|
|
1329
|
+
exports.TRANSFER_DATA_BYTES_LENGTH = 224;
|
|
1330
|
+
const getTransferBoxKey = (message, encoding) => {
|
|
1331
|
+
return (0, common_helper_1.getBoxKey)((0, exports.getTransferBytesFromMsg)(message, encoding), "T_");
|
|
1332
|
+
};
|
|
1333
|
+
exports.getTransferBoxKey = getTransferBoxKey;
|
|
1334
|
+
const getTransferBoxKeyFromHash = (hash) => {
|
|
1335
|
+
return (0, common_helper_1.getBoxKeyFromHash)(hash, 'T_');
|
|
1336
|
+
};
|
|
1337
|
+
exports.getTransferBoxKeyFromHash = getTransferBoxKeyFromHash;
|
|
1338
|
+
const calcTransferHash = (message) => {
|
|
1339
|
+
return (0, common_helper_1.generateHash)((0, exports.getTransferBytesFromMsg)(message));
|
|
1340
|
+
};
|
|
1341
|
+
exports.calcTransferHash = calcTransferHash;
|
|
1342
|
+
const getTransferBytesFromMsg = (message, encoding = 'hex') => {
|
|
1343
|
+
return (0, common_helper_1.getDataBytesFromMsg)(message, encoding, exports.TRANSFER_DATA_BYTES_LENGTH);
|
|
1344
|
+
};
|
|
1345
|
+
exports.getTransferBytesFromMsg = getTransferBytesFromMsg;
|
|
1346
|
+
const decodeDtwMsg = (message, encoding = 'hex') => {
|
|
1347
|
+
const buffer = (0, common_helper_1.getDataBytesFromMsg)(message, encoding, exports.DTW_DATA_BYTES_LENGTH);
|
|
1348
|
+
const chainId = Number((0, codex_helper_1.decode)(buffer.subarray(32, 40), '8B'));
|
|
1349
|
+
const recipientChainId = Number((0, codex_helper_1.decode)(buffer.subarray(72, 80), '8B'));
|
|
1350
|
+
return {
|
|
1351
|
+
loginAddress: String((0, codex_helper_1.decode)(buffer.subarray(0, 32), 'address', chainId)),
|
|
1352
|
+
loginChainId: chainId,
|
|
1353
|
+
recipient: String((0, codex_helper_1.decode)(buffer.subarray(40, 72), 'address', recipientChainId)),
|
|
1354
|
+
recipientChainId,
|
|
1355
|
+
tkAddress: String((0, codex_helper_1.decode)(buffer.subarray(80, 112), 'address', enums_1.Chains.Algorand)),
|
|
1356
|
+
expiredDate: Number((0, codex_helper_1.decode)(buffer.subarray(112, 120), '8B')),
|
|
1357
|
+
};
|
|
1358
|
+
};
|
|
1359
|
+
exports.decodeDtwMsg = decodeDtwMsg;
|
|
1360
|
+
const makeDtwMsg = (data) => {
|
|
1361
|
+
const { loginAddress, loginChainId, recipient, recipientChainId, tkAddress, expiredDate, } = data;
|
|
1362
|
+
const dataBytes = (0, Encoding_1.concatArrays)([
|
|
1363
|
+
(0, codex_helper_1.encode)(loginAddress, 'address', loginChainId),
|
|
1364
|
+
(0, codex_helper_1.encode)(loginChainId, '8B'),
|
|
1365
|
+
(0, codex_helper_1.encode)(recipient, 'address', recipientChainId),
|
|
1366
|
+
(0, codex_helper_1.encode)(recipientChainId, '8B'),
|
|
1367
|
+
(0, codex_helper_1.encode)(tkAddress, 'address', enums_1.Chains.Algorand),
|
|
1368
|
+
(0, codex_helper_1.encode)(expiredDate, '8B'),
|
|
1369
|
+
]);
|
|
1370
|
+
const bs64OrderBytes = (0, codex_helper_1.getBase64EncodedData)(dataBytes);
|
|
1371
|
+
console.log(`Dtw data should be ${exports.DTW_DATA_BYTES_LENGTH} bytes`, bs64OrderBytes.length, bs64OrderBytes);
|
|
1372
|
+
return bs64OrderBytes;
|
|
1373
|
+
// return makeSigningMessage(JSON.stringify(data), dataBytes);
|
|
1374
|
+
};
|
|
1375
|
+
exports.makeDtwMsg = makeDtwMsg;
|
|
1376
|
+
const decodeTransferMsg = (message, encoding = 'hex') => {
|
|
1377
|
+
const buffer = (0, common_helper_1.getDataBytesFromMsg)(message, encoding, exports.TRANSFER_DATA_BYTES_LENGTH);
|
|
1378
|
+
const chainId = Number((0, codex_helper_1.decode)(buffer.subarray(32, 40), '8B'));
|
|
1379
|
+
const recipientChainId = Number((0, codex_helper_1.decode)(buffer.subarray(72, 80), '8B'));
|
|
1380
|
+
const tokenChainId = Number((0, codex_helper_1.decode)(buffer.subarray(112, 120), '8B'));
|
|
1381
|
+
return {
|
|
1382
|
+
loginAddress: String((0, codex_helper_1.decode)(buffer.subarray(0, 32), 'address', chainId)),
|
|
1383
|
+
loginChainId: chainId,
|
|
1384
|
+
recipient: String((0, codex_helper_1.decode)(buffer.subarray(40, 72), 'address', recipientChainId)),
|
|
1385
|
+
recipientChainId,
|
|
1386
|
+
tokenIndex: String((0, codex_helper_1.decode)(buffer.subarray(80, 112), 'token', tokenChainId)),
|
|
1387
|
+
tokenChainId,
|
|
1388
|
+
tokenAmount: String((0, codex_helper_1.decode)(buffer.subarray(120, 152), '32B')),
|
|
1389
|
+
expiredDate: Number((0, codex_helper_1.decode)(buffer.subarray(152, 160), '8B')),
|
|
1390
|
+
random: Number((0, codex_helper_1.decode)(buffer.subarray(160, 168), '8B')),
|
|
1391
|
+
};
|
|
1392
|
+
};
|
|
1393
|
+
exports.decodeTransferMsg = decodeTransferMsg;
|
|
1394
|
+
const makeTransferMsg = (data) => {
|
|
1395
|
+
const { loginAddress, loginChainId, recipient, recipientChainId, tokenAmount, tokenIndex, tokenChainId, expiredDate, random, } = data;
|
|
1396
|
+
const dataBytes = (0, Encoding_1.concatArrays)([
|
|
1397
|
+
(0, codex_helper_1.encode)(loginAddress, 'address', loginChainId),
|
|
1398
|
+
(0, codex_helper_1.encode)(loginChainId, '8B'),
|
|
1399
|
+
(0, codex_helper_1.encode)(recipient, 'address', recipientChainId),
|
|
1400
|
+
(0, codex_helper_1.encode)(recipientChainId, '8B'),
|
|
1401
|
+
(0, codex_helper_1.encode)(tokenIndex, 'token', tokenChainId),
|
|
1402
|
+
(0, codex_helper_1.encode)(tokenChainId, '8B'),
|
|
1403
|
+
(0, codex_helper_1.encode)(tokenAmount, '32B'),
|
|
1404
|
+
(0, codex_helper_1.encode)(expiredDate, '8B'),
|
|
1405
|
+
(0, codex_helper_1.encode)(random, '8B'),
|
|
1406
|
+
]);
|
|
1407
|
+
const bs64OrderBytes = (0, codex_helper_1.getBase64EncodedData)(dataBytes);
|
|
1408
|
+
console.log(`Transfer data should be ${exports.TRANSFER_DATA_BYTES_LENGTH} bytes`, bs64OrderBytes.length, bs64OrderBytes);
|
|
1409
|
+
return bs64OrderBytes;
|
|
1410
|
+
// return makeSigningMessage(JSON.stringify(data), dataBytes);
|
|
1411
|
+
};
|
|
1412
|
+
exports.makeTransferMsg = makeTransferMsg;
|
|
1413
|
+
const makeTransferTxn = async ({ data, message, signature }, dtw, options) => {
|
|
1414
|
+
const { loginAddress, loginChainId, recipient, recipientChainId, tokenIndex, tokenChainId } = data;
|
|
1415
|
+
const { appId, sender, superWallet } = options;
|
|
1416
|
+
const methodArgs = dtw
|
|
1417
|
+
? [
|
|
1418
|
+
...(0, common_helper_1.getMsgArgs)(message, signature, dtw.data.tkAddress, enums_1.Chains.Algorand),
|
|
1419
|
+
...(0, common_helper_1.getMsgArgs)(dtw.message, dtw.signature, loginAddress, loginChainId),
|
|
1420
|
+
] : [
|
|
1421
|
+
...(0, common_helper_1.getMsgArgs)(message, signature, loginAddress, loginChainId),
|
|
1422
|
+
Buffer.alloc(0), Buffer.alloc(0), Buffer.alloc(0),
|
|
1423
|
+
];
|
|
1424
|
+
const appArgs = (0, common_helper_1.getAppArgs)("directTransfer(byte[],byte[],byte[],byte[],byte[],byte[],uint64)uint64", [
|
|
1425
|
+
...methodArgs,
|
|
1426
|
+
options.transferId,
|
|
1427
|
+
]);
|
|
1428
|
+
const cctpIndex = '0x4343545055534443000000000000000000000000000000000000000000000000';
|
|
1429
|
+
const cctpChain = cctp_1.CCTP_UNIFIED_ASSETS[cctpIndex];
|
|
1430
|
+
const boxes = [
|
|
1431
|
+
(0, codex_helper_1.getAccountBalanceBoxName)(loginAddress, loginChainId, tokenIndex, tokenChainId),
|
|
1432
|
+
(0, codex_helper_1.getAccountBalanceBoxName)(recipient, recipientChainId, tokenIndex, tokenChainId),
|
|
1433
|
+
(0, codex_helper_1.getAccountBalanceBoxName)(superWallet.address, superWallet.chainId, tokenIndex, tokenChainId),
|
|
1434
|
+
];
|
|
1435
|
+
if (!(0, utils_1.equalIgnoreCase)(tokenIndex, cctpIndex)) {
|
|
1436
|
+
boxes.push(...[
|
|
1437
|
+
(0, codex_helper_1.getAccountBalanceBoxName)(loginAddress, loginChainId, cctpIndex, cctpChain),
|
|
1438
|
+
(0, codex_helper_1.getAccountBalanceBoxName)(superWallet.address, superWallet.chainId, cctpIndex, cctpChain),
|
|
1439
|
+
]);
|
|
1440
|
+
}
|
|
1441
|
+
if (dtw) {
|
|
1442
|
+
boxes.push((0, codex_helper_1.getTradingKeyBoxName)(loginAddress, loginChainId));
|
|
1443
|
+
}
|
|
1444
|
+
const allBoxes = [
|
|
1445
|
+
...(0, codex_helper_1.createBoxes)(appId, boxes),
|
|
1446
|
+
...(0, codex_helper_1.createBoxes)(appId, [
|
|
1447
|
+
(0, exports.getTransferBoxKey)(message, 'hex'),
|
|
1448
|
+
], (data) => data)
|
|
1449
|
+
];
|
|
1450
|
+
const foreignApps = [options.superAppId];
|
|
1451
|
+
const txnsCount = dtw ? 9 : 6;
|
|
1452
|
+
const appCallTxn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
1453
|
+
appIndex: appId,
|
|
1454
|
+
from: sender,
|
|
1455
|
+
suggestedParams: await options.getTxnParams(txnsCount),
|
|
1456
|
+
appArgs,
|
|
1457
|
+
foreignApps,
|
|
1458
|
+
boxes: allBoxes,
|
|
1459
|
+
});
|
|
1460
|
+
// console.log('directTransfer txn', appCallTxn);
|
|
1461
|
+
return appCallTxn;
|
|
1462
|
+
};
|
|
1463
|
+
exports.makeTransferTxn = makeTransferTxn;
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
/***/ }),
|
|
1467
|
+
|
|
1468
|
+
/***/ 3338:
|
|
1469
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1470
|
+
|
|
1471
|
+
|
|
1472
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1473
|
+
exports.TweetType = exports.SeasonStatusEnum = void 0;
|
|
1474
|
+
var SeasonStatusEnum;
|
|
1475
|
+
(function (SeasonStatusEnum) {
|
|
1476
|
+
SeasonStatusEnum["CREATED"] = "created";
|
|
1477
|
+
SeasonStatusEnum["STARTED"] = "started";
|
|
1478
|
+
SeasonStatusEnum["PAUSED"] = "paused";
|
|
1479
|
+
SeasonStatusEnum["CLOSED"] = "closed";
|
|
1480
|
+
})(SeasonStatusEnum || (exports.SeasonStatusEnum = SeasonStatusEnum = {}));
|
|
1481
|
+
var TweetType;
|
|
1482
|
+
(function (TweetType) {
|
|
1483
|
+
TweetType["Post"] = "POST";
|
|
1484
|
+
TweetType["Comment"] = "COMMENT";
|
|
1485
|
+
})(TweetType || (exports.TweetType = TweetType = {}));
|
|
1486
|
+
|
|
1487
|
+
|
|
1488
|
+
/***/ }),
|
|
1489
|
+
|
|
1490
|
+
/***/ 3487:
|
|
1491
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1492
|
+
|
|
1493
|
+
|
|
1494
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1495
|
+
exports.TradingKeyType = void 0;
|
|
1496
|
+
var TradingKeyType;
|
|
1497
|
+
(function (TradingKeyType) {
|
|
1498
|
+
TradingKeyType["User"] = "User";
|
|
1499
|
+
TradingKeyType["Api"] = "API";
|
|
1500
|
+
})(TradingKeyType || (exports.TradingKeyType = TradingKeyType = {}));
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
/***/ }),
|
|
1504
|
+
|
|
1505
|
+
/***/ 3516:
|
|
1506
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1507
|
+
|
|
1508
|
+
|
|
1509
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1510
|
+
exports.SortDirectionEnum = void 0;
|
|
1511
|
+
var SortDirectionEnum;
|
|
1512
|
+
(function (SortDirectionEnum) {
|
|
1513
|
+
SortDirectionEnum["ASCENDING"] = "ASC";
|
|
1514
|
+
SortDirectionEnum["DESCENDING"] = "DESC";
|
|
1515
|
+
})(SortDirectionEnum || (exports.SortDirectionEnum = SortDirectionEnum = {}));
|
|
1516
|
+
|
|
1517
|
+
|
|
1518
|
+
/***/ }),
|
|
1519
|
+
|
|
1520
|
+
/***/ 3574:
|
|
1521
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1522
|
+
|
|
1523
|
+
|
|
1524
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
1525
|
+
if (k2 === undefined) k2 = k;
|
|
1526
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1527
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1528
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
1529
|
+
}
|
|
1530
|
+
Object.defineProperty(o, k2, desc);
|
|
1531
|
+
}) : (function(o, m, k, k2) {
|
|
1532
|
+
if (k2 === undefined) k2 = k;
|
|
1533
|
+
o[k2] = m[k];
|
|
1534
|
+
}));
|
|
1535
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
1536
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1537
|
+
};
|
|
1538
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1539
|
+
__exportStar(__webpack_require__(7114), exports);
|
|
1540
|
+
__exportStar(__webpack_require__(5386), exports);
|
|
1541
|
+
__exportStar(__webpack_require__(7159), exports);
|
|
1542
|
+
__exportStar(__webpack_require__(9181), exports);
|
|
1543
|
+
__exportStar(__webpack_require__(7359), exports);
|
|
1544
|
+
__exportStar(__webpack_require__(3620), exports);
|
|
1545
|
+
__exportStar(__webpack_require__(573), exports);
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
/***/ }),
|
|
1549
|
+
|
|
1550
|
+
/***/ 3620:
|
|
1551
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1552
|
+
|
|
1553
|
+
|
|
1554
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1555
|
+
exports.HummingbotInstanceStatus = void 0;
|
|
1556
|
+
var HummingbotInstanceStatus;
|
|
1557
|
+
(function (HummingbotInstanceStatus) {
|
|
1558
|
+
HummingbotInstanceStatus["PREPARING"] = "provisioning";
|
|
1559
|
+
HummingbotInstanceStatus["STOPPING"] = "stopping";
|
|
1560
|
+
HummingbotInstanceStatus["RUNNING"] = "running";
|
|
1561
|
+
HummingbotInstanceStatus["STOPPED"] = "stopped";
|
|
1562
|
+
HummingbotInstanceStatus["FAILED"] = "failed";
|
|
1563
|
+
})(HummingbotInstanceStatus || (exports.HummingbotInstanceStatus = HummingbotInstanceStatus = {}));
|
|
1564
|
+
|
|
1565
|
+
|
|
1566
|
+
/***/ }),
|
|
1567
|
+
|
|
1568
|
+
/***/ 3854:
|
|
1569
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1570
|
+
|
|
1571
|
+
|
|
1572
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1573
|
+
exports.TradeSubStatus = exports.TradeStatus = void 0;
|
|
1574
|
+
var TradeStatus;
|
|
1575
|
+
(function (TradeStatus) {
|
|
1576
|
+
TradeStatus["Unconfirmed"] = "UNCONFIRMED";
|
|
1577
|
+
TradeStatus["Confirmed"] = "CONFIRMED";
|
|
1578
|
+
TradeStatus["Rejected"] = "REJECTED";
|
|
1579
|
+
})(TradeStatus || (exports.TradeStatus = TradeStatus = {}));
|
|
1580
|
+
var TradeSubStatus;
|
|
1581
|
+
(function (TradeSubStatus) {
|
|
1582
|
+
TradeSubStatus["RESUBMITTED"] = "RESUBMITTED";
|
|
1583
|
+
TradeSubStatus["PROCESSED"] = "PROCESSED";
|
|
1584
|
+
TradeSubStatus["REMATCHED"] = "REMATCHED";
|
|
1585
|
+
})(TradeSubStatus || (exports.TradeSubStatus = TradeSubStatus = {}));
|
|
1586
|
+
|
|
1587
|
+
|
|
1588
|
+
/***/ }),
|
|
1589
|
+
|
|
1590
|
+
/***/ 3955:
|
|
1591
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1592
|
+
|
|
1593
|
+
|
|
1594
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
1595
|
+
if (k2 === undefined) k2 = k;
|
|
1596
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1597
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1598
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
1599
|
+
}
|
|
1600
|
+
Object.defineProperty(o, k2, desc);
|
|
1601
|
+
}) : (function(o, m, k, k2) {
|
|
1602
|
+
if (k2 === undefined) k2 = k;
|
|
1603
|
+
o[k2] = m[k];
|
|
1604
|
+
}));
|
|
1605
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
1606
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1607
|
+
}) : function(o, v) {
|
|
1608
|
+
o["default"] = v;
|
|
1609
|
+
});
|
|
1610
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
1611
|
+
var ownKeys = function(o) {
|
|
1612
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
1613
|
+
var ar = [];
|
|
1614
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
1615
|
+
return ar;
|
|
1616
|
+
};
|
|
1617
|
+
return ownKeys(o);
|
|
1618
|
+
};
|
|
1619
|
+
return function (mod) {
|
|
1620
|
+
if (mod && mod.__esModule) return mod;
|
|
1621
|
+
var result = {};
|
|
1622
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
1623
|
+
__setModuleDefault(result, mod);
|
|
1624
|
+
return result;
|
|
1625
|
+
};
|
|
1626
|
+
})();
|
|
1627
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1628
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1629
|
+
};
|
|
1630
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1631
|
+
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;
|
|
1632
|
+
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;
|
|
1633
|
+
exports.getTokenFromNormalized = getTokenFromNormalized;
|
|
1634
|
+
const algosdk_1 = __importDefault(__webpack_require__(9709));
|
|
1635
|
+
const bs58 = __importStar(__webpack_require__(4578));
|
|
1636
|
+
const big_number_helper_1 = __webpack_require__(1174);
|
|
1637
|
+
const utils_1 = __webpack_require__(8398);
|
|
1638
|
+
const codex_1 = __webpack_require__(430);
|
|
1639
|
+
Object.defineProperty(exports, "encodeAddress", ({ enumerable: true, get: function () { return codex_1.encodeAddress; } }));
|
|
1640
|
+
const txn_helper_1 = __webpack_require__(8060);
|
|
1641
|
+
const Encoding_1 = __webpack_require__(8593);
|
|
1642
|
+
const enums_1 = __webpack_require__(9965);
|
|
1643
|
+
const algo_helper_1 = __webpack_require__(6897);
|
|
1644
|
+
const eth_helper_1 = __webpack_require__(9019);
|
|
1645
|
+
const ethHelper = __importStar(__webpack_require__(9019));
|
|
1646
|
+
const order_helper_1 = __webpack_require__(7542);
|
|
1647
|
+
const constants_1 = __webpack_require__(6450);
|
|
1648
|
+
const getAddressChainFromNormalized = (address, chain, type = 'address') => {
|
|
1649
|
+
const fromNormalized = type === 'token' ? getTokenFromNormalized : exports.getAddressFromNormalized;
|
|
1650
|
+
return {
|
|
1651
|
+
address: fromNormalized(address, Number(chain)),
|
|
1652
|
+
chainId: Number(chain),
|
|
1653
|
+
};
|
|
1654
|
+
};
|
|
1655
|
+
exports.getAddressChainFromNormalized = getAddressChainFromNormalized;
|
|
1656
|
+
const getAddressFromNormalized = (address, chain) => {
|
|
1657
|
+
const addressBuffer = Buffer.from(address.startsWith("0x")
|
|
1658
|
+
? address.substring(2)
|
|
1659
|
+
: address, 'hex');
|
|
1660
|
+
if (chain === enums_1.Chains.Algorand) {
|
|
1661
|
+
return algosdk_1.default.encodeAddress(addressBuffer);
|
|
1662
|
+
}
|
|
1663
|
+
if (chain === enums_1.Chains.Solana) {
|
|
1664
|
+
return bs58.encode(addressBuffer);
|
|
1665
|
+
}
|
|
1666
|
+
return ethHelper.encodeAddress(addressBuffer);
|
|
1667
|
+
};
|
|
1668
|
+
exports.getAddressFromNormalized = getAddressFromNormalized;
|
|
1669
|
+
function getTokenFromNormalized(token, chainId) {
|
|
1670
|
+
if (Number(chainId) === enums_1.Chains.Algorand) {
|
|
1671
|
+
return String(Number(token));
|
|
1672
|
+
}
|
|
1673
|
+
if (constants_1.CCTP_UNIFIED_ASSETS["0x" + token]) {
|
|
1674
|
+
return "0x" + token;
|
|
1675
|
+
}
|
|
1676
|
+
return (0, exports.getAddressFromNormalized)(token, Number(chainId));
|
|
1677
|
+
}
|
|
1678
|
+
const encode = (value, type, chain) => {
|
|
1679
|
+
// console.log('encode', JSON.stringify({ value: typeof value === "bigint" ? `${value}n` : value, type, chain }));
|
|
1680
|
+
switch (type) {
|
|
1681
|
+
case '8B': return algosdk_1.default.encodeUint64(Number(value));
|
|
1682
|
+
case '32B': return (0, eth_helper_1.encode32Bytes)(value);
|
|
1683
|
+
case 'str': return (0, Encoding_1.encodeString)(String(value));
|
|
1684
|
+
case 'address': return (0, codex_1.encodeAddress)(String(value), chain);
|
|
1685
|
+
case 'token': return (0, exports.encodeToken)(String(value), chain);
|
|
1686
|
+
case 'float': {
|
|
1687
|
+
var b = Buffer.alloc(8);
|
|
1688
|
+
b.writeDoubleBE(Number(value), 0);
|
|
1689
|
+
return new Uint8Array(b);
|
|
1690
|
+
}
|
|
1691
|
+
case 'bool': return new Uint8Array(Buffer.from(algosdk_1.default.encodeUint64(Number(value))).subarray(-1));
|
|
1692
|
+
case '2B': return new Uint8Array(Buffer.from(algosdk_1.default.encodeUint64(Number(value))).subarray(-2));
|
|
1693
|
+
case '4B': return new Uint8Array(Buffer.from(algosdk_1.default.encodeUint64(Number(value))).subarray(-4));
|
|
1694
|
+
default: return Buffer.from(value.toString());
|
|
1695
|
+
}
|
|
1696
|
+
};
|
|
1697
|
+
exports.encode = encode;
|
|
1698
|
+
const decode = (value, type, chain) => {
|
|
1699
|
+
switch (type) {
|
|
1700
|
+
case '8B': return algosdk_1.default.decodeUint64(value, 'safe');
|
|
1701
|
+
case '32B': return (0, eth_helper_1.decode32Bytes)(value);
|
|
1702
|
+
case 'str': return (0, Encoding_1.decodeString)(value);
|
|
1703
|
+
case 'address': return (0, exports.decodeAddress)(value, chain);
|
|
1704
|
+
case 'token': return (0, exports.decodeToken)(value, chain);
|
|
1705
|
+
case 'float': return Buffer.from(value).readDoubleBE(0);
|
|
1706
|
+
case 'bool':
|
|
1707
|
+
case '2B': return (0, exports.decode)(value, '8B');
|
|
1708
|
+
default: return Buffer.from(value).toString();
|
|
1709
|
+
}
|
|
1710
|
+
};
|
|
1711
|
+
exports.decode = decode;
|
|
1712
|
+
const extractAddress = (buffer, startAt, chain) => (0, exports.decodeAddress)(buffer.subarray(startAt, startAt + 32), chain);
|
|
1713
|
+
exports.extractAddress = extractAddress;
|
|
1714
|
+
const extractToken = (buffer, startAt, chain) => (0, exports.decodeToken)(buffer.subarray(startAt, startAt + 32), chain);
|
|
1715
|
+
exports.extractToken = extractToken;
|
|
1716
|
+
const extractDouble = (buffer, startAt = 0) => Number((0, exports.decode)(buffer.subarray(startAt, startAt + 8), 'float'));
|
|
1717
|
+
exports.extractDouble = extractDouble;
|
|
1718
|
+
const extractStr = (buffer, startAt, length) => String((0, exports.decode)(buffer.subarray(startAt, startAt + length), 'str'));
|
|
1719
|
+
exports.extractStr = extractStr;
|
|
1720
|
+
const extractUint16 = (buffer, startAt = 0) => Number((0, exports.decode)(buffer.subarray(startAt, startAt + 2), '8B'));
|
|
1721
|
+
exports.extractUint16 = extractUint16;
|
|
1722
|
+
const extractUint32 = (buffer, startAt = 0) => Number((0, exports.decode)(buffer.subarray(startAt, startAt + 4), '8B'));
|
|
1723
|
+
exports.extractUint32 = extractUint32;
|
|
1724
|
+
const extractUint64 = (buffer, startAt = 0) => Number((0, exports.decode)(buffer.subarray(startAt, startAt + 8), '8B'));
|
|
1725
|
+
exports.extractUint64 = extractUint64;
|
|
1726
|
+
const extractUint256 = (buffer, startAt = 0) => String((0, exports.decode)(buffer.subarray(startAt, startAt + 32), '32B'));
|
|
1727
|
+
exports.extractUint256 = extractUint256;
|
|
1728
|
+
const decodeAddress = (address, chain) => {
|
|
1729
|
+
if (chain === enums_1.Chains.Algorand) {
|
|
1730
|
+
return algosdk_1.default.encodeAddress(address);
|
|
1731
|
+
}
|
|
1732
|
+
if (chain === enums_1.Chains.Solana) {
|
|
1733
|
+
return bs58.encode(address);
|
|
1734
|
+
}
|
|
1735
|
+
return ethHelper.encodeAddress(address);
|
|
1736
|
+
};
|
|
1737
|
+
exports.decodeAddress = decodeAddress;
|
|
1738
|
+
const decodeToken = (token, chain) => {
|
|
1739
|
+
let decodedAddress = Buffer.from(token).toString('hex');
|
|
1740
|
+
if (!decodedAddress.startsWith('0x')) {
|
|
1741
|
+
decodedAddress = "0x" + decodedAddress;
|
|
1742
|
+
}
|
|
1743
|
+
if (constants_1.CCTP_UNIFIED_ASSETS[decodedAddress]) {
|
|
1744
|
+
return decodedAddress;
|
|
1745
|
+
}
|
|
1746
|
+
if (chain === enums_1.Chains.Algorand) {
|
|
1747
|
+
return String((0, eth_helper_1.decode32Bytes)(token));
|
|
1748
|
+
}
|
|
1749
|
+
if (chain === enums_1.Chains.Solana) {
|
|
1750
|
+
return bs58.encode(token);
|
|
1751
|
+
}
|
|
1752
|
+
return (0, exports.decodeAddress)(token, chain);
|
|
1753
|
+
};
|
|
1754
|
+
exports.decodeToken = decodeToken;
|
|
1755
|
+
const normalizeAddress = (address, chain, withPrefix = false) => {
|
|
1756
|
+
let normalizedAddress = Buffer.from((0, codex_1.encodeAddress)(address, chain)).toString('hex');
|
|
1757
|
+
if (withPrefix && !normalizedAddress.startsWith('0x')) {
|
|
1758
|
+
return `0x${normalizedAddress}`;
|
|
1759
|
+
}
|
|
1760
|
+
return normalizedAddress;
|
|
1761
|
+
};
|
|
1762
|
+
exports.normalizeAddress = normalizeAddress;
|
|
1763
|
+
const checkIfAddressIsNormalized = (address) => {
|
|
1764
|
+
if (address.startsWith('0x')) {
|
|
1765
|
+
return Buffer.from(address.substring(2), 'hex').length === 32;
|
|
1766
|
+
}
|
|
1767
|
+
return Buffer.from(address, 'hex').length === 32;
|
|
1768
|
+
};
|
|
1769
|
+
exports.checkIfAddressIsNormalized = checkIfAddressIsNormalized;
|
|
1770
|
+
const encodeToken = (token, chain) => {
|
|
1771
|
+
if (chain === enums_1.Chains.Algorand) {
|
|
1772
|
+
return (0, eth_helper_1.encode32Bytes)(+token);
|
|
1773
|
+
}
|
|
1774
|
+
if (constants_1.CCTP_UNIFIED_ASSETS[token]) {
|
|
1775
|
+
return new Uint8Array((0, eth_helper_1.decodeHexString)(String(token)));
|
|
1776
|
+
}
|
|
1777
|
+
return (0, codex_1.encodeAddress)(String(token), chain);
|
|
1778
|
+
};
|
|
1779
|
+
exports.encodeToken = encodeToken;
|
|
1780
|
+
const getCodexStateValue = async (algoClient, appId) => {
|
|
1781
|
+
const globalState = await (0, algo_helper_1.getAppGlobalState)(algoClient, appId);
|
|
1782
|
+
// console.log('codexState', appId, globalState);
|
|
1783
|
+
// if (globalState["MNA"]) {
|
|
1784
|
+
// console.log('MNA', decodeAddress(Buffer.from(globalState["MNA"]), 8));
|
|
1785
|
+
// }
|
|
1786
|
+
// if (globalState["BKA"]) {
|
|
1787
|
+
// console.log('BKA', decodeAddress(Buffer.from(globalState["BKA"]), 8));
|
|
1788
|
+
// }
|
|
1789
|
+
const msgProcId = globalState["MSG_PROCESSOR"];
|
|
1790
|
+
const superAppId = globalState["UL_SUPERADMIN_APP"];
|
|
1791
|
+
let superWallet = globalState["UL_SUPERADMIN_WALLET"];
|
|
1792
|
+
superWallet = superWallet?.length ? superWallet : undefined;
|
|
1793
|
+
const collectionWalletChainId = superWallet && Number((0, exports.decode)(superWallet.subarray(32, 40), '8B'));
|
|
1794
|
+
const parsedCodexState = {
|
|
1795
|
+
collectionWallet: superWallet && (0, exports.decodeAddress)(superWallet.subarray(0, 32), collectionWalletChainId),
|
|
1796
|
+
collectionWalletChainId,
|
|
1797
|
+
msgProcId,
|
|
1798
|
+
superAppId,
|
|
1799
|
+
};
|
|
1800
|
+
console.log('CodexState parsed', parsedCodexState);
|
|
1801
|
+
return parsedCodexState;
|
|
1802
|
+
};
|
|
1803
|
+
exports.getCodexStateValue = getCodexStateValue;
|
|
1804
|
+
const getCodexAccountInfo = async (algoClient, appId) => {
|
|
1805
|
+
const appAddress = algosdk_1.default.getApplicationAddress(appId);
|
|
1806
|
+
console.log('appAddress', appAddress);
|
|
1807
|
+
const accountInfo = await algoClient.accountInformation(appAddress).do();
|
|
1808
|
+
console.log('CODEX AccountInfo', accountInfo);
|
|
1809
|
+
};
|
|
1810
|
+
exports.getCodexAccountInfo = getCodexAccountInfo;
|
|
1811
|
+
const getAccountBalanceBoxNameHash = (account, token) => {
|
|
1812
|
+
const boxName = (0, exports.getAccountBalanceBoxName)(account.address, account.chainId, token.address, token.chainId);
|
|
1813
|
+
const hash = Buffer.from((0, eth_helper_1.keccak256)(boxName)).toString('hex');
|
|
1814
|
+
return hash;
|
|
1815
|
+
};
|
|
1816
|
+
exports.getAccountBalanceBoxNameHash = getAccountBalanceBoxNameHash;
|
|
1817
|
+
const getAccountBalanceBoxName = (loginAddress, loginChainId, tokenAddress, tokenChainId) => {
|
|
1818
|
+
const addressBytes = (0, codex_1.encodeAddress)(loginAddress, loginChainId);
|
|
1819
|
+
const chainIdBytes = algosdk_1.default.encodeUint64(loginChainId);
|
|
1820
|
+
const tokenChainIdBytes = algosdk_1.default.encodeUint64(tokenChainId);
|
|
1821
|
+
const tokenBytes = (0, exports.encodeToken)(tokenAddress, tokenChainId);
|
|
1822
|
+
const boxName = (0, Encoding_1.concatArrays)([addressBytes, chainIdBytes, tokenBytes, tokenChainIdBytes]);
|
|
1823
|
+
return boxName;
|
|
1824
|
+
};
|
|
1825
|
+
exports.getAccountBalanceBoxName = getAccountBalanceBoxName;
|
|
1826
|
+
const getCCTPBalanceBoxName = (tokenAddress, tokenChainId) => {
|
|
1827
|
+
const boxBytes = (0, Encoding_1.concatArrays)([(0, exports.encodeToken)(tokenAddress, tokenChainId), algosdk_1.default.encodeUint64(tokenChainId)]);
|
|
1828
|
+
return (0, eth_helper_1.keccak256)(boxBytes);
|
|
1829
|
+
};
|
|
1830
|
+
exports.getCCTPBalanceBoxName = getCCTPBalanceBoxName;
|
|
1831
|
+
const getCCTPBalanceBoxValue = async (algoClient, appId, tokenAddress, tokenChainId) => {
|
|
1832
|
+
const boxName = (0, exports.getCCTPBalanceBoxName)(tokenAddress, tokenChainId);
|
|
1833
|
+
const boxValue = await getAccountBox(algoClient, appId, boxName);
|
|
1834
|
+
console.log('Box CCTP balance', tokenAddress.substring(0, 18), tokenChainId, boxValue);
|
|
1835
|
+
return boxValue;
|
|
1836
|
+
};
|
|
1837
|
+
exports.getCCTPBalanceBoxValue = getCCTPBalanceBoxValue;
|
|
1838
|
+
const getCCTPBalancesBoxValue = async (algoClient, appId, tokenAddress, tokenChainIds = [1, 6, 10002, 10003, 10004, 10005]) => {
|
|
1839
|
+
const balances = await Promise.all(tokenChainIds.map(id => getAccountBox(algoClient, appId, (0, exports.getCCTPBalanceBoxName)(tokenAddress, id))));
|
|
1840
|
+
const formatBalance = (b, decimal = 6) => {
|
|
1841
|
+
return new Intl.NumberFormat('en-US', {
|
|
1842
|
+
style: 'currency',
|
|
1843
|
+
currency: 'USD',
|
|
1844
|
+
maximumFractionDigits: decimal,
|
|
1845
|
+
}).format(+(0, big_number_helper_1.divide)(b, 10 ** decimal));
|
|
1846
|
+
};
|
|
1847
|
+
const result = {};
|
|
1848
|
+
for (let i = 0; i < tokenChainIds.length; i++) {
|
|
1849
|
+
const element = tokenChainIds[i];
|
|
1850
|
+
result[element] = formatBalance(balances[i]);
|
|
1851
|
+
}
|
|
1852
|
+
console.log('Box CCTP balance', result);
|
|
1853
|
+
return result;
|
|
1854
|
+
};
|
|
1855
|
+
exports.getCCTPBalancesBoxValue = getCCTPBalancesBoxValue;
|
|
1856
|
+
const getRebalanceBoxName = (dbEntryId) => {
|
|
1857
|
+
const boxBytes = (0, Encoding_1.concatArrays)([(0, exports.encode)('Rebalance_', 'str'), algosdk_1.default.encodeUint64(dbEntryId)]);
|
|
1858
|
+
return boxBytes;
|
|
1859
|
+
};
|
|
1860
|
+
exports.getRebalanceBoxName = getRebalanceBoxName;
|
|
1861
|
+
const getTmcBoxName = (tmcChainId) => {
|
|
1862
|
+
const boxBytes = (0, Encoding_1.concatArrays)([(0, exports.encode)('TokenManager', 'str'), algosdk_1.default.encodeUint64(tmcChainId)]);
|
|
1863
|
+
return (0, eth_helper_1.keccak256)(boxBytes);
|
|
1864
|
+
};
|
|
1865
|
+
exports.getTmcBoxName = getTmcBoxName;
|
|
1866
|
+
const getTmcBoxValue = async (algoClient, appId, tmcChainId) => {
|
|
1867
|
+
const boxName = (0, exports.getTmcBoxName)(tmcChainId);
|
|
1868
|
+
const box = await (0, algo_helper_1.getBoxByName)(algoClient, appId, boxName);
|
|
1869
|
+
if (!box)
|
|
1870
|
+
return;
|
|
1871
|
+
const boxValue = (0, exports.decodeAddress)(box, tmcChainId);
|
|
1872
|
+
console.log('Box TokenManager of chain', tmcChainId, boxValue);
|
|
1873
|
+
return boxValue;
|
|
1874
|
+
};
|
|
1875
|
+
exports.getTmcBoxValue = getTmcBoxValue;
|
|
1876
|
+
const getTradingKeyBoxName = (loginAddress, loginChainId) => {
|
|
1877
|
+
const addressBytes = (0, codex_1.encodeAddress)(loginAddress, loginChainId);
|
|
1878
|
+
const prefixBytes = (0, Encoding_1.encodeString)("TK_");
|
|
1879
|
+
const boxName = (0, Encoding_1.concatArrays)([prefixBytes, addressBytes]);
|
|
1880
|
+
return boxName;
|
|
1881
|
+
};
|
|
1882
|
+
exports.getTradingKeyBoxName = getTradingKeyBoxName;
|
|
1883
|
+
const getTradingKeyBoxValue = async (algoClient, appId, loginAddress, loginChainId) => {
|
|
1884
|
+
const boxName = (0, eth_helper_1.keccak256)((0, exports.getTradingKeyBoxName)(loginAddress, loginChainId));
|
|
1885
|
+
const box = await (0, algo_helper_1.getBoxByName)(algoClient, appId, boxName);
|
|
1886
|
+
if (!box)
|
|
1887
|
+
return;
|
|
1888
|
+
const boxValues = [];
|
|
1889
|
+
for (let index = 0; index + 32 <= box.length; index += 32) {
|
|
1890
|
+
const boxValue = (0, exports.decodeAddress)(box.subarray(index, index + 32), enums_1.Chains.Algorand);
|
|
1891
|
+
boxValues.push(boxValue);
|
|
1892
|
+
}
|
|
1893
|
+
console.log('Box account trading keys', loginAddress.substring(0, 8), boxValues, Buffer.from(boxName).toString('hex'));
|
|
1894
|
+
return boxValues;
|
|
1895
|
+
};
|
|
1896
|
+
exports.getTradingKeyBoxValue = getTradingKeyBoxValue;
|
|
1897
|
+
const getAssetBalancesByAppIndex = async (algoClient, appIndex) => {
|
|
1898
|
+
const appAddress = algosdk_1.default.getApplicationAddress(appIndex);
|
|
1899
|
+
return await (0, exports.getAssetBalancesByAppAddress)(algoClient, appAddress);
|
|
1900
|
+
};
|
|
1901
|
+
exports.getAssetBalancesByAppIndex = getAssetBalancesByAppIndex;
|
|
1902
|
+
const getAssetBalancesByAppAddress = async (algoClient, appAddress) => {
|
|
1903
|
+
const appInfo = await algoClient.accountInformation(appAddress).do();
|
|
1904
|
+
const balances = (0, algo_helper_1.getAccountAssetBalances)(appInfo);
|
|
1905
|
+
return balances;
|
|
1906
|
+
};
|
|
1907
|
+
exports.getAssetBalancesByAppAddress = getAssetBalancesByAppAddress;
|
|
1908
|
+
const getBoxes = async (algoClient, appId) => {
|
|
1909
|
+
const { boxes } = await algoClient.getApplicationBoxes(appId).do();
|
|
1910
|
+
console.log(`boxes of ${appId}`, boxes.map(b => b.name));
|
|
1911
|
+
};
|
|
1912
|
+
exports.getBoxes = getBoxes;
|
|
1913
|
+
const getAccountBalanceBoxValue = async (algoClient, appId, login, token) => {
|
|
1914
|
+
return (0, exports.getAccountBoxValue)(algoClient, appId, login.address, login.chainId, token.address, token.chainId);
|
|
1915
|
+
};
|
|
1916
|
+
exports.getAccountBalanceBoxValue = getAccountBalanceBoxValue;
|
|
1917
|
+
const getAccountBoxValue = async (algoClient, appId, loginAddress, loginChainId, tokenAddress, tokenChainId) => {
|
|
1918
|
+
// console.log('getAccountBoxValue', { loginAddress, loginChainId, tokenAddress, tokenChainId });
|
|
1919
|
+
const boxName = (0, eth_helper_1.keccak256)((0, exports.getAccountBalanceBoxName)(loginAddress, loginChainId, tokenAddress, tokenChainId));
|
|
1920
|
+
const boxValue = await getAccountBox(algoClient, appId, boxName);
|
|
1921
|
+
console.log('Box account value', loginAddress.substring(0, 8), tokenAddress, boxValue, Buffer.from(boxName).toString('hex'));
|
|
1922
|
+
return String(boxValue);
|
|
1923
|
+
};
|
|
1924
|
+
exports.getAccountBoxValue = getAccountBoxValue;
|
|
1925
|
+
const getAccountBoxByHash = async (algoClient, appId, hash) => {
|
|
1926
|
+
const boxName = Buffer.from(hash, 'hex');
|
|
1927
|
+
const box = await (0, algo_helper_1.getBoxByName)(algoClient, appId, boxName);
|
|
1928
|
+
let boxValue = 0n;
|
|
1929
|
+
if (box)
|
|
1930
|
+
boxValue = (0, eth_helper_1.decode32Bytes)(box);
|
|
1931
|
+
console.log('Box account value', JSON.stringify({
|
|
1932
|
+
hash: hash.substring(0, 8),
|
|
1933
|
+
boxValue: String(boxValue),
|
|
1934
|
+
box: `[${box?.toString()}]`
|
|
1935
|
+
}));
|
|
1936
|
+
return boxValue;
|
|
1937
|
+
};
|
|
1938
|
+
exports.getAccountBoxByHash = getAccountBoxByHash;
|
|
1939
|
+
const getAccountBox = async (algoClient, appId, boxName) => {
|
|
1940
|
+
const box = await (0, algo_helper_1.getBoxByName)(algoClient, appId, boxName);
|
|
1941
|
+
let boxValue = 0n;
|
|
1942
|
+
if (box)
|
|
1943
|
+
boxValue = (0, eth_helper_1.decode32Bytes)(box);
|
|
1944
|
+
return boxValue;
|
|
1945
|
+
};
|
|
1946
|
+
const getCompanyBoxName = (companyId) => (0, exports.encode)(companyId, '8B');
|
|
1947
|
+
exports.getCompanyBoxName = getCompanyBoxName;
|
|
1948
|
+
const getCompanyBoxValue = async (algoClient, appId, companyId) => {
|
|
1949
|
+
const boxName = (0, exports.getCompanyBoxName)(companyId);
|
|
1950
|
+
const box = await (0, algo_helper_1.getBoxByName)(algoClient, appId, boxName);
|
|
1951
|
+
if (!box)
|
|
1952
|
+
return;
|
|
1953
|
+
const collectionWalletChainId = Number((0, exports.decode)(box.subarray(32, 40), '8B'));
|
|
1954
|
+
const boxValue = {
|
|
1955
|
+
collectionWallet: (0, exports.decodeAddress)(box.subarray(0, 32), collectionWalletChainId),
|
|
1956
|
+
collectionWalletChainId,
|
|
1957
|
+
takerFee: Number((0, exports.decode)(box.subarray(40, 48), '8B')),
|
|
1958
|
+
makerFee: box.length > 48 ? Number((0, exports.decode)(box.subarray(48, 56), '8B')) : 0,
|
|
1959
|
+
};
|
|
1960
|
+
console.log(`Box company #${companyId} value`, boxValue);
|
|
1961
|
+
return boxValue;
|
|
1962
|
+
};
|
|
1963
|
+
exports.getCompanyBoxValue = getCompanyBoxValue;
|
|
1964
|
+
const getPairBoxValue = async (algoClient, appId, baseToken, priceToken) => {
|
|
1965
|
+
const boxKey = (0, eth_helper_1.keccak256)((0, exports.getPairBoxKey)(baseToken, priceToken));
|
|
1966
|
+
const box = await (0, algo_helper_1.getBoxByName)(algoClient, appId, boxKey);
|
|
1967
|
+
if (!box)
|
|
1968
|
+
return;
|
|
1969
|
+
const boxValue = {
|
|
1970
|
+
minSize: (0, eth_helper_1.decode32Bytes)(box.subarray(0, 32)),
|
|
1971
|
+
minPriceIncrement: (0, eth_helper_1.decode32Bytes)(box.subarray(32, 64)),
|
|
1972
|
+
minSizeIncrement: (0, eth_helper_1.decode32Bytes)(box.subarray(64, 96)),
|
|
1973
|
+
};
|
|
1974
|
+
console.log('Box pair value', box, boxValue);
|
|
1975
|
+
return boxValue;
|
|
1976
|
+
};
|
|
1977
|
+
exports.getPairBoxValue = getPairBoxValue;
|
|
1978
|
+
const getOrderBoxValue = async (algoClient, appId, o, log = true) => {
|
|
1979
|
+
const boxName = o.boxName
|
|
1980
|
+
|| (o.hash && (0, codex_1.getOrderBoxKeyFromHash)(o.hash))
|
|
1981
|
+
|| (0, codex_1.getOrderBoxKey)(o.message, 'hex');
|
|
1982
|
+
const box = await (0, algo_helper_1.getBoxByName)(algoClient, appId, boxName);
|
|
1983
|
+
if (!box)
|
|
1984
|
+
return;
|
|
1985
|
+
const boxValue = {
|
|
1986
|
+
hash: Buffer.from(boxName).toString('hex'),
|
|
1987
|
+
amount: (0, eth_helper_1.decode32Bytes)(box.subarray(0, 32)),
|
|
1988
|
+
price: (0, eth_helper_1.decode32Bytes)(box.subarray(32, 64)),
|
|
1989
|
+
expiredTime: (0, eth_helper_1.decode32Bytes)(box.subarray(64, 72)),
|
|
1990
|
+
expiredDate: new Date(Number((0, eth_helper_1.decode32Bytes)(box.subarray(64, 72))) * 1000)
|
|
1991
|
+
};
|
|
1992
|
+
log && console.log('Box order value', JSON.stringify({
|
|
1993
|
+
expiredDate: boxValue.expiredDate,
|
|
1994
|
+
expiredTime: String(boxValue.expiredTime),
|
|
1995
|
+
hash: boxValue.hash,
|
|
1996
|
+
price: String(boxValue.price),
|
|
1997
|
+
amount: String(boxValue.amount),
|
|
1998
|
+
}));
|
|
1999
|
+
return boxValue;
|
|
2000
|
+
};
|
|
2001
|
+
exports.getOrderBoxValue = getOrderBoxValue;
|
|
2002
|
+
const getTokenBoxValue = async (algoClient, appId, token) => {
|
|
2003
|
+
const boxName = (0, eth_helper_1.keccak256)((0, exports.getTokenBoxKey)(token));
|
|
2004
|
+
const box = await (0, algo_helper_1.getBoxByName)(algoClient, appId, boxName);
|
|
2005
|
+
if (!box)
|
|
2006
|
+
return;
|
|
2007
|
+
const boxValue = {
|
|
2008
|
+
decimal: Number((0, exports.decode)(box.subarray(2, 10), '8B')),
|
|
2009
|
+
name: String((0, exports.decode)(box.subarray(12, box.length), 'str')),
|
|
2010
|
+
};
|
|
2011
|
+
console.log('Box token value', box, boxValue);
|
|
2012
|
+
return boxValue;
|
|
2013
|
+
};
|
|
2014
|
+
exports.getTokenBoxValue = getTokenBoxValue;
|
|
2015
|
+
const makeAssetOptInTxn = (appId, superId, sender, params, balances, token) => {
|
|
2016
|
+
if (token.chainId !== enums_1.Chains.Algorand) {
|
|
2017
|
+
return;
|
|
2018
|
+
}
|
|
2019
|
+
const tokenIndex = Number(token.address);
|
|
2020
|
+
if (tokenIndex === 0 || (0, algo_helper_1.isAssetOptedIn)(balances, tokenIndex)) {
|
|
2021
|
+
return;
|
|
2022
|
+
}
|
|
2023
|
+
console.log('Make optin to codex for', tokenIndex);
|
|
2024
|
+
const m = algosdk_1.default.ABIMethod.fromSignature("asset_opt_in(asset)void");
|
|
2025
|
+
const selector = m.getSelector();
|
|
2026
|
+
const sp = {
|
|
2027
|
+
...params,
|
|
2028
|
+
fee: algosdk_1.default.ALGORAND_MIN_TX_FEE * 2,
|
|
2029
|
+
flatFee: true
|
|
2030
|
+
};
|
|
2031
|
+
return algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
2032
|
+
appIndex: appId,
|
|
2033
|
+
from: sender,
|
|
2034
|
+
suggestedParams: sp,
|
|
2035
|
+
appArgs: [selector, (0, Encoding_1.encodeUint64)(tokenIndex)],
|
|
2036
|
+
foreignApps: [superId],
|
|
2037
|
+
foreignAssets: [tokenIndex],
|
|
2038
|
+
});
|
|
2039
|
+
};
|
|
2040
|
+
exports.makeAssetOptInTxn = makeAssetOptInTxn;
|
|
2041
|
+
const makeDepositTxns = async (appId, algoClient, sender, loginAddress, loginChainId, tokenAmount, tokenIndex, tokenChainId) => {
|
|
2042
|
+
console.log('makeDeposit args', {
|
|
2043
|
+
sender,
|
|
2044
|
+
loginAddress,
|
|
2045
|
+
loginChainId,
|
|
2046
|
+
tokenAmount,
|
|
2047
|
+
tokenIndex,
|
|
2048
|
+
appId
|
|
2049
|
+
});
|
|
2050
|
+
const txns = [];
|
|
2051
|
+
const params = await (0, algo_helper_1.getTxnParams)(algoClient, 1);
|
|
2052
|
+
const codexAddress = algosdk_1.default.getApplicationAddress(appId);
|
|
2053
|
+
const xfer = {
|
|
2054
|
+
suggestedParams: params,
|
|
2055
|
+
from: sender,
|
|
2056
|
+
to: codexAddress,
|
|
2057
|
+
amount: tokenAmount,
|
|
2058
|
+
};
|
|
2059
|
+
txns.push(tokenIndex === 0
|
|
2060
|
+
? algosdk_1.default.makePaymentTxnWithSuggestedParamsFromObject(xfer)
|
|
2061
|
+
: algosdk_1.default.makeAssetTransferTxnWithSuggestedParamsFromObject({
|
|
2062
|
+
...xfer,
|
|
2063
|
+
assetIndex: tokenIndex,
|
|
2064
|
+
}));
|
|
2065
|
+
const m = algosdk_1.default.ABIMethod.fromSignature("depositToCodex(byte[])uint64");
|
|
2066
|
+
const selector = m.getSelector();
|
|
2067
|
+
const messageBytes = (0, exports.makeDepositMsg)({ loginAddress, loginChainId });
|
|
2068
|
+
const msgArg = m.args[0].type.encode(messageBytes);
|
|
2069
|
+
const boxName = (0, eth_helper_1.keccak256)((0, exports.getAccountBalanceBoxName)(loginAddress, loginChainId, tokenIndex, tokenChainId));
|
|
2070
|
+
txns.push(algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
2071
|
+
appIndex: appId,
|
|
2072
|
+
from: sender,
|
|
2073
|
+
suggestedParams: params,
|
|
2074
|
+
appArgs: [selector, msgArg],
|
|
2075
|
+
boxes: [{
|
|
2076
|
+
appIndex: appId,
|
|
2077
|
+
name: boxName
|
|
2078
|
+
}]
|
|
2079
|
+
}));
|
|
2080
|
+
return txns;
|
|
2081
|
+
};
|
|
2082
|
+
exports.makeDepositTxns = makeDepositTxns;
|
|
2083
|
+
const makeAddressChainMsg = (loginAddress, loginChainId) => {
|
|
2084
|
+
const addressBytes = (0, codex_1.encodeAddress)(loginAddress, loginChainId);
|
|
2085
|
+
const chainIdBytes = algosdk_1.default.encodeUint64(loginChainId);
|
|
2086
|
+
const messageBytes = (0, Encoding_1.concatArrays)([addressBytes, chainIdBytes]);
|
|
2087
|
+
console.log('messageBytes', messageBytes, JSON.stringify(messageBytes), (0, Encoding_1.encodeBase64)(messageBytes));
|
|
2088
|
+
return messageBytes;
|
|
2089
|
+
};
|
|
2090
|
+
const makeDepositMsg = ({ loginAddress, loginChainId, }) => {
|
|
2091
|
+
return makeAddressChainMsg(loginAddress, loginChainId);
|
|
2092
|
+
};
|
|
2093
|
+
exports.makeDepositMsg = makeDepositMsg;
|
|
2094
|
+
const makeSuperCollectionWalletMsg = ({ loginAddress, loginChainId, }) => {
|
|
2095
|
+
return makeAddressChainMsg(loginAddress, loginChainId);
|
|
2096
|
+
};
|
|
2097
|
+
const makeCreateOrderMsg = (data) => {
|
|
2098
|
+
const orderBytes = Buffer.concat([
|
|
2099
|
+
(0, exports.encode)(data.version, '2B'),
|
|
2100
|
+
(0, exports.encode)(data.expiredTime, '4B'),
|
|
2101
|
+
(0, exports.encode)(data.orderSide, 'str'),
|
|
2102
|
+
(0, exports.encode)(data.price, '32B'),
|
|
2103
|
+
(0, exports.encode)(data.amount, '32B'),
|
|
2104
|
+
(0, exports.encode)(data.orderType, 'str'),
|
|
2105
|
+
(0, exports.encode)(data.address, 'address', data.chainId),
|
|
2106
|
+
(0, exports.encode)(data.chainId, '2B'),
|
|
2107
|
+
(0, exports.encode)(data.baseTokenAddress, 'token', data.baseTokenChainId),
|
|
2108
|
+
(0, exports.encode)(data.baseTokenChainId, '4B'),
|
|
2109
|
+
(0, exports.encode)(data.priceTokenAddress, 'token', data.priceTokenChainId),
|
|
2110
|
+
(0, exports.encode)(data.priceTokenChainId, '4B'),
|
|
2111
|
+
(0, exports.encode)(data.companyId, '2B'),
|
|
2112
|
+
(0, exports.encode)(data.random, '8B'),
|
|
2113
|
+
(0, exports.encode)(data.decimalPrice, 'float'),
|
|
2114
|
+
Buffer.alloc(50), // extra 50 zero bytes
|
|
2115
|
+
]);
|
|
2116
|
+
const bs64OrderBytes = new Uint8Array(Buffer.from((0, Encoding_1.encodeBase64)(orderBytes)));
|
|
2117
|
+
const messageBytes = new Uint8Array([
|
|
2118
|
+
...getOrderDataJsonBytes(data),
|
|
2119
|
+
...bs64OrderBytes,
|
|
2120
|
+
]);
|
|
2121
|
+
console.log(`Order data should be ${constants_1.ORDER_DATA_BYTES_LENGTH} bytes`, bs64OrderBytes.length, bs64OrderBytes);
|
|
2122
|
+
return messageBytes;
|
|
2123
|
+
};
|
|
2124
|
+
exports.makeCreateOrderMsg = makeCreateOrderMsg;
|
|
2125
|
+
const getOrderDataJsonBytes = (data) => {
|
|
2126
|
+
const { amount, price, baseTokenAddress, baseChain, baseCurrency, baseDecimal, priceTokenAddress, priceChain, priceCurrency, priceDecimal, } = data;
|
|
2127
|
+
const baseTokenName = baseCurrency?.toUpperCase();
|
|
2128
|
+
const priceTokenName = priceCurrency?.toUpperCase();
|
|
2129
|
+
const orderAmount = (0, big_number_helper_1.divide)(amount, 10 ** baseDecimal);
|
|
2130
|
+
const orderPrice = (0, big_number_helper_1.divide)(price, 10 ** priceDecimal);
|
|
2131
|
+
const orderSide = (0, order_helper_1.mapOrderSideFromShortToLong)(data.orderSide);
|
|
2132
|
+
const orderType = (0, order_helper_1.mapOrderTypeShortToLong)(data.orderType);
|
|
2133
|
+
const getToken = (token, chain) => `${token}` + (chain && ` (${chain})`);
|
|
2134
|
+
const priceOrTotal = data.orderType === 'M'
|
|
2135
|
+
? `ESTIMATED TOTAL ${orderPrice} ${priceTokenName}`
|
|
2136
|
+
: `LIMIT PRICE ${orderPrice} ${priceTokenName} per ${baseTokenName}`;
|
|
2137
|
+
const rows = [
|
|
2138
|
+
`NEW ${orderType.toUpperCase()} ORDER ${getToken(baseTokenName, baseChain)} / ${getToken(priceTokenName, priceChain)}:`,
|
|
2139
|
+
`${orderSide} ${orderAmount} ${baseTokenName}, ${priceOrTotal}`,
|
|
2140
|
+
`${baseTokenName} ID: ${baseTokenAddress}`,
|
|
2141
|
+
`${priceTokenName} ID: ${priceTokenAddress}`,
|
|
2142
|
+
`Exp: ${constants_1.DEFAULT_ORDER_EXPIRATION_DAYS} Days`,
|
|
2143
|
+
];
|
|
2144
|
+
const jsonOrder = rows.join('\n') + '\n';
|
|
2145
|
+
return new Uint8Array(Buffer.from(jsonOrder, 'utf-8'));
|
|
2146
|
+
};
|
|
2147
|
+
const getCancelOrderDataJsonBytes = (data) => {
|
|
2148
|
+
const { orderId, amount, price, baseTokenAddress, baseChain, baseCurrency, baseDecimal, priceTokenAddress, priceChain, priceCurrency, priceDecimal, } = data;
|
|
2149
|
+
const baseTokenName = baseCurrency?.toUpperCase();
|
|
2150
|
+
const priceTokenName = priceCurrency?.toUpperCase();
|
|
2151
|
+
const getToken = (token, chain) => `${token}` + (chain && ` (${chain})`);
|
|
2152
|
+
const orderAmount = (0, big_number_helper_1.divide)(amount, 10 ** baseDecimal);
|
|
2153
|
+
const orderPrice = (0, big_number_helper_1.divide)(price, 10 ** priceDecimal);
|
|
2154
|
+
const orderSide = (0, order_helper_1.mapOrderSideFromShortToLong)(data.orderSide);
|
|
2155
|
+
const orderType = (0, order_helper_1.mapOrderTypeShortToLong)(data.orderType);
|
|
2156
|
+
const priceOrTotal = data.orderType === 'M'
|
|
2157
|
+
? `ESTIMATED TOTAL ${orderPrice} ${priceTokenName}`
|
|
2158
|
+
: `LIMIT PRICE ${orderPrice} ${priceTokenName} per ${baseTokenName}`;
|
|
2159
|
+
const rows = [
|
|
2160
|
+
`CANCEL ${orderType.toUpperCase()} ORDER ${getToken(baseTokenName, baseChain)} / ${getToken(priceTokenName, priceChain)}:`,
|
|
2161
|
+
`${orderSide} ${orderAmount} ${baseTokenName}, ${priceOrTotal}`,
|
|
2162
|
+
`Order ID: ${orderId}`,
|
|
2163
|
+
`${baseTokenName} ID: ${baseTokenAddress}`,
|
|
2164
|
+
`${priceTokenName} ID: ${priceTokenAddress}`,
|
|
2165
|
+
];
|
|
2166
|
+
const jsonOrder = rows.join('\n') + '\n';
|
|
2167
|
+
return new Uint8Array(Buffer.from(jsonOrder, 'utf-8'));
|
|
2168
|
+
};
|
|
2169
|
+
exports.getCancelOrderDataJsonBytes = getCancelOrderDataJsonBytes;
|
|
2170
|
+
const decodeCreateOrderMsg = (message, encoding = 'hex') => {
|
|
2171
|
+
const buffer = (0, codex_1.getOrderBytesFromMsg)(message, encoding);
|
|
2172
|
+
const chainId = (0, exports.extractUint16)(buffer, 104);
|
|
2173
|
+
const baseTokenChainId = (0, exports.extractUint32)(buffer, 138);
|
|
2174
|
+
const priceTokenChainId = (0, exports.extractUint32)(buffer, 174);
|
|
2175
|
+
const orderData = {
|
|
2176
|
+
version: (0, exports.extractUint16)(buffer),
|
|
2177
|
+
expiredTime: (0, exports.extractUint32)(buffer, 2),
|
|
2178
|
+
orderSide: (0, exports.extractStr)(buffer, 6, 1),
|
|
2179
|
+
price: (0, exports.extractUint256)(buffer, 7),
|
|
2180
|
+
amount: (0, exports.extractUint256)(buffer, 39),
|
|
2181
|
+
orderType: (0, exports.extractStr)(buffer, 71, 1),
|
|
2182
|
+
address: (0, exports.extractAddress)(buffer, 72, chainId),
|
|
2183
|
+
chainId,
|
|
2184
|
+
baseTokenAddress: (0, exports.extractToken)(buffer, 106, baseTokenChainId),
|
|
2185
|
+
baseTokenChainId,
|
|
2186
|
+
priceTokenAddress: (0, exports.extractToken)(buffer, 142, priceTokenChainId),
|
|
2187
|
+
priceTokenChainId,
|
|
2188
|
+
companyId: (0, exports.extractUint16)(buffer, 178),
|
|
2189
|
+
random: (0, exports.extractUint64)(buffer, 180),
|
|
2190
|
+
decimalPrice: (0, exports.extractDouble)(buffer, 188),
|
|
2191
|
+
};
|
|
2192
|
+
return {
|
|
2193
|
+
...orderData,
|
|
2194
|
+
expiredDate: String(orderData.expiredTime).length > 10
|
|
2195
|
+
? new Date(orderData.expiredTime) // TODO: fix pysdk to send time in sec
|
|
2196
|
+
: new Date(orderData.expiredTime * 1000)
|
|
2197
|
+
};
|
|
2198
|
+
};
|
|
2199
|
+
exports.decodeCreateOrderMsg = decodeCreateOrderMsg;
|
|
2200
|
+
const getMatchOrderArgs = (order) => {
|
|
2201
|
+
const { id, address, chain, message, encoding, signature, tradingKey } = order;
|
|
2202
|
+
// console.log('getMatchOrderArgs', JSON.stringify(order));
|
|
2203
|
+
const signAddress = tradingKey || address;
|
|
2204
|
+
const signChain = tradingKey ? enums_1.Chains.Algorand : chain;
|
|
2205
|
+
return [
|
|
2206
|
+
...(0, codex_1.getMsgArgs)(message, signature, signAddress, signChain, encoding),
|
|
2207
|
+
id,
|
|
2208
|
+
];
|
|
2209
|
+
};
|
|
2210
|
+
const getPairBoxKey = (baseToken, priceToken) => {
|
|
2211
|
+
const boxName = (0, Encoding_1.concatArrays)([
|
|
2212
|
+
(0, exports.getTokenBoxKey)(baseToken),
|
|
2213
|
+
(0, exports.getTokenBoxKey)(priceToken),
|
|
2214
|
+
]);
|
|
2215
|
+
return boxName;
|
|
2216
|
+
};
|
|
2217
|
+
exports.getPairBoxKey = getPairBoxKey;
|
|
2218
|
+
const getTokenBoxKey = ({ address, chainId }) => {
|
|
2219
|
+
const boxNameKey = (0, Encoding_1.concatArrays)([
|
|
2220
|
+
(0, exports.encode)(address, 'token', chainId),
|
|
2221
|
+
(0, exports.encode)(chainId, '8B'),
|
|
2222
|
+
]);
|
|
2223
|
+
return boxNameKey;
|
|
2224
|
+
};
|
|
2225
|
+
exports.getTokenBoxKey = getTokenBoxKey;
|
|
2226
|
+
const createBoxes = (appIndex, boxNames, encode = eth_helper_1.keccak256) => {
|
|
2227
|
+
const boxes = boxNames.map((boxName) => ({
|
|
2228
|
+
appIndex,
|
|
2229
|
+
name: encode(boxName)
|
|
2230
|
+
}));
|
|
2231
|
+
// console.log('createBoxes', boxes.map(b => Buffer.from(b.name).toString('hex')))
|
|
2232
|
+
// console.log(`createBoxesBytes`, boxes.map(b => Array.apply([], Array.from(b.name)).join(", ")));
|
|
2233
|
+
return boxes;
|
|
2234
|
+
};
|
|
2235
|
+
exports.createBoxes = createBoxes;
|
|
2236
|
+
const getShareWalletBytes = (shareData) => {
|
|
2237
|
+
if (!shareData) {
|
|
2238
|
+
return Buffer.alloc(constants_1.SHARE_DATA_LENGTH);
|
|
2239
|
+
}
|
|
2240
|
+
return (0, Encoding_1.concatArrays)([
|
|
2241
|
+
(0, exports.encode)(shareData.address, 'address', shareData.chainId),
|
|
2242
|
+
(0, exports.encode)(shareData.chainId, '2B'),
|
|
2243
|
+
(0, exports.encode)(shareData.feeShare, '2B'),
|
|
2244
|
+
]);
|
|
2245
|
+
};
|
|
2246
|
+
const getShareWalletBoxKey = (shareData, token) => {
|
|
2247
|
+
let boxKey;
|
|
2248
|
+
if (shareData?.address && shareData?.chainId) {
|
|
2249
|
+
boxKey = (0, exports.getAccountBalanceBoxName)(shareData.address, shareData.chainId, token.address, token.chainId);
|
|
2250
|
+
}
|
|
2251
|
+
return boxKey;
|
|
2252
|
+
};
|
|
2253
|
+
const getCollectionWalletBoxKey = (company, token) => {
|
|
2254
|
+
let boxKey;
|
|
2255
|
+
if (company.collectionWallet && company.collectionWalletChainId) {
|
|
2256
|
+
boxKey = (0, exports.getAccountBalanceBoxName)(company.collectionWallet, company.collectionWalletChainId, token.address, token.chainId);
|
|
2257
|
+
}
|
|
2258
|
+
return boxKey;
|
|
2259
|
+
};
|
|
2260
|
+
const makeMatchTxns = (appId, args, params, sender, encoding = 'hex') => {
|
|
2261
|
+
const { id, amount, buy, sell, baseAsset, priceAsset, superCompany, superAppId, fee } = args;
|
|
2262
|
+
const { b_share, s_share, tfee_tier, mfee_tier, mmfee_tier, mm_tfee, p_mfee, p_tfee, bdMaker, bdTaker, afMaker, afTaker } = fee;
|
|
2263
|
+
if (!superCompany) {
|
|
2264
|
+
throw new Error('Collection wallet for super user was not provided');
|
|
2265
|
+
}
|
|
2266
|
+
const feeData = (0, Encoding_1.concatArrays)([
|
|
2267
|
+
(0, exports.encode)(b_share, '2B'),
|
|
2268
|
+
(0, exports.encode)(s_share, '2B'),
|
|
2269
|
+
(0, exports.encode)(mfee_tier, 'str'),
|
|
2270
|
+
(0, exports.encode)(tfee_tier, 'str'),
|
|
2271
|
+
(0, exports.encode)(mmfee_tier, 'str'),
|
|
2272
|
+
(0, exports.encode)(mm_tfee, '2B'),
|
|
2273
|
+
(0, exports.encode)(p_tfee, '2B'),
|
|
2274
|
+
(0, exports.encode)(p_mfee, '2B'),
|
|
2275
|
+
]);
|
|
2276
|
+
const shareData = (0, Encoding_1.concatArrays)([
|
|
2277
|
+
getShareWalletBytes(bdMaker),
|
|
2278
|
+
getShareWalletBytes(afMaker),
|
|
2279
|
+
getShareWalletBytes(bdTaker),
|
|
2280
|
+
getShareWalletBytes(afTaker),
|
|
2281
|
+
]);
|
|
2282
|
+
const msgArgs = [
|
|
2283
|
+
...getMatchOrderArgs({ ...buy, encoding }),
|
|
2284
|
+
...getMatchOrderArgs({ ...sell, encoding }),
|
|
2285
|
+
(0, exports.encode)(amount, '32B'),
|
|
2286
|
+
feeData,
|
|
2287
|
+
(0, exports.encode)(id, '8B'),
|
|
2288
|
+
shareData,
|
|
2289
|
+
];
|
|
2290
|
+
const appArgs = (0, codex_1.getAppArgs)("match(byte[],byte[],byte[],uint64,byte[],byte[],byte[],uint64,byte[],byte[],byte[],byte[])uint64", msgArgs);
|
|
2291
|
+
const pairBoxKey = (0, exports.getPairBoxKey)(baseAsset, priceAsset);
|
|
2292
|
+
const buyOrderBoxKey = (0, codex_1.getOrderBoxKey)(buy.message, encoding);
|
|
2293
|
+
const sellOrderBoxKey = (0, codex_1.getOrderBoxKey)(sell.message, encoding);
|
|
2294
|
+
const baseTokenBoxKey = (0, exports.getTokenBoxKey)(baseAsset);
|
|
2295
|
+
const priceTokenBoxKey = (0, exports.getTokenBoxKey)(priceAsset);
|
|
2296
|
+
const buyBaseAssetBoxKey = (0, exports.getAccountBalanceBoxName)(buy.address, buy.chain, baseAsset.address, baseAsset.chainId);
|
|
2297
|
+
const buyPriceAssetBoxKey = (0, exports.getAccountBalanceBoxName)(buy.address, buy.chain, priceAsset.address, priceAsset.chainId);
|
|
2298
|
+
const sellBaseAssetBoxKey = (0, exports.getAccountBalanceBoxName)(sell.address, sell.chain, baseAsset.address, baseAsset.chainId);
|
|
2299
|
+
const sellPriceAssetBoxKey = (0, exports.getAccountBalanceBoxName)(sell.address, sell.chain, priceAsset.address, priceAsset.chainId);
|
|
2300
|
+
const buyOrderCompanyBoxKey = (0, exports.getCompanyBoxName)(buy.companyId);
|
|
2301
|
+
const sellOrderCompanyBoxKey = (0, exports.getCompanyBoxName)(sell.companyId);
|
|
2302
|
+
const filteredBoxes = [
|
|
2303
|
+
...new Set([
|
|
2304
|
+
pairBoxKey,
|
|
2305
|
+
baseTokenBoxKey,
|
|
2306
|
+
priceTokenBoxKey,
|
|
2307
|
+
buyBaseAssetBoxKey,
|
|
2308
|
+
buyPriceAssetBoxKey,
|
|
2309
|
+
(0, exports.getTradingKeyBoxName)(buy.address, buy.chain),
|
|
2310
|
+
(0, exports.getTradingKeyBoxName)(sell.address, sell.chain),
|
|
2311
|
+
sellBaseAssetBoxKey,
|
|
2312
|
+
sellPriceAssetBoxKey,
|
|
2313
|
+
getCollectionWalletBoxKey(superCompany, baseAsset),
|
|
2314
|
+
getCollectionWalletBoxKey(superCompany, priceAsset),
|
|
2315
|
+
getCollectionWalletBoxKey(buy, baseAsset),
|
|
2316
|
+
getCollectionWalletBoxKey(sell, priceAsset),
|
|
2317
|
+
getShareWalletBoxKey(bdMaker, baseAsset),
|
|
2318
|
+
getShareWalletBoxKey(bdMaker, priceAsset),
|
|
2319
|
+
getShareWalletBoxKey(bdTaker, baseAsset),
|
|
2320
|
+
getShareWalletBoxKey(bdTaker, priceAsset),
|
|
2321
|
+
getShareWalletBoxKey(afMaker, baseAsset),
|
|
2322
|
+
getShareWalletBoxKey(afMaker, priceAsset),
|
|
2323
|
+
getShareWalletBoxKey(afTaker, baseAsset),
|
|
2324
|
+
getShareWalletBoxKey(afTaker, priceAsset),
|
|
2325
|
+
]
|
|
2326
|
+
.filter(Boolean) // filter possible undefined args
|
|
2327
|
+
.map(o => Buffer.from(o).toString('hex')))
|
|
2328
|
+
].map(o => Buffer.from(o, 'hex'));
|
|
2329
|
+
const allBoxes = [
|
|
2330
|
+
...(0, exports.createBoxes)(appId, filteredBoxes),
|
|
2331
|
+
...(0, exports.createBoxes)(appId, [
|
|
2332
|
+
buyOrderBoxKey,
|
|
2333
|
+
sellOrderBoxKey,
|
|
2334
|
+
buyOrderCompanyBoxKey,
|
|
2335
|
+
sellOrderCompanyBoxKey
|
|
2336
|
+
], (data) => data)
|
|
2337
|
+
];
|
|
2338
|
+
const allBoxesUnique = [...new Set(allBoxes.map(o => Buffer.from(o.name).toString('hex')))];
|
|
2339
|
+
console.log(`[TradeID: ${id}] All boxes`, JSON.stringify(allBoxesUnique));
|
|
2340
|
+
// allBoxes = allBoxesUnique.map(o => Buffer.from(o.name))
|
|
2341
|
+
const foreignApps = [superAppId];
|
|
2342
|
+
const MAX_REFS = 8;
|
|
2343
|
+
const mainTxnBoxes = allBoxes.slice(0, MAX_REFS - foreignApps.length);
|
|
2344
|
+
const restBoxes = allBoxes.slice(MAX_REFS - foreignApps.length);
|
|
2345
|
+
const matchTxn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
2346
|
+
from: sender,
|
|
2347
|
+
suggestedParams: params,
|
|
2348
|
+
appIndex: appId,
|
|
2349
|
+
appArgs,
|
|
2350
|
+
boxes: mainTxnBoxes,
|
|
2351
|
+
foreignApps,
|
|
2352
|
+
note: algosdk_1.default.encodeUint64(id)
|
|
2353
|
+
});
|
|
2354
|
+
const dummyParams = { ...params, fee: 0, flatFee: true };
|
|
2355
|
+
const txns = [matchTxn];
|
|
2356
|
+
let dummyTxnIndex = 1;
|
|
2357
|
+
while (restBoxes.length > 0) {
|
|
2358
|
+
const extBoxes = restBoxes.splice(0, MAX_REFS);
|
|
2359
|
+
txns.push((0, txn_helper_1.makeDummyTxn)(appId, sender, dummyParams, extBoxes, `${id}_${dummyTxnIndex++}`));
|
|
2360
|
+
}
|
|
2361
|
+
return txns;
|
|
2362
|
+
};
|
|
2363
|
+
exports.makeMatchTxns = makeMatchTxns;
|
|
2364
|
+
const makeLoginMsg = (data, signingMessage) => {
|
|
2365
|
+
// const dataBytes = concatArrays([
|
|
2366
|
+
// encode(data.address, 'address', data.chainId),
|
|
2367
|
+
// encode(data.chainId, '8B'),
|
|
2368
|
+
// encode(data.provider, 'str'),
|
|
2369
|
+
// ]);
|
|
2370
|
+
// return makeSigningMessage(data.signingMessage, dataBytes);
|
|
2371
|
+
const { address, technology } = data;
|
|
2372
|
+
return (0, exports.getUtf8EncodedData)(signingMessage || JSON.stringify({ address, technology }));
|
|
2373
|
+
};
|
|
2374
|
+
exports.makeLoginMsg = makeLoginMsg;
|
|
2375
|
+
const makeTradingKeyMsg = ({ tkAddress, loginAddress, loginChainId, expiredDate, type }, addKey = true) => {
|
|
2376
|
+
const titleText = `${addKey ? 'Add' : 'Revoke'} ${type} key: ${tkAddress}`;
|
|
2377
|
+
const expirationText = expiredDate ? `Expires On: ${(0, utils_1.listDateFormat)(expiredDate)}` : `No Expiration`;
|
|
2378
|
+
const prettyData = titleText + (addKey ? '\n' + expirationText : '');
|
|
2379
|
+
const dataBytes = (0, Encoding_1.concatArrays)([
|
|
2380
|
+
(0, exports.encode)(tkAddress, 'address', enums_1.Chains.Algorand),
|
|
2381
|
+
(0, exports.encode)(loginAddress, 'address', loginChainId),
|
|
2382
|
+
(0, exports.encode)(loginChainId, '8B'),
|
|
2383
|
+
(0, exports.encode)(expiredDate || 0, '8B'),
|
|
2384
|
+
]);
|
|
2385
|
+
return (0, exports.makeSigningMessage)(prettyData, dataBytes);
|
|
2386
|
+
};
|
|
2387
|
+
exports.makeTradingKeyMsg = makeTradingKeyMsg;
|
|
2388
|
+
const TK_DATA_BYTES_LENGTH = 108;
|
|
2389
|
+
const decodeTradingKeyMsg = (message, encoding = 'hex') => {
|
|
2390
|
+
const buffer = (0, codex_1.getDataBytesFromMsg)(message, encoding, TK_DATA_BYTES_LENGTH);
|
|
2391
|
+
const chainId = (0, exports.extractUint64)(buffer, 64);
|
|
2392
|
+
const tkData = {
|
|
2393
|
+
tkAddress: (0, exports.extractAddress)(buffer, 0, enums_1.Chains.Algorand),
|
|
2394
|
+
address: (0, exports.extractAddress)(buffer, 32, chainId),
|
|
2395
|
+
chainId,
|
|
2396
|
+
expiredTime: (0, exports.extractUint64)(buffer, 72),
|
|
2397
|
+
};
|
|
2398
|
+
return {
|
|
2399
|
+
...tkData,
|
|
2400
|
+
expiredDate: new Date(tkData.expiredTime)
|
|
2401
|
+
};
|
|
2402
|
+
};
|
|
2403
|
+
exports.decodeTradingKeyMsg = decodeTradingKeyMsg;
|
|
2404
|
+
const makeAddTradingKeyTxn = async (algoClient, appId, superId, sender, { loginAddress, loginChainId, }, message,
|
|
2405
|
+
// encoding: BufferEncoding | undefined,
|
|
2406
|
+
signature) => {
|
|
2407
|
+
const msgArgs = (0, codex_1.getMsgArgs)(message, signature, loginAddress, loginChainId);
|
|
2408
|
+
const appArgs = (0, codex_1.getAppArgs)("manageTradingKey(byte[],byte[],byte[],byte[])uint64", [
|
|
2409
|
+
(0, exports.encode)('add', 'str'),
|
|
2410
|
+
...msgArgs,
|
|
2411
|
+
]);
|
|
2412
|
+
const tkBoxKey = (0, exports.getTradingKeyBoxName)(loginAddress, loginChainId);
|
|
2413
|
+
const params = await (0, algo_helper_1.getTxnParams)(algoClient, 5);
|
|
2414
|
+
const txn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
2415
|
+
from: sender,
|
|
2416
|
+
suggestedParams: params,
|
|
2417
|
+
appIndex: appId,
|
|
2418
|
+
appArgs,
|
|
2419
|
+
boxes: (0, exports.createBoxes)(appId, [
|
|
2420
|
+
tkBoxKey,
|
|
2421
|
+
]),
|
|
2422
|
+
foreignApps: [superId],
|
|
2423
|
+
});
|
|
2424
|
+
return txn;
|
|
2425
|
+
};
|
|
2426
|
+
exports.makeAddTradingKeyTxn = makeAddTradingKeyTxn;
|
|
2427
|
+
const makeRevokeTradingKeyTxn = async (algoClient, appId, superId, sender, { loginAddress, loginChainId, }, message,
|
|
2428
|
+
// encoding: BufferEncoding | undefined,
|
|
2429
|
+
signature) => {
|
|
2430
|
+
const msgArgs = (0, codex_1.getMsgArgs)(message, signature, loginAddress, loginChainId);
|
|
2431
|
+
const appArgs = (0, codex_1.getAppArgs)("manageTradingKey(byte[],byte[],byte[],byte[])uint64", [
|
|
2432
|
+
(0, exports.encode)('delete', 'str'),
|
|
2433
|
+
...msgArgs,
|
|
2434
|
+
]);
|
|
2435
|
+
const boxName = (0, exports.getTradingKeyBoxName)(loginAddress, loginChainId);
|
|
2436
|
+
const txn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
2437
|
+
from: sender,
|
|
2438
|
+
suggestedParams: await (0, algo_helper_1.getTxnParams)(algoClient, 5),
|
|
2439
|
+
appIndex: appId,
|
|
2440
|
+
appArgs,
|
|
2441
|
+
boxes: (0, exports.createBoxes)(appId, [boxName]),
|
|
2442
|
+
foreignApps: [superId],
|
|
2443
|
+
});
|
|
2444
|
+
return txn;
|
|
2445
|
+
};
|
|
2446
|
+
exports.makeRevokeTradingKeyTxn = makeRevokeTradingKeyTxn;
|
|
2447
|
+
const makeSetCollectionWalletMsg = (data) => {
|
|
2448
|
+
const { loginAddress, loginChainId, companyId, } = data;
|
|
2449
|
+
const companyIdBytes = algosdk_1.default.encodeUint64(companyId);
|
|
2450
|
+
const senderBytes = (0, codex_1.encodeAddress)(loginAddress, loginChainId);
|
|
2451
|
+
const chainIdBytes = algosdk_1.default.encodeUint64(loginChainId);
|
|
2452
|
+
const dataBytes = (0, Encoding_1.concatArrays)([senderBytes, chainIdBytes, companyIdBytes]);
|
|
2453
|
+
const messageBytes = new Uint8Array([
|
|
2454
|
+
// ...getUtf8EncodedData(JSON.stringify(data)),
|
|
2455
|
+
...(0, exports.getBase64EncodedData)(dataBytes),
|
|
2456
|
+
]);
|
|
2457
|
+
console.log('MESSAGE LENGTH: ', messageBytes);
|
|
2458
|
+
return messageBytes;
|
|
2459
|
+
};
|
|
2460
|
+
exports.makeSetCollectionWalletMsg = makeSetCollectionWalletMsg;
|
|
2461
|
+
const makeSigningMessage = (jsonData, data) => (0, Encoding_1.concatArrays)([
|
|
2462
|
+
(0, exports.getUtf8EncodedData)(jsonData), (0, exports.getBase64EncodedData)(data)
|
|
2463
|
+
]);
|
|
2464
|
+
exports.makeSigningMessage = makeSigningMessage;
|
|
2465
|
+
const getUtf8EncodedData = (jsonData) => new Uint8Array(Buffer.from((jsonData + '\n'), 'utf-8'));
|
|
2466
|
+
exports.getUtf8EncodedData = getUtf8EncodedData;
|
|
2467
|
+
const getBase64EncodedData = (data) => new Uint8Array(Buffer.from((0, Encoding_1.encodeBase64)(data)));
|
|
2468
|
+
exports.getBase64EncodedData = getBase64EncodedData;
|
|
2469
|
+
const makeWithdrawTxns = async (algoClient, { loginAddress, loginChainId, tokenIndex, recipient, recipientChainId }, message, signature,
|
|
2470
|
+
// encoding: BufferEncoding | undefined,
|
|
2471
|
+
sender, options) => {
|
|
2472
|
+
const msgArgs = (0, codex_1.getMsgArgs)(message, signature, loginAddress, loginChainId);
|
|
2473
|
+
const appArgs = (0, codex_1.getAppArgs)("withdraw(byte[],byte[],byte[])uint64", msgArgs);
|
|
2474
|
+
const isAlgoChain = recipientChainId === enums_1.Chains.Algorand;
|
|
2475
|
+
// TODO: calc actual txn fee
|
|
2476
|
+
// const params = await getTxnParams(algoClient, 7);
|
|
2477
|
+
const params = await (0, algo_helper_1.getTxnParams)(algoClient, isAlgoChain ? 6 : 2);
|
|
2478
|
+
params.fee = params.fee + (algosdk_1.default.ALGORAND_MIN_TX_FEE * 5);
|
|
2479
|
+
const { appId, coreId, lsaAddress, msgProcessorId, unifiedChainId, cctpSupportedChains, superWallet } = options;
|
|
2480
|
+
const accountBoxName = (0, eth_helper_1.keccak256)((0, exports.getAccountBalanceBoxName)(loginAddress, loginChainId, tokenIndex, unifiedChainId || recipientChainId));
|
|
2481
|
+
const superBoxName = (0, eth_helper_1.keccak256)((0, exports.getAccountBalanceBoxName)(superWallet.address, superWallet.chainId, tokenIndex, unifiedChainId || recipientChainId));
|
|
2482
|
+
const boxes = [
|
|
2483
|
+
{ appIndex: appId, name: accountBoxName },
|
|
2484
|
+
{ appIndex: appId, name: superBoxName },
|
|
2485
|
+
];
|
|
2486
|
+
if (!isAlgoChain && !unifiedChainId) {
|
|
2487
|
+
boxes.push({ appIndex: msgProcessorId, name: (0, exports.getTmcBoxName)(recipientChainId) });
|
|
2488
|
+
}
|
|
2489
|
+
if (unifiedChainId) {
|
|
2490
|
+
boxes.push(...cctpSupportedChains.map((chainId) => ([
|
|
2491
|
+
{ appIndex: msgProcessorId, name: (0, exports.getCCTPBalanceBoxName)(String(tokenIndex), chainId) },
|
|
2492
|
+
{ appIndex: msgProcessorId, name: (0, exports.getTmcBoxName)(chainId) },
|
|
2493
|
+
])).flat());
|
|
2494
|
+
}
|
|
2495
|
+
const foreignAssets = isAlgoChain && tokenIndex != 0 ? [+tokenIndex] : undefined;
|
|
2496
|
+
const foreignApps = isAlgoChain ? [coreId] : [coreId, msgProcessorId];
|
|
2497
|
+
const whAddress = algosdk_1.default.getApplicationAddress(coreId);
|
|
2498
|
+
const accounts = [lsaAddress, whAddress];
|
|
2499
|
+
if (isAlgoChain) {
|
|
2500
|
+
accounts.push(recipient);
|
|
2501
|
+
}
|
|
2502
|
+
const txns = (0, txn_helper_1.makeGroupTxnsWithDummy)("withdraw", {
|
|
2503
|
+
appIndex: appId,
|
|
2504
|
+
from: sender,
|
|
2505
|
+
suggestedParams: params,
|
|
2506
|
+
appArgs,
|
|
2507
|
+
accounts,
|
|
2508
|
+
foreignAssets,
|
|
2509
|
+
foreignApps,
|
|
2510
|
+
boxes,
|
|
2511
|
+
note: algosdk_1.default.encodeUint64(Date.now()),
|
|
2512
|
+
});
|
|
2513
|
+
console.log('withdraw txns', txns);
|
|
2514
|
+
return txns;
|
|
2515
|
+
};
|
|
2516
|
+
exports.makeWithdrawTxns = makeWithdrawTxns;
|
|
2517
|
+
const makeSetCollectionWalletTxn = async (algoClient, sender, { message, signature, signerAddress, signerChainId }, appId, superAppId, companyId) => {
|
|
2518
|
+
const msgArgs = (0, codex_1.getMsgArgs)(message, signature, signerAddress, signerChainId);
|
|
2519
|
+
const appArgs = (0, codex_1.getAppArgs)("setCollectionWallet(byte[],byte[],byte[])void", msgArgs);
|
|
2520
|
+
const params = await (0, algo_helper_1.getTxnParams)(algoClient, 4);
|
|
2521
|
+
const boxName = (0, exports.getCompanyBoxName)(companyId);
|
|
2522
|
+
const foreignApps = [superAppId];
|
|
2523
|
+
const appCallTxn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
2524
|
+
appIndex: appId,
|
|
2525
|
+
from: sender,
|
|
2526
|
+
suggestedParams: params,
|
|
2527
|
+
appArgs,
|
|
2528
|
+
foreignApps,
|
|
2529
|
+
boxes: [{ appIndex: appId, name: boxName }],
|
|
2530
|
+
});
|
|
2531
|
+
console.log('setCollectionWallet txn', appCallTxn);
|
|
2532
|
+
return appCallTxn;
|
|
2533
|
+
};
|
|
2534
|
+
exports.makeSetCollectionWalletTxn = makeSetCollectionWalletTxn;
|
|
2535
|
+
const makeSetSuperCollectionWalletTxns = async (algoClient, appId, superId, sender, address, chainId) => {
|
|
2536
|
+
const messageBytes = makeSuperCollectionWalletMsg({ loginAddress: address, loginChainId: chainId });
|
|
2537
|
+
return makeSetGlobalTxn(algoClient, appId, superId, sender, { key: "UL_SUPERADMIN_WALLET", type: "S", value: messageBytes });
|
|
2538
|
+
};
|
|
2539
|
+
exports.makeSetSuperCollectionWalletTxns = makeSetSuperCollectionWalletTxns;
|
|
2540
|
+
const makeSetSuperAppTxns = async (algoClient, appId, superId, sender, superAppId) => {
|
|
2541
|
+
const message = (0, exports.encode)(superAppId, "8B");
|
|
2542
|
+
return makeSetGlobalTxn(algoClient, appId, superId, sender, { key: "UL_SUPERADMIN_APP", type: "N", value: message });
|
|
2543
|
+
};
|
|
2544
|
+
exports.makeSetSuperAppTxns = makeSetSuperAppTxns;
|
|
2545
|
+
const makeSetGlobalTxn = async (algoClient, appId, superId, sender, data) => {
|
|
2546
|
+
const { key, type, value } = data;
|
|
2547
|
+
const appArgs = (0, codex_1.getAppArgs)("setGlobal(byte[],byte[],byte[])void", [(0, Encoding_1.encodeString)(key), value, (0, Encoding_1.encodeString)(type)]);
|
|
2548
|
+
const params = await (0, algo_helper_1.getTxnParams)(algoClient, 6);
|
|
2549
|
+
const foreignApps = [superId];
|
|
2550
|
+
const appCallTxn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
2551
|
+
appIndex: appId,
|
|
2552
|
+
from: sender,
|
|
2553
|
+
suggestedParams: params,
|
|
2554
|
+
appArgs,
|
|
2555
|
+
foreignApps,
|
|
2556
|
+
});
|
|
2557
|
+
return appCallTxn;
|
|
2558
|
+
};
|
|
2559
|
+
const makeSetCompanyFeeTxn = async (algoClient, { fee, feeType, companyId }, sender, appId, superAppId) => {
|
|
2560
|
+
const appArgs = (0, codex_1.getAppArgs)("setCompanyFee(uint64,uint64,byte[])void", [fee, companyId, (0, Encoding_1.encodeString)(feeType)]);
|
|
2561
|
+
const params = await (0, algo_helper_1.getTxnParams)(algoClient, 1);
|
|
2562
|
+
const boxName = (0, exports.getCompanyBoxName)(companyId);
|
|
2563
|
+
const foreignApps = [superAppId];
|
|
2564
|
+
const appCallTxn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
2565
|
+
appIndex: appId,
|
|
2566
|
+
from: sender,
|
|
2567
|
+
suggestedParams: params,
|
|
2568
|
+
appArgs,
|
|
2569
|
+
boxes: [{ appIndex: appId, name: boxName }],
|
|
2570
|
+
foreignApps,
|
|
2571
|
+
});
|
|
2572
|
+
console.log('setCompanyFee txn', appCallTxn);
|
|
2573
|
+
return appCallTxn;
|
|
2574
|
+
};
|
|
2575
|
+
exports.makeSetCompanyFeeTxn = makeSetCompanyFeeTxn;
|
|
2576
|
+
const makeUpdateTokenInfoTxns = (appId, superId, sender, params, balances, token) => {
|
|
2577
|
+
const tokenBoxKey = (0, exports.getTokenBoxKey)(token);
|
|
2578
|
+
const msgArgs = [
|
|
2579
|
+
(0, exports.encode)(token.address, 'token', token.chainId),
|
|
2580
|
+
token.chainId,
|
|
2581
|
+
(0, exports.encode)(token.name, 'str'),
|
|
2582
|
+
token.decimal,
|
|
2583
|
+
];
|
|
2584
|
+
const appArgs = (0, codex_1.getAppArgs)("updateTokenInfo(byte[],uint64,byte[],uint64)uint64", msgArgs);
|
|
2585
|
+
const tokenTxn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
2586
|
+
from: sender,
|
|
2587
|
+
suggestedParams: params,
|
|
2588
|
+
appIndex: appId,
|
|
2589
|
+
appArgs,
|
|
2590
|
+
boxes: (0, exports.createBoxes)(appId, [
|
|
2591
|
+
tokenBoxKey,
|
|
2592
|
+
]),
|
|
2593
|
+
foreignApps: [superId],
|
|
2594
|
+
});
|
|
2595
|
+
const txns = [tokenTxn];
|
|
2596
|
+
const optInTxn = (0, exports.makeAssetOptInTxn)(appId, superId, sender, params, balances, token);
|
|
2597
|
+
if (optInTxn) {
|
|
2598
|
+
txns.unshift(optInTxn);
|
|
2599
|
+
}
|
|
2600
|
+
return txns;
|
|
2601
|
+
};
|
|
2602
|
+
exports.makeUpdateTokenInfoTxns = makeUpdateTokenInfoTxns;
|
|
2603
|
+
const makeUpdatePairInfoTxn = (appId, superId, sender, params, baseToken, priceToken, minSize, minPriceIncrement, minSizeIncrement) => {
|
|
2604
|
+
const baseTokenBoxKey = (0, exports.getTokenBoxKey)(baseToken);
|
|
2605
|
+
const priceTokenBoxKey = (0, exports.getTokenBoxKey)(priceToken);
|
|
2606
|
+
const pairBoxKey = (0, exports.getPairBoxKey)(baseToken, priceToken);
|
|
2607
|
+
const appArgs = (0, codex_1.getAppArgs)("updatePairInfo(byte[],uint64,byte[],uint64,byte[],byte[],byte[])uint64", [
|
|
2608
|
+
(0, exports.encode)(baseToken.address, 'token', baseToken.chainId),
|
|
2609
|
+
baseToken.chainId,
|
|
2610
|
+
(0, exports.encode)(priceToken.address, 'token', priceToken.chainId),
|
|
2611
|
+
priceToken.chainId,
|
|
2612
|
+
(0, exports.encode)(minSize, '32B'),
|
|
2613
|
+
(0, exports.encode)(minPriceIncrement, '32B'),
|
|
2614
|
+
(0, exports.encode)(minSizeIncrement, '32B'),
|
|
2615
|
+
]);
|
|
2616
|
+
const txn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
2617
|
+
from: sender,
|
|
2618
|
+
suggestedParams: params,
|
|
2619
|
+
appIndex: appId,
|
|
2620
|
+
appArgs,
|
|
2621
|
+
boxes: (0, exports.createBoxes)(appId, [
|
|
2622
|
+
pairBoxKey,
|
|
2623
|
+
baseTokenBoxKey,
|
|
2624
|
+
priceTokenBoxKey,
|
|
2625
|
+
]),
|
|
2626
|
+
foreignApps: [superId],
|
|
2627
|
+
});
|
|
2628
|
+
return txn;
|
|
2629
|
+
};
|
|
2630
|
+
exports.makeUpdatePairInfoTxn = makeUpdatePairInfoTxn;
|
|
2631
|
+
const getUpgradeImpMsg = (chainId, implementationAddress) => {
|
|
2632
|
+
return (0, Encoding_1.concatArrays)([
|
|
2633
|
+
(0, exports.encode)('upgradee', "str"),
|
|
2634
|
+
(0, exports.encode)(chainId, '8B'),
|
|
2635
|
+
(0, codex_1.encodeAddress)(implementationAddress, chainId),
|
|
2636
|
+
(0, exports.encode)(0, '8B'),
|
|
2637
|
+
]);
|
|
2638
|
+
};
|
|
2639
|
+
exports.getUpgradeImpMsg = getUpgradeImpMsg;
|
|
2640
|
+
|
|
2641
|
+
|
|
2642
|
+
/***/ }),
|
|
2643
|
+
|
|
2644
|
+
/***/ 4132:
|
|
2645
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
2646
|
+
|
|
2647
|
+
|
|
2648
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2649
|
+
exports.MarketMakerSortByEnum = exports.MarketMakerRebateTier = void 0;
|
|
2650
|
+
var MarketMakerRebateTier;
|
|
2651
|
+
(function (MarketMakerRebateTier) {
|
|
2652
|
+
MarketMakerRebateTier[MarketMakerRebateTier["FIRST"] = 1] = "FIRST";
|
|
2653
|
+
MarketMakerRebateTier[MarketMakerRebateTier["SECOND"] = 2] = "SECOND";
|
|
2654
|
+
MarketMakerRebateTier[MarketMakerRebateTier["THIRD"] = 3] = "THIRD";
|
|
2655
|
+
MarketMakerRebateTier[MarketMakerRebateTier["FOURTH"] = 4] = "FOURTH";
|
|
2656
|
+
})(MarketMakerRebateTier || (exports.MarketMakerRebateTier = MarketMakerRebateTier = {}));
|
|
2657
|
+
var MarketMakerSortByEnum;
|
|
2658
|
+
(function (MarketMakerSortByEnum) {
|
|
2659
|
+
MarketMakerSortByEnum["REBATE_TIER"] = "rebateTier";
|
|
2660
|
+
MarketMakerSortByEnum["CREATED_AT"] = "createdAt";
|
|
2661
|
+
MarketMakerSortByEnum["NAME"] = "name";
|
|
2662
|
+
MarketMakerSortByEnum["TAKER_FEE"] = "takerFee";
|
|
2663
|
+
MarketMakerSortByEnum["ENABLED"] = "enabled";
|
|
2664
|
+
MarketMakerSortByEnum["ADDRESS"] = "address";
|
|
2665
|
+
MarketMakerSortByEnum["CHAIN"] = "chainId";
|
|
2666
|
+
})(MarketMakerSortByEnum || (exports.MarketMakerSortByEnum = MarketMakerSortByEnum = {}));
|
|
2667
|
+
|
|
2668
|
+
|
|
2669
|
+
/***/ }),
|
|
2670
|
+
|
|
2671
|
+
/***/ 4199:
|
|
2672
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
2673
|
+
|
|
2674
|
+
|
|
2675
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2676
|
+
exports.ScheduledNotificationStatusEnum = exports.NotificationStatusEnum = exports.NotificationPriorityEnum = exports.CombinedNotificationEnum = exports.AccountNotificationEnum = exports.GlobalNotificationEnum = void 0;
|
|
2677
|
+
var GlobalNotificationEnum;
|
|
2678
|
+
(function (GlobalNotificationEnum) {
|
|
2679
|
+
GlobalNotificationEnum["GLOBAL_PAIR_DELISTING"] = "GLOBAL_PAIR_DELISTING";
|
|
2680
|
+
GlobalNotificationEnum["GLOBAL_NEW_PAIR_LISTING"] = "GLOBAL_NEW_PAIR_LISTING";
|
|
2681
|
+
GlobalNotificationEnum["GLOBAL_SYSTEM_MAINTENANCE"] = "GLOBAL_SYSTEM_MAINTENANCE";
|
|
2682
|
+
GlobalNotificationEnum["GLOBAL_SMART_CONTRACT_UPDATE"] = "GLOBAL_SMART_CONTRACT_UPDATE";
|
|
2683
|
+
})(GlobalNotificationEnum || (exports.GlobalNotificationEnum = GlobalNotificationEnum = {}));
|
|
2684
|
+
var AccountNotificationEnum;
|
|
2685
|
+
(function (AccountNotificationEnum) {
|
|
2686
|
+
AccountNotificationEnum["ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT"] = "ACCOUNT_POINTS_UNLOCK_ACHIEVEMENT";
|
|
2687
|
+
AccountNotificationEnum["ACCOUNT_KYC_STATUS_CHANGED"] = "ACCOUNT_KYC_STATUS_CHANGED";
|
|
2688
|
+
AccountNotificationEnum["ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED"] = "ACCOUNT_AFFILIATE_DASHBOARD_UNLOCKED";
|
|
2689
|
+
})(AccountNotificationEnum || (exports.AccountNotificationEnum = AccountNotificationEnum = {}));
|
|
2690
|
+
exports.CombinedNotificationEnum = {
|
|
2691
|
+
...GlobalNotificationEnum,
|
|
2692
|
+
...AccountNotificationEnum,
|
|
2693
|
+
};
|
|
2694
|
+
var NotificationPriorityEnum;
|
|
2695
|
+
(function (NotificationPriorityEnum) {
|
|
2696
|
+
NotificationPriorityEnum["CRITICAL"] = "CRITICAL";
|
|
2697
|
+
NotificationPriorityEnum["IMPORTANT"] = "IMPORTANT";
|
|
2698
|
+
NotificationPriorityEnum["INFO"] = "INFO";
|
|
2699
|
+
})(NotificationPriorityEnum || (exports.NotificationPriorityEnum = NotificationPriorityEnum = {}));
|
|
2700
|
+
var NotificationStatusEnum;
|
|
2701
|
+
(function (NotificationStatusEnum) {
|
|
2702
|
+
NotificationStatusEnum["UNREAD"] = "UNREAD";
|
|
2703
|
+
NotificationStatusEnum["READ"] = "READ";
|
|
2704
|
+
})(NotificationStatusEnum || (exports.NotificationStatusEnum = NotificationStatusEnum = {}));
|
|
2705
|
+
var ScheduledNotificationStatusEnum;
|
|
2706
|
+
(function (ScheduledNotificationStatusEnum) {
|
|
2707
|
+
ScheduledNotificationStatusEnum["PENDING"] = "PENDING";
|
|
2708
|
+
ScheduledNotificationStatusEnum["PROCESSED"] = "PROCESSED";
|
|
2709
|
+
ScheduledNotificationStatusEnum["FAILED"] = "FAILED";
|
|
2710
|
+
})(ScheduledNotificationStatusEnum || (exports.ScheduledNotificationStatusEnum = ScheduledNotificationStatusEnum = {}));
|
|
2711
|
+
|
|
2712
|
+
|
|
2713
|
+
/***/ }),
|
|
2714
|
+
|
|
2715
|
+
/***/ 4574:
|
|
2716
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
2717
|
+
|
|
2718
|
+
|
|
2719
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2720
|
+
exports.messageForSigning = void 0;
|
|
2721
|
+
const messageForSigning = (signingAddress) => `By signing this message, you confirm that the wallet is a trusted one ${signingAddress}; Data: `;
|
|
2722
|
+
exports.messageForSigning = messageForSigning;
|
|
2723
|
+
|
|
2724
|
+
|
|
2725
|
+
/***/ }),
|
|
2726
|
+
|
|
2727
|
+
/***/ 4578:
|
|
2728
|
+
/***/ ((module) => {
|
|
2729
|
+
|
|
2730
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__4578__;
|
|
2731
|
+
|
|
2732
|
+
/***/ }),
|
|
2733
|
+
|
|
2734
|
+
/***/ 5237:
|
|
2735
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
2736
|
+
|
|
2737
|
+
|
|
2738
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2739
|
+
exports.UpgradeStatus = void 0;
|
|
2740
|
+
var UpgradeStatus;
|
|
2741
|
+
(function (UpgradeStatus) {
|
|
2742
|
+
UpgradeStatus["SUCCESS"] = "success";
|
|
2743
|
+
UpgradeStatus["FAILED"] = "failed";
|
|
2744
|
+
UpgradeStatus["PENDING"] = "pending";
|
|
2745
|
+
})(UpgradeStatus || (exports.UpgradeStatus = UpgradeStatus = {}));
|
|
2746
|
+
|
|
2747
|
+
|
|
2748
|
+
/***/ }),
|
|
2749
|
+
|
|
2750
|
+
/***/ 5386:
|
|
2751
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
2752
|
+
|
|
2753
|
+
|
|
2754
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2755
|
+
|
|
2756
|
+
|
|
2757
|
+
/***/ }),
|
|
2758
|
+
|
|
2759
|
+
/***/ 5882:
|
|
2760
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2761
|
+
|
|
2762
|
+
|
|
2763
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2764
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2765
|
+
};
|
|
2766
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2767
|
+
exports.makeRemoveExpiredOrderTxn = exports.calcOrderHash = exports.getOrderBoxKeyFromHash = exports.getOrderBoxKey = exports.getOrderBytesFromMsg = void 0;
|
|
2768
|
+
const algosdk_1 = __importDefault(__webpack_require__(9709));
|
|
2769
|
+
const common_helper_1 = __webpack_require__(223);
|
|
2770
|
+
const Encoding_1 = __webpack_require__(8593);
|
|
2771
|
+
const constants_1 = __webpack_require__(6450);
|
|
2772
|
+
const codex_helper_1 = __webpack_require__(3955);
|
|
2773
|
+
const getOrderBytesFromMsg = (message, encoding = 'hex') => {
|
|
2774
|
+
return (0, common_helper_1.getDataBytesFromMsg)(message, encoding, constants_1.ORDER_DATA_BYTES_LENGTH);
|
|
2775
|
+
};
|
|
2776
|
+
exports.getOrderBytesFromMsg = getOrderBytesFromMsg;
|
|
2777
|
+
const getOrderBoxKey = (message, encoding) => {
|
|
2778
|
+
return (0, common_helper_1.getBoxKey)((0, exports.getOrderBytesFromMsg)(message, encoding), "O_");
|
|
2779
|
+
};
|
|
2780
|
+
exports.getOrderBoxKey = getOrderBoxKey;
|
|
2781
|
+
const getOrderBoxKeyFromHash = (hash) => (0, common_helper_1.getBoxKeyFromHash)(hash, 'O_');
|
|
2782
|
+
exports.getOrderBoxKeyFromHash = getOrderBoxKeyFromHash;
|
|
2783
|
+
const calcOrderHash = (message) => {
|
|
2784
|
+
return (0, common_helper_1.generateHash)((0, exports.getOrderBytesFromMsg)(message, "hex"));
|
|
2785
|
+
};
|
|
2786
|
+
exports.calcOrderHash = calcOrderHash;
|
|
2787
|
+
const makeRemoveExpiredOrderTxn = (sender, appId, params, hashes, foreignApps = []) => {
|
|
2788
|
+
const boxKeys = hashes.map(o => (0, exports.getOrderBoxKeyFromHash)(o));
|
|
2789
|
+
console.log('makeRemoveExpiredOrderTxn => boxKeys', JSON.stringify(boxKeys.map(o => Buffer.from(o).toString('hex'))));
|
|
2790
|
+
const boxes = boxKeys.map(o => ({ appIndex: appId, name: o }));
|
|
2791
|
+
const appArgs = (0, common_helper_1.getAppArgs)("removeExpiredData(byte[],byte[])uint64", [(0, codex_helper_1.encode)('O_', 'str'), (0, Encoding_1.concatArrays)(boxKeys)]);
|
|
2792
|
+
const appCallTxn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
2793
|
+
appIndex: appId,
|
|
2794
|
+
from: sender,
|
|
2795
|
+
suggestedParams: params,
|
|
2796
|
+
appArgs,
|
|
2797
|
+
boxes,
|
|
2798
|
+
foreignApps,
|
|
2799
|
+
});
|
|
2800
|
+
return appCallTxn;
|
|
2801
|
+
};
|
|
2802
|
+
exports.makeRemoveExpiredOrderTxn = makeRemoveExpiredOrderTxn;
|
|
2803
|
+
|
|
2804
|
+
|
|
2805
|
+
/***/ }),
|
|
2806
|
+
|
|
2807
|
+
/***/ 5910:
|
|
2808
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2812
|
+
exports.getDatepartValue = getDatepartValue;
|
|
2813
|
+
exports.identityDatepart = identityDatepart;
|
|
2814
|
+
exports.inMinCandles = inMinCandles;
|
|
2815
|
+
exports.inHourCandles = inHourCandles;
|
|
2816
|
+
const intervalRegex = {
|
|
2817
|
+
hour: /(\d+)[H]/i,
|
|
2818
|
+
day: /(\d+)[D]/i,
|
|
2819
|
+
week: /(\d+)[W]/i,
|
|
2820
|
+
month: /(\d+)[M]/i,
|
|
2821
|
+
year: /(\d+)[Y]/i,
|
|
2822
|
+
};
|
|
2823
|
+
function getDatepartValue(value) {
|
|
2824
|
+
const datepart = identityDatepart(value);
|
|
2825
|
+
if (datepart === null) {
|
|
2826
|
+
throw new Error(`Cannot fetch datepart from interval: ${value}`);
|
|
2827
|
+
}
|
|
2828
|
+
const units = datepart === 'minute' ? Number(value) : Number(value.slice(0, -1));
|
|
2829
|
+
if (!units) {
|
|
2830
|
+
return mapWithTimeframe(datepart, 1);
|
|
2831
|
+
}
|
|
2832
|
+
if (datepart === 'minute' && units % (7 * 24 * 60) === 0) { // week
|
|
2833
|
+
return mapWithTimeframe('week', units / (7 * 24 * 60));
|
|
2834
|
+
}
|
|
2835
|
+
if (datepart === 'minute' && units % (24 * 60) === 0) { // day
|
|
2836
|
+
return mapWithTimeframe('day', units / (24 * 60));
|
|
2837
|
+
}
|
|
2838
|
+
if (datepart === 'minute' && units % 60 === 0) { // hour
|
|
2839
|
+
return mapWithTimeframe('hour', units / 60);
|
|
2840
|
+
}
|
|
2841
|
+
if (datepart === 'hour' && units % (7 * 24) === 0) { // week
|
|
2842
|
+
return mapWithTimeframe('week', units / (7 * 24));
|
|
2843
|
+
}
|
|
2844
|
+
if (datepart === 'hour' && units % 24 === 0) { // day
|
|
2845
|
+
return mapWithTimeframe(units === 24 ? 'hour' : 'day', units === 24 ? 24 : units / 24);
|
|
2846
|
+
}
|
|
2847
|
+
if (datepart === 'day' && units % 7 === 0) { // week
|
|
2848
|
+
return mapWithTimeframe('week', units / 7);
|
|
2849
|
+
}
|
|
2850
|
+
if (datepart === 'month' && units % 12 === 0) { // year
|
|
2851
|
+
return mapWithTimeframe('year', units / 12);
|
|
2852
|
+
}
|
|
2853
|
+
return mapWithTimeframe(datepart, units);
|
|
2854
|
+
}
|
|
2855
|
+
function identityDatepart(interval) {
|
|
2856
|
+
if (!isNaN(Number(interval))) {
|
|
2857
|
+
return 'minute';
|
|
2858
|
+
}
|
|
2859
|
+
const lastLetter = interval.slice(-1);
|
|
2860
|
+
const value = `1${lastLetter}`;
|
|
2861
|
+
switch (true) {
|
|
2862
|
+
case intervalRegex.hour.test(value): return 'hour';
|
|
2863
|
+
case intervalRegex.day.test(value): return 'day';
|
|
2864
|
+
case intervalRegex.week.test(value): return 'week';
|
|
2865
|
+
case intervalRegex.month.test(value): return 'month';
|
|
2866
|
+
case intervalRegex.year.test(value): return 'year';
|
|
2867
|
+
default: return null;
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
function mapWithTimeframe(datepart, value) {
|
|
2871
|
+
return { datepart, value, timeframe: mapDatepartToTimeframe(datepart, value) };
|
|
2872
|
+
}
|
|
2873
|
+
function inMinCandles(value) {
|
|
2874
|
+
return [1, 3, 5, 15, 30].includes(value);
|
|
2875
|
+
}
|
|
2876
|
+
function inHourCandles(value) {
|
|
2877
|
+
return [1, 2, 3, 4, 12].includes(value);
|
|
2878
|
+
}
|
|
2879
|
+
function mapDatepartToTimeframe(datepart, value) {
|
|
2880
|
+
switch (datepart) {
|
|
2881
|
+
case 'minute':
|
|
2882
|
+
return inMinCandles(value) ? `${value}m` : '1m';
|
|
2883
|
+
case 'hour':
|
|
2884
|
+
return inHourCandles(value) ? `${value}h` : '1h';
|
|
2885
|
+
case 'day':
|
|
2886
|
+
return `1d`;
|
|
2887
|
+
case 'week':
|
|
2888
|
+
return `1w`;
|
|
2889
|
+
case 'month':
|
|
2890
|
+
return `1M`;
|
|
2891
|
+
case 'year':
|
|
2892
|
+
return `1Y`;
|
|
2893
|
+
default:
|
|
2894
|
+
throw new Error(`Unsupported datepart: ${datepart}`);
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
|
|
2898
|
+
|
|
2899
|
+
/***/ }),
|
|
2900
|
+
|
|
2901
|
+
/***/ 6119:
|
|
2902
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
2903
|
+
|
|
2904
|
+
|
|
2905
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2906
|
+
exports.TwitterAccessScopeEnum = void 0;
|
|
2907
|
+
var TwitterAccessScopeEnum;
|
|
2908
|
+
(function (TwitterAccessScopeEnum) {
|
|
2909
|
+
TwitterAccessScopeEnum["USERS_READ"] = "users.read";
|
|
2910
|
+
TwitterAccessScopeEnum["FOLLOWS_READ"] = "follows.read";
|
|
2911
|
+
TwitterAccessScopeEnum["FOLLOWS_WRITE"] = "follows.write";
|
|
2912
|
+
TwitterAccessScopeEnum["TWEET_READ"] = "tweet.read";
|
|
2913
|
+
TwitterAccessScopeEnum["TWEET_WRITE"] = "tweet.write";
|
|
2914
|
+
TwitterAccessScopeEnum["OFFLINE_ACCESS"] = "offline.access";
|
|
2915
|
+
TwitterAccessScopeEnum["LIKE_READ"] = "like.read";
|
|
2916
|
+
TwitterAccessScopeEnum["LIKE_WRITE"] = "like.write";
|
|
2917
|
+
})(TwitterAccessScopeEnum || (exports.TwitterAccessScopeEnum = TwitterAccessScopeEnum = {}));
|
|
2918
|
+
|
|
2919
|
+
|
|
2920
|
+
/***/ }),
|
|
2921
|
+
|
|
2922
|
+
/***/ 6168:
|
|
2923
|
+
/***/ ((module) => {
|
|
2924
|
+
|
|
2925
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__6168__;
|
|
2926
|
+
|
|
2927
|
+
/***/ }),
|
|
2928
|
+
|
|
2929
|
+
/***/ 6450:
|
|
2930
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2931
|
+
|
|
2932
|
+
|
|
2933
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2934
|
+
if (k2 === undefined) k2 = k;
|
|
2935
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2936
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
2937
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
2938
|
+
}
|
|
2939
|
+
Object.defineProperty(o, k2, desc);
|
|
2940
|
+
}) : (function(o, m, k, k2) {
|
|
2941
|
+
if (k2 === undefined) k2 = k;
|
|
2942
|
+
o[k2] = m[k];
|
|
2943
|
+
}));
|
|
2944
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
2945
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2946
|
+
};
|
|
2947
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2948
|
+
__exportStar(__webpack_require__(2806), exports);
|
|
2949
|
+
__exportStar(__webpack_require__(661), exports);
|
|
2950
|
+
__exportStar(__webpack_require__(9862), exports);
|
|
2951
|
+
__exportStar(__webpack_require__(935), exports);
|
|
2952
|
+
__exportStar(__webpack_require__(7801), exports);
|
|
2953
|
+
__exportStar(__webpack_require__(2169), exports);
|
|
2954
|
+
__exportStar(__webpack_require__(4574), exports);
|
|
2955
|
+
|
|
2956
|
+
|
|
2957
|
+
/***/ }),
|
|
2958
|
+
|
|
2959
|
+
/***/ 6828:
|
|
2960
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
2961
|
+
|
|
2962
|
+
|
|
2963
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2964
|
+
exports.KYCAuthenticationStatus = exports.LastLookAction = exports.FeeTier = void 0;
|
|
2965
|
+
var FeeTier;
|
|
2966
|
+
(function (FeeTier) {
|
|
2967
|
+
FeeTier[FeeTier["FEE_TIER_1"] = 1] = "FEE_TIER_1";
|
|
2968
|
+
FeeTier[FeeTier["FEE_TIER_2"] = 2] = "FEE_TIER_2";
|
|
2969
|
+
FeeTier[FeeTier["FEE_TIER_3"] = 3] = "FEE_TIER_3";
|
|
2970
|
+
FeeTier[FeeTier["FEE_TIER_4"] = 4] = "FEE_TIER_4";
|
|
2971
|
+
FeeTier[FeeTier["FEE_TIER_5"] = 5] = "FEE_TIER_5";
|
|
2972
|
+
FeeTier[FeeTier["FEE_TIER_6"] = 6] = "FEE_TIER_6";
|
|
2973
|
+
})(FeeTier || (exports.FeeTier = FeeTier = {}));
|
|
2974
|
+
var LastLookAction;
|
|
2975
|
+
(function (LastLookAction) {
|
|
2976
|
+
LastLookAction[LastLookAction["Approve"] = 1] = "Approve";
|
|
2977
|
+
LastLookAction[LastLookAction["Reject"] = 0] = "Reject";
|
|
2978
|
+
})(LastLookAction || (exports.LastLookAction = LastLookAction = {}));
|
|
2979
|
+
var KYCAuthenticationStatus;
|
|
2980
|
+
(function (KYCAuthenticationStatus) {
|
|
2981
|
+
KYCAuthenticationStatus["INITIATED"] = "INITIATED";
|
|
2982
|
+
KYCAuthenticationStatus["CREATED"] = "CREATED";
|
|
2983
|
+
KYCAuthenticationStatus["PROCESSING"] = "PROCESSING";
|
|
2984
|
+
KYCAuthenticationStatus["APPROVED"] = "APPROVED";
|
|
2985
|
+
KYCAuthenticationStatus["REJECTED"] = "REJECTED";
|
|
2986
|
+
})(KYCAuthenticationStatus || (exports.KYCAuthenticationStatus = KYCAuthenticationStatus = {}));
|
|
2987
|
+
|
|
2988
|
+
|
|
2989
|
+
/***/ }),
|
|
2990
|
+
|
|
2991
|
+
/***/ 6897:
|
|
2992
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2993
|
+
|
|
2994
|
+
|
|
2995
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2996
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2997
|
+
};
|
|
2998
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2999
|
+
exports.verifySignature = exports.decodeAndNormalizeAddress = exports.isAssetOptedIn = exports.getTxnParams = exports.getBoxByName = exports.getAppBoxes = exports.getAppGlobalState = exports.getAccountAssetBalances = exports.createBoxes = void 0;
|
|
3000
|
+
exports.decodeStateArray = decodeStateArray;
|
|
3001
|
+
const algosdk_1 = __importDefault(__webpack_require__(9709));
|
|
3002
|
+
const Encoding_1 = __webpack_require__(8593);
|
|
3003
|
+
const helpers_1 = __webpack_require__(9730);
|
|
3004
|
+
const createBoxes = (appIndex, foreignApps) => {
|
|
3005
|
+
const boxes = foreignApps.map((wlpIndex) => ({
|
|
3006
|
+
appIndex,
|
|
3007
|
+
name: (0, Encoding_1.concatArrays)((0, Encoding_1.encodeArgArray)(["WLP_", wlpIndex]))
|
|
3008
|
+
}));
|
|
3009
|
+
return boxes;
|
|
3010
|
+
};
|
|
3011
|
+
exports.createBoxes = createBoxes;
|
|
3012
|
+
function decodeStateArray(stateArray) {
|
|
3013
|
+
const state = {};
|
|
3014
|
+
stateArray.forEach((row) => {
|
|
3015
|
+
const key = (0, Encoding_1.decodeBase64)(row['key']).toString();
|
|
3016
|
+
let value = row['value'];
|
|
3017
|
+
const valueType = value['type'];
|
|
3018
|
+
if (valueType == 2)
|
|
3019
|
+
value = value['uint'];
|
|
3020
|
+
if (valueType == 1)
|
|
3021
|
+
value = (0, Encoding_1.decodeBase64)(value['bytes']);
|
|
3022
|
+
if (key == 'gov') {
|
|
3023
|
+
state['gov'] = (0, Encoding_1.encodeAddress)(value);
|
|
3024
|
+
}
|
|
3025
|
+
else {
|
|
3026
|
+
state[key] = value;
|
|
3027
|
+
}
|
|
3028
|
+
});
|
|
3029
|
+
return (0, helpers_1.sortKeysInObject)(state);
|
|
3030
|
+
}
|
|
3031
|
+
const getAccountAssetBalances = (accountInfo) => {
|
|
3032
|
+
const balances = {
|
|
3033
|
+
'0': accountInfo['amount']
|
|
3034
|
+
};
|
|
3035
|
+
const assets = accountInfo['assets'];
|
|
3036
|
+
for (let i = 0; i < assets.length; i++) {
|
|
3037
|
+
const assetId = assets[i]['asset-id'];
|
|
3038
|
+
const assetAmt = assets[i]['amount'];
|
|
3039
|
+
balances[assetId] = assetAmt;
|
|
3040
|
+
}
|
|
3041
|
+
console.log(`Account ${accountInfo.address} balances`, JSON.stringify(balances));
|
|
3042
|
+
return balances;
|
|
3043
|
+
};
|
|
3044
|
+
exports.getAccountAssetBalances = getAccountAssetBalances;
|
|
3045
|
+
const getAppGlobalState = async (algodClient, appId) => {
|
|
3046
|
+
const app = await algodClient.getApplicationByID(appId).do();
|
|
3047
|
+
const globalState = decodeStateArray(app['params']['global-state']);
|
|
3048
|
+
return globalState;
|
|
3049
|
+
};
|
|
3050
|
+
exports.getAppGlobalState = getAppGlobalState;
|
|
3051
|
+
const getAppBoxes = async (algodClient, appId) => {
|
|
3052
|
+
const { boxes } = await algodClient.getApplicationBoxes(appId).do();
|
|
3053
|
+
console.log('boxes', appId, boxes
|
|
3054
|
+
.map(o => o.name)
|
|
3055
|
+
.filter(o => o.length === 32)
|
|
3056
|
+
.map(o => Buffer.from(o).toString('base64')));
|
|
3057
|
+
};
|
|
3058
|
+
exports.getAppBoxes = getAppBoxes;
|
|
3059
|
+
const getBoxByName = async (algoClient, appId, boxName) => {
|
|
3060
|
+
try {
|
|
3061
|
+
// console.log('Get box by name', boxName);
|
|
3062
|
+
const { value } = await algoClient.getApplicationBoxByName(appId, boxName).do();
|
|
3063
|
+
const box = value;
|
|
3064
|
+
return box;
|
|
3065
|
+
}
|
|
3066
|
+
catch (error) {
|
|
3067
|
+
if (error.message.includes('box not found')) {
|
|
3068
|
+
console.log(`Box not found '${Buffer.from(boxName).toString('hex')}'`);
|
|
3069
|
+
return null;
|
|
3070
|
+
}
|
|
3071
|
+
throw error;
|
|
3072
|
+
}
|
|
3073
|
+
};
|
|
3074
|
+
exports.getBoxByName = getBoxByName;
|
|
3075
|
+
const getTxnParams = async (algoClient, txnsCount = 1) => {
|
|
3076
|
+
const params = await algoClient.getTransactionParams().do();
|
|
3077
|
+
if (txnsCount > 1) {
|
|
3078
|
+
params.fee = algosdk_1.default.ALGORAND_MIN_TX_FEE * txnsCount;
|
|
3079
|
+
params.flatFee = true;
|
|
3080
|
+
}
|
|
3081
|
+
return { ...params };
|
|
3082
|
+
};
|
|
3083
|
+
exports.getTxnParams = getTxnParams;
|
|
3084
|
+
const isAssetOptedIn = (balances, assetId) => {
|
|
3085
|
+
return Object.keys(balances).includes(assetId.toString());
|
|
3086
|
+
};
|
|
3087
|
+
exports.isAssetOptedIn = isAssetOptedIn;
|
|
3088
|
+
const decodeAndNormalizeAddress = (address) => algosdk_1.default.decodeAddress(address.toUpperCase()).publicKey;
|
|
3089
|
+
exports.decodeAndNormalizeAddress = decodeAndNormalizeAddress;
|
|
3090
|
+
const verifySignature = (signature, address, message, encoding) => {
|
|
3091
|
+
return algosdk_1.default.verifyBytes(new Uint8Array(Buffer.from(message, encoding)), (0, Encoding_1.decodeBase64)(signature), address);
|
|
3092
|
+
};
|
|
3093
|
+
exports.verifySignature = verifySignature;
|
|
3094
|
+
|
|
3095
|
+
|
|
3096
|
+
/***/ }),
|
|
3097
|
+
|
|
3098
|
+
/***/ 6978:
|
|
3099
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3100
|
+
|
|
3101
|
+
|
|
3102
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3103
|
+
exports.MaintenanceMode = void 0;
|
|
3104
|
+
var MaintenanceMode;
|
|
3105
|
+
(function (MaintenanceMode) {
|
|
3106
|
+
MaintenanceMode[MaintenanceMode["Off"] = 0] = "Off";
|
|
3107
|
+
MaintenanceMode[MaintenanceMode["Full"] = 1] = "Full";
|
|
3108
|
+
MaintenanceMode[MaintenanceMode["Partial"] = 2] = "Partial";
|
|
3109
|
+
MaintenanceMode[MaintenanceMode["Scheduled"] = 3] = "Scheduled";
|
|
3110
|
+
})(MaintenanceMode || (exports.MaintenanceMode = MaintenanceMode = {}));
|
|
3111
|
+
|
|
3112
|
+
|
|
3113
|
+
/***/ }),
|
|
3114
|
+
|
|
3115
|
+
/***/ 7114:
|
|
3116
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3117
|
+
|
|
3118
|
+
|
|
3119
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3120
|
+
|
|
3121
|
+
|
|
3122
|
+
/***/ }),
|
|
3123
|
+
|
|
3124
|
+
/***/ 7159:
|
|
3125
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3126
|
+
|
|
3127
|
+
|
|
3128
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3129
|
+
exports.defaultThemesValue = exports.defaultThemeSettingValue = exports.defaultLogoSettingValue = exports.requiredColors = exports.settingIdToSecretType = exports.CredentialNameEnum = exports.AffDashboardVisibilitySettingEnum = exports.SettingIds = void 0;
|
|
3130
|
+
var SettingIds;
|
|
3131
|
+
(function (SettingIds) {
|
|
3132
|
+
SettingIds["ENABLED"] = "company.enabled";
|
|
3133
|
+
SettingIds["APP_TITLE"] = "company.appTitle";
|
|
3134
|
+
SettingIds["DOMAIN"] = "company.domain";
|
|
3135
|
+
SettingIds["LOGO"] = "appearance.logo";
|
|
3136
|
+
SettingIds["AMM"] = "product.amm";
|
|
3137
|
+
SettingIds["OBDEX"] = "product.obdex";
|
|
3138
|
+
SettingIds["THEMES"] = "appearance.themes";
|
|
3139
|
+
SettingIds["DIRECT_SETTLE"] = "company.directSettlement";
|
|
3140
|
+
SettingIds["AMM_FEE"] = "company.ammFee";
|
|
3141
|
+
SettingIds["FEE_SHARE"] = "company.feeShare";
|
|
3142
|
+
SettingIds["MIN_FEE"] = "company.minFee";
|
|
3143
|
+
SettingIds["MAKER_FEE"] = "company.makerFee";
|
|
3144
|
+
SettingIds["TAKER_FEE"] = "company.takerFee";
|
|
3145
|
+
SettingIds["GEOBLOCK"] = "company.geoblock";
|
|
3146
|
+
SettingIds["EMBEDDED_APP_URL"] = "company.embeddedAppUrl";
|
|
3147
|
+
SettingIds["PRODUCT_OBDEX"] = "product.obdex";
|
|
3148
|
+
SettingIds["PRODUCT_AMM"] = "product.amm";
|
|
3149
|
+
SettingIds["NEW_TAB"] = "appearance.newTab";
|
|
3150
|
+
SettingIds["APPEARANCE_TARGET"] = "appearance.target";
|
|
3151
|
+
SettingIds["CUSTOM_MENU_ITEMS"] = "appearance.customMenuItems";
|
|
3152
|
+
SettingIds["REPORT_BUTTONS"] = "appearance.reportButtons";
|
|
3153
|
+
SettingIds["APPEARANCE_CHART_TYPE"] = "appearance.chartType";
|
|
3154
|
+
SettingIds["APPEARANCE_CHART_INT"] = "appearance.chartInt";
|
|
3155
|
+
SettingIds["PINNED_PAIRS"] = "markets.pinnedPairs";
|
|
3156
|
+
SettingIds["KYC_TRADE_REQUIREMENT_ENABLED"] = "markets.kycTradeRequirementEnabled";
|
|
3157
|
+
SettingIds["AFFILIATE_DASHBOARD_VISIBILITY"] = "product.affiliateDashboardVisibility";
|
|
3158
|
+
SettingIds["AFFILIATE_DASHBOARD_THRESHOLD"] = "product.affiliateDashboardThreshold";
|
|
3159
|
+
SettingIds["AFFILIATE_DEFAULT_FEE_SHARE"] = "product.affiliateDefaultFeeShare";
|
|
3160
|
+
SettingIds["AFFILIATE_POINTS_REWARD"] = "product.affiliatePointsReward";
|
|
3161
|
+
SettingIds["POINT_SYSTEM_MODE"] = "product.pointSystem";
|
|
3162
|
+
SettingIds["POINT_SYSTEM_TELEGRAM_API_TOKEN"] = "point-system.telegramApiToken";
|
|
3163
|
+
SettingIds["POINT_SYSTEM_TELEGRAM_ENABLED"] = "point-system.telegramEnabled";
|
|
3164
|
+
SettingIds["POINT_SYSTEM_TELEGRAM_GROUP_ID"] = "point-system.telegramGroupId";
|
|
3165
|
+
SettingIds["POINT_SYSTEM_TELEGRAM_BOT_NAME"] = "point-system.telegramBotName";
|
|
3166
|
+
SettingIds["POINT_SYSTEM_TELEGRAM_BOT_ID"] = "point-system.telegramBotId";
|
|
3167
|
+
SettingIds["POINT_SYSTEM_TELEGRAM_GROUP_NAME"] = "point-system.telegramGroupName";
|
|
3168
|
+
SettingIds["POINT_SYSTEM_TELEGRAM_WEBHOOK_TOKEN"] = "point-system.telegramWebhookToken";
|
|
3169
|
+
SettingIds["POINT_SYSTEM_DISCORD_CLIENT_ID"] = "point-system.discordClientId";
|
|
3170
|
+
SettingIds["POINT_SYSTEM_DISCORD_CLIENT_SECRET"] = "point-system.discordClientSecret";
|
|
3171
|
+
SettingIds["POINT_SYSTEM_DISCORD_SERVER_ID"] = "point-system.discordServerId";
|
|
3172
|
+
SettingIds["POINT_SYSTEM_DISCORD_ENABLED"] = "point-system.discordEnabled";
|
|
3173
|
+
SettingIds["POINT_SYSTEM_TWITTER_CLIENT_ID"] = "point-system.twitterClientId";
|
|
3174
|
+
SettingIds["POINT_SYSTEM_TWITTER_CLIENT_SECRET"] = "point-system.twitterClientSecret";
|
|
3175
|
+
SettingIds["POINT_SYSTEM_TWITTER_BEARER_TOKEN"] = "point-system.twitterBearerToken";
|
|
3176
|
+
SettingIds["POINT_SYSTEM_TWITTER_REFRESH_TOKEN"] = "point-system.twitterRefreshToken";
|
|
3177
|
+
SettingIds["POINT_SYSTEM_TWITTER_ENABLED"] = "point-system.twitterEnabled";
|
|
3178
|
+
SettingIds["POINT_SYSTEM_TWITTER_JOB_ENABLED"] = "point-system.twitterJobEnabled";
|
|
3179
|
+
SettingIds["POINT_SYSTEM_TWITTER_HASHTAGS"] = "point-system.twitterHashtags";
|
|
3180
|
+
SettingIds["POINT_SYSTEM_TWITTER_TWEET_EXP_TIME"] = "point-system.twitterPostDefaultExpirationTime";
|
|
3181
|
+
SettingIds["POINT_SYSTEM_TWITTER_ACCOUNT_NAME"] = "point-system.twitterAccountName";
|
|
3182
|
+
SettingIds["POINT_SYSTEM_TWITTER_ACCOUNT_ID"] = "point-system.twitterAccountId";
|
|
3183
|
+
SettingIds["POINT_SYSTEM_TWITTER_WEBHOOK_TOKEN"] = "point-system.twitterWebhookToken";
|
|
3184
|
+
SettingIds["POINT_SYSTEM_GUIDE_LINK"] = "point-system.guideLink";
|
|
3185
|
+
})(SettingIds || (exports.SettingIds = SettingIds = {}));
|
|
3186
|
+
var AffDashboardVisibilitySettingEnum;
|
|
3187
|
+
(function (AffDashboardVisibilitySettingEnum) {
|
|
3188
|
+
AffDashboardVisibilitySettingEnum["DISABLED"] = "disabled";
|
|
3189
|
+
AffDashboardVisibilitySettingEnum["ENABLED_FOR_ALL"] = "enabled for all";
|
|
3190
|
+
AffDashboardVisibilitySettingEnum["ENABLED_FOR_AFFILIATES"] = "enabled for affiliates";
|
|
3191
|
+
})(AffDashboardVisibilitySettingEnum || (exports.AffDashboardVisibilitySettingEnum = AffDashboardVisibilitySettingEnum = {}));
|
|
3192
|
+
var CredentialNameEnum;
|
|
3193
|
+
(function (CredentialNameEnum) {
|
|
3194
|
+
CredentialNameEnum["API_TOKEN"] = "apiToken";
|
|
3195
|
+
CredentialNameEnum["CLIENT_ID"] = "clientId";
|
|
3196
|
+
CredentialNameEnum["CLIENT_SECRET"] = "clientSecret";
|
|
3197
|
+
CredentialNameEnum["BEARER_TOKEN"] = "bearerToken";
|
|
3198
|
+
CredentialNameEnum["REFRESH_TOKEN"] = "refreshToken";
|
|
3199
|
+
CredentialNameEnum["ACCESS_TOKEN"] = "accessToken";
|
|
3200
|
+
})(CredentialNameEnum || (exports.CredentialNameEnum = CredentialNameEnum = {}));
|
|
3201
|
+
exports.settingIdToSecretType = {
|
|
3202
|
+
'point-system.telegramApiToken': CredentialNameEnum.API_TOKEN,
|
|
3203
|
+
'point-system.discordClientId': CredentialNameEnum.CLIENT_ID,
|
|
3204
|
+
'point-system.discordClientSecret': CredentialNameEnum.CLIENT_SECRET,
|
|
3205
|
+
'point-system.twitterClientSecret': CredentialNameEnum.CLIENT_SECRET,
|
|
3206
|
+
'point-system.twitterClientId': CredentialNameEnum.CLIENT_ID,
|
|
3207
|
+
'point-system.twitterBearerToken': CredentialNameEnum.BEARER_TOKEN,
|
|
3208
|
+
'point-system.twitterRefreshToken': CredentialNameEnum.REFRESH_TOKEN,
|
|
3209
|
+
};
|
|
3210
|
+
exports.requiredColors = [
|
|
3211
|
+
'primary-1',
|
|
3212
|
+
'primary-2',
|
|
3213
|
+
'main-background',
|
|
3214
|
+
'primary-text',
|
|
3215
|
+
'module-background',
|
|
3216
|
+
'buy-text',
|
|
3217
|
+
'buy-background',
|
|
3218
|
+
'sell-text',
|
|
3219
|
+
'sell-background',
|
|
3220
|
+
'secondary-text',
|
|
3221
|
+
'input-background-default',
|
|
3222
|
+
'input-background-hover',
|
|
3223
|
+
'input-background-disabled',
|
|
3224
|
+
'input-border-default',
|
|
3225
|
+
'module-border',
|
|
3226
|
+
'button-disabled',
|
|
3227
|
+
'button-border',
|
|
3228
|
+
'input-border-active',
|
|
3229
|
+
'active-element-default',
|
|
3230
|
+
'hover-element-default',
|
|
3231
|
+
'dropdown-shadow',
|
|
3232
|
+
'button-text',
|
|
3233
|
+
'pair-active-row',
|
|
3234
|
+
];
|
|
3235
|
+
exports.defaultLogoSettingValue = `{"theme1":{"value":"${process.env.FRONTEND_URL}/Theme%3DDark.svg","active":true},"theme2":{"value":"${process.env.FRONTEND_URL}/Theme%3DLight.svg","active":true},"theme3":{"value":"${process.env.FRONTEND_URL}/Theme%3DLight.svg","active":true}}`;
|
|
3236
|
+
exports.defaultThemeSettingValue = '{"theme1":{"name":"dark","active":true,"value":{"primary-1":"rgba(118, 63, 229, 1)","primary-2":"rgba(249, 132, 146, 1)","main-background":"rgba(1, 1, 1, 1)","primary-text":"rgba(255, 255, 255, 1)","module-background":"rgba(19, 23, 34, 1)","buy-text":"rgba(82, 164, 154, 1)","buy-background":"rgba(2, 199, 122, 0.25)","sell-text":"rgba(221, 94, 86, 1)","sell-background":"rgba(255, 59, 105, 0.25)","secondary-text":"rgba(127, 127, 127, 1)","input-background-default":"rgba(13, 15, 21, 1)","input-background-hover":"rgba(28, 33, 45, 1)","input-background-disabled":"rgba(25, 29, 41, 1)","input-border-default":"rgba(28, 33, 45, 1)","module-border":"rgba(28, 33, 45, 1)","button-disabled":"rgba(111, 113, 118, 1)","button-border":"rgba(255, 255, 255, 1)","input-border-active":"rgba(185, 163, 238, 1)","active-element-default":"rgba(230, 136, 150, 1)","hover-element-default":"rgba(185, 163, 238, 1)","dropdown-shadow":"rgba(154, 92, 253, 0.45)","button-text":"rgba(255, 255, 255, 1)","pair-active-row":"rgba(28, 33, 45, 1)"}},"theme2":{"name":"light","active":true,"value":{"primary-1":"rgba(118, 63, 229, 1)","primary-2":"rgba(249, 132, 146, 1)","main-background":"rgba(249, 248, 248, 1)","primary-text":"rgba(0, 0, 0, 1)","module-background":"rgba(255, 255, 255, 1)","buy-text":"rgba(0, 112, 98, 1)","buy-background":"rgba(0, 112, 98, 0.25)","sell-text":"rgba(195, 12, 1, 1)","sell-background":"rgba(255, 59, 105, 0.25)","secondary-text":"rgba(127, 127, 127, 1)","button-disabled":"rgba(203, 199, 199, 1)","input-background-default":"rgba(255, 255, 255, 1)","input-background-hover":"rgba(249, 248, 248, 1)","input-background-disabled":"rgba(249, 248, 248, 1)","input-border-default":"rgba(228, 225, 225, 1)","module-border":"rgba(228, 225, 225, 1)","button-border":"rgba(170, 167, 167, 1)","input-border-active":"rgba(0, 0, 0, 1)","active-element-default":"rgba(230, 136, 150, 1)","hover-element-default":"rgba(185, 163, 238, 1)","dropdown-shadow":"rgba(154, 92, 253, 0.45)","button-text":"rgba(255, 255, 255, 1)","pair-active-row":"rgb(249, 248, 248)"}},"theme3":{"name":"purple","active":true,"value":{"primary-1":"rgba(118, 63, 229, 1)","primary-2":"rgba(249, 132, 146, 1)","main-background":"rgba(255, 255, 255, 1)","primary-text":"rgba(0, 0, 0, 1)","secondary-text":"rgba(127, 127, 127, 1)","buy-text":"rgba(0, 112, 98, 1)","sell-text":"rgba(195, 12, 1, 1)","buy-background":"rgba(0, 112, 98, 0.25)","sell-background":"rgba(255, 59, 105, 0.25)","module-background":"rgba(254, 250, 255, 1)","module-border":"rgba(228, 225, 225, 1)","input-background-default":"rgba(255, 255, 255, 1)","input-background-hover":"rgba(249, 248, 248, 1)","input-background-disabled":"rgba(254, 250, 255, 1)","input-border-default":"rgba(228, 225, 225, 1)","input-border-active":"rgba(0, 0, 0, 1)","button-border":"rgba(170, 167, 167, 1)","button-disabled":"rgba(203, 199, 199, 1)","active-element-default":"rgba(230, 136, 150, 1)","hover-element-default":"rgba(185, 163, 238, 1)","dropdown-shadow":"rgba(154, 92, 253, 0.45)","button-text":"rgba(255, 255, 255, 1)","pair-active-row":"rgb(249, 248, 248)"}}}';
|
|
3237
|
+
var defaultThemesValue;
|
|
3238
|
+
(function (defaultThemesValue) {
|
|
3239
|
+
defaultThemesValue["theme1"] = "{\"name\":\"dark\",\"id\":\"theme1\",\"active\":true, \"chartColors\":{\"bullish_candle_color\": \"rgba(2, 199, 122, 0.25)\",\"bearish_candle_color\": \"rgba(221, 94, 86, 1)\",\"bullish_wick_color\": \"rgba(2, 199, 122, 0.25)\",\"bearish_wick_color\": \"rgba(221, 94, 86, 1)\",\"bullish_outline_color\": \"rgba(2, 199, 122, 0.25)\",\"bearish_outline_color\": \"rgba(221, 94, 86, 1)\",\"line_color\": \"rgba(41, 98, 255, 1)\",\"chart_background\": \"rgba(19, 23, 34, 1)\",\"chart_text\": \"rgba(127, 127, 127, 1)\"}, \"colors\":{\"primary-1\":\"rgba(118, 63, 229, 1)\",\"primary-2\":\"rgba(249, 132, 146, 1)\",\"main-background\":\"rgba(1, 1, 1, 1)\",\"primary-text\":\"rgba(255, 255, 255, 1)\",\"module-background\":\"rgba(19, 23, 34, 1)\",\"buy-text\":\"rgba(82, 164, 154, 1)\",\"buy-background\":\"rgba(2, 199, 122, 0.25)\",\"sell-text\":\"rgba(221, 94, 86, 1)\",\"sell-background\":\"rgba(255, 59, 105, 0.25)\",\"secondary-text\":\"rgba(127, 127, 127, 1)\",\"input-background-default\":\"rgba(13, 15, 21, 1)\",\"input-background-hover\":\"rgba(28, 33, 45, 1)\",\"input-background-disabled\":\"rgba(25, 29, 41, 1)\",\"input-border-default\":\"rgba(28, 33, 45, 1)\",\"module-border\":\"rgba(28, 33, 45, 1)\",\"button-disabled\":\"rgba(111, 113, 118, 1)\",\"button-border\":\"rgba(255, 255, 255, 1)\",\"input-border-active\":\"rgba(185, 163, 238, 1)\",\"active-element-default\":\"rgba(230, 136, 150, 1)\",\"hover-element-default\":\"rgba(185, 163, 238, 1)\",\"dropdown-shadow\":\"rgba(154, 92, 253, 0.45)\",\"button-text\":\"rgba(255, 255, 255, 1)\",\"pair-active-row\":\"rgba(28, 33, 45, 1)\"}}";
|
|
3240
|
+
defaultThemesValue["theme2"] = "{\"name\":\"light\",\"id\":\"theme2\",\"active\":true, \"chartColors\":{\"bullish_candle_color\": \"rgba(0, 112, 98, 1)\",\"bearish_candle_color\": \"rgba(195, 12, 1, 1)\",\"bullish_wick_color\": \"rgba(0, 112, 98, 1)\",\"bearish_wick_color\": \"rgba(195, 12, 1, 1)\",\"bullish_outline_color\": \"rgba(0, 112, 98, 1)\",\"bearish_outline_color\": \"rgba(195, 12, 1, 1)\",\"line_color\": \"rgba(41, 98, 255, 1)\",\"chart_background\": \"rgba(255, 255, 255, 1)\",\"chart_text\": \"rgba(127, 127, 127, 1)\"}, \"colors\":{\"primary-1\":\"rgba(118, 63, 229, 1)\",\"primary-2\":\"rgba(249, 132, 146, 1)\",\"main-background\":\"rgba(249, 248, 248, 1)\",\"primary-text\":\"rgba(0, 0, 0, 1)\",\"module-background\":\"rgba(255, 255, 255, 1)\",\"buy-text\":\"rgba(0, 112, 98, 1)\",\"buy-background\":\"rgba(0, 112, 98, 0.25)\",\"sell-text\":\"rgba(195, 12, 1, 1)\",\"sell-background\":\"rgba(255, 59, 105, 0.25)\",\"secondary-text\":\"rgba(127, 127, 127, 1)\",\"button-disabled\":\"rgba(203, 199, 199, 1)\",\"input-background-default\":\"rgba(255, 255, 255, 1)\",\"input-background-hover\":\"rgba(249, 248, 248, 1)\",\"input-background-disabled\":\"rgba(249, 248, 248, 1)\",\"input-border-default\":\"rgba(228, 225, 225, 1)\",\"module-border\":\"rgba(228, 225, 225, 1)\",\"button-border\":\"rgba(170, 167, 167, 1)\",\"input-border-active\":\"rgba(0, 0, 0, 1)\",\"active-element-default\":\"rgba(230, 136, 150, 1)\",\"hover-element-default\":\"rgba(185, 163, 238, 1)\",\"dropdown-shadow\":\"rgba(154, 92, 253, 0.45)\",\"button-text\":\"rgba(255, 255, 255, 1)\",\"pair-active-row\":\"rgb(249, 248, 248)\"}}";
|
|
3241
|
+
defaultThemesValue["theme3"] = "{\"name\":\"purple\",\"id\":\"theme3\",\"active\":true, \"chartColors\":{\"bullish_candle_color\": \"rgba(0, 112, 98, 1)\",\"bearish_candle_color\": \"rgba(195, 12, 1, 1)\",\"bullish_wick_color\": \"rgba(0, 112, 98, 1)\",\"bearish_wick_color\": \"rgba(195, 12, 1, 1)\",\"bullish_outline_color\": \"rgba(0, 112, 98, 1)\",\"bearish_outline_color\": \"rgba(195, 12, 1, 1)\",\"line_color\": \"rgba(41, 98, 255, 1)\",\"chart_background\": \"rgba(254, 250, 255, 1)\",\"chart_text\": \"rgba(127, 127, 127, 1)\"}, \"colors\":{\"primary-1\":\"rgba(118, 63, 229, 1)\",\"primary-2\":\"rgba(249, 132, 146, 1)\",\"main-background\":\"rgba(255, 255, 255, 1)\",\"primary-text\":\"rgba(0, 0, 0, 1)\",\"secondary-text\":\"rgba(127, 127, 127, 1)\",\"buy-text\":\"rgba(0, 112, 98, 1)\",\"sell-text\":\"rgba(195, 12, 1, 1)\",\"buy-background\":\"rgba(0, 112, 98, 0.25)\",\"sell-background\":\"rgba(255, 59, 105, 0.25)\",\"module-background\":\"rgba(254, 250, 255, 1)\",\"module-border\":\"rgba(228, 225, 225, 1)\",\"input-background-default\":\"rgba(255, 255, 255, 1)\",\"input-background-hover\":\"rgba(249, 248, 248, 1)\",\"input-background-disabled\":\"rgba(254, 250, 255, 1)\",\"input-border-default\":\"rgba(228, 225, 225, 1)\",\"input-border-active\":\"rgba(0, 0, 0, 1)\",\"button-border\":\"rgba(170, 167, 167, 1)\",\"button-disabled\":\"rgba(203, 199, 199, 1)\",\"active-element-default\":\"rgba(230, 136, 150, 1)\",\"hover-element-default\":\"rgba(185, 163, 238, 1)\",\"dropdown-shadow\":\"rgba(154, 92, 253, 0.45)\",\"button-text\":\"rgba(255, 255, 255, 1)\",\"pair-active-row\":\"rgb(249, 248, 248)\"}}";
|
|
3242
|
+
})(defaultThemesValue || (exports.defaultThemesValue = defaultThemesValue = {}));
|
|
3243
|
+
|
|
3244
|
+
|
|
3245
|
+
/***/ }),
|
|
3246
|
+
|
|
3247
|
+
/***/ 7359:
|
|
3248
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3249
|
+
|
|
3250
|
+
|
|
3251
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3252
|
+
exports.ChartQueryDto = exports.StatisticTypeQuery = exports.UsersQueryDto = exports.PairsQueryDto = exports.SmallTimeframeEnum = void 0;
|
|
3253
|
+
var SmallTimeframeEnum;
|
|
3254
|
+
(function (SmallTimeframeEnum) {
|
|
3255
|
+
SmallTimeframeEnum["last_7_days"] = "last_7_days";
|
|
3256
|
+
SmallTimeframeEnum["last_30_days"] = "last_30_days";
|
|
3257
|
+
SmallTimeframeEnum["last_90_days"] = "last_90_days";
|
|
3258
|
+
SmallTimeframeEnum["last_year"] = "last_year";
|
|
3259
|
+
})(SmallTimeframeEnum || (exports.SmallTimeframeEnum = SmallTimeframeEnum = {}));
|
|
3260
|
+
class PairsQueryDto {
|
|
3261
|
+
constructor() {
|
|
3262
|
+
this.timeRange = SmallTimeframeEnum.last_30_days;
|
|
3263
|
+
this.sortBy = 'volume_usd';
|
|
3264
|
+
this.order = 'desc';
|
|
3265
|
+
this.limit = 20;
|
|
3266
|
+
this.page = 1;
|
|
3267
|
+
}
|
|
3268
|
+
}
|
|
3269
|
+
exports.PairsQueryDto = PairsQueryDto;
|
|
3270
|
+
class UsersQueryDto {
|
|
3271
|
+
constructor() {
|
|
3272
|
+
this.timeRange = SmallTimeframeEnum.last_30_days;
|
|
3273
|
+
this.sortBy = 'volume_usd';
|
|
3274
|
+
this.order = 'desc';
|
|
3275
|
+
this.limit = 20;
|
|
3276
|
+
this.page = 1;
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
exports.UsersQueryDto = UsersQueryDto;
|
|
3280
|
+
var StatisticTypeQuery;
|
|
3281
|
+
(function (StatisticTypeQuery) {
|
|
3282
|
+
StatisticTypeQuery["volume"] = "volume";
|
|
3283
|
+
StatisticTypeQuery["fees"] = "fees";
|
|
3284
|
+
StatisticTypeQuery["orders"] = "orders";
|
|
3285
|
+
StatisticTypeQuery["dau"] = "dau";
|
|
3286
|
+
})(StatisticTypeQuery || (exports.StatisticTypeQuery = StatisticTypeQuery = {}));
|
|
3287
|
+
class ChartQueryDto {
|
|
3288
|
+
constructor() {
|
|
3289
|
+
this.type = StatisticTypeQuery.volume;
|
|
3290
|
+
this.timeRange = SmallTimeframeEnum.last_7_days;
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
exports.ChartQueryDto = ChartQueryDto;
|
|
3294
|
+
|
|
3295
|
+
|
|
3296
|
+
/***/ }),
|
|
3297
|
+
|
|
3298
|
+
/***/ 7542:
|
|
3299
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3300
|
+
|
|
3301
|
+
|
|
3302
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3303
|
+
exports.mapOrderSideFromShort = mapOrderSideFromShort;
|
|
3304
|
+
exports.mapOrderSideToShort = mapOrderSideToShort;
|
|
3305
|
+
exports.mapOrderTypeShort = mapOrderTypeShort;
|
|
3306
|
+
exports.mapOrderSideFromShortToLong = mapOrderSideFromShortToLong;
|
|
3307
|
+
exports.mapOrderTypeShortToLong = mapOrderTypeShortToLong;
|
|
3308
|
+
const _enums_1 = __webpack_require__(9965);
|
|
3309
|
+
function mapOrderSideFromShort(value) {
|
|
3310
|
+
switch (value) {
|
|
3311
|
+
case "B": return _enums_1.OrderSide.Buy;
|
|
3312
|
+
case "S": return _enums_1.OrderSide.Sell;
|
|
3313
|
+
default:
|
|
3314
|
+
throw new Error("Unknown order side short type: " + value);
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
function mapOrderSideToShort(value) {
|
|
3318
|
+
switch (value) {
|
|
3319
|
+
case _enums_1.OrderSide.Buy: return "B";
|
|
3320
|
+
case _enums_1.OrderSide.Sell: return "S";
|
|
3321
|
+
default:
|
|
3322
|
+
throw new Error("Unknown order side type: " + value);
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
function mapOrderTypeShort(value) {
|
|
3326
|
+
switch (value) {
|
|
3327
|
+
case "I": return _enums_1.OrderType.IOC;
|
|
3328
|
+
case "P": return _enums_1.OrderType.POST;
|
|
3329
|
+
case "M": return _enums_1.OrderType.Market;
|
|
3330
|
+
case "L":
|
|
3331
|
+
default:
|
|
3332
|
+
return _enums_1.OrderType.Limit;
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3335
|
+
function mapOrderSideFromShortToLong(value) {
|
|
3336
|
+
switch (value) {
|
|
3337
|
+
case "B": return "BUY";
|
|
3338
|
+
case "S": return "SELL";
|
|
3339
|
+
default:
|
|
3340
|
+
throw new Error("Unknown order side short type: " + value);
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3343
|
+
function mapOrderTypeShortToLong(value) {
|
|
3344
|
+
switch (value) {
|
|
3345
|
+
case "I": return "IOC";
|
|
3346
|
+
case "P": return "POST";
|
|
3347
|
+
case "M": return "Market";
|
|
3348
|
+
case "L":
|
|
3349
|
+
default:
|
|
3350
|
+
return "Limit";
|
|
3351
|
+
}
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3354
|
+
|
|
3355
|
+
/***/ }),
|
|
3356
|
+
|
|
3357
|
+
/***/ 7801:
|
|
3358
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3359
|
+
|
|
3360
|
+
|
|
3361
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3362
|
+
exports.QueueOptions = exports.QueueNames = void 0;
|
|
3363
|
+
var QueueNames;
|
|
3364
|
+
(function (QueueNames) {
|
|
3365
|
+
QueueNames["CANCELLATION_TRADE"] = "cancellation_trade";
|
|
3366
|
+
QueueNames["CANCEL_ORDER"] = "cancelOrder";
|
|
3367
|
+
QueueNames["MAINTENANCE"] = "maintenance";
|
|
3368
|
+
QueueNames["SYSTEM"] = "system";
|
|
3369
|
+
QueueNames["NEW_ORDER"] = "newOrder";
|
|
3370
|
+
QueueNames["PROCESS_WALLET_TRANSACTION"] = "wallet_transaction";
|
|
3371
|
+
QueueNames["LAST_LOOK_TRADE"] = "last_look_trade";
|
|
3372
|
+
QueueNames["SEND_TRADE_TO_SETTLE"] = "send_trade_to_settle";
|
|
3373
|
+
QueueNames["TRADE_FIRE"] = "trade_fire";
|
|
3374
|
+
QueueNames["TRADE_CONFIRMED"] = "trade_confirmed";
|
|
3375
|
+
QueueNames["ORDER_OPERATION"] = "order_operation";
|
|
3376
|
+
QueueNames["ORDER_RESULT"] = "order_result";
|
|
3377
|
+
QueueNames["TRADES_QUEUE"] = "trades_q";
|
|
3378
|
+
QueueNames["OPEN_ORDER_BOOK"] = "open_order_book";
|
|
3379
|
+
QueueNames["SOCKET_WALLET_TRANSACTION"] = "socket_wallet_transaction";
|
|
3380
|
+
QueueNames["STREAM_UPDATE_QUOTE"] = "stream_update_quote";
|
|
3381
|
+
QueueNames["STREAM_UPDATE_LAST_PRICE"] = "stream_update_last_price";
|
|
3382
|
+
QueueNames["STREAM_UPDATE_DEPTH"] = "stream_update_depth";
|
|
3383
|
+
QueueNames["STREAM_UPDATE_LAST_CANDLESTICK"] = "stream_update_last_candlestick";
|
|
3384
|
+
QueueNames["STREAM_UPDATE_ORDERS"] = "stream_update_orders";
|
|
3385
|
+
QueueNames["STREAM_UPDATE_TRADES"] = "stream_update_trades";
|
|
3386
|
+
QueueNames["STREAM_UPDATE_ORDER_BOOK"] = "stream_update_order_book";
|
|
3387
|
+
QueueNames["CODEX_DEPOSIT"] = "codex_deposit";
|
|
3388
|
+
QueueNames["CODEX_TRANSFER"] = "codex_transfer";
|
|
3389
|
+
QueueNames["CODEX_WITHDRAWAL"] = "codex_withdrawal";
|
|
3390
|
+
QueueNames["CODEX_BALANCES"] = "codex_balances";
|
|
3391
|
+
QueueNames["CODEX_TRADE"] = "codex_trade";
|
|
3392
|
+
QueueNames["VAA_LOG"] = "vaa_log";
|
|
3393
|
+
QueueNames["SETTINGS_UPDATE"] = "settings_update";
|
|
3394
|
+
QueueNames["POINT_SYSTEM_SETTINGS_UPDATE"] = "point_system_settings_update";
|
|
3395
|
+
QueueNames["NEW_NOTIFICATION"] = "new_notification";
|
|
3396
|
+
})(QueueNames || (exports.QueueNames = QueueNames = {}));
|
|
3397
|
+
exports.QueueOptions = {
|
|
3398
|
+
[QueueNames.CANCELLATION_TRADE]: { options: { durable: true } },
|
|
3399
|
+
[QueueNames.CANCEL_ORDER]: { options: { durable: true } },
|
|
3400
|
+
[QueueNames.CODEX_BALANCES]: { options: { durable: true } },
|
|
3401
|
+
[QueueNames.CODEX_DEPOSIT]: { options: { durable: true } },
|
|
3402
|
+
[QueueNames.CODEX_TRANSFER]: { options: { durable: true } },
|
|
3403
|
+
[QueueNames.CODEX_TRADE]: { options: { durable: true } },
|
|
3404
|
+
[QueueNames.CODEX_WITHDRAWAL]: { options: { durable: true } },
|
|
3405
|
+
[QueueNames.LAST_LOOK_TRADE]: { options: { durable: true } },
|
|
3406
|
+
[QueueNames.MAINTENANCE]: { options: { durable: true } },
|
|
3407
|
+
[QueueNames.SYSTEM]: { options: { durable: true } },
|
|
3408
|
+
[QueueNames.NEW_ORDER]: { options: { durable: true } },
|
|
3409
|
+
[QueueNames.OPEN_ORDER_BOOK]: { options: { durable: true } },
|
|
3410
|
+
[QueueNames.ORDER_OPERATION]: { options: { durable: true, maxPriority: 5 } },
|
|
3411
|
+
[QueueNames.ORDER_RESULT]: { options: { durable: true } },
|
|
3412
|
+
[QueueNames.PROCESS_WALLET_TRANSACTION]: { options: { durable: true } },
|
|
3413
|
+
[QueueNames.SEND_TRADE_TO_SETTLE]: { options: { durable: true } },
|
|
3414
|
+
[QueueNames.SOCKET_WALLET_TRANSACTION]: { options: { durable: true } },
|
|
3415
|
+
[QueueNames.STREAM_UPDATE_DEPTH]: { options: { durable: true } },
|
|
3416
|
+
[QueueNames.STREAM_UPDATE_LAST_CANDLESTICK]: { options: { durable: true } },
|
|
3417
|
+
[QueueNames.STREAM_UPDATE_LAST_PRICE]: { options: { durable: true } },
|
|
3418
|
+
[QueueNames.STREAM_UPDATE_ORDERS]: { options: { durable: true } },
|
|
3419
|
+
[QueueNames.STREAM_UPDATE_ORDER_BOOK]: { options: { durable: true } },
|
|
3420
|
+
[QueueNames.STREAM_UPDATE_QUOTE]: { options: { durable: true } },
|
|
3421
|
+
[QueueNames.STREAM_UPDATE_TRADES]: { options: { durable: true } },
|
|
3422
|
+
[QueueNames.TRADES_QUEUE]: { options: { durable: true } },
|
|
3423
|
+
[QueueNames.TRADE_CONFIRMED]: { options: { durable: true } },
|
|
3424
|
+
[QueueNames.TRADE_FIRE]: { options: { durable: true } },
|
|
3425
|
+
[QueueNames.VAA_LOG]: { options: { durable: true } },
|
|
3426
|
+
[QueueNames.SETTINGS_UPDATE]: { options: { durable: true } },
|
|
3427
|
+
[QueueNames.POINT_SYSTEM_SETTINGS_UPDATE]: { options: { durable: true } },
|
|
3428
|
+
[QueueNames.NEW_NOTIFICATION]: { options: { durable: true } },
|
|
3429
|
+
};
|
|
3430
|
+
|
|
3431
|
+
|
|
3432
|
+
/***/ }),
|
|
3433
|
+
|
|
3434
|
+
/***/ 8060:
|
|
3435
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3436
|
+
|
|
3437
|
+
|
|
3438
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3439
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3440
|
+
};
|
|
3441
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3442
|
+
exports.makeGroupTxnsWithDummy = exports.makeDummyTxn = void 0;
|
|
3443
|
+
const algosdk_1 = __importDefault(__webpack_require__(9709));
|
|
3444
|
+
const common_helper_1 = __webpack_require__(223);
|
|
3445
|
+
const makeDummyTxn = (appIndex, sender, params, boxes, note, foreignApps) => {
|
|
3446
|
+
const appArgs = (0, common_helper_1.getAppArgs)("dummy(uint64)void", [1]);
|
|
3447
|
+
const dummyTxn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
3448
|
+
from: sender,
|
|
3449
|
+
suggestedParams: { ...params, fee: algosdk_1.default.ALGORAND_MIN_TX_FEE, flatFee: true },
|
|
3450
|
+
appArgs,
|
|
3451
|
+
appIndex,
|
|
3452
|
+
boxes,
|
|
3453
|
+
foreignApps,
|
|
3454
|
+
note: new Uint8Array(Buffer.from(note))
|
|
3455
|
+
});
|
|
3456
|
+
return dummyTxn;
|
|
3457
|
+
};
|
|
3458
|
+
exports.makeDummyTxn = makeDummyTxn;
|
|
3459
|
+
const makeGroupTxnsWithDummy = (id, mainTxnBody) => {
|
|
3460
|
+
const MAX_REFS = 8;
|
|
3461
|
+
const { accounts, foreignAssets, foreignApps, boxes, appIndex, from, suggestedParams } = mainTxnBody;
|
|
3462
|
+
console.log('Total resources', [accounts, foreignApps, foreignAssets, boxes]);
|
|
3463
|
+
const totalRefs = [accounts, foreignApps, foreignAssets, boxes].reduce((acc, o) => acc + (o?.length || 0), 0);
|
|
3464
|
+
const mainTxnBoxes = boxes?.slice(0, MAX_REFS - totalRefs) || [];
|
|
3465
|
+
const restBoxes = boxes?.slice(MAX_REFS - totalRefs) || [];
|
|
3466
|
+
const dummyBoxesMax = MAX_REFS - (foreignApps?.length || 0);
|
|
3467
|
+
const mainTxn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
3468
|
+
...mainTxnBody,
|
|
3469
|
+
boxes: mainTxnBoxes
|
|
3470
|
+
});
|
|
3471
|
+
let dummyTxnIndex = 1;
|
|
3472
|
+
let dummyBoxes = [];
|
|
3473
|
+
const dummyTxns2 = [];
|
|
3474
|
+
for (let index = 0; index < restBoxes.length; index++) {
|
|
3475
|
+
const element = restBoxes[index];
|
|
3476
|
+
dummyBoxes.push(element);
|
|
3477
|
+
if (dummyBoxes.length === dummyBoxesMax || index === restBoxes.length - 1) {
|
|
3478
|
+
dummyTxns2.push((0, exports.makeDummyTxn)(appIndex, from, suggestedParams, dummyBoxes, `${id}_${dummyTxnIndex}`, foreignApps));
|
|
3479
|
+
dummyBoxes = [];
|
|
3480
|
+
dummyTxnIndex++;
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
// TODO: check this dummy txn
|
|
3484
|
+
// additional dummy txn for withdrawal
|
|
3485
|
+
dummyTxns2.push((0, exports.makeDummyTxn)(appIndex, from, suggestedParams, [], `${id}_${++dummyTxnIndex}`, foreignApps));
|
|
3486
|
+
console.log("dummy count", dummyTxns2.length);
|
|
3487
|
+
return [mainTxn, ...dummyTxns2];
|
|
3488
|
+
};
|
|
3489
|
+
exports.makeGroupTxnsWithDummy = makeGroupTxnsWithDummy;
|
|
3490
|
+
|
|
3491
|
+
|
|
3492
|
+
/***/ }),
|
|
3493
|
+
|
|
3494
|
+
/***/ 8398:
|
|
3495
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3496
|
+
|
|
3497
|
+
|
|
3498
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3499
|
+
exports.equalIgnoreCase = exports.listDateFormat = void 0;
|
|
3500
|
+
exports.getRandomInt = getRandomInt;
|
|
3501
|
+
exports.getDomains = getDomains;
|
|
3502
|
+
exports.cutEvent = cutEvent;
|
|
3503
|
+
exports.maskingString = maskingString;
|
|
3504
|
+
exports.removeField = removeField;
|
|
3505
|
+
const listDateFormat = (date) => {
|
|
3506
|
+
let newDAte = new Date(date);
|
|
3507
|
+
let parsedDate = newDAte.toLocaleDateString('default', {
|
|
3508
|
+
year: 'numeric',
|
|
3509
|
+
month: 'numeric',
|
|
3510
|
+
day: 'numeric',
|
|
3511
|
+
});
|
|
3512
|
+
let time = newDAte.toLocaleTimeString('en-US', {
|
|
3513
|
+
hour12: true,
|
|
3514
|
+
hour: '2-digit',
|
|
3515
|
+
minute: '2-digit',
|
|
3516
|
+
});
|
|
3517
|
+
return parsedDate + ' ' + time;
|
|
3518
|
+
};
|
|
3519
|
+
exports.listDateFormat = listDateFormat;
|
|
3520
|
+
const equalIgnoreCase = (value1, value2) => {
|
|
3521
|
+
return String(value1).toLowerCase() === String(value2).toLowerCase();
|
|
3522
|
+
};
|
|
3523
|
+
exports.equalIgnoreCase = equalIgnoreCase;
|
|
3524
|
+
function getRandomInt(min, max) {
|
|
3525
|
+
min = Math.ceil(min);
|
|
3526
|
+
max = Math.floor(max);
|
|
3527
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
3528
|
+
}
|
|
3529
|
+
function getDomains(domain) {
|
|
3530
|
+
const domains = [];
|
|
3531
|
+
const parts = domain.split('.');
|
|
3532
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
3533
|
+
domains.push(parts.slice(i).join('.'));
|
|
3534
|
+
}
|
|
3535
|
+
return domains;
|
|
3536
|
+
}
|
|
3537
|
+
;
|
|
3538
|
+
function cutEvent(event) {
|
|
3539
|
+
const headers = event.headers && removeUndefined({
|
|
3540
|
+
'Authorization': event.headers['Authorization']?.substring(0, 200),
|
|
3541
|
+
'CloudFront-Viewer-Country': event.headers['CloudFront-Viewer-Country'],
|
|
3542
|
+
'Host': event.headers['Host'],
|
|
3543
|
+
'origin': event.headers['origin'],
|
|
3544
|
+
'Referer': event.headers['Referer'],
|
|
3545
|
+
'User-Agent': event.headers['User-Agent'],
|
|
3546
|
+
'wl-domain': event.headers['wl-domain'],
|
|
3547
|
+
'X-API-Key': maskingString(event.headers['X-API-Key']),
|
|
3548
|
+
'X-Forwarded-For': event.headers['X-Forwarded-For'],
|
|
3549
|
+
'X-Forwarded-Port': event.headers['X-Forwarded-Port'],
|
|
3550
|
+
'X-Forwarded-Proto': event.headers['X-Forwarded-Proto'],
|
|
3551
|
+
'X-Trading-Key': event.headers['X-Trading-Key'],
|
|
3552
|
+
'X-Wallet-Address': event.headers['X-Wallet-Address'],
|
|
3553
|
+
'X-Wallet-Token': event.headers['X-Wallet-Token'],
|
|
3554
|
+
'accessToken': maskingString(event.headers['accessToken']),
|
|
3555
|
+
'companyId': event.headers['companyId'],
|
|
3556
|
+
'seasonId': event.headers['seasonId'],
|
|
3557
|
+
});
|
|
3558
|
+
const requestContext = event.requestContext && removeUndefined({
|
|
3559
|
+
identity: event.requestContext.identity && removeUndefined({
|
|
3560
|
+
'userAgent': event.requestContext.identity['userAgent'],
|
|
3561
|
+
'sourceIp': event.requestContext.identity['sourceIp'],
|
|
3562
|
+
}),
|
|
3563
|
+
domainName: event.requestContext.domainName,
|
|
3564
|
+
});
|
|
3565
|
+
return removeUndefined({
|
|
3566
|
+
manage: event.manage,
|
|
3567
|
+
path: event.path,
|
|
3568
|
+
httpMethod: event.httpMethod,
|
|
3569
|
+
headers,
|
|
3570
|
+
requestContext,
|
|
3571
|
+
});
|
|
3572
|
+
}
|
|
3573
|
+
function maskingString(str) {
|
|
3574
|
+
if (!str?.length)
|
|
3575
|
+
return str;
|
|
3576
|
+
const maskLen = Math.round(str.length / 3);
|
|
3577
|
+
const start = maskLen;
|
|
3578
|
+
const end = str.length - maskLen;
|
|
3579
|
+
const maskedStr = str.substring(0, start) + "*".repeat(maskLen) + str.substring(end);
|
|
3580
|
+
return maskedStr;
|
|
3581
|
+
}
|
|
3582
|
+
function removeField(obj, fieldToRemove) {
|
|
3583
|
+
if (Array.isArray(obj)) {
|
|
3584
|
+
return obj.map(item => removeField(item, fieldToRemove));
|
|
3585
|
+
}
|
|
3586
|
+
else if (typeof obj === 'object' && obj !== null) {
|
|
3587
|
+
return Object.fromEntries(Object.entries(obj)
|
|
3588
|
+
.filter(([key]) => key !== fieldToRemove)
|
|
3589
|
+
.map(([key, value]) => [key, removeField(value, fieldToRemove)]));
|
|
3590
|
+
}
|
|
3591
|
+
return obj; // Return primitives as-is
|
|
3592
|
+
}
|
|
3593
|
+
function removeUndefined(obj) {
|
|
3594
|
+
return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== undefined));
|
|
3595
|
+
}
|
|
3596
|
+
|
|
3597
|
+
|
|
3598
|
+
/***/ }),
|
|
3599
|
+
|
|
3600
|
+
/***/ 8593:
|
|
3601
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3602
|
+
|
|
3603
|
+
|
|
3604
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3605
|
+
if (k2 === undefined) k2 = k;
|
|
3606
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3607
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
3608
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
3609
|
+
}
|
|
3610
|
+
Object.defineProperty(o, k2, desc);
|
|
3611
|
+
}) : (function(o, m, k, k2) {
|
|
3612
|
+
if (k2 === undefined) k2 = k;
|
|
3613
|
+
o[k2] = m[k];
|
|
3614
|
+
}));
|
|
3615
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
3616
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3617
|
+
}) : function(o, v) {
|
|
3618
|
+
o["default"] = v;
|
|
3619
|
+
});
|
|
3620
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
3621
|
+
var ownKeys = function(o) {
|
|
3622
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
3623
|
+
var ar = [];
|
|
3624
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
3625
|
+
return ar;
|
|
3626
|
+
};
|
|
3627
|
+
return ownKeys(o);
|
|
3628
|
+
};
|
|
3629
|
+
return function (mod) {
|
|
3630
|
+
if (mod && mod.__esModule) return mod;
|
|
3631
|
+
var result = {};
|
|
3632
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
3633
|
+
__setModuleDefault(result, mod);
|
|
3634
|
+
return result;
|
|
3635
|
+
};
|
|
3636
|
+
})();
|
|
3637
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3638
|
+
exports.decodeAddress = exports.encodeAddress = void 0;
|
|
3639
|
+
exports.concatArrays = concatArrays;
|
|
3640
|
+
exports.packData = packData;
|
|
3641
|
+
exports.unpackData = unpackData;
|
|
3642
|
+
exports.encodeArgArray = encodeArgArray;
|
|
3643
|
+
exports.encodeString = encodeString;
|
|
3644
|
+
exports.decodeString = decodeString;
|
|
3645
|
+
exports.encode32Bytes = encode32Bytes;
|
|
3646
|
+
exports.encodeUint64 = encodeUint64;
|
|
3647
|
+
exports.decodeUint64 = decodeUint64;
|
|
3648
|
+
exports.encodeBase64 = encodeBase64;
|
|
3649
|
+
exports.decodeBase64 = decodeBase64;
|
|
3650
|
+
exports.compareArrays = compareArrays;
|
|
3651
|
+
exports.getDeltaUint = getDeltaUint;
|
|
3652
|
+
exports.getDeltaBytes = getDeltaBytes;
|
|
3653
|
+
exports.toUnix = toUnix;
|
|
3654
|
+
exports.fromUnix = fromUnix;
|
|
3655
|
+
const algosdk_1 = __importStar(__webpack_require__(9709));
|
|
3656
|
+
// import sha512 from "js-sha512"
|
|
3657
|
+
const buffer_1 = __webpack_require__(18);
|
|
3658
|
+
function concatArrays(arrays) {
|
|
3659
|
+
return arrays.reduce((a, b) => Uint8Array.from([...a, ...b]));
|
|
3660
|
+
}
|
|
3661
|
+
function packData(value, format) {
|
|
3662
|
+
const chunks = [];
|
|
3663
|
+
for (const [name, type] of Object.entries(format)) {
|
|
3664
|
+
const v = value[name];
|
|
3665
|
+
if (v === undefined) {
|
|
3666
|
+
throw new Error(`Key ${name} missing from value`);
|
|
3667
|
+
}
|
|
3668
|
+
switch (type.type) {
|
|
3669
|
+
case 'address':
|
|
3670
|
+
if (v instanceof Uint8Array && v.length == 32) {
|
|
3671
|
+
chunks.push(v);
|
|
3672
|
+
break;
|
|
3673
|
+
}
|
|
3674
|
+
else if (typeof v === 'string') {
|
|
3675
|
+
chunks.push((0, algosdk_1.decodeAddress)(v).publicKey);
|
|
3676
|
+
}
|
|
3677
|
+
else {
|
|
3678
|
+
throw new Error(`${name}: Expected address, got ${v}`);
|
|
3679
|
+
}
|
|
3680
|
+
break;
|
|
3681
|
+
case 'bytes':
|
|
3682
|
+
if (v instanceof Uint8Array) {
|
|
3683
|
+
if (v.length == type.size) {
|
|
3684
|
+
chunks.push(v);
|
|
3685
|
+
break;
|
|
3686
|
+
}
|
|
3687
|
+
else {
|
|
3688
|
+
throw new Error(`${name}: Bytes length is wrong, expected ${type.size}, got ${v.length}`);
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3691
|
+
else {
|
|
3692
|
+
throw new Error(`${name}: Expected bytes[${type.size}], got ${v}`);
|
|
3693
|
+
}
|
|
3694
|
+
case 'double':
|
|
3695
|
+
if (typeof v === 'number') {
|
|
3696
|
+
const bytes = new ArrayBuffer(8);
|
|
3697
|
+
buffer_1.Buffer.from(bytes).writeDoubleLE(v, 0);
|
|
3698
|
+
chunks.push(new Uint8Array(bytes));
|
|
3699
|
+
break;
|
|
3700
|
+
}
|
|
3701
|
+
else {
|
|
3702
|
+
throw new Error(`${name}: Expected double, got ${v}`);
|
|
3703
|
+
}
|
|
3704
|
+
case 'number':
|
|
3705
|
+
case 'uint':
|
|
3706
|
+
if (typeof v === 'bigint' || typeof v === 'number') {
|
|
3707
|
+
chunks.push(encodeUint64(v));
|
|
3708
|
+
break;
|
|
3709
|
+
}
|
|
3710
|
+
else {
|
|
3711
|
+
throw new Error(`${name}: Expected uint or number, got ${v}`);
|
|
3712
|
+
}
|
|
3713
|
+
case 'string':
|
|
3714
|
+
if (typeof v === 'string') {
|
|
3715
|
+
const str = encodeString(v);
|
|
3716
|
+
if (str.length == type.size) {
|
|
3717
|
+
chunks.push(str);
|
|
3718
|
+
break;
|
|
3719
|
+
}
|
|
3720
|
+
else {
|
|
3721
|
+
throw new Error(`${name}: Expected string length ${type.size}, got string length ${str.length}`);
|
|
3722
|
+
}
|
|
3723
|
+
}
|
|
3724
|
+
else {
|
|
3725
|
+
throw new Error(`${name}: Expected string length ${type.size}, got ${v}`);
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3729
|
+
return concatArrays(chunks);
|
|
3730
|
+
}
|
|
3731
|
+
function unpackData(data, format) {
|
|
3732
|
+
const result = new Map();
|
|
3733
|
+
let index = 0;
|
|
3734
|
+
for (const [name, type] of Object.entries(format)) {
|
|
3735
|
+
if (index >= data.length) {
|
|
3736
|
+
throw new Error('Array index out of bounds');
|
|
3737
|
+
}
|
|
3738
|
+
let value;
|
|
3739
|
+
switch (type.type) {
|
|
3740
|
+
case 'address':
|
|
3741
|
+
value = (0, algosdk_1.encodeAddress)(data.slice(index, index + 32));
|
|
3742
|
+
index += 32;
|
|
3743
|
+
break;
|
|
3744
|
+
case 'bytes':
|
|
3745
|
+
value = data.slice(index, index + type.size);
|
|
3746
|
+
index += type.size;
|
|
3747
|
+
break;
|
|
3748
|
+
case 'double':
|
|
3749
|
+
value = buffer_1.Buffer.from(data.slice(index, index + 8)).readDoubleLE(0);
|
|
3750
|
+
index += 8;
|
|
3751
|
+
break;
|
|
3752
|
+
case 'number':
|
|
3753
|
+
value = Number(decodeUint64(data.slice(index, index + 8)));
|
|
3754
|
+
index += 8;
|
|
3755
|
+
break;
|
|
3756
|
+
case 'uint':
|
|
3757
|
+
value = decodeUint64(data.slice(index, index + 8));
|
|
3758
|
+
index += 8;
|
|
3759
|
+
break;
|
|
3760
|
+
case 'string':
|
|
3761
|
+
value = decodeString(data.slice(index, index + type.size));
|
|
3762
|
+
index += type.size;
|
|
3763
|
+
break;
|
|
3764
|
+
}
|
|
3765
|
+
result.set(name, value);
|
|
3766
|
+
}
|
|
3767
|
+
return Object.fromEntries(result);
|
|
3768
|
+
}
|
|
3769
|
+
function encodeArgArray(params) {
|
|
3770
|
+
return params.map(param => {
|
|
3771
|
+
if (param instanceof Uint8Array)
|
|
3772
|
+
return new Uint8Array(param);
|
|
3773
|
+
if (typeof param === "string")
|
|
3774
|
+
return encodeString(param);
|
|
3775
|
+
if (typeof param === "boolean")
|
|
3776
|
+
param = BigInt(param ? 1 : 0);
|
|
3777
|
+
if (typeof param === "number")
|
|
3778
|
+
param = BigInt(param);
|
|
3779
|
+
return encodeUint64(param);
|
|
3780
|
+
});
|
|
3781
|
+
}
|
|
3782
|
+
function encodeString(value) {
|
|
3783
|
+
return new Uint8Array(buffer_1.Buffer.from(value));
|
|
3784
|
+
}
|
|
3785
|
+
function decodeString(value) {
|
|
3786
|
+
return buffer_1.Buffer.from(value).toString('utf-8');
|
|
3787
|
+
}
|
|
3788
|
+
function encode32Bytes(value) {
|
|
3789
|
+
const valueButes = algosdk_1.default.encodeUint64(value);
|
|
3790
|
+
return concatArrays([new Uint8Array(32 - valueButes.length), valueButes]);
|
|
3791
|
+
}
|
|
3792
|
+
function encodeUint64(value) {
|
|
3793
|
+
const bytes = buffer_1.Buffer.alloc(8);
|
|
3794
|
+
for (let index = 0; index < 8; index++)
|
|
3795
|
+
bytes[7 - index] = Number((BigInt(value) >> BigInt(index * 8)) & BigInt(0xFF));
|
|
3796
|
+
return new Uint8Array(bytes);
|
|
3797
|
+
}
|
|
3798
|
+
function decodeUint64(value) {
|
|
3799
|
+
let num = BigInt(0);
|
|
3800
|
+
for (let index = 0; index < 8 && value?.length; index++)
|
|
3801
|
+
num = (num << BigInt(8)) | BigInt(value[index]);
|
|
3802
|
+
return num;
|
|
3803
|
+
}
|
|
3804
|
+
function encodeBase64(value) {
|
|
3805
|
+
return buffer_1.Buffer.from(value).toString('base64');
|
|
3806
|
+
}
|
|
3807
|
+
function decodeBase64(value) {
|
|
3808
|
+
return buffer_1.Buffer.from(value, 'base64');
|
|
3809
|
+
}
|
|
3810
|
+
// export const sha256HashLength = 32
|
|
3811
|
+
// export function sha256Hash(arr: sha512.Message): Uint8Array {
|
|
3812
|
+
// return new Uint8Array(sha512.sha512_256.arrayBuffer(arr))
|
|
3813
|
+
// }
|
|
3814
|
+
// export function encodeApplicationAddress(id: number): Address {
|
|
3815
|
+
// const APP_ID_PREFIX = Buffer.from('appID');
|
|
3816
|
+
// const toBeSigned = concatArrays([APP_ID_PREFIX, encodeUint64(BigInt(id))]);
|
|
3817
|
+
// return encodeAddress(sha256Hash(toBeSigned));
|
|
3818
|
+
// }
|
|
3819
|
+
function compareArrays(a, b) {
|
|
3820
|
+
return a.length === b.length && a.reduce((equal, item, index) => equal && item === b[index], true);
|
|
3821
|
+
}
|
|
3822
|
+
function getDelta(response, key) {
|
|
3823
|
+
const delta = response['global-state-delta'].find((v) => v.key === key);
|
|
3824
|
+
if (delta === undefined)
|
|
3825
|
+
return undefined;
|
|
3826
|
+
return delta['value'];
|
|
3827
|
+
}
|
|
3828
|
+
function getDeltaUint(response, key) {
|
|
3829
|
+
const delta = getDelta(response, key);
|
|
3830
|
+
if (delta === undefined)
|
|
3831
|
+
return undefined;
|
|
3832
|
+
return BigInt(delta['uint']);
|
|
3833
|
+
}
|
|
3834
|
+
function getDeltaBytes(response, key) {
|
|
3835
|
+
const delta = getDelta(response, key);
|
|
3836
|
+
if (delta === undefined)
|
|
3837
|
+
return undefined;
|
|
3838
|
+
return decodeBase64(delta['bytes']);
|
|
3839
|
+
}
|
|
3840
|
+
function toUnix(date) {
|
|
3841
|
+
return Math.floor(date.getTime() / 1000);
|
|
3842
|
+
}
|
|
3843
|
+
function fromUnix(timestamp) {
|
|
3844
|
+
return new Date(timestamp * 1000);
|
|
3845
|
+
}
|
|
3846
|
+
var algosdk_2 = __webpack_require__(9709);
|
|
3847
|
+
Object.defineProperty(exports, "encodeAddress", ({ enumerable: true, get: function () { return algosdk_2.encodeAddress; } }));
|
|
3848
|
+
Object.defineProperty(exports, "decodeAddress", ({ enumerable: true, get: function () { return algosdk_2.decodeAddress; } }));
|
|
3849
|
+
|
|
3850
|
+
|
|
3851
|
+
/***/ }),
|
|
3852
|
+
|
|
3853
|
+
/***/ 9019:
|
|
3854
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3855
|
+
|
|
3856
|
+
|
|
3857
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3858
|
+
if (k2 === undefined) k2 = k;
|
|
3859
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3860
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
3861
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
3862
|
+
}
|
|
3863
|
+
Object.defineProperty(o, k2, desc);
|
|
3864
|
+
}) : (function(o, m, k, k2) {
|
|
3865
|
+
if (k2 === undefined) k2 = k;
|
|
3866
|
+
o[k2] = m[k];
|
|
3867
|
+
}));
|
|
3868
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
3869
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
3870
|
+
}) : function(o, v) {
|
|
3871
|
+
o["default"] = v;
|
|
3872
|
+
});
|
|
3873
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
3874
|
+
var ownKeys = function(o) {
|
|
3875
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
3876
|
+
var ar = [];
|
|
3877
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
3878
|
+
return ar;
|
|
3879
|
+
};
|
|
3880
|
+
return ownKeys(o);
|
|
3881
|
+
};
|
|
3882
|
+
return function (mod) {
|
|
3883
|
+
if (mod && mod.__esModule) return mod;
|
|
3884
|
+
var result = {};
|
|
3885
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
3886
|
+
__setModuleDefault(result, mod);
|
|
3887
|
+
return result;
|
|
3888
|
+
};
|
|
3889
|
+
})();
|
|
3890
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3891
|
+
exports.keccak256 = exports.verifyMessage = exports.verifySignature = exports.recoverPublicKey = exports.isAddress = exports.unpadHexPrefix = exports.decodeHexString = exports.decodeAndNormalizeAddress = exports.encodeAddress = void 0;
|
|
3892
|
+
exports.decode32Bytes = decode32Bytes;
|
|
3893
|
+
exports.encodeBigNumber = encodeBigNumber;
|
|
3894
|
+
exports.encode32Bytes = encode32Bytes;
|
|
3895
|
+
const ethUtil = __importStar(__webpack_require__(1297));
|
|
3896
|
+
const common_helper_1 = __webpack_require__(223);
|
|
3897
|
+
function decode32Bytes(value) {
|
|
3898
|
+
const bnValue = ethUtil.fromSigned(Buffer.from(value));
|
|
3899
|
+
// console.log('bnValue', value, bnValue, bnValue.toString())
|
|
3900
|
+
return BigInt(bnValue.toString());
|
|
3901
|
+
}
|
|
3902
|
+
function encodeBigNumber(value) {
|
|
3903
|
+
return ethUtil.toUnsigned(new ethUtil.BN(String(value)));
|
|
3904
|
+
}
|
|
3905
|
+
function encode32Bytes(value) {
|
|
3906
|
+
const buffer = encodeBigNumber(value);
|
|
3907
|
+
if (buffer.length > 32) {
|
|
3908
|
+
throw new Error("Invalid value. The buffer length of the value is more than 32");
|
|
3909
|
+
}
|
|
3910
|
+
return new Uint8Array(ethUtil.setLengthLeft(buffer, 32));
|
|
3911
|
+
}
|
|
3912
|
+
const encodeAddress = (address) => {
|
|
3913
|
+
if (address.length !== 32) {
|
|
3914
|
+
throw new Error("Invalid address bytes. The address buffer length is not equel 32");
|
|
3915
|
+
}
|
|
3916
|
+
const normalizedAddress = Buffer.from(address).toString('hex');
|
|
3917
|
+
if (normalizedAddress.slice(0, 24) !== '000000000000000000000000') {
|
|
3918
|
+
console.log('normalizedAddress', normalizedAddress);
|
|
3919
|
+
throw new Error("Invalid normalized address");
|
|
3920
|
+
}
|
|
3921
|
+
const hexAddress = '0x' + normalizedAddress.slice(-40);
|
|
3922
|
+
if (!(0, exports.isAddress)(hexAddress)) {
|
|
3923
|
+
throw new Error("Invalid hex address");
|
|
3924
|
+
}
|
|
3925
|
+
return hexAddress;
|
|
3926
|
+
};
|
|
3927
|
+
exports.encodeAddress = encodeAddress;
|
|
3928
|
+
const decodeAndNormalizeAddress = (address) => {
|
|
3929
|
+
return new Uint8Array(ethUtil.setLengthLeft((0, exports.decodeHexString)(address), 32));
|
|
3930
|
+
};
|
|
3931
|
+
exports.decodeAndNormalizeAddress = decodeAndNormalizeAddress;
|
|
3932
|
+
const decodeHexString = (address) => {
|
|
3933
|
+
return Buffer.from((0, exports.unpadHexPrefix)(address), 'hex');
|
|
3934
|
+
};
|
|
3935
|
+
exports.decodeHexString = decodeHexString;
|
|
3936
|
+
const unpadHexPrefix = (value) => {
|
|
3937
|
+
return value.startsWith('0x') ? value.slice(2) : value;
|
|
3938
|
+
};
|
|
3939
|
+
exports.unpadHexPrefix = unpadHexPrefix;
|
|
3940
|
+
const isAddress = (address) => ethUtil.isValidAddress(address);
|
|
3941
|
+
exports.isAddress = isAddress;
|
|
3942
|
+
const recoverPublicKey = (message, signature) => {
|
|
3943
|
+
const messageHash = ethUtil.keccak256(message); // Ensure message is correctly formatted
|
|
3944
|
+
const { r, s, v } = ethUtil.fromRpcSig(signature);
|
|
3945
|
+
// Recover the public key
|
|
3946
|
+
return ethUtil.ecrecover(messageHash, v, r, s);
|
|
3947
|
+
};
|
|
3948
|
+
exports.recoverPublicKey = recoverPublicKey;
|
|
3949
|
+
const verifySignature = (signature, address, message, encoding) => {
|
|
3950
|
+
return (0, exports.verifyMessage)((0, common_helper_1.getPrefixedMessage)(message, encoding, (0, common_helper_1.getProviderChainId)('EVM')), signature, address);
|
|
3951
|
+
};
|
|
3952
|
+
exports.verifySignature = verifySignature;
|
|
3953
|
+
const verifyMessage = (message, signature, address) => {
|
|
3954
|
+
const pk = (0, exports.recoverPublicKey)(message, signature);
|
|
3955
|
+
const ra = ethUtil.bufferToHex(ethUtil.publicToAddress(pk));
|
|
3956
|
+
return ra.toLowerCase() === address.toLowerCase();
|
|
3957
|
+
};
|
|
3958
|
+
exports.verifyMessage = verifyMessage;
|
|
3959
|
+
const keccak256 = (data) => {
|
|
3960
|
+
return new Uint8Array(ethUtil.keccak256(Buffer.from(data)));
|
|
3961
|
+
};
|
|
3962
|
+
exports.keccak256 = keccak256;
|
|
3963
|
+
|
|
3964
|
+
|
|
3965
|
+
/***/ }),
|
|
3966
|
+
|
|
3967
|
+
/***/ 9136:
|
|
3968
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3969
|
+
|
|
3970
|
+
|
|
3971
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3972
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3973
|
+
};
|
|
3974
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3975
|
+
exports.makeSetManagerKeyTxn = void 0;
|
|
3976
|
+
const algosdk_1 = __importDefault(__webpack_require__(9709));
|
|
3977
|
+
const algo_helper_1 = __webpack_require__(6897);
|
|
3978
|
+
const codex_helper_1 = __webpack_require__(3955);
|
|
3979
|
+
const common_helper_1 = __webpack_require__(223);
|
|
3980
|
+
const makeSetManagerKeyTxn = async (algoClient, superAppId, sender, mnaKey) => {
|
|
3981
|
+
const txnCounts = 1;
|
|
3982
|
+
const params = await (0, algo_helper_1.getTxnParams)(algoClient, txnCounts);
|
|
3983
|
+
params.flatFee = true;
|
|
3984
|
+
params.fee = 4000;
|
|
3985
|
+
console.log("new MNA key:", mnaKey);
|
|
3986
|
+
console.log("sender:", sender);
|
|
3987
|
+
console.log("superAppId:", superAppId);
|
|
3988
|
+
// return makeSetGlobalTxn(algoClient, superAppId, sender, AppGlobalParamName.MNA, mnaKey, AppGlobalParamType.STRING);
|
|
3989
|
+
const txn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
3990
|
+
appIndex: superAppId,
|
|
3991
|
+
from: sender,
|
|
3992
|
+
suggestedParams: params,
|
|
3993
|
+
appArgs: (0, common_helper_1.getAppArgs)("set_global(byte[],byte[],byte[])void", [
|
|
3994
|
+
(0, codex_helper_1.encode)("MNA", 'str'),
|
|
3995
|
+
// encode(mnaKey, 'str'),
|
|
3996
|
+
algosdk_1.default.decodeAddress(mnaKey).publicKey,
|
|
3997
|
+
(0, codex_helper_1.encode)('S', 'str')
|
|
3998
|
+
]),
|
|
3999
|
+
});
|
|
4000
|
+
return txn;
|
|
4001
|
+
};
|
|
4002
|
+
exports.makeSetManagerKeyTxn = makeSetManagerKeyTxn;
|
|
4003
|
+
|
|
4004
|
+
|
|
4005
|
+
/***/ }),
|
|
4006
|
+
|
|
4007
|
+
/***/ 9181:
|
|
4008
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
4009
|
+
|
|
4010
|
+
|
|
4011
|
+
//--import { Asset } from "@ultrade/shared/db/entities/market/asset.entity";
|
|
4012
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4013
|
+
exports.AmmBucketKeys = exports.VALIDATOR_APP_ID = exports.CONTRACT_VERSION = exports.AmmForeignResources = exports.AmmChars = exports.AmmIds = exports.PoolType = void 0;
|
|
4014
|
+
var PoolType;
|
|
4015
|
+
(function (PoolType) {
|
|
4016
|
+
PoolType["STABLE"] = "stable";
|
|
4017
|
+
PoolType["CPMM"] = "constant_product";
|
|
4018
|
+
PoolType["LEND"] = "lending";
|
|
4019
|
+
PoolType["NANO"] = "nano";
|
|
4020
|
+
PoolType["MVNANO"] = "mvnano";
|
|
4021
|
+
})(PoolType || (exports.PoolType = PoolType = {}));
|
|
4022
|
+
var AmmIds;
|
|
4023
|
+
(function (AmmIds) {
|
|
4024
|
+
AmmIds[AmmIds["ultrade"] = 0] = "ultrade";
|
|
4025
|
+
AmmIds[AmmIds["tinyman"] = 1] = "tinyman";
|
|
4026
|
+
AmmIds[AmmIds["pactfi"] = 2] = "pactfi";
|
|
4027
|
+
AmmIds[AmmIds["humble"] = 3] = "humble";
|
|
4028
|
+
AmmIds[AmmIds["algofi"] = 4] = "algofi";
|
|
4029
|
+
})(AmmIds || (exports.AmmIds = AmmIds = {}));
|
|
4030
|
+
var AmmChars;
|
|
4031
|
+
(function (AmmChars) {
|
|
4032
|
+
AmmChars["ultrade"] = "U";
|
|
4033
|
+
AmmChars["tinyman"] = "T";
|
|
4034
|
+
AmmChars["pactfi"] = "P";
|
|
4035
|
+
AmmChars["humble"] = "H";
|
|
4036
|
+
AmmChars["algofi"] = "A";
|
|
4037
|
+
})(AmmChars || (exports.AmmChars = AmmChars = {}));
|
|
4038
|
+
var AmmForeignResources;
|
|
4039
|
+
(function (AmmForeignResources) {
|
|
4040
|
+
AmmForeignResources[AmmForeignResources["ultrade"] = 1] = "ultrade";
|
|
4041
|
+
AmmForeignResources[AmmForeignResources["tinyman"] = 2] = "tinyman";
|
|
4042
|
+
AmmForeignResources[AmmForeignResources["pactfi"] = 1] = "pactfi";
|
|
4043
|
+
AmmForeignResources[AmmForeignResources["humble"] = 1] = "humble";
|
|
4044
|
+
AmmForeignResources[AmmForeignResources["algofi"] = 2] = "algofi";
|
|
4045
|
+
})(AmmForeignResources || (exports.AmmForeignResources = AmmForeignResources = {}));
|
|
4046
|
+
exports.CONTRACT_VERSION = {
|
|
4047
|
+
V1_1: 'v1_1',
|
|
4048
|
+
V2: 'v2',
|
|
4049
|
+
};
|
|
4050
|
+
exports.VALIDATOR_APP_ID = {
|
|
4051
|
+
[exports.CONTRACT_VERSION.V1_1]: {
|
|
4052
|
+
testnet: 62368684,
|
|
4053
|
+
mainnet: 552635992,
|
|
4054
|
+
},
|
|
4055
|
+
[exports.CONTRACT_VERSION.V2]: {
|
|
4056
|
+
testnet: 148607000,
|
|
4057
|
+
mainnet: 1002541853,
|
|
4058
|
+
},
|
|
4059
|
+
};
|
|
4060
|
+
var AmmBucketKeys;
|
|
4061
|
+
(function (AmmBucketKeys) {
|
|
4062
|
+
AmmBucketKeys["ASSETS"] = "assets.json";
|
|
4063
|
+
AmmBucketKeys["TOP_ASSETS"] = "topAssets.json";
|
|
4064
|
+
})(AmmBucketKeys || (exports.AmmBucketKeys = AmmBucketKeys = {}));
|
|
4065
|
+
|
|
4066
|
+
|
|
4067
|
+
/***/ }),
|
|
4068
|
+
|
|
4069
|
+
/***/ 9367:
|
|
4070
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
4071
|
+
|
|
4072
|
+
|
|
4073
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4074
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4075
|
+
};
|
|
4076
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4077
|
+
exports.makeUpdateMbrTxn = exports.getMbrBoxValue = void 0;
|
|
4078
|
+
const algosdk_1 = __importDefault(__webpack_require__(9709));
|
|
4079
|
+
const algo_helper_1 = __webpack_require__(6897);
|
|
4080
|
+
const common_helper_1 = __webpack_require__(223);
|
|
4081
|
+
const Encoding_1 = __webpack_require__(8593);
|
|
4082
|
+
const codex_helper_1 = __webpack_require__(3955);
|
|
4083
|
+
const getMbrBoxName = () => (0, codex_helper_1.encode)('MBR', 'str');
|
|
4084
|
+
const getMbrBoxValue = async (algoClient, appId) => {
|
|
4085
|
+
const boxName = getMbrBoxName();
|
|
4086
|
+
try {
|
|
4087
|
+
const box = await (0, algo_helper_1.getBoxByName)(algoClient, appId, boxName);
|
|
4088
|
+
if (!box)
|
|
4089
|
+
return;
|
|
4090
|
+
const boxValue = (0, Encoding_1.decodeUint64)(box);
|
|
4091
|
+
console.log('Box MBR', boxValue);
|
|
4092
|
+
return boxValue;
|
|
4093
|
+
}
|
|
4094
|
+
catch (err) {
|
|
4095
|
+
console.log("err", err);
|
|
4096
|
+
}
|
|
4097
|
+
};
|
|
4098
|
+
exports.getMbrBoxValue = getMbrBoxValue;
|
|
4099
|
+
const makeUpdateMbrTxn = async (algoClient, sender, appId, superAppId, { amount, type }) => {
|
|
4100
|
+
const appArgs = (0, common_helper_1.getAppArgs)("updateMBR(byte[],uint64)uint64", [(0, codex_helper_1.encode)(type, 'str'), amount]);
|
|
4101
|
+
const foreignApps = type === 'withdraw' ? [superAppId] : [];
|
|
4102
|
+
const txnCounts = type === 'withdraw' ? 2 : 1;
|
|
4103
|
+
const params = await (0, algo_helper_1.getTxnParams)(algoClient, txnCounts);
|
|
4104
|
+
const appCallTxn = algosdk_1.default.makeApplicationNoOpTxnFromObject({
|
|
4105
|
+
appIndex: appId,
|
|
4106
|
+
from: sender,
|
|
4107
|
+
suggestedParams: params,
|
|
4108
|
+
appArgs,
|
|
4109
|
+
boxes: [{ appIndex: appId, name: getMbrBoxName() }],
|
|
4110
|
+
foreignApps,
|
|
4111
|
+
});
|
|
4112
|
+
console.log('updateMbr txn', appCallTxn, sender);
|
|
4113
|
+
if (type === 'deposit') {
|
|
4114
|
+
const xfer = {
|
|
4115
|
+
suggestedParams: params,
|
|
4116
|
+
from: sender,
|
|
4117
|
+
to: algosdk_1.default.getApplicationAddress(appId),
|
|
4118
|
+
amount,
|
|
4119
|
+
};
|
|
4120
|
+
const paymentTxn = algosdk_1.default.makePaymentTxnWithSuggestedParamsFromObject(xfer);
|
|
4121
|
+
return [paymentTxn, appCallTxn];
|
|
4122
|
+
}
|
|
4123
|
+
return [appCallTxn];
|
|
4124
|
+
};
|
|
4125
|
+
exports.makeUpdateMbrTxn = makeUpdateMbrTxn;
|
|
4126
|
+
|
|
4127
|
+
|
|
4128
|
+
/***/ }),
|
|
4129
|
+
|
|
4130
|
+
/***/ 9709:
|
|
4131
|
+
/***/ ((module) => {
|
|
4132
|
+
|
|
4133
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__9709__;
|
|
4134
|
+
|
|
4135
|
+
/***/ }),
|
|
4136
|
+
|
|
4137
|
+
/***/ 9730:
|
|
4138
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
4139
|
+
|
|
4140
|
+
|
|
4141
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4142
|
+
if (k2 === undefined) k2 = k;
|
|
4143
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4144
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
4145
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
4146
|
+
}
|
|
4147
|
+
Object.defineProperty(o, k2, desc);
|
|
4148
|
+
}) : (function(o, m, k, k2) {
|
|
4149
|
+
if (k2 === undefined) k2 = k;
|
|
4150
|
+
o[k2] = m[k];
|
|
4151
|
+
}));
|
|
4152
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
4153
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
4154
|
+
};
|
|
4155
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4156
|
+
exports.sortKeysInObject = sortKeysInObject;
|
|
4157
|
+
exports.round2 = round2;
|
|
4158
|
+
__exportStar(__webpack_require__(5910), exports);
|
|
4159
|
+
__exportStar(__webpack_require__(865), exports);
|
|
4160
|
+
__exportStar(__webpack_require__(839), exports);
|
|
4161
|
+
function sortKeysInObject(o) {
|
|
4162
|
+
return Object.keys(o).sort().reduce((acc, key) => ({ ...acc, [key]: o[key] }), {});
|
|
4163
|
+
}
|
|
4164
|
+
function round2(val) { return Math.round(val * 100) / 100; }
|
|
4165
|
+
|
|
4166
|
+
|
|
4167
|
+
/***/ }),
|
|
4168
|
+
|
|
4169
|
+
/***/ 9862:
|
|
4170
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
4171
|
+
|
|
4172
|
+
|
|
4173
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4174
|
+
exports.CCTP_UNIFIED_ASSETS = void 0;
|
|
4175
|
+
exports.CCTP_UNIFIED_ASSETS = {
|
|
4176
|
+
"0x4343545055534443000000000000000000000000000000000000000000000000": 65537,
|
|
4177
|
+
};
|
|
4178
|
+
|
|
4179
|
+
|
|
4180
|
+
/***/ }),
|
|
4181
|
+
|
|
4182
|
+
/***/ 9965:
|
|
4183
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
4184
|
+
|
|
4185
|
+
|
|
4186
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4187
|
+
if (k2 === undefined) k2 = k;
|
|
4188
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4189
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
4190
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
4191
|
+
}
|
|
4192
|
+
Object.defineProperty(o, k2, desc);
|
|
4193
|
+
}) : (function(o, m, k, k2) {
|
|
4194
|
+
if (k2 === undefined) k2 = k;
|
|
4195
|
+
o[k2] = m[k];
|
|
4196
|
+
}));
|
|
4197
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
4198
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
4199
|
+
};
|
|
4200
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4201
|
+
__exportStar(__webpack_require__(2228), exports);
|
|
4202
|
+
__exportStar(__webpack_require__(6978), exports);
|
|
4203
|
+
__exportStar(__webpack_require__(2739), exports);
|
|
4204
|
+
__exportStar(__webpack_require__(6119), exports);
|
|
4205
|
+
__exportStar(__webpack_require__(3004), exports);
|
|
4206
|
+
|
|
4207
|
+
|
|
4208
|
+
/***/ })
|
|
4209
|
+
|
|
4210
|
+
/******/ });
|
|
4211
|
+
/************************************************************************/
|
|
4212
|
+
/******/ // The module cache
|
|
4213
|
+
/******/ var __webpack_module_cache__ = {};
|
|
4214
|
+
/******/
|
|
4215
|
+
/******/ // The require function
|
|
4216
|
+
/******/ function __webpack_require__(moduleId) {
|
|
4217
|
+
/******/ // Check if module is in cache
|
|
4218
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
4219
|
+
/******/ if (cachedModule !== undefined) {
|
|
4220
|
+
/******/ return cachedModule.exports;
|
|
4221
|
+
/******/ }
|
|
4222
|
+
/******/ // Create a new module (and put it into the cache)
|
|
4223
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
4224
|
+
/******/ // no module.id needed
|
|
4225
|
+
/******/ // no module.loaded needed
|
|
4226
|
+
/******/ exports: {}
|
|
4227
|
+
/******/ };
|
|
4228
|
+
/******/
|
|
4229
|
+
/******/ // Execute the module function
|
|
4230
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
4231
|
+
/******/
|
|
4232
|
+
/******/ // Return the exports of the module
|
|
4233
|
+
/******/ return module.exports;
|
|
4234
|
+
/******/ }
|
|
4235
|
+
/******/
|
|
4236
|
+
/************************************************************************/
|
|
4237
|
+
/******/
|
|
4238
|
+
/******/ // startup
|
|
4239
|
+
/******/ // Load entry module and return exports
|
|
4240
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
4241
|
+
/******/ var __webpack_exports__ = __webpack_require__(9367);
|
|
4242
|
+
/******/
|
|
4243
|
+
/******/ return __webpack_exports__;
|
|
4244
|
+
/******/ })()
|
|
4245
|
+
;
|
|
4246
|
+
});
|