@hyperlane-xyz/sdk 19.5.0 → 19.6.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/core/types.d.ts +430 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/deploy/warp.d.ts.map +1 -1
- package/dist/deploy/warp.js +3 -1
- package/dist/deploy/warp.js.map +1 -1
- package/dist/fee/EvmTokenFeeDeployer.d.ts +16 -0
- package/dist/fee/EvmTokenFeeDeployer.d.ts.map +1 -0
- package/dist/fee/EvmTokenFeeDeployer.hardhat-test.d.ts +2 -0
- package/dist/fee/EvmTokenFeeDeployer.hardhat-test.d.ts.map +1 -0
- package/dist/fee/EvmTokenFeeDeployer.hardhat-test.js +133 -0
- package/dist/fee/EvmTokenFeeDeployer.hardhat-test.js.map +1 -0
- package/dist/fee/EvmTokenFeeDeployer.js +75 -0
- package/dist/fee/EvmTokenFeeDeployer.js.map +1 -0
- package/dist/fee/EvmTokenFeeModule.d.ts +40 -0
- package/dist/fee/EvmTokenFeeModule.d.ts.map +1 -0
- package/dist/fee/EvmTokenFeeModule.hardhat-test.d.ts +2 -0
- package/dist/fee/EvmTokenFeeModule.hardhat-test.d.ts.map +1 -0
- package/dist/fee/EvmTokenFeeModule.hardhat-test.js +215 -0
- package/dist/fee/EvmTokenFeeModule.hardhat-test.js.map +1 -0
- package/dist/fee/EvmTokenFeeModule.js +182 -0
- package/dist/fee/EvmTokenFeeModule.js.map +1 -0
- package/dist/fee/EvmTokenFeeReader.d.ts +25 -0
- package/dist/fee/EvmTokenFeeReader.d.ts.map +1 -0
- package/dist/fee/EvmTokenFeeReader.hardhat-test.d.ts +4 -0
- package/dist/fee/EvmTokenFeeReader.hardhat-test.d.ts.map +1 -0
- package/dist/fee/EvmTokenFeeReader.hardhat-test.js +133 -0
- package/dist/fee/EvmTokenFeeReader.hardhat-test.js.map +1 -0
- package/dist/fee/EvmTokenFeeReader.js +116 -0
- package/dist/fee/EvmTokenFeeReader.js.map +1 -0
- package/dist/fee/contracts.d.ts +9 -0
- package/dist/fee/contracts.d.ts.map +1 -0
- package/dist/fee/contracts.js +9 -0
- package/dist/fee/contracts.js.map +1 -0
- package/dist/fee/types.d.ts +386 -0
- package/dist/fee/types.d.ts.map +1 -0
- package/dist/fee/types.js +107 -0
- package/dist/fee/types.js.map +1 -0
- package/dist/fee/utils.d.ts +10 -0
- package/dist/fee/utils.d.ts.map +1 -0
- package/dist/fee/utils.js +16 -0
- package/dist/fee/utils.js.map +1 -0
- package/dist/fork/types.d.ts +15 -15
- package/dist/ica/types.d.ts +322 -0
- package/dist/ica/types.d.ts.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/ism/serialization.d.ts +37 -0
- package/dist/ism/serialization.d.ts.map +1 -0
- package/dist/ism/serialization.js +96 -0
- package/dist/ism/serialization.js.map +1 -0
- package/dist/mailbox/serialization.d.ts +41 -0
- package/dist/mailbox/serialization.d.ts.map +1 -0
- package/dist/mailbox/serialization.js +104 -0
- package/dist/mailbox/serialization.js.map +1 -0
- package/dist/metadata/agentConfig.d.ts +4 -4
- package/dist/router/HyperlaneRouterDeployer.d.ts +1 -0
- package/dist/router/HyperlaneRouterDeployer.d.ts.map +1 -1
- package/dist/router/HyperlaneRouterDeployer.js +12 -0
- package/dist/router/HyperlaneRouterDeployer.js.map +1 -1
- package/dist/router/types.d.ts +326 -1
- package/dist/router/types.d.ts.map +1 -1
- package/dist/router/types.js +2 -0
- package/dist/router/types.js.map +1 -1
- package/dist/token/EvmERC20WarpModule.d.ts +14 -1
- package/dist/token/EvmERC20WarpModule.d.ts.map +1 -1
- package/dist/token/EvmERC20WarpModule.hardhat-test.js +415 -25
- package/dist/token/EvmERC20WarpModule.hardhat-test.js.map +1 -1
- package/dist/token/EvmERC20WarpModule.js +172 -5
- package/dist/token/EvmERC20WarpModule.js.map +1 -1
- package/dist/token/EvmERC20WarpRouteReader.d.ts +8 -0
- package/dist/token/EvmERC20WarpRouteReader.d.ts.map +1 -1
- package/dist/token/EvmERC20WarpRouteReader.hardhat-test.js +141 -3
- package/dist/token/EvmERC20WarpRouteReader.hardhat-test.js.map +1 -1
- package/dist/token/EvmERC20WarpRouteReader.js +162 -34
- package/dist/token/EvmERC20WarpRouteReader.js.map +1 -1
- package/dist/token/Token.js +2 -2
- package/dist/token/Token.js.map +1 -1
- package/dist/token/Token.test.js +6 -0
- package/dist/token/Token.test.js.map +1 -1
- package/dist/token/TokenStandard.d.ts +2 -0
- package/dist/token/TokenStandard.d.ts.map +1 -1
- package/dist/token/TokenStandard.js +6 -0
- package/dist/token/TokenStandard.js.map +1 -1
- package/dist/token/adapters/CosmWasmTokenAdapter.d.ts +3 -3
- package/dist/token/adapters/CosmWasmTokenAdapter.d.ts.map +1 -1
- package/dist/token/adapters/CosmWasmTokenAdapter.js +7 -7
- package/dist/token/adapters/CosmWasmTokenAdapter.js.map +1 -1
- package/dist/token/adapters/CosmosModuleTokenAdapter.d.ts +2 -2
- package/dist/token/adapters/CosmosModuleTokenAdapter.d.ts.map +1 -1
- package/dist/token/adapters/CosmosModuleTokenAdapter.js +13 -7
- package/dist/token/adapters/CosmosModuleTokenAdapter.js.map +1 -1
- package/dist/token/adapters/CosmosTokenAdapter.d.ts +3 -3
- package/dist/token/adapters/CosmosTokenAdapter.d.ts.map +1 -1
- package/dist/token/adapters/CosmosTokenAdapter.js +15 -7
- package/dist/token/adapters/CosmosTokenAdapter.js.map +1 -1
- package/dist/token/adapters/EvmTokenAdapter.d.ts +13 -8
- package/dist/token/adapters/EvmTokenAdapter.d.ts.map +1 -1
- package/dist/token/adapters/EvmTokenAdapter.js +92 -41
- package/dist/token/adapters/EvmTokenAdapter.js.map +1 -1
- package/dist/token/adapters/ITokenAdapter.d.ts +14 -3
- package/dist/token/adapters/ITokenAdapter.d.ts.map +1 -1
- package/dist/token/adapters/M0PortalLiteTokenAdapter.d.ts +2 -2
- package/dist/token/adapters/M0PortalLiteTokenAdapter.d.ts.map +1 -1
- package/dist/token/adapters/M0PortalLiteTokenAdapter.js +10 -4
- package/dist/token/adapters/M0PortalLiteTokenAdapter.js.map +1 -1
- package/dist/token/adapters/RadixTokenAdapter.d.ts +2 -2
- package/dist/token/adapters/RadixTokenAdapter.d.ts.map +1 -1
- package/dist/token/adapters/RadixTokenAdapter.js +11 -7
- package/dist/token/adapters/RadixTokenAdapter.js.map +1 -1
- package/dist/token/adapters/SealevelTokenAdapter.d.ts +2 -2
- package/dist/token/adapters/SealevelTokenAdapter.d.ts.map +1 -1
- package/dist/token/adapters/SealevelTokenAdapter.js +5 -6
- package/dist/token/adapters/SealevelTokenAdapter.js.map +1 -1
- package/dist/token/adapters/StarknetTokenAdapter.d.ts +2 -2
- package/dist/token/adapters/StarknetTokenAdapter.d.ts.map +1 -1
- package/dist/token/adapters/StarknetTokenAdapter.js +6 -6
- package/dist/token/adapters/StarknetTokenAdapter.js.map +1 -1
- package/dist/token/config.d.ts +7 -2
- package/dist/token/config.d.ts.map +1 -1
- package/dist/token/config.js +6 -2
- package/dist/token/config.js.map +1 -1
- package/dist/token/contracts.d.ts +7 -2
- package/dist/token/contracts.d.ts.map +1 -1
- package/dist/token/contracts.js +13 -2
- package/dist/token/contracts.js.map +1 -1
- package/dist/token/deploy.d.ts +7 -3
- package/dist/token/deploy.d.ts.map +1 -1
- package/dist/token/deploy.js +141 -16
- package/dist/token/deploy.js.map +1 -1
- package/dist/token/types.d.ts +19993 -1868
- package/dist/token/types.d.ts.map +1 -1
- package/dist/token/types.js +98 -3
- package/dist/token/types.js.map +1 -1
- package/dist/token/types.test.js +47 -1
- package/dist/token/types.test.js.map +1 -1
- package/dist/utils/contract.d.ts +2 -0
- package/dist/utils/contract.d.ts.map +1 -0
- package/dist/utils/contract.js +5 -0
- package/dist/utils/contract.js.map +1 -0
- package/dist/warp/WarpCore.d.ts +20 -10
- package/dist/warp/WarpCore.d.ts.map +1 -1
- package/dist/warp/WarpCore.js +111 -38
- package/dist/warp/WarpCore.js.map +1 -1
- package/dist/warp/WarpCore.test.js +17 -8
- package/dist/warp/WarpCore.test.js.map +1 -1
- package/dist/warp/types.d.ts +1 -0
- package/dist/warp/types.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare enum OnchainTokenFeeType {
|
|
3
|
+
LinearFee = 1,
|
|
4
|
+
RegressiveFee = 2,
|
|
5
|
+
ProgressiveFee = 3,
|
|
6
|
+
RoutingFee = 4
|
|
7
|
+
}
|
|
8
|
+
export declare enum TokenFeeType {
|
|
9
|
+
LinearFee = "LinearFee",
|
|
10
|
+
ProgressiveFee = "ProgressiveFee",
|
|
11
|
+
RegressiveFee = "RegressiveFee",
|
|
12
|
+
RoutingFee = "RoutingFee"
|
|
13
|
+
}
|
|
14
|
+
export declare const ImmutableTokenFeeType: readonly [TokenFeeType.LinearFee, TokenFeeType.RegressiveFee, TokenFeeType.ProgressiveFee];
|
|
15
|
+
export declare const onChainTypeToTokenFeeTypeMap: Record<OnchainTokenFeeType, TokenFeeType>;
|
|
16
|
+
export declare const BaseFeeConfigSchema: z.ZodObject<{
|
|
17
|
+
token: z.ZodString;
|
|
18
|
+
owner: z.ZodString;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
owner: string;
|
|
21
|
+
token: string;
|
|
22
|
+
}, {
|
|
23
|
+
owner: string;
|
|
24
|
+
token: string;
|
|
25
|
+
}>;
|
|
26
|
+
export type BaseTokenFeeConfig = z.infer<typeof BaseFeeConfigSchema>;
|
|
27
|
+
export declare const FeeParametersSchema: z.ZodObject<{
|
|
28
|
+
maxFee: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
29
|
+
halfAmount: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
maxFee: bigint;
|
|
32
|
+
halfAmount: bigint;
|
|
33
|
+
}, {
|
|
34
|
+
maxFee: string | number | bigint;
|
|
35
|
+
halfAmount: string | number | bigint;
|
|
36
|
+
}>;
|
|
37
|
+
export type FeeParameters = z.infer<typeof FeeParametersSchema>;
|
|
38
|
+
export declare const LinearFeeConfigSchema: z.ZodObject<{
|
|
39
|
+
owner: z.ZodString;
|
|
40
|
+
token: z.ZodString;
|
|
41
|
+
maxFee: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
42
|
+
halfAmount: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
43
|
+
type: z.ZodLiteral<TokenFeeType.LinearFee>;
|
|
44
|
+
bps: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
type: TokenFeeType.LinearFee;
|
|
47
|
+
owner: string;
|
|
48
|
+
token: string;
|
|
49
|
+
maxFee: bigint;
|
|
50
|
+
halfAmount: bigint;
|
|
51
|
+
bps: bigint;
|
|
52
|
+
}, {
|
|
53
|
+
type: TokenFeeType.LinearFee;
|
|
54
|
+
owner: string;
|
|
55
|
+
token: string;
|
|
56
|
+
maxFee: string | number | bigint;
|
|
57
|
+
halfAmount: string | number | bigint;
|
|
58
|
+
bps: string | number | bigint;
|
|
59
|
+
}>;
|
|
60
|
+
export type LinearFeeConfig = z.infer<typeof LinearFeeConfigSchema>;
|
|
61
|
+
export declare const LinearFeeInputConfigSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
62
|
+
owner: z.ZodString;
|
|
63
|
+
token: z.ZodString;
|
|
64
|
+
maxFee: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>>;
|
|
65
|
+
halfAmount: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>>;
|
|
66
|
+
type: z.ZodLiteral<TokenFeeType.LinearFee>;
|
|
67
|
+
bps: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>>;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
type: TokenFeeType.LinearFee;
|
|
70
|
+
owner: string;
|
|
71
|
+
token: string;
|
|
72
|
+
maxFee?: bigint | undefined;
|
|
73
|
+
halfAmount?: bigint | undefined;
|
|
74
|
+
bps?: bigint | undefined;
|
|
75
|
+
}, {
|
|
76
|
+
type: TokenFeeType.LinearFee;
|
|
77
|
+
owner: string;
|
|
78
|
+
token: string;
|
|
79
|
+
maxFee?: string | number | bigint | undefined;
|
|
80
|
+
halfAmount?: string | number | bigint | undefined;
|
|
81
|
+
bps?: string | number | bigint | undefined;
|
|
82
|
+
}>, {
|
|
83
|
+
type: TokenFeeType.LinearFee;
|
|
84
|
+
owner: string;
|
|
85
|
+
token: string;
|
|
86
|
+
maxFee?: bigint | undefined;
|
|
87
|
+
halfAmount?: bigint | undefined;
|
|
88
|
+
bps?: bigint | undefined;
|
|
89
|
+
}, {
|
|
90
|
+
type: TokenFeeType.LinearFee;
|
|
91
|
+
owner: string;
|
|
92
|
+
token: string;
|
|
93
|
+
maxFee?: string | number | bigint | undefined;
|
|
94
|
+
halfAmount?: string | number | bigint | undefined;
|
|
95
|
+
bps?: string | number | bigint | undefined;
|
|
96
|
+
}>, {
|
|
97
|
+
bps: bigint;
|
|
98
|
+
type: TokenFeeType.LinearFee;
|
|
99
|
+
owner: string;
|
|
100
|
+
token: string;
|
|
101
|
+
maxFee?: bigint | undefined;
|
|
102
|
+
halfAmount?: bigint | undefined;
|
|
103
|
+
}, {
|
|
104
|
+
type: TokenFeeType.LinearFee;
|
|
105
|
+
owner: string;
|
|
106
|
+
token: string;
|
|
107
|
+
maxFee?: string | number | bigint | undefined;
|
|
108
|
+
halfAmount?: string | number | bigint | undefined;
|
|
109
|
+
bps?: string | number | bigint | undefined;
|
|
110
|
+
}>;
|
|
111
|
+
export type LinearFeeInputConfig = z.infer<typeof LinearFeeInputConfigSchema>;
|
|
112
|
+
export declare const ProgressiveFeeConfigSchema: z.ZodObject<{
|
|
113
|
+
owner: z.ZodString;
|
|
114
|
+
token: z.ZodString;
|
|
115
|
+
maxFee: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
116
|
+
halfAmount: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
117
|
+
type: z.ZodLiteral<TokenFeeType.ProgressiveFee>;
|
|
118
|
+
}, "strip", z.ZodTypeAny, {
|
|
119
|
+
type: TokenFeeType.ProgressiveFee;
|
|
120
|
+
owner: string;
|
|
121
|
+
token: string;
|
|
122
|
+
maxFee: bigint;
|
|
123
|
+
halfAmount: bigint;
|
|
124
|
+
}, {
|
|
125
|
+
type: TokenFeeType.ProgressiveFee;
|
|
126
|
+
owner: string;
|
|
127
|
+
token: string;
|
|
128
|
+
maxFee: string | number | bigint;
|
|
129
|
+
halfAmount: string | number | bigint;
|
|
130
|
+
}>;
|
|
131
|
+
export type ProgressiveFeeConfig = z.infer<typeof ProgressiveFeeConfigSchema>;
|
|
132
|
+
export declare const RegressiveFeeConfigSchema: z.ZodObject<{
|
|
133
|
+
owner: z.ZodString;
|
|
134
|
+
token: z.ZodString;
|
|
135
|
+
maxFee: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
136
|
+
halfAmount: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
137
|
+
type: z.ZodLiteral<TokenFeeType.RegressiveFee>;
|
|
138
|
+
}, "strip", z.ZodTypeAny, {
|
|
139
|
+
type: TokenFeeType.RegressiveFee;
|
|
140
|
+
owner: string;
|
|
141
|
+
token: string;
|
|
142
|
+
maxFee: bigint;
|
|
143
|
+
halfAmount: bigint;
|
|
144
|
+
}, {
|
|
145
|
+
type: TokenFeeType.RegressiveFee;
|
|
146
|
+
owner: string;
|
|
147
|
+
token: string;
|
|
148
|
+
maxFee: string | number | bigint;
|
|
149
|
+
halfAmount: string | number | bigint;
|
|
150
|
+
}>;
|
|
151
|
+
export type RegressiveFeeConfig = z.infer<typeof RegressiveFeeConfigSchema>;
|
|
152
|
+
export declare const RoutingFeeConfigSchema: z.ZodObject<{
|
|
153
|
+
owner: z.ZodString;
|
|
154
|
+
token: z.ZodString;
|
|
155
|
+
type: z.ZodLiteral<TokenFeeType.RoutingFee>;
|
|
156
|
+
feeContracts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, z.ZodTypeDef, any>>>>;
|
|
157
|
+
maxFee: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>>;
|
|
158
|
+
halfAmount: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>>;
|
|
159
|
+
}, "strip", z.ZodTypeAny, {
|
|
160
|
+
type: TokenFeeType.RoutingFee;
|
|
161
|
+
owner: string;
|
|
162
|
+
token: string;
|
|
163
|
+
feeContracts?: Record<string, any> | undefined;
|
|
164
|
+
maxFee?: bigint | undefined;
|
|
165
|
+
halfAmount?: bigint | undefined;
|
|
166
|
+
}, {
|
|
167
|
+
type: TokenFeeType.RoutingFee;
|
|
168
|
+
owner: string;
|
|
169
|
+
token: string;
|
|
170
|
+
feeContracts?: Record<string, any> | undefined;
|
|
171
|
+
maxFee?: string | number | bigint | undefined;
|
|
172
|
+
halfAmount?: string | number | bigint | undefined;
|
|
173
|
+
}>;
|
|
174
|
+
export type RoutingFeeConfig = z.infer<typeof RoutingFeeConfigSchema>;
|
|
175
|
+
export declare const RoutingFeeInputConfigSchema: z.ZodObject<{
|
|
176
|
+
type: z.ZodLiteral<TokenFeeType.RoutingFee>;
|
|
177
|
+
owner: z.ZodString;
|
|
178
|
+
token: z.ZodString;
|
|
179
|
+
maxFee: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>>;
|
|
180
|
+
halfAmount: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>>;
|
|
181
|
+
feeContracts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, z.ZodTypeDef, any>>>>;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
type: TokenFeeType.RoutingFee;
|
|
184
|
+
owner: string;
|
|
185
|
+
token: string;
|
|
186
|
+
maxFee?: bigint | undefined;
|
|
187
|
+
halfAmount?: bigint | undefined;
|
|
188
|
+
feeContracts?: Record<string, any> | undefined;
|
|
189
|
+
}, {
|
|
190
|
+
type: TokenFeeType.RoutingFee;
|
|
191
|
+
owner: string;
|
|
192
|
+
token: string;
|
|
193
|
+
maxFee?: string | number | bigint | undefined;
|
|
194
|
+
halfAmount?: string | number | bigint | undefined;
|
|
195
|
+
feeContracts?: Record<string, any> | undefined;
|
|
196
|
+
}>;
|
|
197
|
+
export type RoutingFeeInputConfig = z.infer<typeof RoutingFeeInputConfigSchema>;
|
|
198
|
+
export declare const TokenFeeConfigSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
199
|
+
owner: z.ZodString;
|
|
200
|
+
token: z.ZodString;
|
|
201
|
+
maxFee: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
202
|
+
halfAmount: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
203
|
+
type: z.ZodLiteral<TokenFeeType.LinearFee>;
|
|
204
|
+
bps: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
205
|
+
}, "strip", z.ZodTypeAny, {
|
|
206
|
+
type: TokenFeeType.LinearFee;
|
|
207
|
+
owner: string;
|
|
208
|
+
token: string;
|
|
209
|
+
maxFee: bigint;
|
|
210
|
+
halfAmount: bigint;
|
|
211
|
+
bps: bigint;
|
|
212
|
+
}, {
|
|
213
|
+
type: TokenFeeType.LinearFee;
|
|
214
|
+
owner: string;
|
|
215
|
+
token: string;
|
|
216
|
+
maxFee: string | number | bigint;
|
|
217
|
+
halfAmount: string | number | bigint;
|
|
218
|
+
bps: string | number | bigint;
|
|
219
|
+
}>, z.ZodObject<{
|
|
220
|
+
owner: z.ZodString;
|
|
221
|
+
token: z.ZodString;
|
|
222
|
+
maxFee: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
223
|
+
halfAmount: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
224
|
+
type: z.ZodLiteral<TokenFeeType.ProgressiveFee>;
|
|
225
|
+
}, "strip", z.ZodTypeAny, {
|
|
226
|
+
type: TokenFeeType.ProgressiveFee;
|
|
227
|
+
owner: string;
|
|
228
|
+
token: string;
|
|
229
|
+
maxFee: bigint;
|
|
230
|
+
halfAmount: bigint;
|
|
231
|
+
}, {
|
|
232
|
+
type: TokenFeeType.ProgressiveFee;
|
|
233
|
+
owner: string;
|
|
234
|
+
token: string;
|
|
235
|
+
maxFee: string | number | bigint;
|
|
236
|
+
halfAmount: string | number | bigint;
|
|
237
|
+
}>, z.ZodObject<{
|
|
238
|
+
owner: z.ZodString;
|
|
239
|
+
token: z.ZodString;
|
|
240
|
+
maxFee: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
241
|
+
halfAmount: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
242
|
+
type: z.ZodLiteral<TokenFeeType.RegressiveFee>;
|
|
243
|
+
}, "strip", z.ZodTypeAny, {
|
|
244
|
+
type: TokenFeeType.RegressiveFee;
|
|
245
|
+
owner: string;
|
|
246
|
+
token: string;
|
|
247
|
+
maxFee: bigint;
|
|
248
|
+
halfAmount: bigint;
|
|
249
|
+
}, {
|
|
250
|
+
type: TokenFeeType.RegressiveFee;
|
|
251
|
+
owner: string;
|
|
252
|
+
token: string;
|
|
253
|
+
maxFee: string | number | bigint;
|
|
254
|
+
halfAmount: string | number | bigint;
|
|
255
|
+
}>, z.ZodObject<{
|
|
256
|
+
owner: z.ZodString;
|
|
257
|
+
token: z.ZodString;
|
|
258
|
+
type: z.ZodLiteral<TokenFeeType.RoutingFee>;
|
|
259
|
+
feeContracts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, z.ZodTypeDef, any>>>>;
|
|
260
|
+
maxFee: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>>;
|
|
261
|
+
halfAmount: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>>;
|
|
262
|
+
}, "strip", z.ZodTypeAny, {
|
|
263
|
+
type: TokenFeeType.RoutingFee;
|
|
264
|
+
owner: string;
|
|
265
|
+
token: string;
|
|
266
|
+
feeContracts?: Record<string, any> | undefined;
|
|
267
|
+
maxFee?: bigint | undefined;
|
|
268
|
+
halfAmount?: bigint | undefined;
|
|
269
|
+
}, {
|
|
270
|
+
type: TokenFeeType.RoutingFee;
|
|
271
|
+
owner: string;
|
|
272
|
+
token: string;
|
|
273
|
+
feeContracts?: Record<string, any> | undefined;
|
|
274
|
+
maxFee?: string | number | bigint | undefined;
|
|
275
|
+
halfAmount?: string | number | bigint | undefined;
|
|
276
|
+
}>]>;
|
|
277
|
+
export type TokenFeeConfig = z.infer<typeof TokenFeeConfigSchema>;
|
|
278
|
+
export declare const TokenFeeConfigInputSchema: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
279
|
+
owner: z.ZodString;
|
|
280
|
+
token: z.ZodString;
|
|
281
|
+
maxFee: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>>;
|
|
282
|
+
halfAmount: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>>;
|
|
283
|
+
type: z.ZodLiteral<TokenFeeType.LinearFee>;
|
|
284
|
+
bps: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>>;
|
|
285
|
+
}, "strip", z.ZodTypeAny, {
|
|
286
|
+
type: TokenFeeType.LinearFee;
|
|
287
|
+
owner: string;
|
|
288
|
+
token: string;
|
|
289
|
+
maxFee?: bigint | undefined;
|
|
290
|
+
halfAmount?: bigint | undefined;
|
|
291
|
+
bps?: bigint | undefined;
|
|
292
|
+
}, {
|
|
293
|
+
type: TokenFeeType.LinearFee;
|
|
294
|
+
owner: string;
|
|
295
|
+
token: string;
|
|
296
|
+
maxFee?: string | number | bigint | undefined;
|
|
297
|
+
halfAmount?: string | number | bigint | undefined;
|
|
298
|
+
bps?: string | number | bigint | undefined;
|
|
299
|
+
}>, {
|
|
300
|
+
type: TokenFeeType.LinearFee;
|
|
301
|
+
owner: string;
|
|
302
|
+
token: string;
|
|
303
|
+
maxFee?: bigint | undefined;
|
|
304
|
+
halfAmount?: bigint | undefined;
|
|
305
|
+
bps?: bigint | undefined;
|
|
306
|
+
}, {
|
|
307
|
+
type: TokenFeeType.LinearFee;
|
|
308
|
+
owner: string;
|
|
309
|
+
token: string;
|
|
310
|
+
maxFee?: string | number | bigint | undefined;
|
|
311
|
+
halfAmount?: string | number | bigint | undefined;
|
|
312
|
+
bps?: string | number | bigint | undefined;
|
|
313
|
+
}>, {
|
|
314
|
+
bps: bigint;
|
|
315
|
+
type: TokenFeeType.LinearFee;
|
|
316
|
+
owner: string;
|
|
317
|
+
token: string;
|
|
318
|
+
maxFee?: bigint | undefined;
|
|
319
|
+
halfAmount?: bigint | undefined;
|
|
320
|
+
}, {
|
|
321
|
+
type: TokenFeeType.LinearFee;
|
|
322
|
+
owner: string;
|
|
323
|
+
token: string;
|
|
324
|
+
maxFee?: string | number | bigint | undefined;
|
|
325
|
+
halfAmount?: string | number | bigint | undefined;
|
|
326
|
+
bps?: string | number | bigint | undefined;
|
|
327
|
+
}>, z.ZodObject<{
|
|
328
|
+
owner: z.ZodString;
|
|
329
|
+
token: z.ZodString;
|
|
330
|
+
maxFee: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
331
|
+
halfAmount: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
332
|
+
type: z.ZodLiteral<TokenFeeType.ProgressiveFee>;
|
|
333
|
+
}, "strip", z.ZodTypeAny, {
|
|
334
|
+
type: TokenFeeType.ProgressiveFee;
|
|
335
|
+
owner: string;
|
|
336
|
+
token: string;
|
|
337
|
+
maxFee: bigint;
|
|
338
|
+
halfAmount: bigint;
|
|
339
|
+
}, {
|
|
340
|
+
type: TokenFeeType.ProgressiveFee;
|
|
341
|
+
owner: string;
|
|
342
|
+
token: string;
|
|
343
|
+
maxFee: string | number | bigint;
|
|
344
|
+
halfAmount: string | number | bigint;
|
|
345
|
+
}>, z.ZodObject<{
|
|
346
|
+
owner: z.ZodString;
|
|
347
|
+
token: z.ZodString;
|
|
348
|
+
maxFee: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
349
|
+
halfAmount: z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>;
|
|
350
|
+
type: z.ZodLiteral<TokenFeeType.RegressiveFee>;
|
|
351
|
+
}, "strip", z.ZodTypeAny, {
|
|
352
|
+
type: TokenFeeType.RegressiveFee;
|
|
353
|
+
owner: string;
|
|
354
|
+
token: string;
|
|
355
|
+
maxFee: bigint;
|
|
356
|
+
halfAmount: bigint;
|
|
357
|
+
}, {
|
|
358
|
+
type: TokenFeeType.RegressiveFee;
|
|
359
|
+
owner: string;
|
|
360
|
+
token: string;
|
|
361
|
+
maxFee: string | number | bigint;
|
|
362
|
+
halfAmount: string | number | bigint;
|
|
363
|
+
}>, z.ZodObject<{
|
|
364
|
+
type: z.ZodLiteral<TokenFeeType.RoutingFee>;
|
|
365
|
+
owner: z.ZodString;
|
|
366
|
+
token: z.ZodString;
|
|
367
|
+
maxFee: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>>;
|
|
368
|
+
halfAmount: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodUnion<[z.ZodBigInt, z.ZodNumber]>, z.ZodString]>, bigint, string | number | bigint>>;
|
|
369
|
+
feeContracts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, z.ZodTypeDef, any>>>>;
|
|
370
|
+
}, "strip", z.ZodTypeAny, {
|
|
371
|
+
type: TokenFeeType.RoutingFee;
|
|
372
|
+
owner: string;
|
|
373
|
+
token: string;
|
|
374
|
+
maxFee?: bigint | undefined;
|
|
375
|
+
halfAmount?: bigint | undefined;
|
|
376
|
+
feeContracts?: Record<string, any> | undefined;
|
|
377
|
+
}, {
|
|
378
|
+
type: TokenFeeType.RoutingFee;
|
|
379
|
+
owner: string;
|
|
380
|
+
token: string;
|
|
381
|
+
maxFee?: string | number | bigint | undefined;
|
|
382
|
+
halfAmount?: string | number | bigint | undefined;
|
|
383
|
+
feeContracts?: Record<string, any> | undefined;
|
|
384
|
+
}>]>;
|
|
385
|
+
export type TokenFeeConfigInput = z.infer<typeof TokenFeeConfigInputSchema>;
|
|
386
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/fee/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,oBAAY,mBAAmB;IAC7B,SAAS,IAAI;IACb,aAAa,IAAI;IACjB,cAAc,IAAI;IAClB,UAAU,IAAI;CACf;AAED,oBAAY,YAAY;IACtB,SAAS,cAAc;IACvB,cAAc,mBAAmB;IACjC,aAAa,kBAAkB;IAC/B,UAAU,eAAe;CAC1B;AAED,eAAO,MAAM,qBAAqB,4FAIxB,CAAC;AAGX,eAAO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AAIhF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAK/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ZBigNumberish, ZChainName, ZHash, } from '../metadata/customZodTypes.js';
|
|
3
|
+
import { convertToBps } from './utils.js';
|
|
4
|
+
// Matches the enum in BaseFee.sol
|
|
5
|
+
export var OnchainTokenFeeType;
|
|
6
|
+
(function (OnchainTokenFeeType) {
|
|
7
|
+
OnchainTokenFeeType[OnchainTokenFeeType["LinearFee"] = 1] = "LinearFee";
|
|
8
|
+
OnchainTokenFeeType[OnchainTokenFeeType["RegressiveFee"] = 2] = "RegressiveFee";
|
|
9
|
+
OnchainTokenFeeType[OnchainTokenFeeType["ProgressiveFee"] = 3] = "ProgressiveFee";
|
|
10
|
+
OnchainTokenFeeType[OnchainTokenFeeType["RoutingFee"] = 4] = "RoutingFee";
|
|
11
|
+
})(OnchainTokenFeeType || (OnchainTokenFeeType = {}));
|
|
12
|
+
export var TokenFeeType;
|
|
13
|
+
(function (TokenFeeType) {
|
|
14
|
+
TokenFeeType["LinearFee"] = "LinearFee";
|
|
15
|
+
TokenFeeType["ProgressiveFee"] = "ProgressiveFee";
|
|
16
|
+
TokenFeeType["RegressiveFee"] = "RegressiveFee";
|
|
17
|
+
TokenFeeType["RoutingFee"] = "RoutingFee";
|
|
18
|
+
})(TokenFeeType || (TokenFeeType = {}));
|
|
19
|
+
export const ImmutableTokenFeeType = [
|
|
20
|
+
TokenFeeType.LinearFee,
|
|
21
|
+
TokenFeeType.RegressiveFee,
|
|
22
|
+
TokenFeeType.ProgressiveFee,
|
|
23
|
+
];
|
|
24
|
+
// Mapping between the on-chain token fee type (uint) and the token fee type (string)
|
|
25
|
+
export const onChainTypeToTokenFeeTypeMap = {
|
|
26
|
+
[OnchainTokenFeeType.LinearFee]: TokenFeeType.LinearFee,
|
|
27
|
+
[OnchainTokenFeeType.RegressiveFee]: TokenFeeType.RegressiveFee,
|
|
28
|
+
[OnchainTokenFeeType.ProgressiveFee]: TokenFeeType.ProgressiveFee,
|
|
29
|
+
[OnchainTokenFeeType.RoutingFee]: TokenFeeType.RoutingFee,
|
|
30
|
+
};
|
|
31
|
+
// ====== SHARED SCHEMAS ======
|
|
32
|
+
export const BaseFeeConfigSchema = z.object({
|
|
33
|
+
token: ZHash,
|
|
34
|
+
owner: ZHash,
|
|
35
|
+
});
|
|
36
|
+
export const FeeParametersSchema = z.object({
|
|
37
|
+
maxFee: ZBigNumberish,
|
|
38
|
+
halfAmount: ZBigNumberish,
|
|
39
|
+
});
|
|
40
|
+
const StandardFeeConfigBaseSchema = BaseFeeConfigSchema.merge(FeeParametersSchema);
|
|
41
|
+
// ====== INDIVIDUAL FEE SCHEMAS ======
|
|
42
|
+
export const LinearFeeConfigSchema = StandardFeeConfigBaseSchema.extend({
|
|
43
|
+
type: z.literal(TokenFeeType.LinearFee),
|
|
44
|
+
bps: ZBigNumberish,
|
|
45
|
+
});
|
|
46
|
+
// Linear Fee Input - only requires bps & type
|
|
47
|
+
export const LinearFeeInputConfigSchema = BaseFeeConfigSchema.extend({
|
|
48
|
+
type: z.literal(TokenFeeType.LinearFee),
|
|
49
|
+
bps: ZBigNumberish.optional(),
|
|
50
|
+
...FeeParametersSchema.partial().shape,
|
|
51
|
+
})
|
|
52
|
+
.superRefine((v, ctx) => {
|
|
53
|
+
const hasBps = v.bps !== undefined;
|
|
54
|
+
const hasFeeParams = v.maxFee !== undefined && v.halfAmount !== undefined;
|
|
55
|
+
if (!hasBps && !hasFeeParams) {
|
|
56
|
+
ctx.addIssue({
|
|
57
|
+
code: 'custom',
|
|
58
|
+
path: ['bps'],
|
|
59
|
+
message: 'Provide bps or both maxFee and halfAmount',
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (v.halfAmount === 0n) {
|
|
63
|
+
// Prevents divide by 0
|
|
64
|
+
ctx.addIssue({
|
|
65
|
+
code: 'custom',
|
|
66
|
+
path: ['halfAmount'],
|
|
67
|
+
message: 'halfAmount must be > 0',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
.transform((v) => ({
|
|
72
|
+
...v,
|
|
73
|
+
bps: v.bps ?? convertToBps(v.maxFee, v.halfAmount),
|
|
74
|
+
}));
|
|
75
|
+
export const ProgressiveFeeConfigSchema = StandardFeeConfigBaseSchema.extend({
|
|
76
|
+
type: z.literal(TokenFeeType.ProgressiveFee),
|
|
77
|
+
});
|
|
78
|
+
export const RegressiveFeeConfigSchema = StandardFeeConfigBaseSchema.extend({
|
|
79
|
+
type: z.literal(TokenFeeType.RegressiveFee),
|
|
80
|
+
});
|
|
81
|
+
export const RoutingFeeConfigSchema = BaseFeeConfigSchema.extend({
|
|
82
|
+
type: z.literal(TokenFeeType.RoutingFee),
|
|
83
|
+
feeContracts: z
|
|
84
|
+
.record(ZChainName, z.lazy(() => TokenFeeConfigSchema))
|
|
85
|
+
.optional(), // Destination -> Fee
|
|
86
|
+
maxFee: ZBigNumberish.optional(),
|
|
87
|
+
halfAmount: ZBigNumberish.optional(),
|
|
88
|
+
});
|
|
89
|
+
export const RoutingFeeInputConfigSchema = RoutingFeeConfigSchema.extend({
|
|
90
|
+
feeContracts: z
|
|
91
|
+
.record(ZChainName, z.lazy(() => TokenFeeConfigInputSchema))
|
|
92
|
+
.optional(), // Destination -> Fee
|
|
93
|
+
});
|
|
94
|
+
// ====== UNION SCHEMAS ======
|
|
95
|
+
export const TokenFeeConfigSchema = z.discriminatedUnion('type', [
|
|
96
|
+
LinearFeeConfigSchema,
|
|
97
|
+
ProgressiveFeeConfigSchema,
|
|
98
|
+
RegressiveFeeConfigSchema,
|
|
99
|
+
RoutingFeeConfigSchema,
|
|
100
|
+
]);
|
|
101
|
+
export const TokenFeeConfigInputSchema = z.union([
|
|
102
|
+
LinearFeeInputConfigSchema,
|
|
103
|
+
ProgressiveFeeConfigSchema,
|
|
104
|
+
RegressiveFeeConfigSchema,
|
|
105
|
+
RoutingFeeInputConfigSchema,
|
|
106
|
+
]);
|
|
107
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/fee/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,aAAa,EACb,UAAU,EACV,KAAK,GACN,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,kCAAkC;AAClC,MAAM,CAAN,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,uEAAa,CAAA;IACb,+EAAiB,CAAA;IACjB,iFAAkB,CAAA;IAClB,yEAAc,CAAA;AAChB,CAAC,EALW,mBAAmB,KAAnB,mBAAmB,QAK9B;AAED,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uCAAuB,CAAA;IACvB,iDAAiC,CAAA;IACjC,+CAA+B,CAAA;IAC/B,yCAAyB,CAAA;AAC3B,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,YAAY,CAAC,SAAS;IACtB,YAAY,CAAC,aAAa;IAC1B,YAAY,CAAC,cAAc;CACnB,CAAC;AAEX,q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E,CAAC,oBAAoB,CAAC,CAChD;SACA,QAAQ,EAAE,EAAE,qBAAqB;IACpC,MAAM,EAAE,aAAa,CAAC,QAAQ,EAAE;IAChC,UAAU,EAAE,aAAa,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,2BAA2B,GAAG,sBAAsB,CAAC,MAAM,CAAC;IACvE,YAAY,EAAE,CAAC;SACZ,MAAM,CACL,UAAU,EACV,CAAC,CAAC,IAAI,CAAC,GAAgB,EAAE,CAAC,yBAAyB,CAAC,CACrD;SACA,QAAQ,EAAE,EAAE,qBAAqB;CACrC,CAAC,CAAC;AAGH,8BAA8B;AAE9B,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC/D,qBAAqB;IACrB,0BAA0B;IAC1B,yBAAyB;IACzB,sBAAsB;CACvB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC/C,0BAA0B;IAC1B,0BAA0B;IAC1B,yBAAyB;IACzB,2BAA2B;CAC5B,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const MAX_BPS = 10000n;
|
|
2
|
+
/**
|
|
3
|
+
* Converts fee parameters to basis points (BPS)
|
|
4
|
+
* @param maxFee - Maximum fee amount
|
|
5
|
+
* @param halfAmount - Half of the amount at which maxFee is applied
|
|
6
|
+
* @returns Fee in basis points
|
|
7
|
+
* @throws Error if halfAmount is zero to prevent division by zero
|
|
8
|
+
*/
|
|
9
|
+
export declare function convertToBps(maxFee: bigint, halfAmount: bigint): bigint;
|
|
10
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/fee/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,SAAU,CAAC;AAE/B;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAOvE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const MAX_BPS = 10000n; // 100% in bps
|
|
2
|
+
/**
|
|
3
|
+
* Converts fee parameters to basis points (BPS)
|
|
4
|
+
* @param maxFee - Maximum fee amount
|
|
5
|
+
* @param halfAmount - Half of the amount at which maxFee is applied
|
|
6
|
+
* @returns Fee in basis points
|
|
7
|
+
* @throws Error if halfAmount is zero to prevent division by zero
|
|
8
|
+
*/
|
|
9
|
+
export function convertToBps(maxFee, halfAmount) {
|
|
10
|
+
if (halfAmount === 0n) {
|
|
11
|
+
throw new Error('halfAmount must be > 0 to prevent division by zero');
|
|
12
|
+
}
|
|
13
|
+
const bps = (maxFee * MAX_BPS) / (halfAmount * 2n);
|
|
14
|
+
return bps;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/fee/utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,MAAO,CAAC,CAAC,cAAc;AAE9C;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,UAAkB;IAC7D,IAAI,UAAU,KAAK,EAAE,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,EAAE,CAAC,CAAC;IACnD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/fork/types.d.ts
CHANGED
|
@@ -905,8 +905,8 @@ export declare const RawForkedChainTransactionConfigSchema: z.ZodDiscriminatedUn
|
|
|
905
905
|
} | undefined;
|
|
906
906
|
}>>>;
|
|
907
907
|
}, "strip", z.ZodTypeAny, {
|
|
908
|
-
type: TransactionConfigType.FILE;
|
|
909
908
|
path: string;
|
|
909
|
+
type: TransactionConfigType.FILE;
|
|
910
910
|
defaultSender: string;
|
|
911
911
|
overrides: Record<string, {
|
|
912
912
|
annotation?: string | undefined;
|
|
@@ -939,8 +939,8 @@ export declare const RawForkedChainTransactionConfigSchema: z.ZodDiscriminatedUn
|
|
|
939
939
|
} | undefined;
|
|
940
940
|
}>;
|
|
941
941
|
}, {
|
|
942
|
-
type: TransactionConfigType.FILE;
|
|
943
942
|
path: string;
|
|
943
|
+
type: TransactionConfigType.FILE;
|
|
944
944
|
defaultSender: string;
|
|
945
945
|
overrides?: Record<string, {
|
|
946
946
|
annotation?: string | undefined;
|
|
@@ -1303,8 +1303,8 @@ export declare const RawForkedChainConfigSchema: z.ZodObject<{
|
|
|
1303
1303
|
} | undefined;
|
|
1304
1304
|
}>>>;
|
|
1305
1305
|
}, "strip", z.ZodTypeAny, {
|
|
1306
|
-
type: TransactionConfigType.FILE;
|
|
1307
1306
|
path: string;
|
|
1307
|
+
type: TransactionConfigType.FILE;
|
|
1308
1308
|
defaultSender: string;
|
|
1309
1309
|
overrides: Record<string, {
|
|
1310
1310
|
annotation?: string | undefined;
|
|
@@ -1337,8 +1337,8 @@ export declare const RawForkedChainConfigSchema: z.ZodObject<{
|
|
|
1337
1337
|
} | undefined;
|
|
1338
1338
|
}>;
|
|
1339
1339
|
}, {
|
|
1340
|
-
type: TransactionConfigType.FILE;
|
|
1341
1340
|
path: string;
|
|
1341
|
+
type: TransactionConfigType.FILE;
|
|
1342
1342
|
defaultSender: string;
|
|
1343
1343
|
overrides?: Record<string, {
|
|
1344
1344
|
annotation?: string | undefined;
|
|
@@ -1405,8 +1405,8 @@ export declare const RawForkedChainConfigSchema: z.ZodObject<{
|
|
|
1405
1405
|
} | undefined;
|
|
1406
1406
|
}[];
|
|
1407
1407
|
} | {
|
|
1408
|
-
type: TransactionConfigType.FILE;
|
|
1409
1408
|
path: string;
|
|
1409
|
+
type: TransactionConfigType.FILE;
|
|
1410
1410
|
defaultSender: string;
|
|
1411
1411
|
overrides: Record<string, {
|
|
1412
1412
|
annotation?: string | undefined;
|
|
@@ -1474,8 +1474,8 @@ export declare const RawForkedChainConfigSchema: z.ZodObject<{
|
|
|
1474
1474
|
} | undefined;
|
|
1475
1475
|
}[];
|
|
1476
1476
|
} | {
|
|
1477
|
-
type: TransactionConfigType.FILE;
|
|
1478
1477
|
path: string;
|
|
1478
|
+
type: TransactionConfigType.FILE;
|
|
1479
1479
|
defaultSender: string;
|
|
1480
1480
|
overrides?: Record<string, {
|
|
1481
1481
|
annotation?: string | undefined;
|
|
@@ -1840,8 +1840,8 @@ export declare const RawForkedChainConfigByChainSchema: z.ZodRecord<z.ZodString,
|
|
|
1840
1840
|
} | undefined;
|
|
1841
1841
|
}>>>;
|
|
1842
1842
|
}, "strip", z.ZodTypeAny, {
|
|
1843
|
-
type: TransactionConfigType.FILE;
|
|
1844
1843
|
path: string;
|
|
1844
|
+
type: TransactionConfigType.FILE;
|
|
1845
1845
|
defaultSender: string;
|
|
1846
1846
|
overrides: Record<string, {
|
|
1847
1847
|
annotation?: string | undefined;
|
|
@@ -1874,8 +1874,8 @@ export declare const RawForkedChainConfigByChainSchema: z.ZodRecord<z.ZodString,
|
|
|
1874
1874
|
} | undefined;
|
|
1875
1875
|
}>;
|
|
1876
1876
|
}, {
|
|
1877
|
-
type: TransactionConfigType.FILE;
|
|
1878
1877
|
path: string;
|
|
1878
|
+
type: TransactionConfigType.FILE;
|
|
1879
1879
|
defaultSender: string;
|
|
1880
1880
|
overrides?: Record<string, {
|
|
1881
1881
|
annotation?: string | undefined;
|
|
@@ -1942,8 +1942,8 @@ export declare const RawForkedChainConfigByChainSchema: z.ZodRecord<z.ZodString,
|
|
|
1942
1942
|
} | undefined;
|
|
1943
1943
|
}[];
|
|
1944
1944
|
} | {
|
|
1945
|
-
type: TransactionConfigType.FILE;
|
|
1946
1945
|
path: string;
|
|
1946
|
+
type: TransactionConfigType.FILE;
|
|
1947
1947
|
defaultSender: string;
|
|
1948
1948
|
overrides: Record<string, {
|
|
1949
1949
|
annotation?: string | undefined;
|
|
@@ -2011,8 +2011,8 @@ export declare const RawForkedChainConfigByChainSchema: z.ZodRecord<z.ZodString,
|
|
|
2011
2011
|
} | undefined;
|
|
2012
2012
|
}[];
|
|
2013
2013
|
} | {
|
|
2014
|
-
type: TransactionConfigType.FILE;
|
|
2015
2014
|
path: string;
|
|
2015
|
+
type: TransactionConfigType.FILE;
|
|
2016
2016
|
defaultSender: string;
|
|
2017
2017
|
overrides?: Record<string, {
|
|
2018
2018
|
annotation?: string | undefined;
|
|
@@ -2052,32 +2052,32 @@ export declare const SafeTxFileSchema: z.ZodObject<{
|
|
|
2052
2052
|
version: z.ZodString;
|
|
2053
2053
|
chainId: z.ZodString;
|
|
2054
2054
|
transactions: z.ZodArray<z.ZodObject<{
|
|
2055
|
-
to: z.ZodOptional<z.ZodString>;
|
|
2056
2055
|
value: z.ZodOptional<z.ZodString>;
|
|
2056
|
+
to: z.ZodOptional<z.ZodString>;
|
|
2057
2057
|
data: z.ZodOptional<z.ZodString>;
|
|
2058
2058
|
}, "strip", z.ZodTypeAny, {
|
|
2059
|
-
to?: string | undefined;
|
|
2060
2059
|
value?: string | undefined;
|
|
2060
|
+
to?: string | undefined;
|
|
2061
2061
|
data?: string | undefined;
|
|
2062
2062
|
}, {
|
|
2063
|
-
to?: string | undefined;
|
|
2064
2063
|
value?: string | undefined;
|
|
2064
|
+
to?: string | undefined;
|
|
2065
2065
|
data?: string | undefined;
|
|
2066
2066
|
}>, "many">;
|
|
2067
2067
|
}, "strip", z.ZodTypeAny, {
|
|
2068
2068
|
chainId: string;
|
|
2069
2069
|
version: string;
|
|
2070
2070
|
transactions: {
|
|
2071
|
-
to?: string | undefined;
|
|
2072
2071
|
value?: string | undefined;
|
|
2072
|
+
to?: string | undefined;
|
|
2073
2073
|
data?: string | undefined;
|
|
2074
2074
|
}[];
|
|
2075
2075
|
}, {
|
|
2076
2076
|
chainId: string;
|
|
2077
2077
|
version: string;
|
|
2078
2078
|
transactions: {
|
|
2079
|
-
to?: string | undefined;
|
|
2080
2079
|
value?: string | undefined;
|
|
2080
|
+
to?: string | undefined;
|
|
2081
2081
|
data?: string | undefined;
|
|
2082
2082
|
}[];
|
|
2083
2083
|
}>;
|