@keplr-wallet/hooks-evm 0.13.15-rc.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/.eslintrc.json +14 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +18 -0
- package/build/index.js.map +1 -0
- package/build/tx/amount.d.ts +27 -0
- package/build/tx/amount.js +238 -0
- package/build/tx/amount.js.map +1 -0
- package/build/tx/chain.d.ts +10 -0
- package/build/tx/chain.js +37 -0
- package/build/tx/chain.js.map +1 -0
- package/build/tx/errors.d.ts +30 -0
- package/build/tx/errors.js +84 -0
- package/build/tx/errors.js.map +1 -0
- package/build/tx/evm-fee-utils.d.ts +28 -0
- package/build/tx/evm-fee-utils.js +133 -0
- package/build/tx/evm-fee-utils.js.map +1 -0
- package/build/tx/fee.d.ts +61 -0
- package/build/tx/fee.js +523 -0
- package/build/tx/fee.js.map +1 -0
- package/build/tx/gas-simulator.d.ts +89 -0
- package/build/tx/gas-simulator.js +465 -0
- package/build/tx/gas-simulator.js.map +1 -0
- package/build/tx/gas.d.ts +12 -0
- package/build/tx/gas.js +84 -0
- package/build/tx/gas.js.map +1 -0
- package/build/tx/index.d.ts +13 -0
- package/build/tx/index.js +30 -0
- package/build/tx/index.js.map +1 -0
- package/build/tx/internal.d.ts +3 -0
- package/build/tx/internal.js +3 -0
- package/build/tx/internal.js.map +1 -0
- package/build/tx/name-service-ens.d.ts +40 -0
- package/build/tx/name-service-ens.js +189 -0
- package/build/tx/name-service-ens.js.map +1 -0
- package/build/tx/name-service.d.ts +20 -0
- package/build/tx/name-service.js +20 -0
- package/build/tx/name-service.js.map +1 -0
- package/build/tx/recipient.d.ts +35 -0
- package/build/tx/recipient.js +131 -0
- package/build/tx/recipient.js.map +1 -0
- package/build/tx/send-tx.d.ts +13 -0
- package/build/tx/send-tx.js +24 -0
- package/build/tx/send-tx.js.map +1 -0
- package/build/tx/sender.d.ts +12 -0
- package/build/tx/sender.js +73 -0
- package/build/tx/sender.js.map +1 -0
- package/build/tx/types.d.ts +102 -0
- package/build/tx/types.js +3 -0
- package/build/tx/types.js.map +1 -0
- package/build/tx/validate.d.ts +11 -0
- package/build/tx/validate.js +37 -0
- package/build/tx/validate.js.map +1 -0
- package/package.json +40 -0
- package/src/index.ts +1 -0
- package/src/tx/amount.ts +273 -0
- package/src/tx/chain.ts +31 -0
- package/src/tx/errors.ts +79 -0
- package/src/tx/evm-fee-utils.ts +217 -0
- package/src/tx/fee.ts +622 -0
- package/src/tx/gas-simulator.ts +567 -0
- package/src/tx/gas.ts +93 -0
- package/src/tx/index.ts +13 -0
- package/src/tx/internal.ts +4 -0
- package/src/tx/name-service-ens.ts +207 -0
- package/src/tx/name-service.ts +39 -0
- package/src/tx/recipient.ts +166 -0
- package/src/tx/send-tx.ts +55 -0
- package/src/tx/sender.ts +82 -0
- package/src/tx/types.ts +153 -0
- package/src/tx/validate.ts +55 -0
- package/tsconfig.check.json +90 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evm-fee-utils.js","sourceRoot":"","sources":["../../src/tx/evm-fee-utils.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAIzC,oBAAoB;AACP,QAAA,IAAI,GAAG,IAAI,UAAG,CAAC,SAAA,EAAE,EAAI,CAAC,CAAA,CAAC,CAAC;AACxB,QAAA,2BAA2B,GAAG,EAAE,CAAC;AACjC,QAAA,kCAAkC,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAClD,QAAA,4BAA4B,GAAG,IAAI,UAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,YAAI,CAAC,CAAC;AACrD,QAAA,wCAAwC,GAAG,IAAI,UAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,YAAI,CAAC,CAAC;AAClE,QAAA,4BAA4B,GAMrC;IACF,GAAG,EAAE;QACH,UAAU,EAAE,0CAAkC,CAAC,CAAC,CAAC;QACjD,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@
|
|
|
1
|
+
import { EVMFeeType, IAmountConfig, IFeeConfig, IGasConfig, ISenderConfig, UIProperties } from "./types";
|
|
2
|
+
import { TxChainSetter } from "./chain";
|
|
3
|
+
import { ChainGetter } from "@keplr-wallet/stores";
|
|
4
|
+
import { CoinPretty, Dec } from "@keplr-wallet/unit";
|
|
5
|
+
import { QueriesStore } from "./internal";
|
|
6
|
+
import { EthereumQueriesImpl } from "@keplr-wallet/stores-eth";
|
|
7
|
+
export declare class FeeConfig extends TxChainSetter implements IFeeConfig {
|
|
8
|
+
protected readonly queriesStore: QueriesStore;
|
|
9
|
+
protected readonly senderConfig: ISenderConfig;
|
|
10
|
+
protected readonly amountConfig: IAmountConfig;
|
|
11
|
+
protected readonly gasConfig: IGasConfig;
|
|
12
|
+
protected _type: EVMFeeType;
|
|
13
|
+
protected _customPriorityFee: string;
|
|
14
|
+
protected _customPriorityFeeInput: string;
|
|
15
|
+
protected _customGasPrice: string;
|
|
16
|
+
protected _customGasPriceInput: string;
|
|
17
|
+
protected _forceLegacyFeeMode: boolean | undefined;
|
|
18
|
+
protected _disableBalanceCheck: boolean;
|
|
19
|
+
protected additionAmountToNeedFee: boolean;
|
|
20
|
+
protected _l1DataFee: Dec | undefined;
|
|
21
|
+
constructor(chainGetter: ChainGetter, queriesStore: QueriesStore, initialChainId: string, senderConfig: ISenderConfig, amountConfig: IAmountConfig, gasConfig: IGasConfig, additionAmountToNeedFee?: boolean);
|
|
22
|
+
setAdditionAmountToNeedFee(additionAmountToNeedFee: boolean): void;
|
|
23
|
+
setDisableBalanceCheck(bool: boolean): void;
|
|
24
|
+
get type(): EVMFeeType;
|
|
25
|
+
setType(type: EVMFeeType): void;
|
|
26
|
+
setForceLegacyFeeMode(value: boolean | undefined): void;
|
|
27
|
+
get customPriorityFee(): string;
|
|
28
|
+
get customPriorityFeeInput(): string;
|
|
29
|
+
setCustomPriorityFee(gweiValue: string): void;
|
|
30
|
+
get isLegacyFeeMode(): boolean;
|
|
31
|
+
get customGasPrice(): string;
|
|
32
|
+
get customGasPriceInput(): string;
|
|
33
|
+
setCustomGasPrice(gweiValue: string): void;
|
|
34
|
+
protected get currentPriorityFee(): Dec;
|
|
35
|
+
get l1DataFee(): Dec | undefined;
|
|
36
|
+
setL1DataFee(fee: Dec): void;
|
|
37
|
+
protected getEthereumQueries(): EthereumQueriesImpl | undefined;
|
|
38
|
+
protected canEIP1559TxFeesAndReady(isRefresh?: boolean): boolean;
|
|
39
|
+
refreshEIP1559TxFees(): void;
|
|
40
|
+
readonly getEIP1559TxFees: (feeTypeOrManual: EVMFeeType | "manual") => import("./evm-fee-utils").EIP1559TxFees;
|
|
41
|
+
protected getFeeCurrency(): AppCurrency;
|
|
42
|
+
get maxFeePerGas(): Dec | undefined;
|
|
43
|
+
get maxPriorityFeePerGas(): Dec | undefined;
|
|
44
|
+
get gasPrice(): Dec | undefined;
|
|
45
|
+
protected getL1DataFeeToAdd(): Dec;
|
|
46
|
+
get fee(): CoinPretty | undefined;
|
|
47
|
+
get maxFee(): CoinPretty | undefined;
|
|
48
|
+
get fees(): CoinPretty[];
|
|
49
|
+
get selectableFeeCurrencies(): FeeCurrency[];
|
|
50
|
+
setFee(fee: {
|
|
51
|
+
type: EVMFeeType;
|
|
52
|
+
currency: FeeCurrency;
|
|
53
|
+
} | CoinPretty | CoinPretty[] | undefined): void;
|
|
54
|
+
readonly getFeeTypePrettyForFeeCurrency: (_currency: FeeCurrency, feeType: EVMFeeType) => CoinPretty;
|
|
55
|
+
toStdFee(): StdFee;
|
|
56
|
+
get uiProperties(): UIProperties;
|
|
57
|
+
}
|
|
58
|
+
import { AppCurrency, FeeCurrency, StdFee } from "@keplr-wallet/types";
|
|
59
|
+
export declare const useFeeConfig: (chainGetter: ChainGetter, queriesStore: QueriesStore, chainId: string, senderConfig: ISenderConfig, amountConfig: IAmountConfig, gasConfig: IGasConfig, opts?: {
|
|
60
|
+
additionAmountToNeedFee?: boolean;
|
|
61
|
+
}) => FeeConfig;
|
package/build/tx/fee.js
ADDED
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.useFeeConfig = exports.FeeConfig = void 0;
|
|
10
|
+
const chain_1 = require("./chain");
|
|
11
|
+
const mobx_1 = require("mobx");
|
|
12
|
+
const unit_1 = require("@keplr-wallet/unit");
|
|
13
|
+
const react_1 = require("react");
|
|
14
|
+
const errors_1 = require("./errors");
|
|
15
|
+
const mobx_utils_1 = require("mobx-utils");
|
|
16
|
+
const evm_fee_utils_1 = require("./evm-fee-utils");
|
|
17
|
+
class FeeConfig extends chain_1.TxChainSetter {
|
|
18
|
+
constructor(chainGetter, queriesStore, initialChainId, senderConfig, amountConfig, gasConfig, additionAmountToNeedFee = true) {
|
|
19
|
+
super(chainGetter, initialChainId);
|
|
20
|
+
this.queriesStore = queriesStore;
|
|
21
|
+
this.senderConfig = senderConfig;
|
|
22
|
+
this.amountConfig = amountConfig;
|
|
23
|
+
this.gasConfig = gasConfig;
|
|
24
|
+
this._type = "average";
|
|
25
|
+
this._customPriorityFee = "";
|
|
26
|
+
this._customPriorityFeeInput = "";
|
|
27
|
+
this._customGasPrice = "";
|
|
28
|
+
this._customGasPriceInput = "";
|
|
29
|
+
this._forceLegacyFeeMode = undefined;
|
|
30
|
+
this._disableBalanceCheck = false;
|
|
31
|
+
this.additionAmountToNeedFee = true;
|
|
32
|
+
this._l1DataFee = undefined;
|
|
33
|
+
this.getEIP1559TxFees = (0, mobx_utils_1.computedFn)((feeTypeOrManual) => {
|
|
34
|
+
const isCustom = feeTypeOrManual === "custom";
|
|
35
|
+
const feeType = feeTypeOrManual === "manual" || feeTypeOrManual === "custom"
|
|
36
|
+
? "average"
|
|
37
|
+
: feeTypeOrManual;
|
|
38
|
+
const ethereumQueries = this.getEthereumQueries();
|
|
39
|
+
if (ethereumQueries && this.canEIP1559TxFeesAndReady()) {
|
|
40
|
+
if (feeTypeOrManual === "custom") {
|
|
41
|
+
// Legacy mode: use custom gas price if available
|
|
42
|
+
if (this.isLegacyFeeMode) {
|
|
43
|
+
if (isCustom && this._customGasPrice.trim() !== "") {
|
|
44
|
+
try {
|
|
45
|
+
return { gasPrice: new unit_1.Dec(this._customGasPrice) };
|
|
46
|
+
}
|
|
47
|
+
catch (_a) {
|
|
48
|
+
// fall through to default
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return (0, evm_fee_utils_1.computeEIP1559TxFees)(ethereumQueries, feeType, this.chainId);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// EIP-1559 mode: use custom priority fee
|
|
56
|
+
if (isCustom && this._customPriorityFee.trim() !== "") {
|
|
57
|
+
try {
|
|
58
|
+
const customWei = new unit_1.Dec(this._customPriorityFee);
|
|
59
|
+
// 여기서 feeType이 average인 이유는 customWei값이 존재 하면 실제로 계산 하지 않고 설정된 값으로 전달이 되기 때문에
|
|
60
|
+
// fallback feeType이다.
|
|
61
|
+
return (0, evm_fee_utils_1.computeEIP1559TxFees)(ethereumQueries, "average", this.chainId, customWei);
|
|
62
|
+
}
|
|
63
|
+
catch (_b) {
|
|
64
|
+
// fall through to default
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return (0, evm_fee_utils_1.computeEIP1559TxFees)(ethereumQueries, "average", this.chainId);
|
|
68
|
+
}
|
|
69
|
+
return (0, evm_fee_utils_1.computeEIP1559TxFees)(ethereumQueries, feeType, this.chainId);
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
gasPrice: new unit_1.Dec(0),
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
this.getFeeTypePrettyForFeeCurrency = (0, mobx_utils_1.computedFn)((_currency, feeType) => {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
const fees = this.getEIP1559TxFees(feeType);
|
|
78
|
+
const price = (_b = (_a = fees.gasPrice) !== null && _a !== void 0 ? _a : fees.maxFeePerGas) !== null && _b !== void 0 ? _b : new unit_1.Dec(0);
|
|
79
|
+
const feeCurrency = this.getFeeCurrency();
|
|
80
|
+
const gasDec = new unit_1.Dec(this.gasConfig.gas);
|
|
81
|
+
const l1DataFeeToAdd = this.getL1DataFeeToAdd();
|
|
82
|
+
return new unit_1.CoinPretty(feeCurrency, price.mul(gasDec).add(l1DataFeeToAdd).roundUp());
|
|
83
|
+
});
|
|
84
|
+
this.additionAmountToNeedFee = additionAmountToNeedFee;
|
|
85
|
+
(0, mobx_1.makeObservable)(this);
|
|
86
|
+
}
|
|
87
|
+
setAdditionAmountToNeedFee(additionAmountToNeedFee) {
|
|
88
|
+
this.additionAmountToNeedFee = additionAmountToNeedFee;
|
|
89
|
+
}
|
|
90
|
+
setDisableBalanceCheck(bool) {
|
|
91
|
+
this._disableBalanceCheck = bool;
|
|
92
|
+
}
|
|
93
|
+
get type() {
|
|
94
|
+
return this._type;
|
|
95
|
+
}
|
|
96
|
+
setType(type) {
|
|
97
|
+
var _a;
|
|
98
|
+
if (type === "custom" && this._customPriorityFee === "") {
|
|
99
|
+
const currentFees = this.getEIP1559TxFees(this._type);
|
|
100
|
+
const priorityFee = currentFees.maxPriorityFeePerGas;
|
|
101
|
+
if (priorityFee) {
|
|
102
|
+
this._customPriorityFee = priorityFee.truncate().toString();
|
|
103
|
+
this._customPriorityFeeInput = priorityFee.quo(evm_fee_utils_1.GWEI).toString(9);
|
|
104
|
+
}
|
|
105
|
+
if (this.isLegacyFeeMode) {
|
|
106
|
+
const fees = this.getEIP1559TxFees("average");
|
|
107
|
+
const currentGasPrice = (_a = fees.gasPrice) !== null && _a !== void 0 ? _a : new unit_1.Dec(0);
|
|
108
|
+
this._customGasPrice = currentGasPrice.truncate().toString();
|
|
109
|
+
this._customGasPriceInput = currentGasPrice.quo(evm_fee_utils_1.GWEI).toString(9);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (type !== "custom") {
|
|
113
|
+
this._forceLegacyFeeMode = undefined;
|
|
114
|
+
}
|
|
115
|
+
this._type = type;
|
|
116
|
+
}
|
|
117
|
+
setForceLegacyFeeMode(value) {
|
|
118
|
+
this._forceLegacyFeeMode = value;
|
|
119
|
+
}
|
|
120
|
+
get customPriorityFee() {
|
|
121
|
+
return this._customPriorityFee;
|
|
122
|
+
}
|
|
123
|
+
get customPriorityFeeInput() {
|
|
124
|
+
return this._customPriorityFeeInput;
|
|
125
|
+
}
|
|
126
|
+
setCustomPriorityFee(gweiValue) {
|
|
127
|
+
if (gweiValue.startsWith(".")) {
|
|
128
|
+
gweiValue = "0" + gweiValue;
|
|
129
|
+
}
|
|
130
|
+
this._customPriorityFeeInput = gweiValue;
|
|
131
|
+
if (gweiValue.trim() === "") {
|
|
132
|
+
this._customPriorityFee = "";
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
try {
|
|
136
|
+
this._customPriorityFee = new unit_1.Dec(gweiValue)
|
|
137
|
+
.mul(evm_fee_utils_1.GWEI)
|
|
138
|
+
.truncate()
|
|
139
|
+
.toString();
|
|
140
|
+
}
|
|
141
|
+
catch (_a) {
|
|
142
|
+
// keep previous value on invalid input
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
get isLegacyFeeMode() {
|
|
147
|
+
if (this._forceLegacyFeeMode !== undefined) {
|
|
148
|
+
return this._forceLegacyFeeMode;
|
|
149
|
+
}
|
|
150
|
+
const ethereumQueries = this.getEthereumQueries();
|
|
151
|
+
if (!ethereumQueries || !this.canEIP1559TxFeesAndReady()) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
const block = ethereumQueries.queryEthereumBlock.getQueryByBlockNumberOrTag(evm_fee_utils_1.ETH_FEE_HISTORY_NEWEST_BLOCK).block;
|
|
155
|
+
if (!block || block.baseFeePerGas == null) {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
return parseInt(block.baseFeePerGas) === 0;
|
|
159
|
+
}
|
|
160
|
+
get customGasPrice() {
|
|
161
|
+
return this._customGasPrice;
|
|
162
|
+
}
|
|
163
|
+
get customGasPriceInput() {
|
|
164
|
+
return this._customGasPriceInput;
|
|
165
|
+
}
|
|
166
|
+
setCustomGasPrice(gweiValue) {
|
|
167
|
+
if (gweiValue.startsWith(".")) {
|
|
168
|
+
gweiValue = "0" + gweiValue;
|
|
169
|
+
}
|
|
170
|
+
this._customGasPriceInput = gweiValue;
|
|
171
|
+
if (gweiValue.trim() === "") {
|
|
172
|
+
this._customGasPrice = "";
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
try {
|
|
176
|
+
this._customGasPrice = new unit_1.Dec(gweiValue)
|
|
177
|
+
.mul(evm_fee_utils_1.GWEI)
|
|
178
|
+
.truncate()
|
|
179
|
+
.toString();
|
|
180
|
+
}
|
|
181
|
+
catch (_a) {
|
|
182
|
+
// keep previous value on invalid input
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
get currentPriorityFee() {
|
|
187
|
+
const ethereumQueries = this.queriesStore.get(this.chainId).ethereum;
|
|
188
|
+
if (!ethereumQueries || !this.canEIP1559TxFeesAndReady()) {
|
|
189
|
+
return new unit_1.Dec(0);
|
|
190
|
+
}
|
|
191
|
+
const feeType = this.type === "custom" ? "average" : this.type;
|
|
192
|
+
const priorityFee = (0, evm_fee_utils_1.calculateOptimalMaxPriorityFeePerGas)(ethereumQueries, feeType, this.chainId);
|
|
193
|
+
return priorityFee;
|
|
194
|
+
}
|
|
195
|
+
get l1DataFee() {
|
|
196
|
+
return this._l1DataFee;
|
|
197
|
+
}
|
|
198
|
+
setL1DataFee(fee) {
|
|
199
|
+
this._l1DataFee = fee;
|
|
200
|
+
}
|
|
201
|
+
getEthereumQueries() {
|
|
202
|
+
return this.queriesStore.get(this.chainId).ethereum;
|
|
203
|
+
}
|
|
204
|
+
canEIP1559TxFeesAndReady(isRefresh) {
|
|
205
|
+
if (!this.senderConfig.sender.startsWith("0x")) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
const ethereumQueries = this.getEthereumQueries();
|
|
209
|
+
if (!ethereumQueries) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
const blockQuery = ethereumQueries.queryEthereumBlock.getQueryByBlockNumberOrTag(evm_fee_utils_1.ETH_FEE_HISTORY_NEWEST_BLOCK);
|
|
213
|
+
if (blockQuery.block != null) {
|
|
214
|
+
if (isRefresh) {
|
|
215
|
+
blockQuery.waitFreshResponse();
|
|
216
|
+
}
|
|
217
|
+
const feeHistoryQuery = ethereumQueries.queryEthereumFeeHistory.getQueryByFeeHistoryParams(evm_fee_utils_1.ETH_FEE_HISTORY_BLOCK_COUNT, evm_fee_utils_1.ETH_FEE_HISTORY_NEWEST_BLOCK, evm_fee_utils_1.ETH_FEE_HISTORY_REWARD_PERCENTILES);
|
|
218
|
+
if (feeHistoryQuery.feeHistory != null) {
|
|
219
|
+
if (isRefresh) {
|
|
220
|
+
feeHistoryQuery.waitFreshResponse();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
const maxPriorityFeePerGasQuery = ethereumQueries.queryEthereumMaxPriorityFee;
|
|
224
|
+
if (maxPriorityFeePerGasQuery.maxPriorityFeePerGas != null) {
|
|
225
|
+
if (isRefresh) {
|
|
226
|
+
maxPriorityFeePerGasQuery.waitFreshResponse();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
const gasPriceQuery = ethereumQueries.queryEthereumGasPrice;
|
|
232
|
+
if (gasPriceQuery.gasPrice != null) {
|
|
233
|
+
if (isRefresh) {
|
|
234
|
+
gasPriceQuery.waitFreshResponse();
|
|
235
|
+
}
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
refreshEIP1559TxFees() {
|
|
241
|
+
this.canEIP1559TxFeesAndReady(true);
|
|
242
|
+
}
|
|
243
|
+
getFeeCurrency() {
|
|
244
|
+
const u = this.modularChainInfo.unwrapped;
|
|
245
|
+
if (u.type !== "evm" && u.type !== "ethermint") {
|
|
246
|
+
throw new Error("Chain is not an EVM chain");
|
|
247
|
+
}
|
|
248
|
+
return u.evm.nativeCurrency;
|
|
249
|
+
}
|
|
250
|
+
get maxFeePerGas() {
|
|
251
|
+
const fees = this.getEIP1559TxFees(this.type);
|
|
252
|
+
return fees.maxFeePerGas;
|
|
253
|
+
}
|
|
254
|
+
get maxPriorityFeePerGas() {
|
|
255
|
+
const fees = this.getEIP1559TxFees(this.type);
|
|
256
|
+
return fees.maxPriorityFeePerGas;
|
|
257
|
+
}
|
|
258
|
+
get gasPrice() {
|
|
259
|
+
var _a;
|
|
260
|
+
const fees = this.getEIP1559TxFees(this.type);
|
|
261
|
+
return (_a = fees.gasPrice) !== null && _a !== void 0 ? _a : fees.maxFeePerGas;
|
|
262
|
+
}
|
|
263
|
+
getL1DataFeeToAdd() {
|
|
264
|
+
return (0, evm_fee_utils_1.getL1DataFeeToAdd)(this.modularChainInfo.hasFeature("op-stack-l1-data-fee"), this._l1DataFee);
|
|
265
|
+
}
|
|
266
|
+
get fee() {
|
|
267
|
+
const price = this.gasPrice;
|
|
268
|
+
if (!price || price.equals(new unit_1.Dec(0))) {
|
|
269
|
+
return undefined;
|
|
270
|
+
}
|
|
271
|
+
const feeCurrency = this.getFeeCurrency();
|
|
272
|
+
const gasDec = new unit_1.Dec(this.gasConfig.gas);
|
|
273
|
+
const l1DataFeeToAdd = this.getL1DataFeeToAdd();
|
|
274
|
+
return new unit_1.CoinPretty(feeCurrency, price.mul(gasDec).add(l1DataFeeToAdd).roundUp());
|
|
275
|
+
}
|
|
276
|
+
get maxFee() {
|
|
277
|
+
const price = this.gasPrice;
|
|
278
|
+
if (!price || price.equals(new unit_1.Dec(0))) {
|
|
279
|
+
return undefined;
|
|
280
|
+
}
|
|
281
|
+
const feeCurrency = this.getFeeCurrency();
|
|
282
|
+
const gasDec = new unit_1.Dec(this.gasConfig.gas);
|
|
283
|
+
const l1DataFeeToAdd = this.getL1DataFeeToAdd();
|
|
284
|
+
// For maxFee, use a higher multiplier to be safe
|
|
285
|
+
return new unit_1.CoinPretty(feeCurrency, price.mul(new unit_1.Dec(1.2)).mul(gasDec).add(l1DataFeeToAdd).roundUp());
|
|
286
|
+
}
|
|
287
|
+
// --- hooks IFeeConfig 구조 호환용 ---
|
|
288
|
+
get fees() {
|
|
289
|
+
return this.fee ? [this.fee] : [];
|
|
290
|
+
}
|
|
291
|
+
get selectableFeeCurrencies() {
|
|
292
|
+
return [this.getFeeCurrency()];
|
|
293
|
+
}
|
|
294
|
+
setFee(fee) {
|
|
295
|
+
if (!fee) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
if ("type" in fee && "currency" in fee) {
|
|
299
|
+
this.setType(fee.type);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
toStdFee() {
|
|
303
|
+
const fee = this.fee;
|
|
304
|
+
if (!fee) {
|
|
305
|
+
return { gas: "0", amount: [] };
|
|
306
|
+
}
|
|
307
|
+
return {
|
|
308
|
+
gas: this.gasConfig.gas.toString(),
|
|
309
|
+
amount: [fee.toCoin()],
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
// --- end hooks IFeeConfig 구조 호환용 ---
|
|
313
|
+
get uiProperties() {
|
|
314
|
+
if (this._disableBalanceCheck) {
|
|
315
|
+
return {};
|
|
316
|
+
}
|
|
317
|
+
if (!this.canEIP1559TxFeesAndReady()) {
|
|
318
|
+
return {
|
|
319
|
+
loadingState: "loading-block",
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
if (this._type === "custom") {
|
|
323
|
+
const rawValue = this.isLegacyFeeMode
|
|
324
|
+
? this._customGasPrice
|
|
325
|
+
: this._customPriorityFee;
|
|
326
|
+
if (rawValue.trim() !== "") {
|
|
327
|
+
try {
|
|
328
|
+
const dec = new unit_1.Dec(rawValue);
|
|
329
|
+
if (dec.lt(new unit_1.Dec(0))) {
|
|
330
|
+
return {
|
|
331
|
+
error: new Error("Enter a positive number"),
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
catch (_a) {
|
|
336
|
+
return {
|
|
337
|
+
error: new Error("Enter a valid number"),
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
let priorWarning = undefined;
|
|
343
|
+
let priorIsLoadingState = false;
|
|
344
|
+
const makeReturn = (uiProperties) => {
|
|
345
|
+
return Object.assign(Object.assign(Object.assign({}, uiProperties), (() => {
|
|
346
|
+
if (priorIsLoadingState) {
|
|
347
|
+
if (uiProperties.loadingState === "loading-block") {
|
|
348
|
+
return {
|
|
349
|
+
loadingState: "loading-block",
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
return {
|
|
354
|
+
loadingState: "loading",
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return {};
|
|
359
|
+
})()), (() => {
|
|
360
|
+
if (priorWarning) {
|
|
361
|
+
if (uiProperties.error) {
|
|
362
|
+
return {};
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
return {
|
|
366
|
+
warning: priorWarning,
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return {};
|
|
371
|
+
})());
|
|
372
|
+
};
|
|
373
|
+
const ethereumQueries = this.getEthereumQueries();
|
|
374
|
+
if (ethereumQueries) {
|
|
375
|
+
const eipState = (0, evm_fee_utils_1.getEIP1559QueryUIState)(ethereumQueries, this.chainId);
|
|
376
|
+
if (eipState.warning) {
|
|
377
|
+
priorWarning = eipState.warning;
|
|
378
|
+
}
|
|
379
|
+
if (eipState.isLoading) {
|
|
380
|
+
priorIsLoadingState = true;
|
|
381
|
+
}
|
|
382
|
+
if (eipState.isBlocked) {
|
|
383
|
+
return makeReturn({
|
|
384
|
+
loadingState: "loading-block",
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
const fee = this.fee;
|
|
389
|
+
if (!fee) {
|
|
390
|
+
return makeReturn({
|
|
391
|
+
error: new Error("Fee is not set"),
|
|
392
|
+
loadingState: "loading-block",
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
const feeCurrency = this.getFeeCurrency();
|
|
396
|
+
let needAmount = new unit_1.Int(fee.toCoin().amount);
|
|
397
|
+
if (this.additionAmountToNeedFee) {
|
|
398
|
+
for (const amt of this.amountConfig.amount) {
|
|
399
|
+
if (amt.currency.coinMinimalDenom === feeCurrency.coinMinimalDenom) {
|
|
400
|
+
needAmount = needAmount.add(new unit_1.Int(amt.toCoin().amount));
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
const bal = this.queriesStore
|
|
405
|
+
.get(this.chainId)
|
|
406
|
+
.queryBalances.getQueryEthereumHexAddress(this.senderConfig.sender)
|
|
407
|
+
.getBalance(feeCurrency);
|
|
408
|
+
if (!bal) {
|
|
409
|
+
priorWarning = new Error(`Can't parse the balance for ${feeCurrency.coinMinimalDenom}`);
|
|
410
|
+
}
|
|
411
|
+
if (bal) {
|
|
412
|
+
bal.waitResponse();
|
|
413
|
+
if (bal.error) {
|
|
414
|
+
priorWarning = new Error("Failed to fetch balance");
|
|
415
|
+
}
|
|
416
|
+
if (!bal.response) {
|
|
417
|
+
return makeReturn({
|
|
418
|
+
loadingState: "loading-block",
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
if (new unit_1.Int(bal.balance.toCoin().amount).lt(needAmount)) {
|
|
422
|
+
if (bal.isFetching) {
|
|
423
|
+
priorIsLoadingState = true;
|
|
424
|
+
}
|
|
425
|
+
return makeReturn({
|
|
426
|
+
error: new errors_1.InsufficientFeeError("Insufficient fee"),
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return makeReturn({});
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
__decorate([
|
|
434
|
+
mobx_1.observable
|
|
435
|
+
], FeeConfig.prototype, "_type", void 0);
|
|
436
|
+
__decorate([
|
|
437
|
+
mobx_1.observable
|
|
438
|
+
], FeeConfig.prototype, "_customPriorityFee", void 0);
|
|
439
|
+
__decorate([
|
|
440
|
+
mobx_1.observable
|
|
441
|
+
], FeeConfig.prototype, "_customPriorityFeeInput", void 0);
|
|
442
|
+
__decorate([
|
|
443
|
+
mobx_1.observable
|
|
444
|
+
], FeeConfig.prototype, "_customGasPrice", void 0);
|
|
445
|
+
__decorate([
|
|
446
|
+
mobx_1.observable
|
|
447
|
+
], FeeConfig.prototype, "_customGasPriceInput", void 0);
|
|
448
|
+
__decorate([
|
|
449
|
+
mobx_1.observable
|
|
450
|
+
], FeeConfig.prototype, "_forceLegacyFeeMode", void 0);
|
|
451
|
+
__decorate([
|
|
452
|
+
mobx_1.observable
|
|
453
|
+
], FeeConfig.prototype, "_disableBalanceCheck", void 0);
|
|
454
|
+
__decorate([
|
|
455
|
+
mobx_1.observable
|
|
456
|
+
], FeeConfig.prototype, "additionAmountToNeedFee", void 0);
|
|
457
|
+
__decorate([
|
|
458
|
+
mobx_1.observable
|
|
459
|
+
], FeeConfig.prototype, "_l1DataFee", void 0);
|
|
460
|
+
__decorate([
|
|
461
|
+
mobx_1.action
|
|
462
|
+
], FeeConfig.prototype, "setAdditionAmountToNeedFee", null);
|
|
463
|
+
__decorate([
|
|
464
|
+
mobx_1.action
|
|
465
|
+
], FeeConfig.prototype, "setDisableBalanceCheck", null);
|
|
466
|
+
__decorate([
|
|
467
|
+
mobx_1.action
|
|
468
|
+
], FeeConfig.prototype, "setType", null);
|
|
469
|
+
__decorate([
|
|
470
|
+
mobx_1.action
|
|
471
|
+
], FeeConfig.prototype, "setForceLegacyFeeMode", null);
|
|
472
|
+
__decorate([
|
|
473
|
+
mobx_1.action
|
|
474
|
+
], FeeConfig.prototype, "setCustomPriorityFee", null);
|
|
475
|
+
__decorate([
|
|
476
|
+
mobx_1.computed
|
|
477
|
+
], FeeConfig.prototype, "isLegacyFeeMode", null);
|
|
478
|
+
__decorate([
|
|
479
|
+
mobx_1.action
|
|
480
|
+
], FeeConfig.prototype, "setCustomGasPrice", null);
|
|
481
|
+
__decorate([
|
|
482
|
+
mobx_1.action
|
|
483
|
+
], FeeConfig.prototype, "setL1DataFee", null);
|
|
484
|
+
__decorate([
|
|
485
|
+
mobx_1.computed
|
|
486
|
+
], FeeConfig.prototype, "maxFeePerGas", null);
|
|
487
|
+
__decorate([
|
|
488
|
+
mobx_1.computed
|
|
489
|
+
], FeeConfig.prototype, "maxPriorityFeePerGas", null);
|
|
490
|
+
__decorate([
|
|
491
|
+
mobx_1.computed
|
|
492
|
+
], FeeConfig.prototype, "gasPrice", null);
|
|
493
|
+
__decorate([
|
|
494
|
+
mobx_1.computed
|
|
495
|
+
], FeeConfig.prototype, "fee", null);
|
|
496
|
+
__decorate([
|
|
497
|
+
mobx_1.computed
|
|
498
|
+
], FeeConfig.prototype, "maxFee", null);
|
|
499
|
+
__decorate([
|
|
500
|
+
mobx_1.computed
|
|
501
|
+
], FeeConfig.prototype, "fees", null);
|
|
502
|
+
__decorate([
|
|
503
|
+
mobx_1.computed
|
|
504
|
+
], FeeConfig.prototype, "selectableFeeCurrencies", null);
|
|
505
|
+
__decorate([
|
|
506
|
+
mobx_1.action
|
|
507
|
+
], FeeConfig.prototype, "setFee", null);
|
|
508
|
+
__decorate([
|
|
509
|
+
mobx_1.computed
|
|
510
|
+
], FeeConfig.prototype, "uiProperties", null);
|
|
511
|
+
exports.FeeConfig = FeeConfig;
|
|
512
|
+
const useFeeConfig = (chainGetter, queriesStore, chainId, senderConfig, amountConfig, gasConfig, opts = {}) => {
|
|
513
|
+
var _a;
|
|
514
|
+
const [config] = (0, react_1.useState)(() => {
|
|
515
|
+
var _a;
|
|
516
|
+
return new FeeConfig(chainGetter, queriesStore, chainId, senderConfig, amountConfig, gasConfig, (_a = opts.additionAmountToNeedFee) !== null && _a !== void 0 ? _a : true);
|
|
517
|
+
});
|
|
518
|
+
config.setChain(chainId);
|
|
519
|
+
config.setAdditionAmountToNeedFee((_a = opts.additionAmountToNeedFee) !== null && _a !== void 0 ? _a : true);
|
|
520
|
+
return config;
|
|
521
|
+
};
|
|
522
|
+
exports.useFeeConfig = useFeeConfig;
|
|
523
|
+
//# sourceMappingURL=fee.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fee.js","sourceRoot":"","sources":["../../src/tx/fee.ts"],"names":[],"mappings":";;;;;;;;;AAQA,mCAAwC;AAExC,+BAAoE;AACpE,6CAA0D;AAC1D,iCAAiC;AAEjC,qCAAgD;AAChD,2CAAwC;AAExC,mDASyB;AAEzB,MAAa,SAAU,SAAQ,qBAAa;IA4B1C,YACE,WAAwB,EACL,YAA0B,EAC7C,cAAsB,EACH,YAA2B,EAC3B,YAA2B,EAC3B,SAAqB,EACxC,0BAAmC,IAAI;QAEvC,KAAK,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAPhB,iBAAY,GAAZ,YAAY,CAAc;QAE1B,iBAAY,GAAZ,YAAY,CAAe;QAC3B,iBAAY,GAAZ,YAAY,CAAe;QAC3B,cAAS,GAAT,SAAS,CAAY;QAhChC,UAAK,GAAe,SAAS,CAAC;QAG9B,uBAAkB,GAAW,EAAE,CAAC;QAGhC,4BAAuB,GAAW,EAAE,CAAC;QAGrC,oBAAe,GAAW,EAAE,CAAC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