@proton/wrap-constants 0.0.85 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
- "version": "0.0.85",
8
+ "version": "0.2.0",
9
9
  "license": "MIT",
10
10
  "main": "dist/index.js",
11
11
  "typings": "dist/index.d.ts",
@@ -39,10 +39,10 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "lodash.clonedeep": "^4.5.0",
42
- "zod": "^3.13.4"
42
+ "nestjs-zod": "^1.1.2"
43
43
  },
44
44
  "resolutions": {
45
45
  "typescript": "4.5"
46
46
  },
47
- "gitHead": "5b444f96aba0bd1eb3e57a9e1e90a503d8e7824a"
47
+ "gitHead": "47979948f8cca5472ead715a98f7d29f2463825d"
48
48
  }
package/src/coins.ts CHANGED
@@ -224,7 +224,7 @@ export const initializeCoins = (protonChain: string): {
224
224
  allowBridge: IS_MAINNET,
225
225
  allowLend: true,
226
226
  allowBorrow: true,
227
- name: 'Metal DAO',
227
+ name: 'Metal',
228
228
  coin: 'MTL',
229
229
  xtokenSymbol: 'XMT',
230
230
  xtokenPrecision: 8,
@@ -243,20 +243,6 @@ export const initializeCoins = (protonChain: string): {
243
243
  image: 'https://www.proton.org/images/tokens/xtokensXMT.png',
244
244
  coingeckoId: 'metal'
245
245
  },
246
- {
247
- allowSwap: IS_MAINNET,
248
- allowBridge: false,
249
- allowLend: false,
250
- allowBorrow: false,
251
- name: 'Metal Chain',
252
- coin: 'METAL',
253
- xtokenSymbol: 'METAL',
254
- xtokenPrecision: 8,
255
- xtokenContract: 'xtokens',
256
- wallets: [],
257
- image: 'https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/metal-chain.png',
258
- coingeckoId: ''
259
- },
260
246
  {
261
247
  allowSwap: true,
262
248
  allowBridge: true,
package/src/constants.ts CHANGED
@@ -9,6 +9,9 @@ export const initializeConstants = (chain: string) => {
9
9
 
10
10
  const constants = {
11
11
  SWAP_CONTRACT: 'proton.swaps',
12
+ DEX_CONTRACT: chain === 'proton'
13
+ ? 'dextest21'
14
+ : 'dex',
12
15
  FEE_FACTOR,
13
16
  GOOGLE_MAPS_KEY: 'AIzaSyDb2_CrK032kSIqBXbkdwmaLKWELl0SxVs',
14
17
  SWAP_URL: chain === 'proton'
@@ -56,9 +59,13 @@ export const initializeConstants = (chain: string) => {
56
59
  ? 'https://api.protonchain.com'
57
60
  : 'https://api-dev.protonchain.com',
58
61
 
62
+ METAL_DEX_ENDPOINT: chain === 'proton'
63
+ ? 'https://metallicus-dbapi-dev01.binfra.one'
64
+ : 'https://metallicus-dbapi-dev01.binfra.one',
65
+
59
66
  PROTON_ENDPOINTS: chain === 'proton'
60
- ? ['https://proton.greymass.com', 'https://proton.eoscafeblock.com', 'https://proton.cryptolions.io', 'https://proton.eosusa.news']
61
- : ['https://testnet.protonchain.com'],
67
+ ? ['https://metal-proton-rpc.global.binfra.one', 'https://proton.greymass.com', 'https://proton.eoscafeblock.com', 'https://proton.cryptolions.io', 'https://proton.eosusa.news']
68
+ : ['https://metal-protontest-rpc.global.binfra.one', 'https://testnet.protonchain.com'],
62
69
 
63
70
  CHAIN_ID: chain === 'proton'
64
71
  ? '384da888112027f0321850a169f737c33e53b388aad48b5adace4bab97f437e0'
@@ -1,4 +1,4 @@
1
- import * as z from 'zod'
1
+ import { z } from 'nestjs-zod/z';
2
2
  import { accountParser, authorizationsParser } from './base'
3
3
 
4
4
  const actionParser = z.object({
@@ -1,4 +1,4 @@
1
- import * as z from 'zod'
1
+ import { z } from 'nestjs-zod/z';
2
2
  import { accountParser } from './base'
3
3
  import { generateAuthParser } from './auth'
4
4
 
@@ -1,4 +1,4 @@
1
- import * as z from 'zod'
1
+ import { z } from 'nestjs-zod/z';
2
2
  import { baseActionParser, singleActionTransactionParser } from './actions'
3
3
  import { authorizationParser } from './base'
4
4
  import { WRAP_CONTRACT, WRAP_AUTH_ACTION } from '../constants'
@@ -1,4 +1,4 @@
1
- import * as z from 'zod'
1
+ import { z } from 'nestjs-zod/z'
2
2
 
3
3
  export const accountParser = z.string().regex(/^[.1-5a-z]{0,12}[.1-5a-j]?$/)
4
4
 
@@ -1,4 +1,4 @@
1
- import * as z from 'zod'
1
+ import { z } from 'nestjs-zod/z'
2
2
 
3
3
  export interface CurrencyStat {
4
4
  supply : string;
@@ -1,4 +1,4 @@
1
- import * as z from 'zod'
1
+ import { z } from 'nestjs-zod/z'
2
2
 
3
3
  export enum Type {
4
4
  RECEIVE = 'receive',
@@ -0,0 +1,167 @@
1
+ import { ExtendedAsset, ExtendedSymbol } from '@bloks/numbers';
2
+ import { createZodDto } from 'nestjs-zod';
3
+ import { z } from 'nestjs-zod/z';
4
+
5
+ const numTransform = z.string().regex(/\d+/).transform(Number)
6
+
7
+ const ohlcvParser = z.object({
8
+ time: z.number(),
9
+ open: z.number(),
10
+ high: z.number(),
11
+ low: z.number(),
12
+ close: z.number(),
13
+ volume: z.number(),
14
+ volume_bid: z.number(),
15
+ count: z.number()
16
+ })
17
+ export type OHLCV = z.infer<typeof ohlcvParser>
18
+ export class OHLCV_DTO extends createZodDto(ohlcvParser) {}
19
+
20
+ const getOhlcvParser = z.object({
21
+ interval: z.string(),
22
+ dateFrom: z.string(),
23
+ dateTo: z.string(),
24
+ marketId: z.number().or(numTransform),
25
+ limit: z.number().or(numTransform).default(500).refine(n => n <= 1000, 'Max limit is 1000'),
26
+ })
27
+ export type GetOHLCV = z.infer<typeof getOhlcvParser>
28
+ export class GetOHLCV_DTO extends createZodDto(getOhlcvParser) {}
29
+
30
+ const orderHistoryParser = z.object({
31
+ seq: z.number(),
32
+ block_num: z.number(),
33
+ block_time: z.string(),
34
+ order_id: z.number(),
35
+ market_id: z.number(),
36
+ quantity_init: z.number().optional(),
37
+ quantity_curr: z.number(),
38
+ price: z.number(),
39
+ account_name: z.string(),
40
+ order_side: z.number(),
41
+ order_type: z.number(),
42
+ status: z.string(),
43
+ quantity_change: z.number(),
44
+ trx_id: z.string(),
45
+ })
46
+ export type OrderHistory = z.infer<typeof orderHistoryParser>
47
+ export class OrderHistory_DTO extends createZodDto(orderHistoryParser) {}
48
+
49
+ const getOrderHistoryParser = z.object({
50
+ account: z.string(),
51
+ offset: z.number().or(numTransform).default(0),
52
+ limit: z.number().or(numTransform).default(100).refine(n => n <= 250, 'Max limit is 250'),
53
+ })
54
+ export type GetOrderHistory = z.infer<typeof getOrderHistoryParser>
55
+ export class GetOrderHistory_DTO extends createZodDto(getOrderHistoryParser) {}
56
+
57
+
58
+ const depthParser = z.object({
59
+ level: z.number(),
60
+ ask: z.number(),
61
+ bid: z.number(),
62
+ count: z.number(),
63
+ })
64
+ export type Depth = z.infer<typeof depthParser>
65
+ export class Depth_DTO extends createZodDto(depthParser) {}
66
+
67
+ const getDepthParser = z.object({
68
+ marketId: z.number(),
69
+ step: z.string(),
70
+ side: z.string(),
71
+ limit: z.number().or(numTransform).default(100).refine(n => n <= 250, 'Max limit is 250'),
72
+ })
73
+ export type GetDepth = z.infer<typeof getDepthParser>
74
+ export class GetDepth_DTO extends createZodDto(getDepthParser) {}
75
+
76
+ const tradeParser = z.object({
77
+ block_num: z.number(),
78
+ block_time: z.string(),
79
+ trade_id: z.number(),
80
+ market_id: z.number(),
81
+ price: z.number(),
82
+ bid_user: z.string(),
83
+ bid_user_order_id: z.number(),
84
+ bid_amount: z.number(),
85
+ bid_fee: z.number(),
86
+ ask_user: z.string(),
87
+ ask_user_order_id: z.number(),
88
+ ask_amount: z.number(),
89
+ ask_fee: z.number(),
90
+ order_side: z.number(),
91
+ trx_id: z.string(),
92
+ })
93
+ export type Trade = z.infer<typeof tradeParser>
94
+ export class Trade_DTO extends createZodDto(tradeParser) {}
95
+
96
+ const getTradesParser = z.object({
97
+ marketId: z.number().or(numTransform),
98
+ offset: z.number().or(numTransform).default(0),
99
+ limit: z.number().or(numTransform).default(100).refine(n => n <= 250, 'Max limit is 250'),
100
+ })
101
+
102
+ export type GetTrades = z.infer<typeof getTradesParser>
103
+ export class GetTrades_DTO extends createZodDto(getTradesParser) {}
104
+
105
+ const syncParser = z.object({
106
+ sourceid: z.number(),
107
+ block_num: z.string(),
108
+ block_time: z.string(),
109
+ irreversible: z.string(),
110
+ is_master: z.number(),
111
+ last_updated: z.string(),
112
+ })
113
+ export type Sync = z.infer<typeof syncParser>
114
+
115
+ export enum orderType { INVALID = 0, MARKET = 1, LIMIT = 2, STOPLOSS = 3, TAKEPROFIT = 4 }
116
+
117
+ export enum orderSide { INVALID = 0, BUY = 1, SELL = 2 }
118
+
119
+ export enum logStatus {
120
+ CREATE = "create",
121
+ UPDATE = "update",
122
+ TRANSFER = "transfer",
123
+ CANCEL = "cancel",
124
+ DELETE = "delete",
125
+ }
126
+
127
+ export interface CurrentOrder {
128
+ order_id: number
129
+ market_id: number
130
+ quantity_init: number
131
+ quantity_curr: number
132
+ price: number
133
+ account_name: string
134
+ order_side: number
135
+ order_type: number
136
+ status: string
137
+ created_at: string
138
+ updated_at: string
139
+ }
140
+
141
+ export interface RawMarket {
142
+ market_id: number
143
+ order_min: number
144
+ status_code: number
145
+ maker_fee: number
146
+ taker_fee: number
147
+ bid_token: {
148
+ sym: string
149
+ contract: string
150
+ }
151
+ ask_token: {
152
+ quantity: string
153
+ contract: string
154
+ }
155
+ }
156
+
157
+ export interface Market {
158
+ market_id: number
159
+ order_min: number
160
+ status_code: number
161
+ maker_fee: number
162
+ taker_fee: number
163
+ bid_token: ExtendedSymbol
164
+ ask_token: ExtendedAsset
165
+ bid_multiplier: number
166
+ ask_multiplier: number
167
+ }
@@ -8,4 +8,5 @@ export * from './otc'
8
8
  export * from './pool'
9
9
  export * from './withdraw'
10
10
  export * from './withdrawalHistory'
11
- export * from './wrap'
11
+ export * from './wrap'
12
+ export * from './dex'
@@ -1,4 +1,4 @@
1
- import * as z from 'zod'
1
+ import { z } from 'nestjs-zod/z'
2
2
 
3
3
  export const otcOrderResponseParser = z.object({
4
4
  success : z.boolean(),
@@ -1,4 +1,4 @@
1
- import * as z from 'zod'
1
+ import { z } from 'nestjs-zod/z'
2
2
  import { singleActionTransactionParser } from './actions'
3
3
  import { authorizationParser } from './base'
4
4
  import { WRAP_CONTRACT } from '../constants'
@@ -1,4 +1,4 @@
1
- import * as z from 'zod'
1
+ import { z } from 'nestjs-zod/z'
2
2
 
3
3
  export const withdrawHistoryMetalSwapParser = z.object({
4
4
  id : z.string(),
@@ -1,4 +1,4 @@
1
- import * as z from 'zod'
1
+ import { z } from 'nestjs-zod/z'
2
2
  import { ExtendedAssetParser } from './base'
3
3
 
4
4
  export enum Status {