@proton/wrap-constants 0.0.32 → 0.0.33
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/parsers/actions.d.ts +617 -0
- package/dist/parsers/address.d.ts +483 -0
- package/dist/parsers/auth.d.ts +926 -0
- package/dist/parsers/base.d.ts +32 -0
- package/dist/parsers/currency.d.ts +101 -0
- package/dist/parsers/deposit.d.ts +49 -0
- package/dist/parsers/index.d.ts +10 -0
- package/dist/parsers/otc.d.ts +39 -0
- package/dist/parsers/withdraw.d.ts +511 -0
- package/dist/parsers/withdrawalHistory.d.ts +70 -0
- package/dist/parsers/wrap.d.ts +85 -0
- package/dist/wrap-constants.cjs.development.js +169 -194
- package/dist/wrap-constants.cjs.development.js.map +1 -1
- package/dist/wrap-constants.cjs.production.min.js +1 -1
- package/dist/wrap-constants.cjs.production.min.js.map +1 -1
- package/dist/wrap-constants.esm.js +170 -199
- package/dist/wrap-constants.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/parsers/actions.ts +61 -0
- package/src/parsers/address.ts +27 -0
- package/src/parsers/auth.ts +23 -0
- package/src/parsers/base.ts +18 -0
- package/src/parsers/currency.ts +31 -0
- package/src/parsers/deposit.ts +30 -0
- package/src/parsers/index.ts +10 -0
- package/src/parsers/otc.ts +23 -0
- package/src/parsers/withdraw.ts +39 -0
- package/src/parsers/withdrawalHistory.ts +23 -0
- package/src/parsers/wrap.ts +41 -0
- package/dist/parsers.d.ts +0 -1881
- package/src/parsers.ts +0 -334
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as z from 'zod'
|
|
2
|
+
|
|
3
|
+
export enum Type {
|
|
4
|
+
RECEIVE = 'receive',
|
|
5
|
+
SEND = 'send'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const depositBodyParser = z.object({
|
|
9
|
+
id : z.string(), // "0x000010203121388fac991"
|
|
10
|
+
type : z.nativeEnum(Type), // "receive" or "send"
|
|
11
|
+
hash : z.string(), // "0x000010203121388fac991"
|
|
12
|
+
coin : z.string(), // "ETH" or "XPR"
|
|
13
|
+
wallet : z.string(), // "ETH-ROPSTEN" or "XPR-MAINNET"
|
|
14
|
+
})
|
|
15
|
+
export type DepositBody = z.infer<typeof depositBodyParser>
|
|
16
|
+
|
|
17
|
+
export const transactionParser = z.object({
|
|
18
|
+
id : z.string(), // "2629304740076324677"
|
|
19
|
+
wallet : z.string(), // "ETH"
|
|
20
|
+
value : z.number(), // 10000000000000000
|
|
21
|
+
valueString : z.string(), // "10000000000000000"
|
|
22
|
+
address : z.string(), // "0x0000"
|
|
23
|
+
type : z.nativeEnum(Type), // "receive" or "send"
|
|
24
|
+
state : z.string(), // "confirmed"
|
|
25
|
+
confirmations : z.number(), // 1
|
|
26
|
+
hash : z.string(), // "b4781422be95fee8fbbf720e3e0fa9705ae834474ef25f5724cdd0f5d23211ed"
|
|
27
|
+
blockHash : z.string().optional().nullable(), // "000000000000000000089b270eb99f75107d6a9cde37ec944cb80a2998df7b43"
|
|
28
|
+
blockHeight : z.number().optional().nullable(), // 643159
|
|
29
|
+
})
|
|
30
|
+
export type Transaction = z.infer<typeof transactionParser>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './actions'
|
|
2
|
+
export * from './address'
|
|
3
|
+
export * from './auth'
|
|
4
|
+
export * from './base'
|
|
5
|
+
export * from './currency'
|
|
6
|
+
export * from './deposit'
|
|
7
|
+
export * from './otc'
|
|
8
|
+
export * from './withdraw'
|
|
9
|
+
export * from './withdrawalHistory'
|
|
10
|
+
export * from './wrap'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as z from 'zod'
|
|
2
|
+
|
|
3
|
+
export const otcOrderResponseParser = z.object({
|
|
4
|
+
success : z.boolean(),
|
|
5
|
+
transaction_id: z.string(),
|
|
6
|
+
errormsg : z.string().optional()
|
|
7
|
+
})
|
|
8
|
+
export type OtcOrderResponse = z.infer<typeof otcOrderResponseParser>
|
|
9
|
+
|
|
10
|
+
export const otcQuoteBodyParser = z.object({
|
|
11
|
+
baseAmount : z.number(),
|
|
12
|
+
baseSymbol : z.string(),
|
|
13
|
+
quoteSymbol: z.string()
|
|
14
|
+
})
|
|
15
|
+
export type OtcQuoteBody = z.infer<typeof otcQuoteBodyParser>
|
|
16
|
+
|
|
17
|
+
export const otcQuoteResponseParser = z.object({
|
|
18
|
+
success : z.boolean(),
|
|
19
|
+
token : z.string(),
|
|
20
|
+
qty : z.number(),
|
|
21
|
+
errormsg: z.string().optional()
|
|
22
|
+
})
|
|
23
|
+
export type OtcQuoteResponse = z.infer<typeof otcQuoteResponseParser>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as z from 'zod'
|
|
2
|
+
import { singleActionTransactionParser } from './actions'
|
|
3
|
+
import { authorizationParser } from './base'
|
|
4
|
+
import { WRAP_CONTRACT } from '../constants'
|
|
5
|
+
import { baseActionParser } from './actions'
|
|
6
|
+
|
|
7
|
+
const withdrawData = {
|
|
8
|
+
from: z.string().refine((val) => val !== WRAP_CONTRACT, {
|
|
9
|
+
message: `${WRAP_CONTRACT} must be receiver`,
|
|
10
|
+
}),
|
|
11
|
+
to: z.literal(WRAP_CONTRACT),
|
|
12
|
+
quantity: z.string(),
|
|
13
|
+
memo: z.string()
|
|
14
|
+
}
|
|
15
|
+
const withdrawBodyBaseAction = baseActionParser('*', 'transfer', withdrawData)
|
|
16
|
+
export type WithdrawBodyBaseAction = z.infer<typeof withdrawBodyBaseAction>
|
|
17
|
+
|
|
18
|
+
export const withdrawBodyParser = z.object({
|
|
19
|
+
signer : authorizationParser,
|
|
20
|
+
signatures : z.array(z.string()).length(1),
|
|
21
|
+
transaction: singleActionTransactionParser('*', 'transfer', withdrawData),
|
|
22
|
+
quoteId: z.string(),
|
|
23
|
+
provider: z.string().optional()
|
|
24
|
+
})
|
|
25
|
+
export type WithdrawBody = z.infer<typeof withdrawBodyParser>
|
|
26
|
+
|
|
27
|
+
export const withdrawMetalResponseParser = z.object({
|
|
28
|
+
success: z.boolean(),
|
|
29
|
+
id : z.string(),
|
|
30
|
+
})
|
|
31
|
+
export type WithdrawMetalResponse = z.infer<typeof withdrawMetalResponseParser>
|
|
32
|
+
|
|
33
|
+
export const withdrawalFeeQuoteParser = z.object({
|
|
34
|
+
quoteId : z.string(),
|
|
35
|
+
estimatedFee: z.string(),
|
|
36
|
+
currency : z.string(),
|
|
37
|
+
network : z.string(),
|
|
38
|
+
})
|
|
39
|
+
export type WithdrawalFeeQuote = z.infer<typeof withdrawalFeeQuoteParser>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as z from 'zod'
|
|
2
|
+
|
|
3
|
+
export const withdrawHistoryMetalSwapParser = z.object({
|
|
4
|
+
id : z.string(),
|
|
5
|
+
status : z.string(),
|
|
6
|
+
amount : z.string(),
|
|
7
|
+
currency : z.string(),
|
|
8
|
+
network : z.string(),
|
|
9
|
+
created : z.string(),
|
|
10
|
+
withdrawalAddress: z.string(),
|
|
11
|
+
withdrawalHash : z.string().optional()
|
|
12
|
+
})
|
|
13
|
+
export type WithdrawHistoryMetalSwap = z.infer<typeof withdrawHistoryMetalSwapParser>
|
|
14
|
+
|
|
15
|
+
export const withdrawHistoryMetalResponseParser = z.object({
|
|
16
|
+
swaps : z.array(withdrawHistoryMetalSwapParser),
|
|
17
|
+
page : z.number(),
|
|
18
|
+
pageSize : z.number(),
|
|
19
|
+
numberOfElements: z.number(),
|
|
20
|
+
totalPages : z.number(),
|
|
21
|
+
totalElements : z.number()
|
|
22
|
+
})
|
|
23
|
+
export type WithdrawHistoryMetalResponse = z.infer<typeof withdrawHistoryMetalResponseParser>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as z from 'zod'
|
|
2
|
+
import { ExtendedAssetParser } from './base'
|
|
3
|
+
|
|
4
|
+
export enum Status {
|
|
5
|
+
PENDING = 'pending',
|
|
6
|
+
SUCCESS = 'success',
|
|
7
|
+
FAIL = 'fail',
|
|
8
|
+
PROCESSING = 'processing'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const wrapStartParser = z.object({
|
|
12
|
+
balance : ExtendedAssetParser,
|
|
13
|
+
id : z.string(),
|
|
14
|
+
txid : z.string(),
|
|
15
|
+
chain : z.string(),
|
|
16
|
+
deposit_address: z.string(),
|
|
17
|
+
confirmations : z.number()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export type WrapStart = z.infer<typeof wrapStartParser>
|
|
21
|
+
|
|
22
|
+
export const wrapSetConfParser = z.object({
|
|
23
|
+
wrap_hash : z.string(),
|
|
24
|
+
confirmations: z.number()
|
|
25
|
+
})
|
|
26
|
+
export type WrapSetConf = z.infer<typeof wrapSetConfParser>
|
|
27
|
+
|
|
28
|
+
export const wrapParser = z.object({
|
|
29
|
+
index : z.number(),
|
|
30
|
+
proton_account : z.string(),
|
|
31
|
+
balance : ExtendedAssetParser,
|
|
32
|
+
id : z.string(),
|
|
33
|
+
txid : z.string(),
|
|
34
|
+
chain : z.string(),
|
|
35
|
+
deposit_address: z.string(),
|
|
36
|
+
status : z.nativeEnum(Status),
|
|
37
|
+
finish_txid : z.string(),
|
|
38
|
+
wrap_hash : z.string(),
|
|
39
|
+
confirmations : z.number(),
|
|
40
|
+
})
|
|
41
|
+
export type Wrap = z.infer<typeof wrapParser>
|