@proton/wrap-constants 0.2.192 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2421 -0
- package/dist/index.d.cts +2604 -0
- package/dist/index.d.mts +2076 -12743
- package/dist/index.mjs +2232 -2758
- package/package.json +29 -15
- package/src/coins.ts +3 -3
- package/src/parsers/actions.ts +88 -65
- package/src/parsers/address.ts +22 -22
- package/src/parsers/auth.ts +2 -2
- package/src/parsers/deposit.ts +4 -10
- package/src/parsers/dex.ts +49 -33
- package/src/parsers/login.ts +7 -8
- package/src/parsers/pool.ts +1 -1
- package/src/parsers/withdraw.ts +31 -31
- package/src/parsers/wrap.ts +31 -31
- package/dist/index.d.ts +0 -13271
- package/dist/index.js +0 -2957
package/src/parsers/withdraw.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import * as z from
|
|
2
|
-
import { singleActionTransactionParser } from
|
|
3
|
-
import { authorizationParser } from
|
|
4
|
-
import { WRAP_CONTRACT } from
|
|
5
|
-
import { baseActionParser } from
|
|
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
6
|
|
|
7
7
|
const withdrawData = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
const withdrawBodyBaseAction = baseActionParser(
|
|
16
|
-
export type WithdrawBodyBaseAction = z.infer<typeof withdrawBodyBaseAction
|
|
8
|
+
from: z.string().refine((val) => val !== WRAP_CONTRACT, {
|
|
9
|
+
error: `${WRAP_CONTRACT} must be receiver`,
|
|
10
|
+
}),
|
|
11
|
+
to: z.literal(WRAP_CONTRACT),
|
|
12
|
+
quantity: z.string(),
|
|
13
|
+
memo: z.string(),
|
|
14
|
+
};
|
|
15
|
+
export const withdrawBodyBaseAction = baseActionParser("*", "transfer", withdrawData);
|
|
16
|
+
export type WithdrawBodyBaseAction = z.infer<typeof withdrawBodyBaseAction>;
|
|
17
17
|
|
|
18
18
|
export const withdrawBodyParser = z.object({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})
|
|
25
|
-
export type WithdrawBody = z.infer<typeof withdrawBodyParser
|
|
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
26
|
|
|
27
27
|
export const withdrawMetalResponseParser = z.object({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
export type WithdrawMetalResponse = z.infer<typeof withdrawMetalResponseParser
|
|
28
|
+
success: z.boolean(),
|
|
29
|
+
id: z.string(),
|
|
30
|
+
});
|
|
31
|
+
export type WithdrawMetalResponse = z.infer<typeof withdrawMetalResponseParser>;
|
|
32
32
|
|
|
33
33
|
export const withdrawalFeeQuoteParser = z.object({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
})
|
|
39
|
-
export type WithdrawalFeeQuote = z.infer<typeof withdrawalFeeQuoteParser
|
|
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>;
|
package/src/parsers/wrap.ts
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import * as z from
|
|
2
|
-
import { ExtendedAssetParser } from
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { ExtendedAssetParser } from "./base";
|
|
3
3
|
|
|
4
4
|
export enum Status {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
PENDING = "pending",
|
|
6
|
+
SUCCESS = "success",
|
|
7
|
+
FAIL = "fail",
|
|
8
|
+
PROCESSING = "processing",
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export const wrapStartParser = z.object({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})
|
|
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
19
|
|
|
20
|
-
export type WrapStart = z.infer<typeof wrapStartParser
|
|
20
|
+
export type WrapStart = z.infer<typeof wrapStartParser>;
|
|
21
21
|
|
|
22
22
|
export const wrapSetConfParser = z.object({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
26
|
-
export type WrapSetConf = z.infer<typeof wrapSetConfParser
|
|
23
|
+
wrap_hash: z.string(),
|
|
24
|
+
confirmations: z.number(),
|
|
25
|
+
});
|
|
26
|
+
export type WrapSetConf = z.infer<typeof wrapSetConfParser>;
|
|
27
27
|
|
|
28
28
|
export const wrapParser = z.object({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
})
|
|
41
|
-
export type Wrap = z.infer<typeof wrapParser
|
|
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.enum(Status),
|
|
37
|
+
finish_txid: z.string(),
|
|
38
|
+
wrap_hash: z.string(),
|
|
39
|
+
confirmations: z.number(),
|
|
40
|
+
});
|
|
41
|
+
export type Wrap = z.infer<typeof wrapParser>;
|