@ultrade/shared 1.0.9 → 1.0.11
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/README.md +232 -0
- package/dist/browser/helpers/withdraw.helper.js +1 -1
- package/dist/browser/interfaces/index.js +1 -1
- package/dist/{src/common → common}/mappers/codexAsset.mapper.d.ts +1 -1
- package/dist/{src/common → common}/mappers/codexBalance.mapper.d.ts +1 -1
- package/dist/{src/common → common}/mappers/trade.mapper.d.ts +3 -3
- package/dist/{src/helpers → helpers}/assert.helper.d.ts +2 -2
- package/dist/{src/helpers → helpers}/balance.helper.d.ts +3 -3
- package/dist/{src/helpers → helpers}/codex/common.helper.d.ts +1 -1
- package/dist/{src/helpers → helpers}/order.helper.d.ts +1 -1
- package/dist/{src/helpers → helpers}/pair.helper.d.ts +1 -1
- package/dist/{src/helpers → helpers}/pointSystem.helper.d.ts +1 -1
- package/dist/{src/helpers → helpers}/withdraw.helper.d.ts +1 -1
- package/dist/{src/interfaces → interfaces}/accountInfo.interface.d.ts +2 -2
- package/dist/{src/interfaces → interfaces}/api/affiliate.interface.d.ts +1 -1
- package/dist/{src/interfaces → interfaces}/cache.interface.d.ts +1 -1
- package/dist/{src/interfaces → interfaces}/db/hummingbot/index.d.ts +2 -2
- package/dist/{src/interfaces → interfaces}/db/market/index.d.ts +2 -2
- package/dist/{src/interfaces → interfaces}/db/notification_center/index.d.ts +2 -2
- package/dist/{src/interfaces → interfaces}/db/relayer/index.d.ts +2 -2
- package/dist/{src/interfaces → interfaces}/db/social/index.d.ts +2 -2
- package/dist/{src/interfaces → interfaces}/db/white_label/index.d.ts +2 -2
- package/dist/{src/interfaces → interfaces}/db/withdrawal_wallets/index.d.ts +1 -1
- package/dist/{src/interfaces → interfaces}/dto/index.d.ts +1 -1
- package/dist/{src/interfaces → interfaces}/index.d.ts +1 -0
- package/dist/{src/interfaces → interfaces}/last-look-trade.interface.d.ts +1 -1
- package/dist/{src/interfaces → interfaces}/order.interface.d.ts +2 -2
- package/dist/interfaces/pagination.interface.d.ts +57 -0
- package/dist/{src/interfaces → interfaces}/services/accountCache.interface.d.ts +2 -2
- package/dist/{src/interfaces → interfaces}/services/balances.interface.d.ts +1 -1
- package/dist/{src/interfaces → interfaces}/services/price-model.interface.d.ts +1 -1
- package/dist/{src/interfaces → interfaces}/services/price-service.interface.d.ts +1 -1
- package/dist/{src/interfaces → interfaces}/services/socialActivity.interface.d.ts +1 -1
- package/dist/{src/interfaces → interfaces}/streaming.interface.d.ts +2 -2
- package/dist/{src/interfaces → interfaces}/trading.interface.d.ts +2 -2
- package/dist/{src/interfaces → interfaces}/tradingKey.interface.d.ts +1 -1
- package/dist/{src/interfaces → interfaces}/wallet.interface.d.ts +1 -1
- package/dist/{src/interfaces → interfaces}/withdrawalWallets.interface.d.ts +1 -1
- package/dist/node/helpers/withdraw.helper.js +1 -1
- package/dist/{src/types → types}/amm/amm.d.ts +1 -1
- package/dist/{src/types → types}/hummingbots.types.d.ts +1 -1
- package/dist/{src/types → types}/notification.type.d.ts +1 -1
- package/dist/{src/types → types}/state.type.d.ts +1 -1
- package/package.json +13 -8
- /package/dist/{src/common → common}/auth.helper.d.ts +0 -0
- /package/dist/{src/common → common}/big-number.helper.d.ts +0 -0
- /package/dist/{src/common → common}/index.d.ts +0 -0
- /package/dist/{src/common → common}/mappers/index.d.ts +0 -0
- /package/dist/{src/common → common}/utils/assert.d.ts +0 -0
- /package/dist/{src/common → common}/utils/decode.d.ts +0 -0
- /package/dist/{src/common → common}/utils/index.d.ts +0 -0
- /package/dist/{src/common → common}/utils/social.d.ts +0 -0
- /package/dist/{src/common → common}/utils/stat.d.ts +0 -0
- /package/dist/{src/constants → constants}/auth.d.ts +0 -0
- /package/dist/{src/constants → constants}/cctp.d.ts +0 -0
- /package/dist/{src/constants → constants}/codex.d.ts +0 -0
- /package/dist/{src/constants → constants}/index.d.ts +0 -0
- /package/dist/{src/constants → constants}/response.d.ts +0 -0
- /package/dist/{src/constants → constants}/settings.d.ts +0 -0
- /package/dist/{src/constants → constants}/withdrawalWalletsMessage.d.ts +0 -0
- /package/dist/{src/enums → enums}/chains.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/account/index.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/affiliate.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/available-pair-settings.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/common.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/component/index.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/index.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/market-maker.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/notification-center/userNotification.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/order-side.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/order-status.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/order-type.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/relayer.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/setting-type.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/social-action.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/social-prompt.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/social.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/state-type.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/trade.enums.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/tradingKeyType.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/upgrade.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/db/withdrawal-wallet.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/index.d.ts +0 -0
- /package/dist/{src/enums → enums}/maintenanceMode.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/notification.enum.d.ts +0 -0
- /package/dist/{src/enums → enums}/rabbitMq.d.ts +0 -0
- /package/dist/{src/enums → enums}/social.enum.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/Encoding.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/algo.helper.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/atomic.helper.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/codex/index.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/codex/mbr.helper.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/codex/mna.helper.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/codex/order.helper.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/codex/setGlobal.helper.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/codex/transfer.helper.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/codex/txn.helper.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/codex.helper.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/eth.helper.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/index.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/interval.helpers.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/liquidity.helper.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/ticker.helpers.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/vaa.helper.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/api/index.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/db/baseModel.interface.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/db/index.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/db/marketing/index.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/db/softDeleteModel.interface.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/emailService.interface.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/kmsService.interface.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/market.interface.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/pair.interface.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/query.interface.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/services/algod.interface.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/services/coin-market-cap.interface.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/services/index.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/services/tmc.interface.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/timestream.interface.d.ts +0 -0
- /package/dist/{src/interfaces → interfaces}/transfer.interface.d.ts +0 -0
- /package/dist/{src/types → types}/algo-order.type.d.ts +0 -0
- /package/dist/{src/types → types}/api/request.types.d.ts +0 -0
- /package/dist/{src/types → types}/codex.types.d.ts +0 -0
- /package/dist/{src/types → types}/index.d.ts +0 -0
- /package/dist/{src/types → types}/settings.type.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICompany, ICompanySetting } from '
|
|
1
|
+
import { ICompany, ICompanySetting } from './index.ts';
|
|
2
2
|
export interface ICompanyCache extends Pick<ICompany, 'id' | 'domain' | 'name' | 'enabled' | 'isSuper' | 'collectionWallet' | 'collectionWalletChainId'> {
|
|
3
3
|
companyBDPartner: ICompanyBDPartnerCache;
|
|
4
4
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FeeTier, LastLookAction, KYCAuthenticationStatus, StateType, UpgradeStatus, OrderSide, TradeStatus, TradeSubStatus, TradingKeyType, ComponentType, ComponentStatusType, PairComponentStatusType } from '
|
|
2
|
-
import { IBaseModel, ICompany } from '
|
|
1
|
+
import { FeeTier, LastLookAction, KYCAuthenticationStatus, StateType, UpgradeStatus, OrderSide, TradeStatus, TradeSubStatus, TradingKeyType, ComponentType, ComponentStatusType, PairComponentStatusType } from '../../../enums/index.ts';
|
|
2
|
+
import { IBaseModel, ICompany } from '../../index.ts';
|
|
3
3
|
export interface IAccount {
|
|
4
4
|
address: string;
|
|
5
5
|
chainId: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GlobalNotificationEnum, NotificationPriorityEnum, NotificationStatusEnum, NotificationType, ScheduledNotificationStatusEnum } from '
|
|
2
|
-
import { IAccount } from '
|
|
1
|
+
import { GlobalNotificationEnum, NotificationPriorityEnum, NotificationStatusEnum, NotificationType, ScheduledNotificationStatusEnum } from '../../../enums/index.ts';
|
|
2
|
+
import { IAccount } from '../../index.ts';
|
|
3
3
|
export interface INotificationModel {
|
|
4
4
|
id: number;
|
|
5
5
|
priority: NotificationPriorityEnum;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CCTPStatus, TransactionType } from '
|
|
2
|
-
import { ICodexAsset } from '
|
|
1
|
+
import { CCTPStatus, TransactionType } from '../../../enums/index.ts';
|
|
2
|
+
import { ICodexAsset } from '../../index.ts';
|
|
3
3
|
export interface IOperationStatus {
|
|
4
4
|
primaryId: number;
|
|
5
5
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ActionSource, PromptTypeEnum, SeasonStatusEnum, TweetType } from '
|
|
2
|
-
import { IAccount, ICompany } from '
|
|
1
|
+
import { ActionSource, PromptTypeEnum, SeasonStatusEnum, TweetType } from '../../../enums/index.ts';
|
|
2
|
+
import { IAccount, ICompany } from '../../index.ts';
|
|
3
3
|
export interface ISocialAccount {
|
|
4
4
|
address: string;
|
|
5
5
|
companyId: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SettingTypeColumn, MarketMakerRebateTier } from '
|
|
2
|
-
import { ICollectionWallet, IBaseModel, ISoftDeleteModel, IAccount, IPairEntity, IAvailablePairSetting, IInvitedByAffiliateAccount } from '
|
|
1
|
+
import { SettingTypeColumn, MarketMakerRebateTier } from '../../../enums/index.ts';
|
|
2
|
+
import { ICollectionWallet, IBaseModel, ISoftDeleteModel, IAccount, IPairEntity, IAvailablePairSetting, IInvitedByAffiliateAccount } from '../../index.ts';
|
|
3
3
|
export interface ICompanyBDPartner {
|
|
4
4
|
companyId: number;
|
|
5
5
|
name: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OrderSide, OrderType, Chains } from "
|
|
2
|
-
import { IRangeParamsDto } from "
|
|
1
|
+
import { OrderSide, OrderType, Chains } from "../enums/index.ts";
|
|
2
|
+
import { IRangeParamsDto } from "./index.ts";
|
|
3
3
|
export interface IOrderDataInMsg {
|
|
4
4
|
address: string;
|
|
5
5
|
chainId: Chains;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface ObjectLiteral {
|
|
2
|
+
[s: string]: any;
|
|
3
|
+
}
|
|
4
|
+
export interface IPaginationLinks {
|
|
5
|
+
/**
|
|
6
|
+
* a link to the "first" page
|
|
7
|
+
*/
|
|
8
|
+
first?: string;
|
|
9
|
+
/**
|
|
10
|
+
* a link to the "previous" page
|
|
11
|
+
*/
|
|
12
|
+
previous?: string;
|
|
13
|
+
/**
|
|
14
|
+
* a link to the "next" page
|
|
15
|
+
*/
|
|
16
|
+
next?: string;
|
|
17
|
+
/**
|
|
18
|
+
* a link to the "last" page
|
|
19
|
+
*/
|
|
20
|
+
last?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface IPaginationMeta extends ObjectLiteral {
|
|
23
|
+
/**
|
|
24
|
+
* the amount of items on this specific page
|
|
25
|
+
*/
|
|
26
|
+
itemCount: number;
|
|
27
|
+
/**
|
|
28
|
+
* the total amount of items
|
|
29
|
+
*/
|
|
30
|
+
totalItems?: number;
|
|
31
|
+
/**
|
|
32
|
+
* the amount of items that were requested per page
|
|
33
|
+
*/
|
|
34
|
+
itemsPerPage: number;
|
|
35
|
+
/**
|
|
36
|
+
* the total amount of pages in this paginator
|
|
37
|
+
*/
|
|
38
|
+
totalPages?: number;
|
|
39
|
+
/**
|
|
40
|
+
* the current page this paginator "points" to
|
|
41
|
+
*/
|
|
42
|
+
currentPage: number;
|
|
43
|
+
}
|
|
44
|
+
export interface PaginatedResult<PaginationObject, T extends ObjectLiteral = IPaginationMeta> {
|
|
45
|
+
/**
|
|
46
|
+
* a list of items to be returned
|
|
47
|
+
*/
|
|
48
|
+
items: PaginationObject[];
|
|
49
|
+
/**
|
|
50
|
+
* associated meta information (e.g., counts)
|
|
51
|
+
*/
|
|
52
|
+
meta: T;
|
|
53
|
+
/**
|
|
54
|
+
* associated links
|
|
55
|
+
*/
|
|
56
|
+
links?: IPaginationLinks;
|
|
57
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IAccount, IAccountInfo } from '
|
|
2
|
-
import { LastLookAction, MarketMakerRebateTier, KYCAuthenticationStatus } from '
|
|
1
|
+
import { IAccount, IAccountInfo } from '../index.ts';
|
|
2
|
+
import { LastLookAction, MarketMakerRebateTier, KYCAuthenticationStatus } from '../../enums/index.ts';
|
|
3
3
|
export interface AccountInfo extends IAccount, IAccountInfo {
|
|
4
4
|
lastLook?: {
|
|
5
5
|
defaultAction: LastLookAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICodexAsset, IPriceModel } from '
|
|
1
|
+
import { ICodexAsset, IPriceModel } from '../index.ts';
|
|
2
2
|
export interface PriceProvider {
|
|
3
3
|
getPrices(assets: Pick<ICodexAsset, 'id' | 'coinmarketcapId'>[]): Promise<IPriceModel | null>;
|
|
4
4
|
compareAssetWithCoinmarketId(assets: ICodexAsset[], isMainnet: boolean): Promise<ICodexAsset[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OperationStatusEnum, OrderSide, OrderStatus, OrderType } from "
|
|
2
|
-
import { Notification } from "
|
|
1
|
+
import { OperationStatusEnum, OrderSide, OrderStatus, OrderType } from "../enums/index.ts";
|
|
2
|
+
import { Notification } from "../types/index.ts";
|
|
3
3
|
export interface CancelStreamTrade {
|
|
4
4
|
pairId: number;
|
|
5
5
|
pairKey: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OrderSide, OrderType, TradeStatus } from "
|
|
2
|
-
import { IPairSetting, PairToken, PairTokenInfo } from "
|
|
1
|
+
import { OrderSide, OrderType, TradeStatus } from "../enums/index.ts";
|
|
2
|
+
import { IPairSetting, PairToken, PairTokenInfo } from "./index.ts";
|
|
3
3
|
export interface InsertTrade {
|
|
4
4
|
buy_order_id?: number;
|
|
5
5
|
sell_order_id?: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{PublicKey as b}from"@solana/web3.js";var m={"0x4343545055534443000000000000000000000000000000000000000000000000":65537};import io from"algosdk";import*as z from"bs58";import se from"algosdk";import Re,{decodeAddress as ke,encodeAddress as Pe}from"algosdk";import{Buffer as T}from"buffer";import{encodeAddress as te,decodeAddress as Ue}from"algosdk";function p(e){return e.reduce((r,t)=>Uint8Array.from([...r,...t]))}function h(e){return new Uint8Array(T.from(e))}function P(e){return T.from(e).toString("utf-8")}function L(e){return T.from(e).toString("base64")}function I(e){return T.from(e,"base64")}import ne from"bignumber.js";ne.config({DECIMAL_PLACES:40,EXPONENTIAL_AT:45});var $e=`{"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 w={V1_1:"v1_1",V2:"v2"},Xe={[w.V1_1]:{testnet:62368684,mainnet:552635992},[w.V2]:{testnet:148607e3,mainnet:1002541853}};var M=e=>se.decodeAddress(e.toUpperCase()).publicKey;import*as a from"ethereumjs-util";function _(e){let r=a.fromSigned(Buffer.from(e));return BigInt(r.toString())}function ce(e){return a.toUnsigned(new a.BN(String(e)))}function l(e){let r=ce(e);if(r.length>32)throw new Error("Invalid value. The buffer length of the value is more than 32");return new Uint8Array(a.setLengthLeft(r,32))}var U=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(!de(t))throw new Error("Invalid hex address");return t},v=e=>new Uint8Array(a.setLengthLeft(E(e),32)),E=e=>Buffer.from(pe(e),"hex"),pe=e=>e.startsWith("0x")?e.slice(2):e,de=e=>a.isValidAddress(e);var N=e=>new Uint8Array(a.keccak256(Buffer.from(e)));import d from"algosdk";import*as C from"bs58";import _r from"algosdk";import Rr from"algosdk";import Qr from"algosdk";var Ur={SMALLESTUNIT:process.env.SMALLEST_UNIT},vr={SMALLEST_UNITS:process.env.SMALLEST_UNIT};var Gr=["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 G=e=>`By signing this message, you confirm that the wallet is a trusted one ${e}; Data: `;import cn from"algosdk";var K=(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))(K||{}),H=(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))(H||{}),ht={...K,...H};import En from"algosdk";var s=(e,r,t)=>{switch(r){case"8B":return d.encodeUint64(Number(e));case"32B":return l(e);case"str":return h(String(e));case"address":return u(String(e),t);case"token":return $(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(d.encodeUint64(Number(e))).subarray(-1));case"2B":return new Uint8Array(Buffer.from(d.encodeUint64(Number(e))).subarray(-2));case"4B":return new Uint8Array(Buffer.from(d.encodeUint64(Number(e))).subarray(-4));default:return Buffer.from(e.toString())}},c=(e,r,t)=>{switch(r){case"8B":return d.decodeUint64(e,"safe");case"32B":return _(e);case"str":return P(e);case"address":return V(e,t);case"token":return Te(e,t);case"float":return Buffer.from(e).readDoubleBE(0);case"bool":case"2B":return c(e,"8B");default:return Buffer.from(e).toString()}};var V=(e,r)=>r===8?d.encodeAddress(e):r===1?C.encode(e):U(e),Te=(e,r)=>{let t=Buffer.from(e).toString("hex");return t.startsWith("0x")||(t="0x"+t),m[t]?t:r===8?String(_(e)):r===1?C.encode(e):V(e,r)};var $=(e,r)=>r===8?l(+e):m[e]?new Uint8Array(E(String(e))):u(String(e),r);var O=(e,r,t,n)=>{let o=u(e,r),i=d.encodeUint64(r),x=d.encodeUint64(n),A=$(t,n);return p([o,i,A,x])};var B=(e,r)=>p([Ee(e),Y(r)]),Ee=e=>new Uint8Array(Buffer.from(e+`
|
|
2
|
-
`,"utf-8")),Y=e=>new Uint8Array(Buffer.from(L(e)));var y=e=>Buffer.from(N(e)).toString("hex");var g=(e,r,t)=>{let n=Buffer.from(e,r),o=n.subarray(n.length-t),i=Buffer.from(o).toString();return I(i)};var u=(e,r)=>r===8?M(e):r===1?z.decode(e):v(e);var he=new b("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Ie=new b("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function _e(e,r,t=!1,n=he,o=Ie){if(!t&&!b.isOnCurve(r.toBuffer()))throw new Error("TokenOwnerOffCurveError");let[i]=b.findProgramAddressSync([r.toBuffer(),n.toBuffer(),e.toBuffer()],o);return i}var
|
|
2
|
+
`,"utf-8")),Y=e=>new Uint8Array(Buffer.from(L(e)));var y=e=>Buffer.from(N(e)).toString("hex");var g=(e,r,t)=>{let n=Buffer.from(e,r),o=n.subarray(n.length-t),i=Buffer.from(o).toString();return I(i)};var u=(e,r)=>r===8?M(e):r===1?z.decode(e):v(e);var he=new b("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Ie=new b("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function _e(e,r,t=!1,n=he,o=Ie){if(!t&&!b.isOnCurve(r.toBuffer()))throw new Error("TokenOwnerOffCurveError");let[i]=b.findProgramAddressSync([r.toBuffer(),n.toBuffer(),e.toBuffer()],o);return i}var Ta=(e,r,t)=>{let n=e==="MainNet"?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";if(j(r,t))return n},Ea=process.env.ALGO_NETWORK==="MainNet"?"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v":"4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",j=(e,r)=>m[e]&&r===1,Ne=(e,r="hex")=>g(e,r,248),ya=e=>y(Ne(e,"hex")),ha=(e,r="hex")=>{let t=g(e,r,248),n=Number(c(t.subarray(32,40),"8B")),o=Number(c(t.subarray(104,112),"8B"));return{loginAddress:String(c(t.subarray(0,32),"address",n)),loginChainId:n,tokenIndex:String(c(t.subarray(40,72),"token",o)),tokenChainId:o,recipient:String(c(t.subarray(72,104),"address",o)),recipientChainId:o,tokenAmount:String(c(t.subarray(112,144),"32B")),isNative:!!c(t.subarray(144,145),"bool"),fee:Number(c(t.subarray(145,177),"32B")),random:Number(c(t.subarray(177,185),"8B"))}},Ia=(e,r)=>{let{loginAddress:t,loginChainId:n,recipient:o,recipientChainId:i,tokenAmount:x,tokenIndex:A,isNative:D,fee:q,random:J,solanaUsdc:Q}=e,R=u(o,i);if(j(String(A),i)){let re=new b(Q),k=_e(re,new b(o));console.log("associatedTokenAddress",k.toBase58()),R=u(k.toBase58(),i)}let Z=O(t,n,A,i),ee=p([Z.slice(0,72),R,s(i,"8B"),l(x),s(+D,"bool"),l(q),s(J,"8B")]);return B(r||JSON.stringify(e),ee)},Se={EVM:5,ALGORAND:8,SOLANA:1},_a=e=>{let r=[s(e.address,"address",Se[e.type]),s(e.name,"str"),s(e.type,"str"),s(e.description||"","str")],t=Buffer.concat(r),n=G(e.address);return B(n,t)};export{Ie as ASSOCIATED_TOKEN_PROGRAM_ID,Ea as SOLANA_USDC,he as TOKEN_PROGRAM_ID,ya as calcWithdrawHash,_a as createWithdrawalWalletMsg,ha as decodeWithdrawMsg,_e as getAssociatedTokenAddressSync,Ta as getSolanaUsdc,Ne as getWithdrawBytesFromMsg,j as isSolanaCctp,Ia as makeWithdrawMsg};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NotificationPriorityEnum, NotificationStatusEnum, NotificationType } from "
|
|
1
|
+
import { NotificationPriorityEnum, NotificationStatusEnum, NotificationType } from "../enums/index.ts";
|
|
2
2
|
export type Notification = {
|
|
3
3
|
id: number | null;
|
|
4
4
|
globalNotificationId: number | null;
|
package/package.json
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultrade/shared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "This package contains shared code for the projects.",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./browser/common/*": {
|
|
7
7
|
"import": "./dist/browser/common/*.js",
|
|
8
|
-
"types": "./dist/
|
|
8
|
+
"types": "./dist/common/*.d.ts"
|
|
9
9
|
},
|
|
10
10
|
"./node/common/*": {
|
|
11
11
|
"import": "./dist/node/common/*.js",
|
|
12
|
-
"types": "./dist/
|
|
12
|
+
"types": "./dist/common/*.d.ts"
|
|
13
13
|
},
|
|
14
14
|
"./browser/helpers/*": {
|
|
15
15
|
"import": "./dist/browser/helpers/*.js",
|
|
16
|
-
"types": "./dist/
|
|
16
|
+
"types": "./dist/helpers/*.d.ts"
|
|
17
17
|
},
|
|
18
18
|
"./node/helpers/*": {
|
|
19
19
|
"import": "./dist/node/helpers/*.js",
|
|
20
|
-
"types": "./dist/
|
|
20
|
+
"types": "./dist/helpers/*.d.ts"
|
|
21
21
|
},
|
|
22
22
|
"./browser/*": {
|
|
23
23
|
"import": "./dist/browser/*/index.js",
|
|
24
|
-
"types": "./dist
|
|
24
|
+
"types": "./dist/*/index.d.ts"
|
|
25
25
|
},
|
|
26
26
|
"./node/*": {
|
|
27
27
|
"import": "./dist/node/*/index.js",
|
|
28
|
-
"types": "./dist
|
|
28
|
+
"types": "./dist/*/index.d.ts"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
@@ -36,8 +36,13 @@
|
|
|
36
36
|
"version:update": "npm version patch --no-git-tag-version"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
|
-
"dist"
|
|
39
|
+
"dist",
|
|
40
|
+
"README.md"
|
|
40
41
|
],
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"registry": "https://registry.npmjs.org/",
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
41
46
|
"devDependencies": {
|
|
42
47
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
|
43
48
|
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|