@vultisig/core-chain 4.1.0 → 4.1.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,26 @@
1
1
  # @vultisig/core-chain
2
2
 
3
+ ## 4.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2297](https://github.com/vultisig/vultisig-sdk/pull/2297) [`c0eafeb`](https://github.com/vultisig/vultisig-sdk/commit/c0eafeb12df42cffa70ef6951c081a74383e5fa2) Thanks [@rcoderdev](https://github.com/rcoderdev)! - Make the SDK package graph explicit and acyclic. Shared Bitcoin signing protobuf schemas now live in `@vultisig/mpc-types`, `@vultisig/core-mpc` preserves its existing schema subpath as a compatibility export, and SDK builds resolve the declared core packages through their published export maps.
8
+
9
+ - [#2252](https://github.com/vultisig/vultisig-sdk/pull/2252) [`ef252e4`](https://github.com/vultisig/vultisig-sdk/commit/ef252e40b590a6cad9f303f7aba743c617442f90) Thanks [@Ehsan-saradar](https://github.com/Ehsan-saradar)! - fix(ton): stop hiding action-phase failures on sends and in status
10
+
11
+ Every TON send OR'd `IGNORE_ACTION_PHASE_ERRORS` into the wallet contract's send mode, which tells the contract to skip an outgoing transfer it cannot carry out instead of failing. The transaction then landed un-aborted with the seqno consumed and nothing moved, and the status resolver — which read only `aborted` and `compute_ph.exit_code` — reported it as confirmed. The user was told a transfer succeeded while the funds never left.
12
+
13
+ The flag is now dropped from native, MAX, dApp `signTon`, and Jetton sends (both the WalletCore and the React Native builders), and `getTonTxStatus` reads the action phase (`success`, `no_funds`, `result_code`, `skipped_actions`) alongside the compute phase. A transaction the indexer knows but has not yet described stays pending instead of counting as success.
14
+
15
+ Dropping the flag changes the signed body, so TON signing hashes move. Clients must upgrade together: a co-signer on an older build derives a different hash and the keysign fails. The mobile and cross-encoder golden corpora are re-recorded to the new values.
16
+
17
+ - [#2093](https://github.com/vultisig/vultisig-sdk/pull/2093) [`bfe0292`](https://github.com/vultisig/vultisig-sdk/commit/bfe0292e3876fb7acc7044bac1b544c27aba8919) Thanks [@gomesalexandre](https://github.com/gomesalexandre)! - Publishes token-transfer / ERC-20-calldata destination safety helpers alongside the existing burn-address guard (`assertSafeDestination`): `assertSafeTokenTransferDestination` (rejects a transfer whose recipient is itself a known token contract — not just its own, any registered token's), `isErc20TransferCalldata`, `decodeErc20Recipient`, `decodeErc20Approve`, and `decodeErc20RecipientFromSig`, all re-exported from `@vultisig/sdk`. Previously only `agent-backend-ts` had this guard family as a private fork; `packages/sdk/src/tools/prep/send.ts`'s inline own-token-contract check is now additionally backed by the registry-based guard (catching sends to a _different_ known token's contract, on top of the existing unconditional self-contract check).
18
+
19
+ - [#2092](https://github.com/vultisig/vultisig-sdk/pull/2092) [`acd0b2e`](https://github.com/vultisig/vultisig-sdk/commit/acd0b2eaa882669a399fb378e51244ed4199ee47) Thanks [@gomesalexandre](https://github.com/gomesalexandre)! - Consolidates four independently-maintained, overlapping Cosmos-family bech32 HRP tables — `tools/cosmos/gov.ts`'s `CHAIN_HRP`, `tools/prep/ibcTransfer.ts`'s `IBC_CHAIN_HRP`, `tools/swap/skip/skipSwap.ts`'s `COSMOS_CHAIN_HRPS`, and `tools/token/resolveContract.ts`'s `CW20_CHAIN_PREFIX` — into a single canonical registry, `COSMOS_CHAIN_ID_HRP`/`getCosmosChainHrp` (`@vultisig/core-chain/chains/cosmos/cosmosHrp`). All four consumers now derive their HRP checks from the same source instead of hand-maintained local copies that could drift from each other. As a side effect, Skip swap address validation now also HRP-checks four chain-ids (`axelar-dojo-1`, `juno-1`, `stargaze-1`, `akashnet-2`) it previously had no entry for and silently skipped — strictly safer, not a behavior change for any chain that was already validated. Deliberately does not touch `utils/addressFormat.ts`'s separate `cosmosHRPByChain`/`cosmosValoperByChain` tables, which are keyed by a different (lowercase chain-tag) space and ported 1:1 from a Go reference for cross-language parity.
20
+
21
+ - Updated dependencies [[`c0eafeb`](https://github.com/vultisig/vultisig-sdk/commit/c0eafeb12df42cffa70ef6951c081a74383e5fa2)]:
22
+ - @vultisig/mpc-types@0.3.0
23
+
3
24
  ## 4.1.0
4
25
 
5
26
  ### Minor Changes
@@ -15,7 +15,7 @@ type BuildCoseSign1Input = {
15
15
  /**
16
16
  * Build and return the full COSE_Sign1 CBOR:
17
17
  *
18
- * [protected: bstr, unprotected: {}, payload: bstr, signature: bstr]
18
+ * [protected: bstr, unprotected: { "hashed": false }, payload: bstr, signature: bstr]
19
19
  *
20
20
  * Also returns the `protectedSerialized` bytes needed to compute the
21
21
  * Sig_structure before signing.
@@ -32,7 +32,7 @@ export const buildSigStructure = (protectedBytes, payload) => cborArray([
32
32
  /**
33
33
  * Build and return the full COSE_Sign1 CBOR:
34
34
  *
35
- * [protected: bstr, unprotected: {}, payload: bstr, signature: bstr]
35
+ * [protected: bstr, unprotected: { "hashed": false }, payload: bstr, signature: bstr]
36
36
  *
37
37
  * Also returns the `protectedSerialized` bytes needed to compute the
38
38
  * Sig_structure before signing.
@@ -41,7 +41,7 @@ export const buildCoseSign1 = ({ addressBytes, payload, signature }) => {
41
41
  const protectedSerialized = buildProtectedHeaders(addressBytes);
42
42
  return cborArray([
43
43
  cborBytes(protectedSerialized),
44
- cborMap([]), // empty unprotected headers
44
+ cborMap([[cborText('hashed'), Uint8Array.of(0xf4)]]), // `false` per RFC 8949 §3.3
45
45
  cborBytes(payload),
46
46
  cborBytes(signature),
47
47
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"buildCoseStructures.js","sourceRoot":"","sources":["../../../../../../../packages/core/chain/chains/cardano/cip30/buildCoseStructures.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAEvG;;;;;;GAMG;AACH,MAAM,qBAAqB,GAAG,CAAC,YAAwB,EAAc,EAAE,CACrE,OAAO,CAAC;IACN,CAAC,QAAQ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QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACtC,CAAC,CAAA"}
1
+ {"version":3,"file":"buildCoseStructures.js","sourceRoot":"","sources":["../../../../../../../packages/core/chain/chains/cardano/cip30/buildCoseStructures.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAEvG;;;;;;GAMG;AACH,MAAM,qBAAqB,GAAG,CAAC,YAAwB,EAAc,EAAE,CACrE,OAAO,CAAC;IACN,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;CAC/C,CAAC,CAAA;AAEJ;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,cAA0B,EAAE,OAAmB,EAAc,EAAE,CAC/F,SAAS,CAAC;IACR,QAAQ,CAAC,YAAY,CAAC;IACtB,SAAS,CAAC,cAAc,CAAC;IACzB,SAAS,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,qBAAqB;IACnD,SAAS,CAAC,OAAO,CAAC;CACnB,CAAC,CAAA;AAWJ;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAuB,EAAc,EAAE;IACtG,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAA;IAC/D,OAAO,SAAS,CAAC;QACf,SAAS,CAAC,mBAAmB,CAAC;QAC9B,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,4BAA4B;QAClF,SAAS,CAAC,OAAO,CAAC;QAClB,SAAS,CAAC,SAAS,CAAC;KACrB,CAAC,CAAA;AACJ,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,YAAwB,EAAc,EAAE,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAA;AAOtH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,SAAS,EAAqB,EAAc,EAAE,CAC3E,OAAO,CAAC;IACN,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACtC,CAAC,CAAA"}
@@ -1,4 +1,35 @@
1
+ /**
2
+ * Slots added to the current tip to produce a Cardano transaction's TTL.
3
+ *
4
+ * Cardano slots are 1 second, so this is the window during which a built
5
+ * transaction stays valid; past it the node rejects it outright. Read together
6
+ * with {@link cardanoBroadcastTtlSafetyMargin}: the usable window for a signing
7
+ * ceremony is `cardanoSlotOffset - cardanoBroadcastTtlSafetyMargin` seconds,
8
+ * because broadcast refuses anything closer to expiry than the margin.
9
+ *
10
+ * Do not read this constant directly to build a TTL - call
11
+ * {@link getCardanoSendTtl}, so every consumer applies one policy instead of
12
+ * re-deriving it from the raw number.
13
+ */
1
14
  export declare const cardanoSlotOffset = 720;
2
15
  export declare const cardanoDefaultFee = 180000n;
16
+ /**
17
+ * How close to its TTL a Cardano transaction may get before broadcast refuses
18
+ * it. Guards against signing a transaction that expires in flight, which would
19
+ * otherwise surface as an opaque node rejection after the ceremony completed.
20
+ */
3
21
  export declare const cardanoBroadcastTtlSafetyMargin = 60;
22
+ /**
23
+ * The canonical TTL for a Cardano transaction built against `currentSlot`.
24
+ *
25
+ * This is protocol policy, not a per-caller choice: a transaction's validity
26
+ * window has to agree across every consumer that builds, signs or broadcasts
27
+ * one. When a consumer re-derives it locally the two silently diverge, and the
28
+ * same send stays valid for a different length of time depending on which code
29
+ * path produced it - while the broadcast-time freshness guard keeps using this
30
+ * side's numbers to judge it.
31
+ *
32
+ * @param currentSlot - the chain tip the transaction is being built against
33
+ */
34
+ export declare const getCardanoSendTtl: (currentSlot: bigint) => bigint;
4
35
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cardano/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,MAAM,CAAA;AACpC,eAAO,MAAM,iBAAiB,UAAU,CAAA;AACxC,eAAO,MAAM,+BAA+B,KAAK,CAAA"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cardano/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC,eAAO,MAAM,iBAAiB,UAAU,CAAA;AAExC;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,KAAK,CAAA;AAEjD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,GAAI,aAAa,MAAM,KAAG,MAAiD,CAAA"}
@@ -1,4 +1,35 @@
1
+ /**
2
+ * Slots added to the current tip to produce a Cardano transaction's TTL.
3
+ *
4
+ * Cardano slots are 1 second, so this is the window during which a built
5
+ * transaction stays valid; past it the node rejects it outright. Read together
6
+ * with {@link cardanoBroadcastTtlSafetyMargin}: the usable window for a signing
7
+ * ceremony is `cardanoSlotOffset - cardanoBroadcastTtlSafetyMargin` seconds,
8
+ * because broadcast refuses anything closer to expiry than the margin.
9
+ *
10
+ * Do not read this constant directly to build a TTL - call
11
+ * {@link getCardanoSendTtl}, so every consumer applies one policy instead of
12
+ * re-deriving it from the raw number.
13
+ */
1
14
  export const cardanoSlotOffset = 720;
2
15
  export const cardanoDefaultFee = 180000n;
16
+ /**
17
+ * How close to its TTL a Cardano transaction may get before broadcast refuses
18
+ * it. Guards against signing a transaction that expires in flight, which would
19
+ * otherwise surface as an opaque node rejection after the ceremony completed.
20
+ */
3
21
  export const cardanoBroadcastTtlSafetyMargin = 60;
22
+ /**
23
+ * The canonical TTL for a Cardano transaction built against `currentSlot`.
24
+ *
25
+ * This is protocol policy, not a per-caller choice: a transaction's validity
26
+ * window has to agree across every consumer that builds, signs or broadcasts
27
+ * one. When a consumer re-derives it locally the two silently diverge, and the
28
+ * same send stays valid for a different length of time depending on which code
29
+ * path produced it - while the broadcast-time freshness guard keeps using this
30
+ * side's numbers to judge it.
31
+ *
32
+ * @param currentSlot - the chain tip the transaction is being built against
33
+ */
34
+ export const getCardanoSendTtl = (currentSlot) => currentSlot + BigInt(cardanoSlotOffset);
4
35
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cardano/config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AACpC,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAA;AACxC,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,CAAA"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cardano/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAEpC,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAA;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,CAAA;AAEjD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAAmB,EAAU,EAAE,CAAC,WAAW,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAA"}
@@ -0,0 +1,39 @@
1
+ import { CosmosChain } from '../../Chain.js';
2
+ /**
3
+ * Canonical Cosmos-family bech32 HRP (human-readable prefix), keyed by
4
+ * CHAIN-ID rather than the SDK `Chain` enum, so it covers both:
5
+ *
6
+ * - every first-class Vultisig-supported Cosmos chain (`CosmosChain`,
7
+ * resolvable to an HRP via `getCosmosChainHrp` below), and
8
+ * - IBC/Skip DESTINATION chains that are valid transfer/swap targets but
9
+ * have no wallet/RPC support of their own (e.g. `neutron-1`, `juno-1`,
10
+ * `stargaze-1`) — these have no `CosmosChain` member to key by.
11
+ *
12
+ * Consolidates what were four independently-maintained, overlapping copies
13
+ * (architecture#1787): `tools/cosmos/gov.ts`'s `CHAIN_HRP`, `tools/prep/
14
+ * ibcTransfer.ts`'s `IBC_CHAIN_HRP`, `tools/swap/skip/skipSwap.ts`'s
15
+ * `COSMOS_CHAIN_HRPS`, and `tools/token/resolveContract.ts`'s
16
+ * `CW20_CHAIN_PREFIX`. Every entry below was cross-checked against all four
17
+ * source tables for the chains they had in common — no value differs across
18
+ * copies, so this union is a lossless merge, not a judgment call on which
19
+ * source wins.
20
+ *
21
+ * Deliberately does NOT absorb `utils/addressFormat.ts`'s `cosmosHRPByChain`
22
+ * / `cosmosValoperByChain` — those are keyed by a THIRD, different space
23
+ * (lowercase "canonical chain tag", not chain-id or `Chain` enum), ported
24
+ * 1:1 from a Go reference (`chain_prefix_extractor.go`) for cross-language
25
+ * parity, and cover additional chains (sei, kava, persistence, secret,
26
+ * crescent, qbtc) this registry has no chain-id for. Forcing that table
27
+ * through this one would risk silently breaking Go parity for no
28
+ * consolidation benefit — a real, but separately-scoped, follow-up.
29
+ */
30
+ export declare const COSMOS_CHAIN_ID_HRP: Record<string, string>;
31
+ /**
32
+ * Resolve the bech32 HRP for a first-class Vultisig `CosmosChain`. Throws on
33
+ * a registry gap (a `CosmosChain` member with no HRP entry above) rather
34
+ * than returning `undefined` — that's a bug in this file, not a caller
35
+ * error, and failing loudly here beats a confusing downstream 404/wrong-HRP
36
+ * address match.
37
+ */
38
+ export declare function getCosmosChainHrp(chain: CosmosChain): string;
39
+ //# sourceMappingURL=cosmosHrp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cosmosHrp.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/cosmosHrp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGzC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAmBtD,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAO5D"}
@@ -0,0 +1,65 @@
1
+ import { getCosmosChainId } from './chainInfo.js';
2
+ /**
3
+ * Canonical Cosmos-family bech32 HRP (human-readable prefix), keyed by
4
+ * CHAIN-ID rather than the SDK `Chain` enum, so it covers both:
5
+ *
6
+ * - every first-class Vultisig-supported Cosmos chain (`CosmosChain`,
7
+ * resolvable to an HRP via `getCosmosChainHrp` below), and
8
+ * - IBC/Skip DESTINATION chains that are valid transfer/swap targets but
9
+ * have no wallet/RPC support of their own (e.g. `neutron-1`, `juno-1`,
10
+ * `stargaze-1`) — these have no `CosmosChain` member to key by.
11
+ *
12
+ * Consolidates what were four independently-maintained, overlapping copies
13
+ * (architecture#1787): `tools/cosmos/gov.ts`'s `CHAIN_HRP`, `tools/prep/
14
+ * ibcTransfer.ts`'s `IBC_CHAIN_HRP`, `tools/swap/skip/skipSwap.ts`'s
15
+ * `COSMOS_CHAIN_HRPS`, and `tools/token/resolveContract.ts`'s
16
+ * `CW20_CHAIN_PREFIX`. Every entry below was cross-checked against all four
17
+ * source tables for the chains they had in common — no value differs across
18
+ * copies, so this union is a lossless merge, not a judgment call on which
19
+ * source wins.
20
+ *
21
+ * Deliberately does NOT absorb `utils/addressFormat.ts`'s `cosmosHRPByChain`
22
+ * / `cosmosValoperByChain` — those are keyed by a THIRD, different space
23
+ * (lowercase "canonical chain tag", not chain-id or `Chain` enum), ported
24
+ * 1:1 from a Go reference (`chain_prefix_extractor.go`) for cross-language
25
+ * parity, and cover additional chains (sei, kava, persistence, secret,
26
+ * crescent, qbtc) this registry has no chain-id for. Forcing that table
27
+ * through this one would risk silently breaking Go parity for no
28
+ * consolidation benefit — a real, but separately-scoped, follow-up.
29
+ */
30
+ export const COSMOS_CHAIN_ID_HRP = {
31
+ 'phoenix-1': 'terra',
32
+ 'columbus-5': 'terra',
33
+ 'cosmoshub-4': 'cosmos',
34
+ 'osmosis-1': 'osmo',
35
+ 'kaiyo-1': 'kujira',
36
+ 'neutron-1': 'neutron',
37
+ 'axelar-dojo-1': 'axelar',
38
+ 'injective-1': 'inj',
39
+ 'juno-1': 'juno',
40
+ 'stargaze-1': 'stars',
41
+ 'noble-1': 'noble',
42
+ 'akashnet-2': 'akash',
43
+ 'dydx-mainnet-1': 'dydx',
44
+ 'stride-1': 'stride',
45
+ celestia: 'celestia',
46
+ 'thorchain-1': 'thor',
47
+ 'mayachain-mainnet-v1': 'maya',
48
+ 'agoric-3': 'agoric',
49
+ };
50
+ /**
51
+ * Resolve the bech32 HRP for a first-class Vultisig `CosmosChain`. Throws on
52
+ * a registry gap (a `CosmosChain` member with no HRP entry above) rather
53
+ * than returning `undefined` — that's a bug in this file, not a caller
54
+ * error, and failing loudly here beats a confusing downstream 404/wrong-HRP
55
+ * address match.
56
+ */
57
+ export function getCosmosChainHrp(chain) {
58
+ const chainId = getCosmosChainId(chain);
59
+ const hrp = COSMOS_CHAIN_ID_HRP[chainId];
60
+ if (!hrp) {
61
+ throw new Error(`getCosmosChainHrp: no HRP registered for ${chain} (chainId ${chainId})`);
62
+ }
63
+ return hrp;
64
+ }
65
+ //# sourceMappingURL=cosmosHrp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cosmosHrp.js","sourceRoot":"","sources":["../../../../../../packages/core/chain/chains/cosmos/cosmosHrp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,WAAW,EAAE,OAAO;IACpB,YAAY,EAAE,OAAO;IACrB,aAAa,EAAE,QAAQ;IACvB,WAAW,EAAE,MAAM;IACnB,SAAS,EAAE,QAAQ;IACnB,WAAW,EAAE,SAAS;IACtB,eAAe,EAAE,QAAQ;IACzB,aAAa,EAAE,KAAK;IACpB,QAAQ,EAAE,MAAM;IAChB,YAAY,EAAE,OAAO;IACrB,SAAS,EAAE,OAAO;IAClB,YAAY,EAAE,OAAO;IACrB,gBAAgB,EAAE,MAAM;IACxB,UAAU,EAAE,QAAQ;IACpB,QAAQ,EAAE,UAAU;IACpB,aAAa,EAAE,MAAM;IACrB,sBAAsB,EAAE,MAAM;IAC9B,UAAU,EAAE,QAAQ;CACrB,CAAA;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAkB;IAClD,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACvC,MAAM,GAAG,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAA;IACxC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,4CAA4C,KAAK,aAAa,OAAO,GAAG,CAAC,CAAA;IAC3F,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -1,4 +1,4 @@
1
- import { SignBitcoin } from '@vultisig/core-mpc/types/vultisig/keysign/v1/wasm_execute_contract_payload_pb';
1
+ import { SignBitcoin } from '@vultisig/mpc-types/types/vultisig/keysign/v1/wasm_execute_contract_payload_pb';
2
2
  import { Network, Psbt } from 'bitcoinjs-lib';
3
3
  type BuildSignBitcoinFromPsbtInput = {
4
4
  psbt: Psbt;
@@ -1 +1 @@
1
- {"version":3,"file":"buildSignBitcoinFromPsbt.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/chain/chains/utxo/tx/buildSignBitcoinFromPsbt.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,WAAW,EAEZ,MAAM,+EAA+E,CAAA;AACtF,OAAO,EAAyB,OAAO,EAAqB,IAAI,EAAkC,MAAM,eAAe,CAAA;AAiEvH,KAAK,6BAA6B,GAAG;IACnC,IAAI,EAAE,IAAI,CAAA;IACV,aAAa,EAAE,MAAM,CAAA;IACrB,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GAAI,mCAItC,6BAA6B,KAAG,WA8HlC,CAAA"}
1
+ {"version":3,"file":"buildSignBitcoinFromPsbt.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/chain/chains/utxo/tx/buildSignBitcoinFromPsbt.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,WAAW,EAEZ,MAAM,gFAAgF,CAAA;AACvF,OAAO,EAAyB,OAAO,EAAqB,IAAI,EAAkC,MAAM,eAAe,CAAA;AAiEvH,KAAK,6BAA6B,GAAG;IACnC,IAAI,EAAE,IAAI,CAAA;IACV,aAAa,EAAE,MAAM,CAAA;IACrB,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GAAI,mCAItC,6BAA6B,KAAG,WA8HlC,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { create } from '@bufbuild/protobuf';
2
- import { BitcoinInputSchema, BitcoinOutputSchema, SignBitcoinSchema, } from '@vultisig/core-mpc/types/vultisig/keysign/v1/wasm_execute_contract_payload_pb';
2
+ import { BitcoinInputSchema, BitcoinOutputSchema, SignBitcoinSchema, } from '@vultisig/mpc-types/types/vultisig/keysign/v1/wasm_execute_contract_payload_pb';
3
3
  import { address as btcAddress, networks, opcodes, script as bscript, Transaction } from 'bitcoinjs-lib';
4
4
  /**
5
5
  * Detect the script type from a scriptPubKey buffer.
@@ -1 +1 @@
1
- {"version":3,"file":"buildSignBitcoinFromPsbt.js","sourceRoot":"","sources":["../../../../../../../packages/core/chain/chains/utxo/tx/buildSignBitcoinFromPsbt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EAEnB,iBAAiB,GAClB,MAAM,+EAA+E,CAAA;AACtF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAW,QAAQ,EAAE,OAAO,EAAQ,MAAM,IAAI,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAKvH;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,YAAoB,EAAE,YAAyB,EAAc,EAAE;IACvF,iDAAiD;IACjD,IAAI,YAAY,CAAC,MAAM,KAAK,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACvF,OAAO,QAAQ,CAAA;IACjB,CAAC;IACD,wFAAwF;IACxF,IACE,YAAY,CAAC,MAAM,KAAK,EAAE;QAC1B,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI;QACxB,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI;QACxB,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI;QACxB,YAAY,CAAC,EAAE,CAAC,KAAK,IAAI;QACzB,YAAY,CAAC,EAAE,CAAC,KAAK,IAAI,EACzB,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,8CAA8C;IAC9C,IAAI,YAAY,CAAC,MAAM,KAAK,EAAE,IA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M,CAAC;gBACP,4CAA4C;YAC9C,CAAC;QACH,CAAC;QAED,gFAAgF;QAChF,gFAAgF;QAChF,mFAAmF;QACnF,+EAA+E;QAC/E,qEAAqE;QACrE,OAAO,MAAM,CAAC,mBAAmB,EAAE;YACjC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC9B,OAAO,EAAE,aAAa;YACtB,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;YAC3D,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YACpC,QAAQ,EAAE,aAAa,KAAK,EAAE,IAAI,aAAa,KAAK,aAAa;SAClE,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAC,iBAAiB,EAAE;QAC/B,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM;QACN,OAAO;KACR,CAAC,CAAA;AACJ,CAAC,CAAA"}
1
+ {"version":3,"file":"buildSignBitcoinFromPsbt.js","sourceRoot":"","sources":["../../../../../../../packages/core/chain/chains/utxo/tx/buildSignBitcoinFromPsbt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EAEnB,iBAAiB,GAClB,MAAM,gFAAgF,CAAA;AACvF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAW,QAAQ,EAAE,OAAO,EAAQ,MAAM,IAAI,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAKvH;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,YAAoB,EAAE,YAAyB,EAAc,EAAE;IACvF,iDAAiD;IACjD,IAAI,YAAY,CAAC,MAAM,KAAK,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,YAAY,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AC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QAC5C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;QAC3C,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;QAEnC,IAAI,aAAa,GAAG,EAAE,CAAA;QACtB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,IAAI,CAAC;gBACH,aAAa,GAAG,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;YACvE,CAAC;YAAC,MAAM,CAAC;gBACP,4CAA4C;YAC9C,CAAC;QACH,CAAC;QAED,gFAAgF;QAChF,gFAAgF;QAChF,mFAAmF;QACnF,+EAA+E;QAC/E,qEAAqE;QACrE,OAAO,MAAM,CAAC,mBAAmB,EAAE;YACjC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC9B,OAAO,EAAE,aAAa;YACtB,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;YAC3D,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YACpC,QAAQ,EAAE,aAAa,KAAK,EAAE,IAAI,aAAa,KAAK,aAAa;SAClE,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAC,iBAAiB,EAAE;QAC/B,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM;QACN,OAAO;KACR,CAAC,CAAA;AACJ,CAAC,CAAA"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Throws when a plain token-transfer `recipient` is itself a known token
3
+ * contract address on `chain` — most commonly the SAME token being sent to
4
+ * its own contract, but also catches a transfer aimed at a different known
5
+ * token's contract.
6
+ *
7
+ * Call this ONLY on plain-transfer recipients (a native/ERC-20 send, or a
8
+ * decoded ERC-20 `transfer` hidden inside an arbitrary contract-call's
9
+ * calldata — see `decodeErc20Recipient` below). `sendingTokenContract` is
10
+ * the contract address of the token actually being sent (`undefined` for a
11
+ * native-coin send, which this guard is a no-op for — there is no "the ETH
12
+ * contract" to accidentally send ETH to).
13
+ */
14
+ export declare function assertSafeTokenTransferDestination(chain: string, recipient: string, sendingTokenContract: string | undefined): void;
15
+ /**
16
+ * True when `data`'s selector is a plain ERC-20 `transfer`/`transferFrom` —
17
+ * the two calldata shapes where the call target IS the token being moved, so
18
+ * a recipient that is itself a known token contract strands the funds and
19
+ * `assertSafeTokenTransferDestination` applies. ERC-721 `safeTransferFrom`
20
+ * deliberately returns false: the 721 standard's on-chain `onERC721Received`
21
+ * check already reverts a transfer to a non-receiver contract, so extending
22
+ * the registry guard there would add false-positive surface without closing
23
+ * a loss path. Every other selector is an arbitrary contract call and stays
24
+ * out of scope.
25
+ */
26
+ export declare function isErc20TransferCalldata(data: string): boolean;
27
+ /**
28
+ * If `data` looks like an ERC-20 `transfer`/`transferFrom` (or the
29
+ * same-shaped ERC-721 `safeTransferFrom`) call, return the decoded recipient
30
+ * address (lower-cased, `0x`-prefixed). Otherwise returns `null`.
31
+ *
32
+ * A contract-call builder that sets `to = <token contract>` + `data =
33
+ * <encoded transfer>` must run this to check the ACTUAL recipient —
34
+ * otherwise a destination guard that only vets the token contract address
35
+ * lets the real recipient slip through unchecked.
36
+ *
37
+ * Calldata layout for `transfer(address,uint256)`:
38
+ * 0x00–0x04 selector (4 bytes)
39
+ * 0x04–0x24 recipient (32-byte padded; address in last 20 bytes)
40
+ * 0x24–0x44 amount
41
+ *
42
+ * For `transferFrom(address,address,uint256)` (ERC-20) and
43
+ * `safeTransferFrom(address,address,uint256[,bytes])` (ERC-721 — same head layout):
44
+ * 0x00–0x04 selector
45
+ * 0x04–0x24 sender
46
+ * 0x24–0x44 recipient
47
+ * 0x44–0x64 amount / tokenId
48
+ */
49
+ export declare function decodeErc20Recipient(data: string): string | null;
50
+ export declare const ERC20_APPROVE_SELECTOR = "0x095ea7b3";
51
+ /**
52
+ * If `data` is an ERC-20 `approve(address spender, uint256 amount)` call,
53
+ * decode the SPENDER (lower-cased, `0x`-prefixed) + the raw allowance
54
+ * amount. Otherwise null. Mirrors `decodeErc20Recipient`'s slot math:
55
+ * spender = first 32-byte slot (bytes 4..36), amount = second slot (bytes
56
+ * 36..68).
57
+ */
58
+ export declare function decodeErc20Approve(data: string): {
59
+ spender: string;
60
+ amount: bigint;
61
+ } | null;
62
+ /**
63
+ * Extract the ERC-20/721 transfer RECIPIENT from a `function_sig` + `args`
64
+ * shape — the alternative to raw ABI-encoded `data` some builders accept
65
+ * (function signature + positional args, ABI-encoded server/caller-side
66
+ * AFTER any pre-dispatch destination guard already ran). Without this, a
67
+ * transfer expressed as `function_sig: "transfer(address,uint256)"` +
68
+ * `args: [<recipient>, <amount>]` has no `data` for `decodeErc20Recipient`
69
+ * to see and a destination guard silently no-ops.
70
+ *
71
+ * Mirrors `decodeErc20Recipient`'s selector→slot mapping on the parsed
72
+ * signature: `transfer(address,uint256)` → `args[0]`;
73
+ * `transferFrom`/`safeTransferFrom(address from,address to,…)` → `args[1]`
74
+ * (the recipient is the SECOND address, never `from`). A non-transfer
75
+ * signature (or one that doesn't match either shape) → `null`.
76
+ */
77
+ export declare function decodeErc20RecipientFromSig(functionSig: unknown, args: unknown): string | null;
78
+ //# sourceMappingURL=tokenTransferGuards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenTransferGuards.d.ts","sourceRoot":"","sources":["../../../../../packages/core/chain/security/tokenTransferGuards.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;GAYG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,oBAAoB,EAAE,MAAM,GAAG,SAAS,GACvC,IAAI,CAiBN;AAaD;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAK7D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA4BhE;AAMD,eAAO,MAAM,sBAAsB,eAAe,CAAA;AAElD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAe3F;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAuC9F"}
@@ -0,0 +1,203 @@
1
+ import { knownTokensIndex } from '@vultisig/core-chain/coin/knownTokens';
2
+ const EVM_ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
3
+ /**
4
+ * Throws when a plain token-transfer `recipient` is itself a known token
5
+ * contract address on `chain` — most commonly the SAME token being sent to
6
+ * its own contract, but also catches a transfer aimed at a different known
7
+ * token's contract.
8
+ *
9
+ * Call this ONLY on plain-transfer recipients (a native/ERC-20 send, or a
10
+ * decoded ERC-20 `transfer` hidden inside an arbitrary contract-call's
11
+ * calldata — see `decodeErc20Recipient` below). `sendingTokenContract` is
12
+ * the contract address of the token actually being sent (`undefined` for a
13
+ * native-coin send, which this guard is a no-op for — there is no "the ETH
14
+ * contract" to accidentally send ETH to).
15
+ */
16
+ export function assertSafeTokenTransferDestination(chain, recipient, sendingTokenContract) {
17
+ if (!sendingTokenContract)
18
+ return;
19
+ const hit = knownTokensIndex[chain]?.[recipient.toLowerCase()];
20
+ if (!hit)
21
+ return;
22
+ const isSameToken = recipient.toLowerCase() === sendingTokenContract.toLowerCase();
23
+ if (isSameToken) {
24
+ throw new Error(`Refusing to build transaction: sending ${hit.ticker} to the ${hit.ticker} token contract ` +
25
+ `(${recipient}) would permanently burn it — the contract cannot credit a balance to itself. ` +
26
+ 'Did you mean to send to a wallet address instead?');
27
+ }
28
+ throw new Error(`Refusing to build transaction: destination ${recipient} is the ${hit.ticker} token contract on ${chain}, ` +
29
+ 'not a wallet — tokens sent to a token contract are permanently unrecoverable. ' +
30
+ 'Did you mean to send to a wallet address instead?');
31
+ }
32
+ // ── ERC-20 calldata recipient decoding ───────────────────────────────────────
33
+ const ERC20_TRANSFER_SELECTOR = '0xa9059cbb';
34
+ const ERC20_TRANSFER_FROM_SELECTOR = '0x23b872dd';
35
+ // ERC-721 safeTransferFrom — same recipient offset as ERC-20 transferFrom
36
+ // (second 32-byte slot). Two overloads; both hit the same decode path:
37
+ // safeTransferFrom(address,address,uint256) → 0x42842e0e (3-arg)
38
+ // safeTransferFrom(address,address,uint256,bytes) → 0xb88d4fde (4-arg, common in wallet SDKs)
39
+ const ERC721_SAFE_TRANSFER_FROM_SELECTOR = '0x42842e0e';
40
+ const ERC721_SAFE_TRANSFER_FROM_BYTES_SELECTOR = '0xb88d4fde';
41
+ /**
42
+ * True when `data`'s selector is a plain ERC-20 `transfer`/`transferFrom` —
43
+ * the two calldata shapes where the call target IS the token being moved, so
44
+ * a recipient that is itself a known token contract strands the funds and
45
+ * `assertSafeTokenTransferDestination` applies. ERC-721 `safeTransferFrom`
46
+ * deliberately returns false: the 721 standard's on-chain `onERC721Received`
47
+ * check already reverts a transfer to a non-receiver contract, so extending
48
+ * the registry guard there would add false-positive surface without closing
49
+ * a loss path. Every other selector is an arbitrary contract call and stays
50
+ * out of scope.
51
+ */
52
+ export function isErc20TransferCalldata(data) {
53
+ if (typeof data !== 'string')
54
+ return false;
55
+ const hex = data.startsWith('0x') ? data : `0x${data}`;
56
+ const selector = hex.slice(0, 10).toLowerCase();
57
+ return selector === ERC20_TRANSFER_SELECTOR || selector === ERC20_TRANSFER_FROM_SELECTOR;
58
+ }
59
+ /**
60
+ * If `data` looks like an ERC-20 `transfer`/`transferFrom` (or the
61
+ * same-shaped ERC-721 `safeTransferFrom`) call, return the decoded recipient
62
+ * address (lower-cased, `0x`-prefixed). Otherwise returns `null`.
63
+ *
64
+ * A contract-call builder that sets `to = <token contract>` + `data =
65
+ * <encoded transfer>` must run this to check the ACTUAL recipient —
66
+ * otherwise a destination guard that only vets the token contract address
67
+ * lets the real recipient slip through unchecked.
68
+ *
69
+ * Calldata layout for `transfer(address,uint256)`:
70
+ * 0x00–0x04 selector (4 bytes)
71
+ * 0x04–0x24 recipient (32-byte padded; address in last 20 bytes)
72
+ * 0x24–0x44 amount
73
+ *
74
+ * For `transferFrom(address,address,uint256)` (ERC-20) and
75
+ * `safeTransferFrom(address,address,uint256[,bytes])` (ERC-721 — same head layout):
76
+ * 0x00–0x04 selector
77
+ * 0x04–0x24 sender
78
+ * 0x24–0x44 recipient
79
+ * 0x44–0x64 amount / tokenId
80
+ */
81
+ export function decodeErc20Recipient(data) {
82
+ if (typeof data !== 'string')
83
+ return null;
84
+ const hex = data.startsWith('0x') ? data : `0x${data}`;
85
+ if (hex.length < 10)
86
+ return null;
87
+ const selector = hex.slice(0, 10).toLowerCase();
88
+ let recipientSliceStart;
89
+ if (selector === ERC20_TRANSFER_SELECTOR) {
90
+ // recipient is at bytes 4..36 → hex chars 10..74, last 40 chars = addr
91
+ recipientSliceStart = 10;
92
+ }
93
+ else if (selector === ERC20_TRANSFER_FROM_SELECTOR ||
94
+ selector === ERC721_SAFE_TRANSFER_FROM_SELECTOR ||
95
+ selector === ERC721_SAFE_TRANSFER_FROM_BYTES_SELECTOR) {
96
+ // recipient is at bytes 36..68 → hex chars 74..138, last 40 chars = addr
97
+ recipientSliceStart = 74;
98
+ }
99
+ else {
100
+ return null;
101
+ }
102
+ const slotEnd = recipientSliceStart + 64;
103
+ if (hex.length < slotEnd)
104
+ return null;
105
+ const slot = hex.slice(recipientSliceStart, slotEnd);
106
+ // Recipient occupies the last 40 hex chars (rightmost 20 bytes) of the slot.
107
+ const addr = `0x${slot.slice(24).toLowerCase()}`;
108
+ if (!EVM_ADDRESS_RE.test(addr))
109
+ return null;
110
+ return addr;
111
+ }
112
+ // ERC-20 approve(address spender, uint256 amount) — 0x095ea7b3. The SPENDER
113
+ // receives spend authority over the owner's tokens; a raw approve built via
114
+ // an arbitrary contract-call path is OPAQUE (no spender decode, no
115
+ // WYSIWYS surface) unless decoded explicitly.
116
+ export const ERC20_APPROVE_SELECTOR = '0x095ea7b3';
117
+ /**
118
+ * If `data` is an ERC-20 `approve(address spender, uint256 amount)` call,
119
+ * decode the SPENDER (lower-cased, `0x`-prefixed) + the raw allowance
120
+ * amount. Otherwise null. Mirrors `decodeErc20Recipient`'s slot math:
121
+ * spender = first 32-byte slot (bytes 4..36), amount = second slot (bytes
122
+ * 36..68).
123
+ */
124
+ export function decodeErc20Approve(data) {
125
+ if (typeof data !== 'string')
126
+ return null;
127
+ const hex = data.startsWith('0x') ? data : `0x${data}`;
128
+ if (hex.slice(0, 10).toLowerCase() !== ERC20_APPROVE_SELECTOR)
129
+ return null;
130
+ // 4-byte selector + 32-byte spender + 32-byte amount = 138 hex chars incl the `0x`.
131
+ if (hex.length < 138)
132
+ return null;
133
+ const spender = `0x${hex.slice(10, 74).slice(24).toLowerCase()}`;
134
+ if (!EVM_ADDRESS_RE.test(spender))
135
+ return null;
136
+ let amount;
137
+ try {
138
+ amount = BigInt(`0x${hex.slice(74, 138)}`);
139
+ }
140
+ catch {
141
+ return null;
142
+ }
143
+ return { spender, amount };
144
+ }
145
+ /**
146
+ * Extract the ERC-20/721 transfer RECIPIENT from a `function_sig` + `args`
147
+ * shape — the alternative to raw ABI-encoded `data` some builders accept
148
+ * (function signature + positional args, ABI-encoded server/caller-side
149
+ * AFTER any pre-dispatch destination guard already ran). Without this, a
150
+ * transfer expressed as `function_sig: "transfer(address,uint256)"` +
151
+ * `args: [<recipient>, <amount>]` has no `data` for `decodeErc20Recipient`
152
+ * to see and a destination guard silently no-ops.
153
+ *
154
+ * Mirrors `decodeErc20Recipient`'s selector→slot mapping on the parsed
155
+ * signature: `transfer(address,uint256)` → `args[0]`;
156
+ * `transferFrom`/`safeTransferFrom(address from,address to,…)` → `args[1]`
157
+ * (the recipient is the SECOND address, never `from`). A non-transfer
158
+ * signature (or one that doesn't match either shape) → `null`.
159
+ */
160
+ export function decodeErc20RecipientFromSig(functionSig, args) {
161
+ if (typeof functionSig !== 'string' || !Array.isArray(args))
162
+ return null;
163
+ // Accept "function transfer(address,uint256)" or "transfer(address,uint256)".
164
+ const m = functionSig
165
+ .replace(/^\s*function\s+/i, '')
166
+ .trim()
167
+ .match(/^(\w+)\s*\(([^)]*)\)$/);
168
+ if (!m)
169
+ return null;
170
+ const name = m[1];
171
+ // Strip any inline arg names ("address to" → "address") so we compare pure types.
172
+ const argTypes = m[2].split(',').map(t => t.trim().split(/\s+/)[0]);
173
+ const isUint256 = (type) => type === 'uint' || type === 'uint256';
174
+ let idx;
175
+ if (name === 'transfer' && argTypes.length === 2 && argTypes[0] === 'address' && isUint256(argTypes[1])) {
176
+ idx = 0; // transfer(address to, uint256 amount) — recipient is the FIRST arg
177
+ }
178
+ else if (name === 'transferFrom' &&
179
+ argTypes.length === 3 &&
180
+ argTypes[0] === 'address' &&
181
+ argTypes[1] === 'address' &&
182
+ isUint256(argTypes[2])) {
183
+ idx = 1; // transferFrom(address from, address to, uint256 amount) — recipient is the SECOND arg
184
+ }
185
+ else if (name === 'safeTransferFrom' &&
186
+ (argTypes.length === 3 || (argTypes.length === 4 && argTypes[3] === 'bytes')) &&
187
+ argTypes[0] === 'address' &&
188
+ argTypes[1] === 'address' &&
189
+ isUint256(argTypes[2])) {
190
+ idx = 1; // ERC-721 safeTransferFrom overloads — recipient is the SECOND arg
191
+ }
192
+ else {
193
+ return null;
194
+ }
195
+ if (args.length !== argTypes.length)
196
+ return null;
197
+ const raw = args[idx];
198
+ if (typeof raw !== 'string')
199
+ return null;
200
+ const addr = raw.trim().toLowerCase();
201
+ return EVM_ADDRESS_RE.test(addr) ? addr : null;
202
+ }
203
+ //# sourceMappingURL=tokenTransferGuards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenTransferGuards.js","sourceRoot":"","sources":["../../../../../packages/core/chain/security/tokenTransferGuards.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AAExE,MAAM,cAAc,GAAG,qBAAqB,CAAA;AAE5C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kCAAkC,CAChD,KAAa,EACb,SAAiB,EACjB,oBAAwC;IAExC,IAAI,CAAC,oBAAoB;QAAE,OAAM;IACjC,MAAM,GAAG,GAAG,gBAAgB,CAAC,KAAc,CAAC,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAA;IACvE,IAAI,CAAC,GAAG;QAAE,OAAM;IAChB,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,EAAE,KAAK,oBAAoB,CAAC,WAAW,EAAE,CAAA;IAClF,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CACb,0CAA0C,GAAG,CAAC,MAAM,WAAW,GAAG,CAAC,MAAM,kBAAkB;YACzF,IAAI,SAAS,gFAAgF;YAC7F,mDAAmD,CACtD,CAAA;IACH,CAAC;IACD,MAAM,IAAI,KAAK,CACb,8CAA8C,SAAS,WAAW,GAAG,CAAC,MAAM,sBAAsB,KAAK,IAAI;QACzG,gFAAgF;QAChF,mDAAmD,CACtD,CAAA;AACH,CAAC;AAED,gFAAgF;AAEhF,MAAM,uBAAuB,GAAG,YAAY,CAAA;AAC5C,MAAM,4BAA4B,GAAG,YAAY,CAAA;AACjD,0EAA0E;AAC1E,uEAAuE;AACvE,yEAAyE;AACzE,gGAAgG;AAChG,MAAM,kCAAkC,GAAG,YAAY,CAAA;AACvD,MAAM,wCAAwC,GAAG,YAAY,CAAA;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,U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AC;QACrB,QAAQ,CAAC,CAAC,CAAC,KAAK,SAAS;QACzB,QAAQ,CAAC,CAAC,CAAC,KAAK,SAAS;QACzB,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EACtB,CAAC;QACD,GAAG,GAAG,CAAC,CAAA,CAAC,uFAAuF;IACjG,CAAC;SAAM,IACL,IAAI,KAAK,kBAAkB;QAC3B,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC;QAC7E,QAAQ,CAAC,CAAC,CAAC,KAAK,SAAS;QACzB,QAAQ,CAAC,CAAC,CAAC,KAAK,SAAS;QACzB,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EACtB,CAAC;QACD,GAAG,GAAG,CAAC,CAAA,CAAC,mEAAmE;IAC7E,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IAChD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA;IACrB,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IACxC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IACrC,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AAChD,CAAC"}
@@ -1,4 +1,10 @@
1
1
  import { OtherChain } from '@vultisig/core-chain/Chain';
2
2
  import { TxStatusResolver } from '../resolver.js';
3
+ /**
4
+ * Resolves a TON transaction by the hash of the external message that carried it.
5
+ * Success requires the transaction to be un-aborted *and* to have cleared both the
6
+ * compute and the action phase; a transaction the indexer knows but hasn't fully
7
+ * described yet stays pending.
8
+ */
3
9
  export declare const getTonTxStatus: TxStatusResolver<OtherChain.Ton>;
4
10
  //# sourceMappingURL=ton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ton.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/chain/tx/status/resolvers/ton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAM9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAiB9C,eAAO,MAAM,cAAc,EAAE,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAoC3D,CAAA"}
1
+ {"version":3,"file":"ton.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/chain/tx/status/resolvers/ton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAM9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AA0D9C;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAmC3D,CAAA"}
@@ -3,6 +3,36 @@ import { chainFeeCoin } from '@vultisig/core-chain/coin/chainFeeCoin';
3
3
  import { rootApiUrl } from '@vultisig/core-config';
4
4
  import { attempt } from '@vultisig/lib-utils/attempt';
5
5
  import { queryUrl } from '@vultisig/lib-utils/query/queryUrl';
6
+ /**
7
+ * TVM exit codes 0 and 1 are the success conventions; any other code is a revert.
8
+ * An absent code means the message had no compute phase (a plain transfer to a
9
+ * wallet), which is not a failure.
10
+ */
11
+ const hasComputePhaseFailed = (computePhase) => {
12
+ const exitCode = computePhase?.exit_code;
13
+ return exitCode !== undefined && exitCode !== 0 && exitCode !== 1;
14
+ };
15
+ /**
16
+ * The action phase is where the wallet contract actually emits the outgoing
17
+ * transfer, so it is where the money moves. A transaction can pass its compute
18
+ * phase and land un-aborted while its action phase moved nothing — the seqno is
19
+ * consumed either way — so this is what separates a real send from a silent
20
+ * no-op. `result_code` is checked alongside `success` because indexers do not
21
+ * always populate both.
22
+ */
23
+ const hasActionPhaseFailed = (actionPhase) => {
24
+ if (!actionPhase) {
25
+ return false;
26
+ }
27
+ const { success, no_funds, result_code, skipped_actions } = actionPhase;
28
+ return success === false || no_funds === true || (result_code ?? 0) !== 0 || (skipped_actions ?? 0) > 0;
29
+ };
30
+ /**
31
+ * Resolves a TON transaction by the hash of the external message that carried it.
32
+ * Success requires the transaction to be un-aborted *and* to have cleared both the
33
+ * compute and the action phase; a transaction the indexer knows but hasn't fully
34
+ * described yet stays pending.
35
+ */
6
36
  export const getTonTxStatus = async ({ hash }) => {
7
37
  const url = `${rootApiUrl}/ton/v3/transactionsByMessage?msg_hash=${hash}&direction=in&limit=1`;
8
38
  const { data: response, error } = await attempt(queryUrl(url));
@@ -10,16 +40,12 @@ export const getTonTxStatus = async ({ hash }) => {
10
40
  return { status: 'pending', isKnown: false };
11
41
  }
12
42
  const tx = response.transactions[0];
13
- // Check if transaction was aborted
14
- if (tx.description?.aborted) {
15
- return { status: 'error' };
43
+ const { description } = tx;
44
+ if (!description) {
45
+ // Indexed, but the execution details haven't landed yet. Keep polling rather
46
+ // than reading the missing phases as success.
47
+ return { status: 'pending', isKnown: true };
16
48
  }
17
- // Check compute phase exit code
18
- const exitCode = tx.description?.compute_ph?.exit_code;
19
- // Exit code 0 or 1 indicates success
20
- // If no exit code is present (simple transfers), assume success
21
- const success = exitCode === undefined || exitCode === 0 || exitCode === 1;
22
- const status = success ? 'success' : 'error';
23
49
  const feeCoin = chainFeeCoin[Chain.Ton];
24
50
  const feeStr = tx.total_fees;
25
51
  const receipt = feeStr != null && feeStr !== ''
@@ -29,6 +55,9 @@ export const getTonTxStatus = async ({ hash }) => {
29
55
  feeTicker: feeCoin.ticker,
30
56
  }
31
57
  : undefined;
32
- return { status, receipt };
58
+ const failed = description.aborted === true ||
59
+ hasComputePhaseFailed(description.compute_ph) ||
60
+ hasActionPhaseFailed(description.action);
61
+ return { status: failed ? 'error' : 'success', receipt };
33
62
  };
34
63
  //# sourceMappingURL=ton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ton.js","sourceRoot":"","sources":["../../../../../../../packages/core/chain/tx/status/resolvers/ton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAA;AAmB7D,MAAM,CAAC,MAAM,cAAc,GAAqC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;IACjF,MAAM,GAAG,GAAG,GAAG,UAAU,0CAA0C,IAAI,uBAAuB,CAAA;IAE9F,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,MAAM,OAAO,CAAC,QAAQ,CAA0B,GAAG,CAAC,CAAC,CAAA;IAEvF,IAAI,KAAK,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7D,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;IAC9C,CAAC;IAED,MAAM,EAAE,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;IAEnC,mCAAmC;IACnC,IAAI,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,CAAC;QAC5B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;IAC5B,CAAC;IAED,gCAAgC;IAChC,MAAM,QAAQ,GAAG,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,CAAA;IAEtD,qCAAqC;IACrC,gEAAgE;IAChE,MAAM,OAAO,GAAG,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK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MAAM,CAAC,MAAM,CAAC;YACzB,WAAW,EAAE,OAAO,CAAC,QAAQ;YAC7B,SAAS,EAAE,OAAO,CAAC,MAAM;SAC1B;QACH,CAAC,CAAC,SAAS,CAAA;IAEf,MAAM,MAAM,GACV,WAAW,CAAC,OAAO,KAAK,IAAI;QAC5B,qBAAqB,CAAC,WAAW,CAAC,UAAU,CAAC;QAC7C,oBAAoB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;IAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,CAAA;AAC1D,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vultisig/core-chain",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "description": "Blockchain chain logic shared across Vultisig clients",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -240,6 +240,11 @@
240
240
  "import": "./dist/chains/cosmos/cosmosGasLimitRecord.js",
241
241
  "default": "./dist/chains/cosmos/cosmosGasLimitRecord.js"
242
242
  },
243
+ "./chains/cosmos/cosmosHrp": {
244
+ "types": "./dist/chains/cosmos/cosmosHrp.d.ts",
245
+ "import": "./dist/chains/cosmos/cosmosHrp.js",
246
+ "default": "./dist/chains/cosmos/cosmosHrp.js"
247
+ },
243
248
  "./chains/cosmos/cosmosMemoCap": {
244
249
  "types": "./dist/chains/cosmos/cosmosMemoCap.d.ts",
245
250
  "import": "./dist/chains/cosmos/cosmosMemoCap.js",
@@ -1648,6 +1653,11 @@
1648
1653
  "import": "./dist/security/dangerousAddresses.js",
1649
1654
  "default": "./dist/security/dangerousAddresses.js"
1650
1655
  },
1656
+ "./security/tokenTransferGuards": {
1657
+ "types": "./dist/security/tokenTransferGuards.d.ts",
1658
+ "import": "./dist/security/tokenTransferGuards.js",
1659
+ "default": "./dist/security/tokenTransferGuards.js"
1660
+ },
1651
1661
  "./signing/SignatureAlgorithm": {
1652
1662
  "types": "./dist/signing/SignatureAlgorithm.d.ts",
1653
1663
  "import": "./dist/signing/SignatureAlgorithm.js",
@@ -2402,6 +2412,7 @@
2402
2412
  "@trustwallet/wallet-core": "^4.7.3",
2403
2413
  "@vultisig/core-config": "0.9.1",
2404
2414
  "@vultisig/lib-utils": "0.10.6",
2415
+ "@vultisig/mpc-types": "0.3.0",
2405
2416
  "bip32": "^5.0.1",
2406
2417
  "bitcoinjs-lib": "^7.0.1",
2407
2418
  "bs58": "^6.0.0",