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