@vultisig/core-chain 1.5.0 → 1.5.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @vultisig/core-chain
2
2
 
3
+ ## 1.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#319](https://github.com/vultisig/vultisig-sdk/pull/319) [`03007d7`](https://github.com/vultisig/vultisig-sdk/commit/03007d7293b2f51f6269d39bf3725715182f933e) Thanks [@rcoderdev](https://github.com/rcoderdev)! - fix(chain): THORChain native swap `streaming_interval` 0 (Rapid Swaps)
8
+
9
+ THORChain can serve swaps in a single block and auto-stream when needed.
10
+ Using `1` forced streaming; `0` lets the protocol choose. MayaChain
11
+ unchanged (`3`).
12
+
13
+ Refs: https://github.com/vultisig/vultisig-windows/issues/3613
14
+
3
15
  ## 1.5.0
4
16
 
5
17
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"cosmosGasLimitRecord.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/cosmosGasLimitRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAE/D,OAAO,EAAiB,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAexD,eAAO,MAAM,iBAAiB,GAAI,MAAM,OAAO,CAAC,WAAW,CAAC,KAAG,MAM9D,CAAA"}
1
+ {"version":3,"file":"cosmosGasLimitRecord.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/cosmosGasLimitRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAE/D,OAAO,EAAiB,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAqBxD,eAAO,MAAM,iBAAiB,GAAI,MAAM,OAAO,CAAC,WAAW,CAAC,KAAG,MAM9D,CAAA"}
@@ -8,7 +8,13 @@ const cosmosGasLimitRecord = {
8
8
  [Chain.Noble]: 200000n,
9
9
  [Chain.Akash]: 200000n,
10
10
  [Chain.Terra]: 300000n,
11
- [Chain.TerraClassic]: 300000n,
11
+ // TerraClassic default covers both bank.MsgSend (uluna ~80k) and
12
+ // ibc.MsgTransfer (~150-200k), with margin for chain load. uusd
13
+ // (USTC) MsgSend has its own 1M override below for the burn-tax /
14
+ // treasury post-handler path; IBC `MsgTransfer` is exempt from the
15
+ // burn tax (per classic-terra/core fee_tax.go::FilterMsgAndComputeTax)
16
+ // so it falls through to this default.
17
+ [Chain.TerraClassic]: 400000n,
12
18
  [Chain.THORChain]: 20000000n,
13
19
  [Chain.MayaChain]: 2000000000n,
14
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"cosmosGasLimitRecord.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/cosmosGasLimitRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,MAAM,4BAA4B,CAAA;AAE/D,OAAO,EAAE,aAAa,EAAW,MAAM,iBAAiB,CAAA;AAExD,MAAM,oBAAoB,GAAgC;IACxD,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO;IACvB,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO;IACxB,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO;IACvB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO;IACrB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO;IACtB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO;IACtB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO;IACtB,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,OAAO;IAC7B,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,SAAS;IAC5B,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,WAAW;CAC/B,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAA0B,EAAU,EAAE;IACtE,IAAI,aAAa,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QACnE,OAAO,QAAU,CAAA;IACnB,CAAC;IAED,OAAO,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACzC,CAAC,CAAA"}
1
+ {"version":3,"file":"cosmosGasLimitRecord.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/cosmosGasLimitRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,MAAM,4BAA4B,CAAA;AAE/D,OAAO,EAAE,aAAa,EAAW,MAAM,iBAAiB,CAAA;AAExD,MAAM,oBAAoB,GAAgC;IACxD,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO;IACvB,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO;IACxB,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO;IACvB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO;IACrB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO;IACtB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO;IACtB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO;IACtB,iEAAiE;IACjE,gEAAgE;IAChE,kEAAkE;IAClE,mEAAmE;IACnE,uEAAuE;IACvE,uCAAuC;IACvC,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,OAAO;IAC7B,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,SAAS;IAC5B,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,WAAW;CAC/B,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAA0B,EAAU,EAAE;IACtE,IAAI,aAAa,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QACnE,OAAO,QAAU,CAAA;IACnB,CAAC;IAED,OAAO,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACzC,CAAC,CAAA"}
@@ -1,3 +1,14 @@
1
- /** Fetches the median of non-zero recent prioritization fees from the Solana RPC. */
2
- export declare const getDynamicPriorityFeePrice: () => Promise<number>;
1
+ import { PublicKey } from '@solana/web3.js';
2
+ /**
3
+ * Fetches the 75th-percentile non-zero recent prioritization fee from the
4
+ * Solana RPC. When `writableAccounts` is provided, the query is scoped to
5
+ * slots that wrote to those accounts (vault-aware) — the global feed is
6
+ * dominated by no-op vote txs and underestimates fees for contended
7
+ * writes. Floors at `solanaConfig.priorityFeePrice` so a low-congestion
8
+ * percentile never undershoots the cross-platform minimum, AND falls
9
+ * back to the floor when the sample window is too sparse to extrapolate
10
+ * a reliable percentile (see MIN_SAMPLE_SIZE).
11
+ */
12
+ export declare const getDynamicPriorityFeePrice: (writableAccounts?: PublicKey[]) => Promise<number>;
13
+ export declare const _MIN_SAMPLE_SIZE_FOR_TEST = 5;
3
14
  //# sourceMappingURL=getDynamicPriorityFeePrice.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDynamicPriorityFeePrice.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/solana/getDynamicPriorityFeePrice.ts"],"names":[],"mappings":"AAGA,qFAAqF;AACrF,eAAO,MAAM,0BAA0B,QAAa,OAAO,CAAC,MAAM,CAqBjE,CAAA"}
1
+ {"version":3,"file":"getDynamicPriorityFeePrice.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/solana/getDynamicPriorityFeePrice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAoB3C;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,GACnC,mBAAkB,SAAS,EAAO,KACnC,OAAO,CAAC,MAAM,CA0BhB,CAAA;AAID,eAAO,MAAM,yBAAyB,IAAkB,CAAA"}
@@ -1,20 +1,46 @@
1
1
  import { getSolanaClient } from './client.js';
2
2
  import { solanaConfig } from './solanaConfig.js';
3
- /** Fetches the median of non-zero recent prioritization fees from the Solana RPC. */
4
- export const getDynamicPriorityFeePrice = async () => {
3
+ const PRIORITY_FEE_PERCENTILE = 0.75;
4
+ /**
5
+ * Minimum sample size before the percentile selection is statistically
6
+ * meaningful. With the new lockedWritableAccounts scoping, sparse windows
7
+ * (1-3 non-zero fee slots in the recent window) become more likely - a
8
+ * single LP-add slot at e.g. 50_000_000 µLam/CU would dominate the
9
+ * percentile and set a wildly inflated fee for the next caller. Math.max
10
+ * floor below only protects against UNDER-payment; this guard protects
11
+ * against OVER-payment from a sparse-window spike. Below threshold we
12
+ * fall back to the cross-platform floor as the base rate (effectively
13
+ * "we don't have enough signal, pay the minimum").
14
+ */
15
+ const MIN_SAMPLE_SIZE = 5;
16
+ /**
17
+ * Fetches the 75th-percentile non-zero recent prioritization fee from the
18
+ * Solana RPC. When `writableAccounts` is provided, the query is scoped to
19
+ * slots that wrote to those accounts (vault-aware) — the global feed is
20
+ * dominated by no-op vote txs and underestimates fees for contended
21
+ * writes. Floors at `solanaConfig.priorityFeePrice` so a low-congestion
22
+ * percentile never undershoots the cross-platform minimum, AND falls
23
+ * back to the floor when the sample window is too sparse to extrapolate
24
+ * a reliable percentile (see MIN_SAMPLE_SIZE).
25
+ */
26
+ export const getDynamicPriorityFeePrice = async (writableAccounts = []) => {
5
27
  const client = getSolanaClient();
6
- const recentFees = await client.getRecentPrioritizationFees();
28
+ const recentFees = await client.getRecentPrioritizationFees(writableAccounts.length > 0
29
+ ? { lockedWritableAccounts: writableAccounts }
30
+ : undefined);
7
31
  const nonZeroFees = recentFees
8
32
  .map(entry => entry.prioritizationFee)
9
33
  .filter(fee => fee > 0)
10
34
  .sort((a, b) => a - b);
11
- if (nonZeroFees.length === 0) {
35
+ // Sparse-window guard: too few non-zero samples means a single
36
+ // outlier slot would dominate the percentile. Fall back to floor.
37
+ if (nonZeroFees.length < MIN_SAMPLE_SIZE) {
12
38
  return solanaConfig.priorityFeePrice;
13
39
  }
14
- const mid = Math.floor(nonZeroFees.length / 2);
15
- if (nonZeroFees.length % 2 === 0) {
16
- return Math.round((nonZeroFees[mid - 1] + nonZeroFees[mid]) / 2);
17
- }
18
- return nonZeroFees[mid];
40
+ const index = Math.min(Math.floor(nonZeroFees.length * PRIORITY_FEE_PERCENTILE), nonZeroFees.length - 1);
41
+ return Math.max(nonZeroFees[index], solanaConfig.priorityFeePrice);
19
42
  };
43
+ // Test-only export: lets unit tests pin the threshold without re-stating
44
+ // the magic number. Not exported from package barrel.
45
+ export const _MIN_SAMPLE_SIZE_FOR_TEST = MIN_SAMPLE_SIZE;
20
46
  //# sourceMappingURL=getDynamicPriorityFeePrice.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getDynamicPriorityFeePrice.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/solana/getDynamicPriorityFeePrice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,qFAAqF;AACrF,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,IAAqB,EAAE;IAClE,MAAM,MAAM,GAAG,eAAe,EAAE,CAAA;IAEhC,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,2BAA2B,EAAE,CAAA;IAE7D,MAAM,WAAW,GAAG,UAAU;SACzB,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC;SACrC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;SACtB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IAE1B,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,YAAY,CAAC,gBAAgB,CAAA;IACxC,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAE9C,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IACpE,CAAC;IAED,OAAO,WAAW,CAAC,GAAG,CAAC,CAAA;AAC3B,CAAC,CAAA"}
1
+ {"version":3,"file":"getDynamicPriorityFeePrice.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/solana/getDynamicPriorityFeePrice.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,MAAM,uBAAuB,GAAG,IAAI,CAAA;AAEpC;;;;;;;;;;GAUG;AACH,MAAM,eAAe,GAAG,CAAC,CAAA;AAEzB;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,EAC3C,mBAAgC,EAAE,EACnB,EAAE;IACjB,MAAM,MAAM,GAAG,eAAe,EAAE,CAAA;IAEhC,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,2BAA2B,CACvD,gBAAgB,CAAC,MAAM,GAAG,CAAC;QACvB,CAAC,CAAC,EAAE,sBAAsB,EAAE,gBAAgB,EAAE;QAC9C,CAAC,CAAC,SAAS,CAClB,CAAA;IAED,MAAM,WAAW,GAAG,UAAU;SACzB,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC;SACrC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;SACtB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IAE1B,+DAA+D;IAC/D,kEAAkE;IAClE,IAAI,WAAW,CAAC,MAAM,GAAG,eAAe,EAAE,CAAC;QACvC,OAAO,YAAY,CAAC,gBAAgB,CAAA;IACxC,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAClB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,uBAAuB,CAAC,EACxD,WAAW,CAAC,MAAM,GAAG,CAAC,CACzB,CAAA;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAA;AACtE,CAAC,CAAA;AAED,yEAAyE;AACzE,sDAAsD;AACtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,eAAe,CAAA"}
@@ -2,5 +2,6 @@ export declare const solanaConfig: {
2
2
  priorityFeeLimit: number;
3
3
  priorityFeePrice: number;
4
4
  baseFee: number;
5
+ ataRentLamports: number;
5
6
  };
6
7
  //# sourceMappingURL=solanaConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"solanaConfig.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/solana/solanaConfig.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;CAOxB,CAAA"}
1
+ {"version":3,"file":"solanaConfig.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/solana/solanaConfig.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;CAsBxB,CAAA"}
@@ -1,8 +1,22 @@
1
1
  export const solanaConfig = {
2
- priorityFeeLimit: Number(100_000), // Turbo fee in lamports, around 5 cents
3
- priorityFeePrice: 1_000_000, // Turbo fee in lamports, around 5 cents
4
- // regardless of its complexity Solana charges a fixed base transaction fee of 5000 lamports per transaction.
5
- // This base fee is separate from the priority fee.
6
- baseFee: 5000, // 0.000005 SOL Base fee in lamports
2
+ priorityFeeLimit: Number(100_000), // Compute-unit limit for priority fee
3
+ priorityFeePrice: 1_000_000, // Floor price in micro-lamports per CU
4
+ // Solana charges 5000 lamports per signature. Vultisig sends are
5
+ // single-signer, so this is the per-tx base fee. If a future path
6
+ // emits multi-signer messages this becomes 5000 * N.
7
+ baseFee: 5000,
8
+ // Rent-exempt minimum for a 165-byte SPL token associated account, used
9
+ // when emitting `createAssociatedTokenAccount` alongside an SPL transfer.
10
+ //
11
+ // Derivation: (128-byte account header + 165-byte SPL Token data)
12
+ // × RENT_PER_BYTE_PER_YEAR (3480 lamports)
13
+ // × 2-year threshold
14
+ // = 293 × 3480 × 2
15
+ // = 2,039,280 lamports
16
+ //
17
+ // Constant on mainnet/devnet/testnet today — rent rate is hardcoded in
18
+ // the Solana runtime. If Solana ever bumps RENT_PER_BYTE_PER_YEAR or
19
+ // the 2-year threshold, re-derive from the formula above.
20
+ ataRentLamports: 2_039_280,
7
21
  };
8
22
  //# sourceMappingURL=solanaConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"solanaConfig.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/solana/solanaConfig.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,wCAAwC;IAC3E,gBAAgB,EAAE,SAAS,EAAE,wCAAwC;IAErE,6GAA6G;IAC7G,mDAAmD;IACnD,OAAO,EAAE,IAAI,EAAE,oCAAoC;CACpD,CAAA"}
1
+ {"version":3,"file":"solanaConfig.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/solana/solanaConfig.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,sCAAsC;IACzE,gBAAgB,EAAE,SAAS,EAAE,uCAAuC;IAEpE,iEAAiE;IACjE,kEAAkE;IAClE,qDAAqD;IACrD,OAAO,EAAE,IAAI;IAEb,wEAAwE;IACxE,0EAA0E;IAC1E,EAAE;IACF,kEAAkE;IAClE,uDAAuD;IACvD,iCAAiC;IACjC,6BAA6B;IAC7B,iCAAiC;IACjC,EAAE;IACF,uEAAuE;IACvE,qEAAqE;IACrE,0DAA0D;IAC1D,eAAe,EAAE,SAAS;CAC3B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vultisig/core-chain",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Blockchain chain logic shared across Vultisig clients",
5
5
  "license": "MIT",
6
6
  "repository": {