@vultisig/core-chain 2.23.3 → 2.24.1
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/CHANGELOG.md +24 -0
- package/dist/chains/cosmos/cosmosDecimal.d.ts +15 -0
- package/dist/chains/cosmos/cosmosDecimal.d.ts.map +1 -0
- package/dist/chains/cosmos/cosmosDecimal.js +15 -0
- package/dist/chains/cosmos/cosmosDecimal.js.map +1 -0
- package/dist/chains/cosmos/gas.d.ts +2 -6
- package/dist/chains/cosmos/gas.d.ts.map +1 -1
- package/dist/chains/cosmos/gas.js +20 -13
- package/dist/chains/cosmos/gas.js.map +1 -1
- package/dist/chains/cosmos/osmosisDynamicFee.d.ts +13 -0
- package/dist/chains/cosmos/osmosisDynamicFee.d.ts.map +1 -0
- package/dist/chains/cosmos/osmosisDynamicFee.js +108 -0
- package/dist/chains/cosmos/osmosisDynamicFee.js.map +1 -0
- package/dist/chains/cosmos/resolveCosmosGasFee.d.ts +22 -1
- package/dist/chains/cosmos/resolveCosmosGasFee.d.ts.map +1 -1
- package/dist/chains/cosmos/resolveCosmosGasFee.js +32 -3
- package/dist/chains/cosmos/resolveCosmosGasFee.js.map +1 -1
- package/dist/chains/ripple/issuedCurrency.d.ts +56 -0
- package/dist/chains/ripple/issuedCurrency.d.ts.map +1 -0
- package/dist/chains/ripple/issuedCurrency.js +104 -0
- package/dist/chains/ripple/issuedCurrency.js.map +1 -0
- package/dist/chains/utxo/minUtxo.d.ts.map +1 -1
- package/dist/chains/utxo/minUtxo.js +7 -1
- package/dist/chains/utxo/minUtxo.js.map +1 -1
- package/dist/coin/utils/findByTicker.d.ts.map +1 -1
- package/dist/coin/utils/findByTicker.js +15 -1
- package/dist/coin/utils/findByTicker.js.map +1 -1
- package/dist/swap/general/cowswap/api/getCowSwapQuote.d.ts.map +1 -1
- package/dist/swap/general/cowswap/api/getCowSwapQuote.js +68 -3
- package/dist/swap/general/cowswap/api/getCowSwapQuote.js.map +1 -1
- package/dist/swap/general/jupiter/api/getJupiterSwapQuote.d.ts.map +1 -1
- package/dist/swap/general/jupiter/api/getJupiterSwapQuote.js +7 -0
- package/dist/swap/general/jupiter/api/getJupiterSwapQuote.js.map +1 -1
- package/dist/swap/general/knownAggregatorRouters.d.ts +14 -0
- package/dist/swap/general/knownAggregatorRouters.d.ts.map +1 -0
- package/dist/swap/general/knownAggregatorRouters.js +83 -0
- package/dist/swap/general/knownAggregatorRouters.js.map +1 -0
- package/dist/swap/general/kyber/api/tx.d.ts.map +1 -1
- package/dist/swap/general/kyber/api/tx.js +19 -2
- package/dist/swap/general/kyber/api/tx.js.map +1 -1
- package/dist/swap/general/lifi/api/getLifiSwapQuote.d.ts.map +1 -1
- package/dist/swap/general/lifi/api/getLifiSwapQuote.js +8 -1
- package/dist/swap/general/lifi/api/getLifiSwapQuote.js.map +1 -1
- package/dist/swap/general/oneInch/api/getOneInchSwapQuote.d.ts +6 -1
- package/dist/swap/general/oneInch/api/getOneInchSwapQuote.d.ts.map +1 -1
- package/dist/swap/general/oneInch/api/getOneInchSwapQuote.js +24 -1
- package/dist/swap/general/oneInch/api/getOneInchSwapQuote.js.map +1 -1
- package/dist/swap/general/priceImpactGuard.d.ts +73 -0
- package/dist/swap/general/priceImpactGuard.d.ts.map +1 -0
- package/dist/swap/general/priceImpactGuard.js +89 -0
- package/dist/swap/general/priceImpactGuard.js.map +1 -0
- package/dist/swap/general/swapkit/api/getSwapKitQuote.d.ts.map +1 -1
- package/dist/swap/general/swapkit/api/getSwapKitQuote.js +5 -0
- package/dist/swap/general/swapkit/api/getSwapKitQuote.js.map +1 -1
- package/dist/swap/native/limitSwapMemo.d.ts.map +1 -1
- package/dist/swap/native/limitSwapMemo.js +12 -1
- package/dist/swap/native/limitSwapMemo.js.map +1 -1
- package/dist/swap/native/thorchainDepositMemo.d.ts +19 -0
- package/dist/swap/native/thorchainDepositMemo.d.ts.map +1 -0
- package/dist/swap/native/thorchainDepositMemo.js +75 -0
- package/dist/swap/native/thorchainDepositMemo.js.map +1 -0
- package/dist/swap/quote/findSwapQuote.d.ts.map +1 -1
- package/dist/swap/quote/findSwapQuote.js +20 -3
- package/dist/swap/quote/findSwapQuote.js.map +1 -1
- package/dist/tx/broadcast/resolvers/cardano.d.ts.map +1 -1
- package/dist/tx/broadcast/resolvers/cardano.js +4 -4
- package/dist/tx/broadcast/resolvers/cardano.js.map +1 -1
- package/dist/tx/broadcast/resolvers/utxo.d.ts.map +1 -1
- package/dist/tx/broadcast/resolvers/utxo.js +4 -4
- package/dist/tx/broadcast/resolvers/utxo.js.map +1 -1
- package/dist/tx/fee/evm/clampEvmPriorityFee.d.ts +8 -0
- package/dist/tx/fee/evm/clampEvmPriorityFee.d.ts.map +1 -0
- package/dist/tx/fee/evm/clampEvmPriorityFee.js +50 -0
- package/dist/tx/fee/evm/clampEvmPriorityFee.js.map +1 -0
- package/dist/tx/status/resolvers/utxo.d.ts.map +1 -1
- package/dist/tx/status/resolvers/utxo.js +12 -2
- package/dist/tx/status/resolvers/utxo.js.map +1 -1
- package/dist/utils/isValidTokenId.d.ts +2 -1
- package/dist/utils/isValidTokenId.d.ts.map +1 -1
- package/dist/utils/isValidTokenId.js +12 -1
- package/dist/utils/isValidTokenId.js.map +1 -1
- package/package.json +36 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @vultisig/core-chain
|
|
2
2
|
|
|
3
|
+
## 2.24.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1107](https://github.com/vultisig/vultisig-sdk/pull/1107) [`c5e89cb`](https://github.com/vultisig/vultisig-sdk/commit/c5e89cb317ae6f4ca00eb6c628ad6bac636e4821) Thanks [@gomesalexandre](https://github.com/gomesalexandre)! - fix(swap): populate 1inch affiliateFee for display (AGG-05) — 1inch general-swap quotes never populated `affiliateFee` on the returned `GeneralSwapQuote`, unlike Kyber and LI.FI, leaving the fee-transparency row blank for 1inch even though a real affiliate cut is taken via its `fee`/`referrer` params. `getOneInchSwapQuote` now grosses the post-fee `dstAmount` back up (same bps-based calc `getKyberSwapAffiliateFee` uses) to compute and attach a display-only `affiliateFee`.
|
|
8
|
+
|
|
9
|
+
- [#1101](https://github.com/vultisig/vultisig-sdk/pull/1101) [`9a1fc02`](https://github.com/vultisig/vultisig-sdk/commit/9a1fc0276ddc8fc905fab392875499d39011520d) Thanks [@gomesalexandre](https://github.com/gomesalexandre)! - fix(swap): surface non-integer dstAmount drops + validate THORChain/MayaChain MsgDeposit memos (SDK-CORRECTNESS-04/06/08) — a drifted provider's non-integer `dstAmount` used to silently drop that quote from ranking with no signal it was a parse failure; `findSwapQuote` now `console.warn`s the provider + raw value before rethrowing. `prepareThorchainMsgDepositTxFromKeys` accepted an arbitrary memo string with no structural validation, unlike the fully-validated limit-swap memo path; it now fails closed on non-printable/oversized memos and unrecognized THORChain/MayaChain deposit actions (and, for the two documented LP actions, a malformed pool id), while still accepting non-LP operator-style memos (BOND, UNBOND, etc.) verbatim. Also replaced an `as any` cast on the deposit's chain-specific proto binding with per-chain branches so the `case`/`value` pairing is statically checked instead of bypassed.
|
|
10
|
+
|
|
11
|
+
## 2.24.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#1042](https://github.com/vultisig/vultisig-sdk/pull/1042) [`ad6196b`](https://github.com/vultisig/vultisig-sdk/commit/ad6196b32ae879e7b0e0fda48e462fc7a05eb1de) Thanks [@Ehsan-saradar](https://github.com/Ehsan-saradar)! - feat(ripple): XRP trust-line (TrustSet) support for issued tokens
|
|
16
|
+
|
|
17
|
+
Add support for opening/modifying an XRPL trust line so a vault can hold issued
|
|
18
|
+
currencies (e.g. RLUSD). `getRippleSigningInputs` now emits a WalletCore
|
|
19
|
+
`OperationTrustSet` (LimitAmount = { currency, issuer, value }) when the keysign
|
|
20
|
+
coin is an issued currency, and falls through to the existing Payment path for
|
|
21
|
+
native XRP. New `chains/ripple/issuedCurrency` helpers encode the composite
|
|
22
|
+
`currency.issuer` token id, normalise human tickers to on-ledger currency codes,
|
|
23
|
+
format issued-currency values, and expose the 0.2 XRP owner-reserve delta
|
|
24
|
+
(`rippleOwnerReserveDrops`). `isValidTokenId` validates XRPL `currency.issuer`
|
|
25
|
+
ids.
|
|
26
|
+
|
|
3
27
|
## 2.23.3
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact-rational decimal parsing/fee math shared by every cosmos gas-price
|
|
3
|
+
* resolver (the generic node-config path and Osmosis's dynamic EIP-1559
|
|
4
|
+
* path). Kept in its own module so both can depend on it without a circular
|
|
5
|
+
* import between them.
|
|
6
|
+
*/
|
|
7
|
+
export type ParsedDecimal = {
|
|
8
|
+
numerator: bigint;
|
|
9
|
+
denominator: bigint;
|
|
10
|
+
};
|
|
11
|
+
/** Parses a non-negative decimal string (e.g. "0.030000000000000000") into an exact fraction. */
|
|
12
|
+
export declare const parseDecimal: (value: string) => ParsedDecimal | undefined;
|
|
13
|
+
/** ceil(gasLimit * gasPrice), computed as an exact fraction - never loses precision to IEEE-754 rounding. */
|
|
14
|
+
export declare const getFeeAmountFromGasPrice: (gasLimit: bigint, gasPrice: ParsedDecimal) => bigint;
|
|
15
|
+
//# sourceMappingURL=cosmosDecimal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosmosDecimal.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/cosmosDecimal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,iGAAiG;AACjG,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,aAAa,GAAG,SAQ5D,CAAA;AAED,6GAA6G;AAC7G,eAAO,MAAM,wBAAwB,GAAI,UAAU,MAAM,EAAE,UAAU,aAAa,KAAG,MAIpF,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Parses a non-negative decimal string (e.g. "0.030000000000000000") into an exact fraction. */
|
|
2
|
+
export const parseDecimal = (value) => {
|
|
3
|
+
if (!/^\d+(?:\.\d+)?$/.test(value))
|
|
4
|
+
return undefined;
|
|
5
|
+
const [whole, fraction = ''] = value.split('.');
|
|
6
|
+
const denominator = 10n ** BigInt(fraction.length);
|
|
7
|
+
const numerator = BigInt(`${whole}${fraction}`);
|
|
8
|
+
return { numerator, denominator };
|
|
9
|
+
};
|
|
10
|
+
/** ceil(gasLimit * gasPrice), computed as an exact fraction - never loses precision to IEEE-754 rounding. */
|
|
11
|
+
export const getFeeAmountFromGasPrice = (gasLimit, gasPrice) => {
|
|
12
|
+
const total = gasLimit * gasPrice.numerator;
|
|
13
|
+
return (total + gasPrice.denominator - 1n) / gasPrice.denominator;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=cosmosDecimal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosmosDecimal.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/cosmosDecimal.ts"],"names":[],"mappings":"AAWA,iGAAiG;AACjG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAA6B,EAAE;IACvE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IAEpD,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC/C,MAAM,WAAW,GAAG,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAClD,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,KAAK,GAAG,QAAQ,EAAE,CAAC,CAAA;IAE/C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAA;AACnC,CAAC,CAAA;AAED,6GAA6G;AAC7G,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAE,QAAuB,EAAU,EAAE;IAC5F,MAAM,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAA;IAE3C,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,WAAW,GAAG,EAAE,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAA;AACnE,CAAC,CAAA"}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { IbcEnabledCosmosChain } from '../../Chain.js';
|
|
2
2
|
import type { CoinKey } from '../../coin/Coin.js';
|
|
3
|
+
import { type ParsedDecimal } from './cosmosDecimal.js';
|
|
4
|
+
export { getFeeAmountFromGasPrice } from './cosmosDecimal.js';
|
|
3
5
|
export declare const cosmosGasRecord: Record<IbcEnabledCosmosChain, bigint>;
|
|
4
6
|
type FetchOpts = {
|
|
5
7
|
fetchImpl?: typeof fetch;
|
|
6
8
|
signal?: AbortSignal;
|
|
7
9
|
};
|
|
8
|
-
type ParsedDecimal = {
|
|
9
|
-
numerator: bigint;
|
|
10
|
-
denominator: bigint;
|
|
11
|
-
};
|
|
12
|
-
export declare const getFeeAmountFromGasPrice: (gasLimit: bigint, gasPrice: ParsedDecimal) => bigint;
|
|
13
10
|
export declare const getMinGasPriceForDenom: (minimumGasPrice: string, targetDenom: string) => ParsedDecimal | undefined;
|
|
14
11
|
export declare const getCosmosFeeAmount: (coin: CoinKey<IbcEnabledCosmosChain>, opts?: FetchOpts) => Promise<bigint>;
|
|
15
|
-
export {};
|
|
16
12
|
//# sourceMappingURL=gas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/gas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"gas.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/gas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAA4B,KAAK,aAAa,EAAgB,MAAM,iBAAiB,CAAA;AAM5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAI1D,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,qBAAqB,EAAE,MAAM,CASjE,CAAA;AAED,KAAK,SAAS,GAAG;IACf,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;IACxB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,CAAA;AAqBD,eAAO,MAAM,sBAAsB,GAAI,iBAAiB,MAAM,EAAE,aAAa,MAAM,KAAG,aAAa,GAAG,SAYrG,CAAA;AA0ED,eAAO,MAAM,kBAAkB,GAC7B,MAAM,OAAO,CAAC,qBAAqB,CAAC,EACpC,OAAM,SAAc,KACnB,OAAO,CAAC,MAAM,CAehB,CAAA"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Chain } from '../../Chain.js';
|
|
2
|
+
import { getFeeAmountFromGasPrice, parseDecimal } from './cosmosDecimal.js';
|
|
2
3
|
import { cosmosFeeCoinDenom } from './cosmosFeeCoinDenom.js';
|
|
3
4
|
import { getCosmosGasLimit } from './cosmosGasLimitRecord.js';
|
|
4
5
|
import { getCosmosRpcUrl } from './getCosmosRpcUrl.js';
|
|
6
|
+
import { getOsmosisDynamicFeeFloor } from './osmosisDynamicFee.js';
|
|
7
|
+
export { getFeeAmountFromGasPrice } from './cosmosDecimal.js';
|
|
5
8
|
const defaultGas = 7500n;
|
|
6
9
|
export const cosmosGasRecord = {
|
|
7
10
|
[Chain.Cosmos]: defaultGas,
|
|
@@ -16,14 +19,6 @@ export const cosmosGasRecord = {
|
|
|
16
19
|
const minGasPriceConfigPath = '/cosmos/base/node/v1beta1/config';
|
|
17
20
|
const minGasPriceFetchTimeoutMs = 3_000;
|
|
18
21
|
const maxLiveFeeMultiplier = 10n;
|
|
19
|
-
const parseDecimal = (value) => {
|
|
20
|
-
if (!/^\d+(?:\.\d+)?$/.test(value))
|
|
21
|
-
return undefined;
|
|
22
|
-
const [whole, fraction = ''] = value.split('.');
|
|
23
|
-
const denominator = 10n ** BigInt(fraction.length);
|
|
24
|
-
const numerator = BigInt(`${whole}${fraction}`);
|
|
25
|
-
return { numerator, denominator };
|
|
26
|
-
};
|
|
27
22
|
const parseMinGasPriceEntry = (entry) => {
|
|
28
23
|
const match = entry.trim().match(/^(\d+(?:\.\d+)?)([a-zA-Z][a-zA-Z0-9/._:-]*)$/);
|
|
29
24
|
if (!match)
|
|
@@ -34,10 +29,6 @@ const parseMinGasPriceEntry = (entry) => {
|
|
|
34
29
|
return undefined;
|
|
35
30
|
return { ...decimal, denom };
|
|
36
31
|
};
|
|
37
|
-
export const getFeeAmountFromGasPrice = (gasLimit, gasPrice) => {
|
|
38
|
-
const total = gasLimit * gasPrice.numerator;
|
|
39
|
-
return (total + gasPrice.denominator - 1n) / gasPrice.denominator;
|
|
40
|
-
};
|
|
41
32
|
export const getMinGasPriceForDenom = (minimumGasPrice, targetDenom) => {
|
|
42
33
|
for (const entry of minimumGasPrice.split(',')) {
|
|
43
34
|
const parsed = parseMinGasPriceEntry(entry);
|
|
@@ -97,7 +88,7 @@ const fetchMinGasPrice = async (chain, { fetchImpl = fetch, signal } = {}) => {
|
|
|
97
88
|
timeoutController.cleanup();
|
|
98
89
|
}
|
|
99
90
|
};
|
|
100
|
-
|
|
91
|
+
const getGenericCosmosFeeAmount = async (coin, opts) => {
|
|
101
92
|
const floor = cosmosGasRecord[coin.chain];
|
|
102
93
|
try {
|
|
103
94
|
const minimumGasPrice = await fetchMinGasPrice(coin.chain, opts);
|
|
@@ -113,4 +104,20 @@ export const getCosmosFeeAmount = async (coin, opts = {}) => {
|
|
|
113
104
|
return floor;
|
|
114
105
|
}
|
|
115
106
|
};
|
|
107
|
+
export const getCosmosFeeAmount = async (coin, opts = {}) => {
|
|
108
|
+
if (coin.chain !== Chain.Osmosis)
|
|
109
|
+
return getGenericCosmosFeeAmount(coin, opts);
|
|
110
|
+
// Osmosis's real fee floor is enforced by its EIP-1559 `x/txfees` module,
|
|
111
|
+
// NOT the generic node-config `minimum-gas-price` (a per-node/operator-
|
|
112
|
+
// configurable value that doesn't track the live protocol floor, and can
|
|
113
|
+
// be clamped away by the anomaly guard above when it legitimately spikes).
|
|
114
|
+
// Run both lookups concurrently (each has its own timeout budget) rather
|
|
115
|
+
// than sequentially, and never pay less than the higher of the two -
|
|
116
|
+
// see osmosisDynamicFee.ts.
|
|
117
|
+
const [genericFee, dynamicFloor] = await Promise.all([
|
|
118
|
+
getGenericCosmosFeeAmount(coin, opts),
|
|
119
|
+
getOsmosisDynamicFeeFloor(getCosmosGasLimit(coin), opts),
|
|
120
|
+
]);
|
|
121
|
+
return dynamicFloor !== null && dynamicFloor > genericFee ? dynamicFloor : genericFee;
|
|
122
|
+
};
|
|
116
123
|
//# sourceMappingURL=gas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/gas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAyB,MAAM,aAAa,CAAA;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"gas.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/gas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,K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AAM,OAAO,CAAC,GAAG,CAAC;QACnD,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC;QACrC,yBAAyB,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;KACzD,CAAC,CAAA;IACF,OAAO,YAAY,KAAK,IAAI,IAAI,YAAY,GAAG,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAA;AACvF,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type FetchOpts = {
|
|
2
|
+
fetchImpl?: typeof fetch;
|
|
3
|
+
signal?: AbortSignal;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Live fee floor for Osmosis (base-denom units for `gasLimit`), or null when
|
|
7
|
+
* the lookup failed OR the computed floor exceeds the sanity ceiling
|
|
8
|
+
* (fail-open in both cases - caller should fall back to its own static or
|
|
9
|
+
* generically-derived fee).
|
|
10
|
+
*/
|
|
11
|
+
export declare function getOsmosisDynamicFeeFloor(gasLimit: bigint, opts?: FetchOpts): Promise<bigint | null>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=osmosisDynamicFee.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"osmosisDynamicFee.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/osmosisDynamicFee.ts"],"names":[],"mappings":"AAiDA,KAAK,SAAS,GAAG;IACf,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;IACxB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,CAAA;AA8CD;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE,SAAc,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAa9G"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Chain } from '../../Chain.js';
|
|
2
|
+
import { getFeeAmountFromGasPrice, parseDecimal } from './cosmosDecimal.js';
|
|
3
|
+
import { getCosmosRpcUrl } from './getCosmosRpcUrl.js';
|
|
4
|
+
/**
|
|
5
|
+
* Osmosis runs an EIP-1559-style dynamic base fee (`x/txfees` module): the
|
|
6
|
+
* real minimum required fee floats and is enforced at the protocol/consensus
|
|
7
|
+
* level, separate from a node's own locally-configured `minimum-gas-prices`
|
|
8
|
+
* (the generic `/cosmos/base/node/v1beta1/config` value `getCosmosFeeAmount`
|
|
9
|
+
* otherwise queries for every ibc-enabled chain). A tx priced against only
|
|
10
|
+
* the generic node config can still be rejected at broadcast with sdk error
|
|
11
|
+
* code 13 ("insufficient fees") when the live EIP-1559 base fee has risen
|
|
12
|
+
* above it.
|
|
13
|
+
*
|
|
14
|
+
* Live-verified in production (vultiagent-app): a broadcast failed with
|
|
15
|
+
* "base fee was 0.03 -> required 12000uosmo" - the generic min-gas-price
|
|
16
|
+
* mechanism did not reflect the real floor.
|
|
17
|
+
*
|
|
18
|
+
* Query Osmosis's own `cur_eip_base_fee` endpoint directly and apply
|
|
19
|
+
* headroom, rather than relying on the generic node-config value.
|
|
20
|
+
*
|
|
21
|
+
* Trust boundary (review finding, 2026-07-08): this floor feeds directly
|
|
22
|
+
* into the SIGNABLE fee, so a compromised/malfunctioning/MITM'd LCD (this
|
|
23
|
+
* endpoint honors a user-configured RPC override) returning a pathological
|
|
24
|
+
* `base_fee` must never (a) inflate the signable fee unboundedly, or (b)
|
|
25
|
+
* crash fee resolution outright (violating the fail-open contract every
|
|
26
|
+
* other error path here honors). Both are closed by computing the floor
|
|
27
|
+
* with exact rational arithmetic (no IEEE-754 `Number`, so no
|
|
28
|
+
* overflow-to-Infinity path) and clamping the result to a generous sanity
|
|
29
|
+
* ceiling before returning it.
|
|
30
|
+
*/
|
|
31
|
+
const OSMOSIS_BASE_FEE_HEADROOM = { numerator: 5n, denominator: 4n }; // 1.25x, exact
|
|
32
|
+
// Hard ceiling on the base-fee lookup: fail-open only covers ERRORS - a
|
|
33
|
+
// stalled txfees LCD (TCP up, no bytes) would otherwise hang the fee
|
|
34
|
+
// resolution indefinitely.
|
|
35
|
+
const OSMOSIS_BASE_FEE_TIMEOUT_MS = 5_000;
|
|
36
|
+
// Sanity backstop on the computed floor itself, independent of the fetch
|
|
37
|
+
// succeeding: the live-verified real incident this guards against needed
|
|
38
|
+
// ~12_000 uosmo against a 9_000n static floor (~1.3x) - 1000x is enormous
|
|
39
|
+
// headroom above any realistic base-fee spike while still bounding a
|
|
40
|
+
// pathological/malicious LCD response (e.g. a `base_fee` of "1000" would
|
|
41
|
+
// otherwise compute a ~375 OSMO fee for a standard send).
|
|
42
|
+
const OSMOSIS_DYNAMIC_FLOOR_MAX_MULTIPLIER = 1000n;
|
|
43
|
+
const OSMOSIS_STATIC_FLOOR = 9000n; // must match cosmosGasRecord[Chain.Osmosis] in gas.ts
|
|
44
|
+
async function fetchOsmosisBaseFeePerGas({ fetchImpl = fetch, signal } = {}) {
|
|
45
|
+
const controller = new AbortController();
|
|
46
|
+
const onAbort = () => controller.abort();
|
|
47
|
+
if (signal?.aborted) {
|
|
48
|
+
controller.abort();
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
52
|
+
}
|
|
53
|
+
const timeout = setTimeout(() => controller.abort(), OSMOSIS_BASE_FEE_TIMEOUT_MS);
|
|
54
|
+
const timeoutPromise = new Promise((_resolve, reject) => {
|
|
55
|
+
const rejectTimeout = () => reject(new Error('Osmosis base-fee request timed out'));
|
|
56
|
+
if (controller.signal.aborted) {
|
|
57
|
+
rejectTimeout();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
controller.signal.addEventListener('abort', rejectTimeout, { once: true });
|
|
61
|
+
});
|
|
62
|
+
try {
|
|
63
|
+
const body = await Promise.race([
|
|
64
|
+
(async () => {
|
|
65
|
+
const res = await fetchImpl(`${getCosmosRpcUrl(Chain.Osmosis)}/osmosis/txfees/v1beta1/cur_eip_base_fee`, {
|
|
66
|
+
signal: controller.signal,
|
|
67
|
+
});
|
|
68
|
+
if (!res.ok)
|
|
69
|
+
throw new Error(`Osmosis base-fee request failed: ${res.status}`);
|
|
70
|
+
return (await res.json());
|
|
71
|
+
})(),
|
|
72
|
+
timeoutPromise,
|
|
73
|
+
]);
|
|
74
|
+
const baseFee = body?.base_fee;
|
|
75
|
+
if (typeof baseFee !== 'string')
|
|
76
|
+
return null;
|
|
77
|
+
// Exact rational parse - no `Number()` coercion, so no path to
|
|
78
|
+
// overflow-to-Infinity on a pathologically long-but-regex-valid string.
|
|
79
|
+
return parseDecimal(baseFee) ?? null;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
clearTimeout(timeout);
|
|
86
|
+
signal?.removeEventListener('abort', onAbort);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Live fee floor for Osmosis (base-denom units for `gasLimit`), or null when
|
|
91
|
+
* the lookup failed OR the computed floor exceeds the sanity ceiling
|
|
92
|
+
* (fail-open in both cases - caller should fall back to its own static or
|
|
93
|
+
* generically-derived fee).
|
|
94
|
+
*/
|
|
95
|
+
export async function getOsmosisDynamicFeeFloor(gasLimit, opts = {}) {
|
|
96
|
+
const baseFee = await fetchOsmosisBaseFeePerGas(opts);
|
|
97
|
+
if (baseFee === null)
|
|
98
|
+
return null;
|
|
99
|
+
const withHeadroom = {
|
|
100
|
+
numerator: baseFee.numerator * OSMOSIS_BASE_FEE_HEADROOM.numerator,
|
|
101
|
+
denominator: baseFee.denominator * OSMOSIS_BASE_FEE_HEADROOM.denominator,
|
|
102
|
+
};
|
|
103
|
+
const fee = getFeeAmountFromGasPrice(gasLimit, withHeadroom);
|
|
104
|
+
if (fee > OSMOSIS_STATIC_FLOOR * OSMOSIS_DYNAMIC_FLOOR_MAX_MULTIPLIER)
|
|
105
|
+
return null;
|
|
106
|
+
return fee;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=osmosisDynamicFee.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"osmosisDynamicFee.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/osmosisDynamicFee.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,wBAAwB,EAAsB,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,yBAAyB,GAAkB,EAAE,SAAS,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAA,CAAC,eAAe;AACnG,wEAAwE;AACxE,qEAAqE;AACrE,2BAA2B;AAC3B,MAAM,2BAA2B,GAAG,KAAK,CAAA;AACzC,yEAAyE;AACzE,yEAAyE;AACzE,0EAA0E;AAC1E,qEAAqE;AACrE,yEAAyE;AACzE,0DAA0D;AAC1D,MAAM,oCAAoC,GAAG,KAAM,CAAA;AACnD,MAAM,oBAAoB,GAAG,KAAM,CAAA,CAAC,sDAAsD;AAW1F,KAAK,UAAU,yBAAyB,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,MAAM,KAAgB,EAAE;IACpF,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAA;IACxC,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;IACxC,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;QACpB,UAAU,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;SAAM,CAAC;QACN,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;IAC5D,CAAC;IACD,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CA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AC,OAAO,CAAC,CAAA;QACrB,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC/C,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,QAAgB,EAAE,OAAkB,EAAE;IACpF,MAAM,OAAO,GAAG,MAAM,yBAAyB,CAAC,IAAI,CAAC,CAAA;IACrD,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IAEjC,MAAM,YAAY,GAAkB;QAClC,SAAS,EAAE,OAAO,CAAC,SAAS,GAAG,yBAAyB,CAAC,SAAS;QAClE,WAAW,EAAE,OAAO,CAAC,WAAW,GAAG,yBAAyB,CAAC,WAAW;KACzE,CAAA;IACD,MAAM,GAAG,GAAG,wBAAwB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;IAE5D,IAAI,GAAG,GAAG,oBAAoB,GAAG,oCAAoC;QAAE,OAAO,IAAI,CAAA;IAElF,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -11,6 +11,18 @@
|
|
|
11
11
|
* the extra gas. Below or equal to the static limit, both values are left
|
|
12
12
|
* untouched, keeping the non-dynamic path byte-identical.
|
|
13
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* COSMOS-02: an IBC transfer (ICS-20 `MsgTransfer`, optionally PFM-forwarded
|
|
16
|
+
* via memo) does measurably more work on the source leg than a plain bank
|
|
17
|
+
* send — channel-state writes plus a relayer event — so the flat per-chain
|
|
18
|
+
* limit (calibrated for `MsgSend`) is undersized and can run out of gas
|
|
19
|
+
* mid-execution: the fee is spent, the transfer fails, and funds don't move
|
|
20
|
+
* but the fee is still burned. PFM hops are budgeted by each forwarding
|
|
21
|
+
* chain, not the source leg here, so ×2 headroom on the source leg is
|
|
22
|
+
* sufficient. Mirrors the app's own `IBC_GAS_MULTIPLIER`
|
|
23
|
+
* (vultiagent-app/src/services/cosmosTx.ts).
|
|
24
|
+
*/
|
|
25
|
+
export declare const IBC_GAS_MULTIPLIER = 2n;
|
|
14
26
|
type ResolveCosmosGasFeeInput = {
|
|
15
27
|
/** static per-chain fee amount already stored in `CosmosSpecific.gas` */
|
|
16
28
|
gas: bigint;
|
|
@@ -18,11 +30,20 @@ type ResolveCosmosGasFeeInput = {
|
|
|
18
30
|
relayedGasLimit: bigint | undefined;
|
|
19
31
|
/** static per-chain gas limit (`getCosmosGasLimit`) */
|
|
20
32
|
staticGasLimit: bigint;
|
|
33
|
+
/**
|
|
34
|
+
* Whether this tx is an IBC transfer (`MsgTransfer`, optionally
|
|
35
|
+
* PFM-forwarded). Applies `IBC_GAS_MULTIPLIER` to both the static gas
|
|
36
|
+
* limit and its matching fee before resolving against a relayed limit.
|
|
37
|
+
* Defaults to `false` so every other Cosmos message (plain sends, wasm
|
|
38
|
+
* executes, staking) keeps paying the calibrated flat fee — a blanket
|
|
39
|
+
* multiplier on all Cosmos messages would overpay non-IBC sends.
|
|
40
|
+
*/
|
|
41
|
+
isIbcTransfer?: boolean;
|
|
21
42
|
};
|
|
22
43
|
type ResolveCosmosGasFeeResult = {
|
|
23
44
|
resolvedGasLimit: bigint;
|
|
24
45
|
feeAmount: bigint;
|
|
25
46
|
};
|
|
26
|
-
export declare const resolveCosmosGasFee: ({ gas, relayedGasLimit, staticGasLimit, }: ResolveCosmosGasFeeInput) => ResolveCosmosGasFeeResult;
|
|
47
|
+
export declare const resolveCosmosGasFee: ({ gas, relayedGasLimit, staticGasLimit, isIbcTransfer, }: ResolveCosmosGasFeeInput) => ResolveCosmosGasFeeResult;
|
|
27
48
|
export {};
|
|
28
49
|
//# sourceMappingURL=resolveCosmosGasFee.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveCosmosGasFee.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/resolveCosmosGasFee.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,KAAK,wBAAwB,GAAG;IAC9B,yEAAyE;IACzE,GAAG,EAAE,MAAM,CAAA;IACX,gFAAgF;IAChF,eAAe,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,uDAAuD;IACvD,cAAc,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"resolveCosmosGasFee.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/resolveCosmosGasFee.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,KAAK,CAAA;AAEpC,KAAK,wBAAwB,GAAG;IAC9B,yEAAyE;IACzE,GAAG,EAAE,MAAM,CAAA;IACX,gFAAgF;IAChF,eAAe,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,uDAAuD;IACvD,cAAc,EAAE,MAAM,CAAA;IACtB;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AAED,KAAK,yBAAyB,GAAG;IAC/B,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,0DAKjC,wBAAwB,KAAG,yBAY7B,CAAA"}
|
|
@@ -1,6 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the effective Cosmos gas limit and fee amount for a native send,
|
|
3
|
+
* honoring a relayed dynamic `gas_limit` when present.
|
|
4
|
+
*
|
|
5
|
+
* Shared by the signing-inputs resolver (what gets signed) and the fee-display
|
|
6
|
+
* resolver (what the user sees) so the shown and signed fee can never drift —
|
|
7
|
+
* the gas limit is part of the SignDoc, so both sides MUST agree.
|
|
8
|
+
*
|
|
9
|
+
* When the relayed limit exceeds the static per-chain limit, the fee amount is
|
|
10
|
+
* scaled proportionally with a ceiling (exact integer math) so the tx pays for
|
|
11
|
+
* the extra gas. Below or equal to the static limit, both values are left
|
|
12
|
+
* untouched, keeping the non-dynamic path byte-identical.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* COSMOS-02: an IBC transfer (ICS-20 `MsgTransfer`, optionally PFM-forwarded
|
|
16
|
+
* via memo) does measurably more work on the source leg than a plain bank
|
|
17
|
+
* send — channel-state writes plus a relayer event — so the flat per-chain
|
|
18
|
+
* limit (calibrated for `MsgSend`) is undersized and can run out of gas
|
|
19
|
+
* mid-execution: the fee is spent, the transfer fails, and funds don't move
|
|
20
|
+
* but the fee is still burned. PFM hops are budgeted by each forwarding
|
|
21
|
+
* chain, not the source leg here, so ×2 headroom on the source leg is
|
|
22
|
+
* sufficient. Mirrors the app's own `IBC_GAS_MULTIPLIER`
|
|
23
|
+
* (vultiagent-app/src/services/cosmosTx.ts).
|
|
24
|
+
*/
|
|
25
|
+
export const IBC_GAS_MULTIPLIER = 2n;
|
|
26
|
+
export const resolveCosmosGasFee = ({ gas, relayedGasLimit, staticGasLimit, isIbcTransfer = false, }) => {
|
|
27
|
+
const effectiveStaticGasLimit = isIbcTransfer ? staticGasLimit * IBC_GAS_MULTIPLIER : staticGasLimit;
|
|
28
|
+
const effectiveGas = isIbcTransfer ? gas * IBC_GAS_MULTIPLIER : gas;
|
|
29
|
+
const resolvedGasLimit = relayedGasLimit && relayedGasLimit > 0n ? relayedGasLimit : effectiveStaticGasLimit;
|
|
30
|
+
const feeAmount = resolvedGasLimit > effectiveStaticGasLimit
|
|
31
|
+
? (effectiveGas * resolvedGasLimit + effectiveStaticGasLimit - 1n) / effectiveStaticGasLimit
|
|
32
|
+
: effectiveGas;
|
|
4
33
|
return { resolvedGasLimit, feeAmount };
|
|
5
34
|
};
|
|
6
35
|
//# sourceMappingURL=resolveCosmosGasFee.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveCosmosGasFee.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/resolveCosmosGasFee.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveCosmosGasFee.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/resolveCosmosGasFee.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAA;AAyBpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,GAAG,EACH,eAAe,EACf,cAAc,EACd,aAAa,GAAG,KAAK,GACI,EAA6B,EAAE;IACxD,MAAM,uBAAuB,GAAG,aAAa,CAAC,CAAC,CAAC,cAAc,GAAG,kBAAkB,CAAC,CAAC,CAAC,cAAc,CAAA;IACpG,MAAM,YAAY,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAA;IAEnE,MAAM,gBAAgB,GAAG,eAAe,IAAI,eAAe,GAAG,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,uBAAuB,CAAA;IAE5G,MAAM,SAAS,GACb,gBAAgB,GAAG,uBAAuB;QACxC,CAAC,CAAC,CAAC,YAAY,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,EAAE,CAAC,GAAG,uBAAuB;QAC5F,CAAC,CAAC,YAAY,CAAA;IAElB,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,CAAA;AACxC,CAAC,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { KnownCoin } from '@vultisig/core-chain/coin/Coin';
|
|
2
|
+
/**
|
|
3
|
+
* Owner-reserve locked by each XRP Ledger object a wallet owns, including every
|
|
4
|
+
* trust line. Opening a trust line raises the account's required reserve by this
|
|
5
|
+
* amount (it is locked, not spent). Current mainnet value is 0.2 XRP.
|
|
6
|
+
* @see https://xrpl.org/docs/concepts/accounts/reserves
|
|
7
|
+
*/
|
|
8
|
+
export declare const rippleOwnerReserveDrops = 200000n;
|
|
9
|
+
/**
|
|
10
|
+
* Normalises a human currency ticker to the on-ledger XRPL currency code.
|
|
11
|
+
*
|
|
12
|
+
* - 3-character codes (e.g. `USD`) are standard codes and are used verbatim.
|
|
13
|
+
* - An already-encoded 40-char hex code passes through (upper-cased).
|
|
14
|
+
* - Anything else (e.g. `RLUSD`) is encoded as the 160-bit form: the ASCII bytes
|
|
15
|
+
* right-padded with zeros to 20 bytes, hex-encoded. This is what the XRP Ledger
|
|
16
|
+
* and WalletCore's Ripple signer expect for non-standard currencies.
|
|
17
|
+
*/
|
|
18
|
+
export declare const toXrplCurrencyCode: (currency: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* True if `currency` is already a valid on-ledger XRPL currency code: either a
|
|
21
|
+
* 3-character standard code or the 40-char hex (160-bit) non-standard form.
|
|
22
|
+
* A human ticker like `RLUSD` is NOT valid here - it must first be normalised
|
|
23
|
+
* via {@link toXrplCurrencyCode} before being used in a token id or TrustSet.
|
|
24
|
+
*/
|
|
25
|
+
export declare const isValidXrplCurrencyCode: (currency: string) => boolean;
|
|
26
|
+
type RippleIssuedCurrency = {
|
|
27
|
+
currency: string;
|
|
28
|
+
issuer: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Composite identifier for an XRPL issued currency: `<currencyCode>.<issuer>`.
|
|
32
|
+
* XRPL tokens are identified by the (currency, issuer) pair rather than a single
|
|
33
|
+
* contract address, so both are encoded into the coin `id`.
|
|
34
|
+
*/
|
|
35
|
+
export declare const rippleTokenId: ({ currency, issuer }: RippleIssuedCurrency) => string;
|
|
36
|
+
/** Splits a {@link rippleTokenId} back into its `currency` code and `issuer`. */
|
|
37
|
+
export declare const parseRippleTokenId: (id: string) => RippleIssuedCurrency;
|
|
38
|
+
/**
|
|
39
|
+
* Formats an issued-currency base-unit amount as an XRPL value string: a plain
|
|
40
|
+
* decimal (never scientific notation) with trailing-zero fractional digits
|
|
41
|
+
* trimmed. XRPL issued amounts allow up to 15 significant digits.
|
|
42
|
+
*/
|
|
43
|
+
export declare const formatIssuedCurrencyValue: (amount: bigint, decimals: number) => string;
|
|
44
|
+
/**
|
|
45
|
+
* XRPL issued currencies carry up to 15 significant decimal digits rather than a
|
|
46
|
+
* fixed on-chain decimal count. We model them internally with this many decimals.
|
|
47
|
+
*/
|
|
48
|
+
export declare const rippleIssuedCurrencyDecimals = 15;
|
|
49
|
+
/**
|
|
50
|
+
* Curated XRPL issued tokens surfaced in the "open trust line" flow. Not wired
|
|
51
|
+
* into `knownTokens` — issued-currency balances / asset-list display are handled
|
|
52
|
+
* separately (vultisig-windows#4307 / vultisig-sdk#997).
|
|
53
|
+
*/
|
|
54
|
+
export declare const rippleKnownIssuedTokens: KnownCoin[];
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=issuedCurrency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issuedCurrency.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/ripple/issuedCurrency.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,UAAU,CAAA;AAqB9C;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,KAAG,MAYrD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,UAAU,MAAM,KAAG,OAEyB,CAAA;AAIpF,KAAK,oBAAoB,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,sBAAsB,oBAAoB,KAAG,MACZ,CAAA;AAE/D,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,GAAI,IAAI,MAAM,KAAG,oBAU/C,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,MAAM,EAAE,UAAU,MAAM,KAAG,MAU5E,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,KAAK,CAAA;AAE9C;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,EAY9C,CAAA"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Chain } from '@vultisig/core-chain/Chain';
|
|
2
|
+
/**
|
|
3
|
+
* Owner-reserve locked by each XRP Ledger object a wallet owns, including every
|
|
4
|
+
* trust line. Opening a trust line raises the account's required reserve by this
|
|
5
|
+
* amount (it is locked, not spent). Current mainnet value is 0.2 XRP.
|
|
6
|
+
* @see https://xrpl.org/docs/concepts/accounts/reserves
|
|
7
|
+
*/
|
|
8
|
+
export const rippleOwnerReserveDrops = 200000n;
|
|
9
|
+
/** XRPL "standard" (ISO-4217-like) currency codes are exactly 3 characters. */
|
|
10
|
+
const standardCurrencyCodeLength = 3;
|
|
11
|
+
/** Non-standard XRPL currency codes are a 160-bit value, i.e. 40 hex chars. */
|
|
12
|
+
const hexCurrencyCodeLength = 40;
|
|
13
|
+
const hexCurrencyCodeRegex = /^[0-9a-fA-F]{40}$/;
|
|
14
|
+
const asciiToHexCurrencyCode = (currency) => {
|
|
15
|
+
const bytes = Buffer.from(currency, 'ascii');
|
|
16
|
+
if (bytes.length > 20) {
|
|
17
|
+
throw new Error(`XRPL currency code too long: "${currency}" (max 20 bytes)`);
|
|
18
|
+
}
|
|
19
|
+
return Buffer.concat([bytes, Buffer.alloc(20 - bytes.length)])
|
|
20
|
+
.toString('hex')
|
|
21
|
+
.toUpperCase();
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Normalises a human currency ticker to the on-ledger XRPL currency code.
|
|
25
|
+
*
|
|
26
|
+
* - 3-character codes (e.g. `USD`) are standard codes and are used verbatim.
|
|
27
|
+
* - An already-encoded 40-char hex code passes through (upper-cased).
|
|
28
|
+
* - Anything else (e.g. `RLUSD`) is encoded as the 160-bit form: the ASCII bytes
|
|
29
|
+
* right-padded with zeros to 20 bytes, hex-encoded. This is what the XRP Ledger
|
|
30
|
+
* and WalletCore's Ripple signer expect for non-standard currencies.
|
|
31
|
+
*/
|
|
32
|
+
export const toXrplCurrencyCode = (currency) => {
|
|
33
|
+
const value = currency.trim();
|
|
34
|
+
if (value.length === standardCurrencyCodeLength) {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
if (value.length === hexCurrencyCodeLength && hexCurrencyCodeRegex.test(value)) {
|
|
38
|
+
return value.toUpperCase();
|
|
39
|
+
}
|
|
40
|
+
return asciiToHexCurrencyCode(value);
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* True if `currency` is already a valid on-ledger XRPL currency code: either a
|
|
44
|
+
* 3-character standard code or the 40-char hex (160-bit) non-standard form.
|
|
45
|
+
* A human ticker like `RLUSD` is NOT valid here - it must first be normalised
|
|
46
|
+
* via {@link toXrplCurrencyCode} before being used in a token id or TrustSet.
|
|
47
|
+
*/
|
|
48
|
+
export const isValidXrplCurrencyCode = (currency) => currency.length === standardCurrencyCodeLength ||
|
|
49
|
+
(currency.length === hexCurrencyCodeLength && hexCurrencyCodeRegex.test(currency));
|
|
50
|
+
const tokenIdSeparator = '.';
|
|
51
|
+
/**
|
|
52
|
+
* Composite identifier for an XRPL issued currency: `<currencyCode>.<issuer>`.
|
|
53
|
+
* XRPL tokens are identified by the (currency, issuer) pair rather than a single
|
|
54
|
+
* contract address, so both are encoded into the coin `id`.
|
|
55
|
+
*/
|
|
56
|
+
export const rippleTokenId = ({ currency, issuer }) => `${toXrplCurrencyCode(currency)}${tokenIdSeparator}${issuer}`;
|
|
57
|
+
/** Splits a {@link rippleTokenId} back into its `currency` code and `issuer`. */
|
|
58
|
+
export const parseRippleTokenId = (id) => {
|
|
59
|
+
const index = id.indexOf(tokenIdSeparator);
|
|
60
|
+
if (index <= 0 || index === id.length - 1) {
|
|
61
|
+
throw new Error(`Invalid Ripple token id: "${id}"`);
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
currency: id.slice(0, index),
|
|
65
|
+
issuer: id.slice(index + 1),
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Formats an issued-currency base-unit amount as an XRPL value string: a plain
|
|
70
|
+
* decimal (never scientific notation) with trailing-zero fractional digits
|
|
71
|
+
* trimmed. XRPL issued amounts allow up to 15 significant digits.
|
|
72
|
+
*/
|
|
73
|
+
export const formatIssuedCurrencyValue = (amount, decimals) => {
|
|
74
|
+
const negative = amount < 0n;
|
|
75
|
+
const digits = (negative ? -amount : amount).toString().padStart(decimals + 1, '0');
|
|
76
|
+
const intPart = digits.slice(0, digits.length - decimals) || '0';
|
|
77
|
+
const fracPart = decimals > 0 ? digits.slice(digits.length - decimals).replace(/0+$/, '') : '';
|
|
78
|
+
const magnitude = fracPart ? `${intPart}.${fracPart}` : intPart;
|
|
79
|
+
return negative && magnitude !== '0' ? `-${magnitude}` : magnitude;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* XRPL issued currencies carry up to 15 significant decimal digits rather than a
|
|
83
|
+
* fixed on-chain decimal count. We model them internally with this many decimals.
|
|
84
|
+
*/
|
|
85
|
+
export const rippleIssuedCurrencyDecimals = 15;
|
|
86
|
+
/**
|
|
87
|
+
* Curated XRPL issued tokens surfaced in the "open trust line" flow. Not wired
|
|
88
|
+
* into `knownTokens` — issued-currency balances / asset-list display are handled
|
|
89
|
+
* separately (vultisig-windows#4307 / vultisig-sdk#997).
|
|
90
|
+
*/
|
|
91
|
+
export const rippleKnownIssuedTokens = [
|
|
92
|
+
{
|
|
93
|
+
chain: Chain.Ripple,
|
|
94
|
+
id: rippleTokenId({
|
|
95
|
+
currency: 'RLUSD',
|
|
96
|
+
issuer: 'rMxCKbEDwqr76QuheSUMdEGf4B9xJ8m5De',
|
|
97
|
+
}),
|
|
98
|
+
ticker: 'RLUSD',
|
|
99
|
+
logo: 'rlusd',
|
|
100
|
+
decimals: rippleIssuedCurrencyDecimals,
|
|
101
|
+
priceProviderId: 'ripple-usd',
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
//# sourceMappingURL=issuedCurrency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issuedCurrency.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/ripple/issuedCurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAGlD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,OAAO,CAAA;AAE9C,+EAA+E;AAC/E,MAAM,0BAA0B,GAAG,CAAC,CAAA;AAEpC,+EAA+E;AAC/E,MAAM,qBAAqB,GAAG,EAAE,CAAA;AAEhC,MAAM,oBAAoB,GAAG,mBAAmB,CAAA;AAEhD,MAAM,sBAAsB,GAAG,CAAC,QAAgB,EAAU,EAAE;IAC1D,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC5C,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,iCAAiC,QAAQ,kBAAkB,CAAC,CAAA;IAC9E,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;SAC3D,QAAQ,CAAC,KAAK,CAAC;SACf,WAAW,EAAE,CAAA;AAClB,CAAC,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAU,EAAE;IAC7D,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;IAE7B,IAAI,KAAK,CAAC,MAAM,KAAK,0BAA0B,EAAE,CAAC;QAChD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,qBAAqB,IAAI,oBA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"AAAA,OAAO,EAAS,cAAc,EAAE,MAAM,aAAa,CAAA;AAEnD,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"minUtxo.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/utxo/minUtxo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,cAAc,EAAE,MAAM,aAAa,CAAA;AAEnD,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAclD,CAAA"}
|
|
@@ -3,7 +3,13 @@ export const minUtxo = {
|
|
|
3
3
|
[Chain.Cardano]: 1400000n,
|
|
4
4
|
[Chain.Bitcoin]: 546n,
|
|
5
5
|
[Chain.Dogecoin]: 1000000n,
|
|
6
|
-
|
|
6
|
+
// UTXO-02 (audit r2): Litecoin's DUST_RELAY_TX_FEE is ~10x Bitcoin's, so its real standard dust threshold
|
|
7
|
+
// is ~2_940 litoshi for a P2WPKH output (the scriptType LTC uses), ~5_460 legacy P2PKH — NOT 1_000. At the
|
|
8
|
+
// old 1_000n, a change output of 1_001..2_939 litoshi was treated as spendable but is non-standard dust, so
|
|
9
|
+
// the tx could be rejected by relays / get stuck. Use the P2WPKH standard (2_940). KEEP IN SYNC with the
|
|
10
|
+
// per-chain dustLimit map in packages/sdk/src/chains/utxo/tx.ts (UTXO_SPECS). BCH/Dash/Zcash stay at 1_000n
|
|
11
|
+
// — that's already at/above their real ~546 dust (BTC-like relay fee), so it's conservative, not dangerous.
|
|
12
|
+
[Chain.Litecoin]: 2940n,
|
|
7
13
|
[Chain.BitcoinCash]: 1000n,
|
|
8
14
|
[Chain.Dash]: 1000n,
|
|
9
15
|
[Chain.Zcash]: 1000n,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minUtxo.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/utxo/minUtxo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAkB,MAAM,aAAa,CAAA;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAmC;IACrD,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,QAAU;IAC3B,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI;IACrB,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAU;IAC5B,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAM;IACxB,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,KAAM;IAC3B,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAM;IACpB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAM;CACtB,CAAA"}
|
|
1
|
+
{"version":3,"file":"minUtxo.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/utxo/minUtxo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAkB,MAAM,aAAa,CAAA;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAmC;IACrD,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,QAAU;IAC3B,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI;IACrB,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAU;IAC5B,0GAA0G;IAC1G,2GAA2G;IAC3G,4GAA4G;IAC5G,yGAAyG;IACzG,4GAA4G;IAC5G,4GAA4G;IAC5G,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAM;IACxB,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,KAAM;IAC3B,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAM;IACpB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAM;CACtB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findByTicker.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/coin/utils/findByTicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAE9B,KAAK,iBAAiB,CAAC,CAAC,SAAS,IAAI,IAAI;IACvC,KAAK,EAAE,CAAC,EAAE,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;
|
|
1
|
+
{"version":3,"file":"findByTicker.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/coin/utils/findByTicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAE9B,KAAK,iBAAiB,CAAC,CAAC,SAAS,IAAI,IAAI;IACvC,KAAK,EAAE,CAAC,EAAE,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAOD,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,IAAI,EAAE,mBAAmB,iBAAiB,CAAC,CAAC,CAAC,KAAG,CAAC,GAAG,IAU1F,CAAA"}
|