@qntx/wallet-chains 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bitcoin-sign.mjs +1 -1
- package/dist/bitcoin.d.mts +1 -1
- package/dist/bitcoin.mjs +1 -1
- package/dist/evm-sign.d.mts +1 -1
- package/dist/evm-sign.mjs +28 -2
- package/dist/evm-sign.mjs.map +1 -1
- package/dist/evm.d.mts +111 -5
- package/dist/evm.mjs +570 -21
- package/dist/evm.mjs.map +1 -1
- package/dist/{index-DYwm4-Ec.d.mts → index-DpL5hvPl.d.mts} +102 -4
- package/dist/index.d.mts +2 -2
- package/dist/{message-ChhEZ0lx.mjs → message-zf3XHwwc.mjs} +2 -2
- package/dist/{message-ChhEZ0lx.mjs.map → message-zf3XHwwc.mjs.map} +1 -1
- package/dist/solana.d.mts +30 -1
- package/dist/solana.mjs +507 -23
- package/dist/solana.mjs.map +1 -1
- package/dist/src-8NZeEnrW.mjs.map +1 -1
- package/dist/{typed-data-J5g2WemC.mjs → typed-data-B4PJ1v8F.mjs} +97 -6
- package/dist/typed-data-B4PJ1v8F.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/typed-data-J5g2WemC.mjs.map +0 -1
package/dist/bitcoin-sign.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ChainError } from "./src-8NZeEnrW.mjs";
|
|
2
|
-
import { a as bitcoinNetwork, n as signBip322Simple, r as signLegacyMessage } from "./message-
|
|
2
|
+
import { a as bitcoinNetwork, n as signBip322Simple, r as signLegacyMessage } from "./message-zf3XHwwc.mjs";
|
|
3
3
|
import { Address, OutScript } from "@scure/btc-signer/payment.js";
|
|
4
4
|
import { SigHash, Transaction } from "@scure/btc-signer/transaction.js";
|
|
5
5
|
// src/bitcoin/sign.ts
|
package/dist/bitcoin.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as BitcoinTemplate,
|
|
1
|
+
import { a as BitcoinTemplate, l as DisplayIntent, v as SignRequest, x as Verifiability } from "./index-DpL5hvPl.mjs";
|
|
2
2
|
import { NETWORK } from "@scure/btc-signer/utils.js";
|
|
3
3
|
type BitcoinNetwork = {
|
|
4
4
|
readonly caip2: string;
|
package/dist/bitcoin.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as ChainError } from "./src-8NZeEnrW.mjs";
|
|
2
2
|
import { n as requestBase, t as isRecord$2 } from "./account-ref-D2rW_qlI.mjs";
|
|
3
|
-
import { a as bitcoinNetwork, i as BITCOIN_NETWORKS, t as bip322ToSpendTxid } from "./message-
|
|
3
|
+
import { a as bitcoinNetwork, i as BITCOIN_NETWORKS, t as bip322ToSpendTxid } from "./message-zf3XHwwc.mjs";
|
|
4
4
|
import { schnorr, secp256k1 } from "@noble/curves/secp256k1.js";
|
|
5
5
|
import { Address, OutScript, p2pkh, p2sh, p2tr, p2wpkh } from "@scure/btc-signer/payment.js";
|
|
6
6
|
import { taprootTweakPubkey } from "@scure/btc-signer/utils.js";
|
package/dist/evm-sign.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as EvmTransaction } from "./index-
|
|
1
|
+
import { d as EvmTransaction } from "./index-DpL5hvPl.mjs";
|
|
2
2
|
/** Signs a normalized transaction; returns the serialized signed envelope. */
|
|
3
3
|
export declare const signEvmTransaction: (tx: EvmTransaction, privateKey: Uint8Array) => Uint8Array;
|
|
4
4
|
/** EIP-191 personal_sign; returns the 65-byte signature r‖s‖v with v∈{27,28}. */
|
package/dist/evm-sign.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { t as ChainError } from "./src-8NZeEnrW.mjs";
|
|
2
|
-
import { i as parseTypedData } from "./typed-data-
|
|
3
|
-
import * as TypedData from "ox/TypedData";
|
|
2
|
+
import { i as parseTypedData } from "./typed-data-B4PJ1v8F.mjs";
|
|
4
3
|
import * as Hex from "ox/Hex";
|
|
4
|
+
import * as TypedData from "ox/TypedData";
|
|
5
|
+
import * as Authorization from "ox/Authorization";
|
|
5
6
|
import * as PersonalMessage from "ox/PersonalMessage";
|
|
6
7
|
import * as Secp256k1 from "ox/Secp256k1";
|
|
7
8
|
import * as Signature from "ox/Signature";
|
|
8
9
|
import * as TxEnvelopeEip1559 from "ox/TxEnvelopeEip1559";
|
|
9
10
|
import * as TxEnvelopeEip2930 from "ox/TxEnvelopeEip2930";
|
|
11
|
+
import * as TxEnvelopeEip7702 from "ox/TxEnvelopeEip7702";
|
|
10
12
|
import * as TxEnvelopeLegacy from "ox/TxEnvelopeLegacy";
|
|
11
13
|
// src/evm/sign.ts
|
|
12
14
|
/**
|
|
@@ -65,6 +67,30 @@ const signEvmTransaction = (tx, privateKey) => {
|
|
|
65
67
|
const signature = sign(TxEnvelopeEip2930.getSignPayload(envelope), privateKeyHex);
|
|
66
68
|
return Hex.toBytes(TxEnvelopeEip2930.serialize(envelope, { signature }));
|
|
67
69
|
}
|
|
70
|
+
if (tx.type === "eip7702") {
|
|
71
|
+
const auth = {
|
|
72
|
+
chainId: tx.chainId,
|
|
73
|
+
address: hex(tx.authorization.address, "authorization.address"),
|
|
74
|
+
nonce: BigInt(tx.nonce + 1)
|
|
75
|
+
};
|
|
76
|
+
const authSignature = sign(Authorization.getSignPayload(auth), privateKeyHex);
|
|
77
|
+
const envelope = {
|
|
78
|
+
...base,
|
|
79
|
+
type: "eip7702",
|
|
80
|
+
to: hex(tx.to, "to"),
|
|
81
|
+
accessList: tx.accessList.map(accessEntry),
|
|
82
|
+
maxFeePerGas: BigInt(tx.maxFeePerGas),
|
|
83
|
+
maxPriorityFeePerGas: BigInt(tx.maxPriorityFeePerGas),
|
|
84
|
+
authorizationList: [{
|
|
85
|
+
...auth,
|
|
86
|
+
r: authSignature.r,
|
|
87
|
+
s: authSignature.s,
|
|
88
|
+
yParity: authSignature.yParity ?? 0
|
|
89
|
+
}]
|
|
90
|
+
};
|
|
91
|
+
const signature = sign(TxEnvelopeEip7702.getSignPayload(envelope), privateKeyHex);
|
|
92
|
+
return Hex.toBytes(TxEnvelopeEip7702.serialize(envelope, { signature }));
|
|
93
|
+
}
|
|
68
94
|
const envelope = {
|
|
69
95
|
...base,
|
|
70
96
|
type: "eip1559",
|
package/dist/evm-sign.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evm-sign.mjs","names":[],"sources":["../src/evm/sign.ts"],"sourcesContent":["/**\n * /evm/sign — deterministic (RFC 6979) ECDSA signing over the chain's canonical payloads. Inputs\n * must already be normalized: the kernel calls `normalizeEvm` first and rejects on a ChainError. No\n * key caching; the caller wipes key bytes.\n */\nimport * as Hex from \"ox/Hex\";\nimport * as PersonalMessage from \"ox/PersonalMessage\";\nimport * as Secp256k1 from \"ox/Secp256k1\";\nimport * as Signature from \"ox/Signature\";\nimport * as TxEnvelopeEip1559 from \"ox/TxEnvelopeEip1559\";\nimport * as TxEnvelopeEip2930 from \"ox/TxEnvelopeEip2930\";\nimport * as TxEnvelopeLegacy from \"ox/TxEnvelopeLegacy\";\nimport * as TypedData from \"ox/TypedData\";\n\nimport { ChainError } from \"../index.ts\";\nimport type { EvmAccessListEntry, EvmTransaction } from \"../index.ts\";\nimport { parseTypedData } from \"./typed-data.ts\";\n\n/** Validates a string is `0x`-hex and narrows it for ox's branded type. */\nfunction assertHex(value: string, field: string): asserts value is `0x${string}` {\n if (!/^0x(?:[0-9a-fA-F]{2})*$/.test(value)) {\n throw new ChainError(\"invalid-quantity\", `${field} must be 0x-prefixed bytes`);\n }\n}\n\nconst hex = (value: string, field: string): `0x${string}` => {\n assertHex(value, field);\n return value;\n};\n\nconst key = (privateKey: Uint8Array): `0x${string}` => {\n if (privateKey.length !== 32) {\n throw new ChainError(\"invalid-request\", \"private key must be 32 bytes\");\n }\n return Hex.fromBytes(privateKey);\n};\n\nconst accessEntry = (entry: EvmAccessListEntry) => ({\n address: hex(entry.address, \"accessList.address\"),\n storageKeys: entry.storageKeys.map((k) => hex(k, \"accessList.storageKeys\")),\n});\n\nconst sign = (payload: `0x${string}`, privateKey: `0x${string}`) =>\n Secp256k1.sign({ payload, privateKey, as: \"Object\" as const });\n\n/** Signs a normalized transaction; returns the serialized signed envelope. */\nexport const signEvmTransaction = (tx: EvmTransaction, privateKey: Uint8Array): Uint8Array => {\n const privateKeyHex = key(privateKey);\n const base = {\n chainId: tx.chainId,\n to: tx.to === undefined ? undefined : hex(tx.to, \"to\"),\n data: hex(tx.data, \"data\"),\n value: BigInt(tx.value),\n nonce: BigInt(tx.nonce),\n gas: BigInt(tx.gas),\n };\n if (tx.type === \"legacy\") {\n const envelope = { ...base, type: \"legacy\" as const, gasPrice: BigInt(tx.gasPrice) };\n const signature = sign(TxEnvelopeLegacy.getSignPayload(envelope), privateKeyHex);\n return Hex.toBytes(TxEnvelopeLegacy.serialize(envelope, { signature }));\n }\n if (tx.type === \"eip2930\") {\n const envelope = {\n ...base,\n type: \"eip2930\" as const,\n gasPrice: BigInt(tx.gasPrice),\n accessList: tx.accessList.map(accessEntry),\n };\n const signature = sign(TxEnvelopeEip2930.getSignPayload(envelope), privateKeyHex);\n return Hex.toBytes(TxEnvelopeEip2930.serialize(envelope, { signature }));\n }\n const envelope = {\n ...base,\n type: \"eip1559\" as const,\n accessList: tx.accessList.map(accessEntry),\n maxFeePerGas: BigInt(tx.maxFeePerGas),\n maxPriorityFeePerGas: BigInt(tx.maxPriorityFeePerGas),\n };\n const signature = sign(TxEnvelopeEip1559.getSignPayload(envelope), privateKeyHex);\n return Hex.toBytes(TxEnvelopeEip1559.serialize(envelope, { signature }));\n};\n\n/** 65-byte r‖s‖v; `Signature.toBytes` emits v = 27 + yParity already. */\nconst rs_v = (signature: Signature.Signature): Uint8Array => Signature.toBytes(signature);\n\n/** EIP-191 personal_sign; returns the 65-byte signature r‖s‖v with v∈{27,28}. */\nexport const signEvmPersonalMessage = (message: Uint8Array, privateKey: Uint8Array): Uint8Array => {\n const payload = PersonalMessage.getSignPayload(Hex.fromBytes(message));\n return rs_v(Signature.from(sign(payload, key(privateKey))));\n};\n\n/** EIP-712 typed data; returns the 65-byte signature r‖s‖v with v∈{27,28}. */\nexport const signEvmTypedData = (typedData: string, privateKey: Uint8Array): Uint8Array => {\n const { json } = parseTypedData(typedData);\n const payload = TypedData.getSignPayload(json);\n return rs_v(Signature.from(sign(payload, key(privateKey))));\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"evm-sign.mjs","names":[],"sources":["../src/evm/sign.ts"],"sourcesContent":["/**\n * /evm/sign — deterministic (RFC 6979) ECDSA signing over the chain's canonical payloads. Inputs\n * must already be normalized: the kernel calls `normalizeEvm` first and rejects on a ChainError. No\n * key caching; the caller wipes key bytes.\n */\nimport * as Authorization from \"ox/Authorization\";\nimport * as Hex from \"ox/Hex\";\nimport * as PersonalMessage from \"ox/PersonalMessage\";\nimport * as Secp256k1 from \"ox/Secp256k1\";\nimport * as Signature from \"ox/Signature\";\nimport * as TxEnvelopeEip1559 from \"ox/TxEnvelopeEip1559\";\nimport * as TxEnvelopeEip2930 from \"ox/TxEnvelopeEip2930\";\nimport * as TxEnvelopeEip7702 from \"ox/TxEnvelopeEip7702\";\nimport * as TxEnvelopeLegacy from \"ox/TxEnvelopeLegacy\";\nimport * as TypedData from \"ox/TypedData\";\n\nimport { ChainError } from \"../index.ts\";\nimport type { EvmAccessListEntry, EvmTransaction } from \"../index.ts\";\nimport { parseTypedData } from \"./typed-data.ts\";\n\n/** Validates a string is `0x`-hex and narrows it for ox's branded type. */\nfunction assertHex(value: string, field: string): asserts value is `0x${string}` {\n if (!/^0x(?:[0-9a-fA-F]{2})*$/.test(value)) {\n throw new ChainError(\"invalid-quantity\", `${field} must be 0x-prefixed bytes`);\n }\n}\n\nconst hex = (value: string, field: string): `0x${string}` => {\n assertHex(value, field);\n return value;\n};\n\nconst key = (privateKey: Uint8Array): `0x${string}` => {\n if (privateKey.length !== 32) {\n throw new ChainError(\"invalid-request\", \"private key must be 32 bytes\");\n }\n return Hex.fromBytes(privateKey);\n};\n\nconst accessEntry = (entry: EvmAccessListEntry) => ({\n address: hex(entry.address, \"accessList.address\"),\n storageKeys: entry.storageKeys.map((k) => hex(k, \"accessList.storageKeys\")),\n});\n\nconst sign = (payload: `0x${string}`, privateKey: `0x${string}`) =>\n Secp256k1.sign({ payload, privateKey, as: \"Object\" as const });\n\n/** Signs a normalized transaction; returns the serialized signed envelope. */\nexport const signEvmTransaction = (tx: EvmTransaction, privateKey: Uint8Array): Uint8Array => {\n const privateKeyHex = key(privateKey);\n const base = {\n chainId: tx.chainId,\n to: tx.to === undefined ? undefined : hex(tx.to, \"to\"),\n data: hex(tx.data, \"data\"),\n value: BigInt(tx.value),\n nonce: BigInt(tx.nonce),\n gas: BigInt(tx.gas),\n };\n if (tx.type === \"legacy\") {\n const envelope = { ...base, type: \"legacy\" as const, gasPrice: BigInt(tx.gasPrice) };\n const signature = sign(TxEnvelopeLegacy.getSignPayload(envelope), privateKeyHex);\n return Hex.toBytes(TxEnvelopeLegacy.serialize(envelope, { signature }));\n }\n if (tx.type === \"eip2930\") {\n const envelope = {\n ...base,\n type: \"eip2930\" as const,\n gasPrice: BigInt(tx.gasPrice),\n accessList: tx.accessList.map(accessEntry),\n };\n const signature = sign(TxEnvelopeEip2930.getSignPayload(envelope), privateKeyHex);\n return Hex.toBytes(TxEnvelopeEip2930.serialize(envelope, { signature }));\n }\n if (tx.type === \"eip7702\") {\n const auth = {\n chainId: tx.chainId,\n address: hex(tx.authorization.address, \"authorization.address\"),\n nonce: BigInt(tx.nonce + 1),\n };\n const authSignature = sign(Authorization.getSignPayload(auth), privateKeyHex);\n const envelope = {\n ...base,\n type: \"eip7702\" as const,\n to: hex(tx.to, \"to\"),\n accessList: tx.accessList.map(accessEntry),\n maxFeePerGas: BigInt(tx.maxFeePerGas),\n maxPriorityFeePerGas: BigInt(tx.maxPriorityFeePerGas),\n authorizationList: [\n {\n ...auth,\n r: authSignature.r,\n s: authSignature.s,\n yParity: authSignature.yParity ?? 0,\n },\n ],\n };\n const signature = sign(TxEnvelopeEip7702.getSignPayload(envelope), privateKeyHex);\n return Hex.toBytes(TxEnvelopeEip7702.serialize(envelope, { signature }));\n }\n const envelope = {\n ...base,\n type: \"eip1559\" as const,\n accessList: tx.accessList.map(accessEntry),\n maxFeePerGas: BigInt(tx.maxFeePerGas),\n maxPriorityFeePerGas: BigInt(tx.maxPriorityFeePerGas),\n };\n const signature = sign(TxEnvelopeEip1559.getSignPayload(envelope), privateKeyHex);\n return Hex.toBytes(TxEnvelopeEip1559.serialize(envelope, { signature }));\n};\n\n/** 65-byte r‖s‖v; `Signature.toBytes` emits v = 27 + yParity already. */\nconst rs_v = (signature: Signature.Signature): Uint8Array => Signature.toBytes(signature);\n\n/** EIP-191 personal_sign; returns the 65-byte signature r‖s‖v with v∈{27,28}. */\nexport const signEvmPersonalMessage = (message: Uint8Array, privateKey: Uint8Array): Uint8Array => {\n const payload = PersonalMessage.getSignPayload(Hex.fromBytes(message));\n return rs_v(Signature.from(sign(payload, key(privateKey))));\n};\n\n/** EIP-712 typed data; returns the 65-byte signature r‖s‖v with v∈{27,28}. */\nexport const signEvmTypedData = (typedData: string, privateKey: Uint8Array): Uint8Array => {\n const { json } = parseTypedData(typedData);\n const payload = TypedData.getSignPayload(json);\n return rs_v(Signature.from(sign(payload, key(privateKey))));\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,SAAS,UAAU,OAAe,OAA+C;CAC/E,IAAI,CAAC,0BAA0B,KAAK,KAAK,GACvC,MAAM,IAAI,WAAW,oBAAoB,GAAG,MAAM,2BAA2B;AAEjF;AAEA,MAAM,OAAO,OAAe,UAAiC;CAC3D,UAAU,OAAO,KAAK;CACtB,OAAO;AACT;AAEA,MAAM,OAAO,eAA0C;CACrD,IAAI,WAAW,WAAW,IACxB,MAAM,IAAI,WAAW,mBAAmB,8BAA8B;CAExE,OAAO,IAAI,UAAU,UAAU;AACjC;AAEA,MAAM,eAAe,WAA+B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iability } from "./index-DpL5hvPl.mjs";
|
|
2
|
+
import "ox/AbiFunction";
|
|
2
3
|
/** The native asset id in `AssetFlow` and simulated asset changes. */
|
|
3
4
|
export declare const EVM_NATIVE_ASSET = "native";
|
|
4
5
|
/** EIP-55 checksummed address, e.g. `0x52908400098527886E0F7030069857D2E4169EE7`. */
|
|
@@ -29,15 +30,51 @@ type EvmTokenTable = Readonly<Record<string, Readonly<Record<string, EvmToken>>>
|
|
|
29
30
|
/** The built-in table. */
|
|
30
31
|
export declare const evmTokenTable: EvmTokenTable;
|
|
31
32
|
export declare const lookupEvmToken: (table: EvmTokenTable, chainId: number, address: string) => EvmToken | undefined;
|
|
33
|
+
export declare const MAX_UINT256: bigint;
|
|
32
34
|
/** The canonical Permit2 deployment (the same address on every supported chain). */
|
|
33
35
|
export declare const PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
34
36
|
/** What the signer can guarantee about this request (WD-065). */
|
|
35
|
-
export declare const verifiabilityEvm: (request: SignRequest) => Verifiability;
|
|
37
|
+
export declare const verifiabilityEvm: (request: SignRequest, signer: string) => Verifiability;
|
|
36
38
|
/**
|
|
37
|
-
* Decodes a normalized request into a DisplayIntent.
|
|
38
|
-
*
|
|
39
|
+
* Decodes a normalized request into a DisplayIntent. `signer` is the address of the signing
|
|
40
|
+
* account; the token table parameter is for tests.
|
|
39
41
|
*/
|
|
40
|
-
export declare const decodeEvm: (request: SignRequest, table?: EvmTokenTable) => DisplayIntent;
|
|
42
|
+
export declare const decodeEvm: (request: SignRequest, signer: string, table?: EvmTokenTable) => DisplayIntent;
|
|
43
|
+
/** MetaMask Delegation Framework v1.3.0 DelegationManager — the same address on every chain. */
|
|
44
|
+
export declare const DELEGATION_MANAGER = "0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3";
|
|
45
|
+
/** ERC-4337 EntryPoint v0.8 — the same address on every chain. */
|
|
46
|
+
export declare const ENTRY_POINT_V08 = "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108";
|
|
47
|
+
/**
|
|
48
|
+
* Typed data whose domain targets an execution context over the signer's account turns a signature
|
|
49
|
+
* into execution rights: a Delegation the DelegationManager redeems, a PackedUserOperation the
|
|
50
|
+
* EntryPoint runs for a delegated 7702 account, or an action the account's own EIP-712 domain
|
|
51
|
+
* authorizes. A generic typed-data request must never produce such a signature.
|
|
52
|
+
*/
|
|
53
|
+
export declare const assertNoExecutionGrant: (domain: Record<string, unknown>, signer: string) => void;
|
|
54
|
+
/**
|
|
55
|
+
* MetaMask Delegation Framework EIP7702StatelessDeleGator v1.3.0 — deterministic CREATE2, the same
|
|
56
|
+
* address on every chain that supports it.
|
|
57
|
+
*/
|
|
58
|
+
export declare const EVM_DELEGATOR: {
|
|
59
|
+
readonly address: "0x63c0c19a282a1B52b07dD5a65b58948A07DAE32B";
|
|
60
|
+
readonly name: "EIP7702StatelessDeleGator";
|
|
61
|
+
readonly version: "1.3.0";
|
|
62
|
+
};
|
|
63
|
+
/** The EIP-7702 designator byte prefix: `0xef0100 ‖ address` marks a delegated account's code. */
|
|
64
|
+
export declare const EVM_DELEGATION_PREFIX = "0xef0100";
|
|
65
|
+
/** ERC-7821 batch-default self-call payload for `execute` on the delegator. */
|
|
66
|
+
export declare const encodeBatchExecute: (calls: ReadonlyArray<{
|
|
67
|
+
readonly to: string;
|
|
68
|
+
readonly value: bigint;
|
|
69
|
+
readonly data: string;
|
|
70
|
+
}>) => string;
|
|
71
|
+
type Execution = {
|
|
72
|
+
readonly to: string;
|
|
73
|
+
readonly value: bigint;
|
|
74
|
+
readonly data: string;
|
|
75
|
+
};
|
|
76
|
+
/** Decodes an `execute` call; undefined unless the encoding is canonical batch-default mode. */
|
|
77
|
+
export declare const decodeBatchExecute: (data: string) => ReadonlyArray<Execution> | undefined;
|
|
41
78
|
type TypedDataField = {
|
|
42
79
|
readonly name: string;
|
|
43
80
|
readonly type: string;
|
|
@@ -72,6 +109,75 @@ export declare const recoverEvmSigner: (request: Extract<SignRequest, {
|
|
|
72
109
|
readonly signedTransaction?: Uint8Array;
|
|
73
110
|
readonly signature?: Uint8Array;
|
|
74
111
|
}) => string;
|
|
112
|
+
/**
|
|
113
|
+
* The 0x AllowanceHolder (`exec`) is deployed at the same address on every chain the taker Settler
|
|
114
|
+
* supports. `exec` grants the caller a one-time allowance of `amount` of `token` to `operator`,
|
|
115
|
+
* then calls `target` with `data` (forwarding `msg.value`).
|
|
116
|
+
*/
|
|
117
|
+
export declare const ALLOWANCE_HOLDER = "0x0000000000001fF3684f28c67538d4D072C22734";
|
|
118
|
+
/** Chains whose AllowanceHolder + Settler deployment this decoder recognises. */
|
|
119
|
+
export declare const ZEROX_CHAINS: ReadonlySet<number>;
|
|
120
|
+
/**
|
|
121
|
+
* Whether `address` is a taker-feature (2) 0x Settler on `chainId`. Settlers deploy as a CREATE2
|
|
122
|
+
* shim whose CREATE child is the contract: `salt = (feature << 128) | (chainId << 64) | nonce`,
|
|
123
|
+
* `shim = CREATE2(deployer, salt, initHash)`, `settler = CREATE(shim, 1)`. Settler is redeployed
|
|
124
|
+
* roughly monthly, so nonces 1..256 leave decades of headroom; the loop runs 512 keccaks and is
|
|
125
|
+
* only reached for an AllowanceHolder `exec`. Feature 5 (bridge) is deliberately not matched.
|
|
126
|
+
*/
|
|
127
|
+
export declare const isZeroExSettler: (chainId: number, address: string) => boolean;
|
|
128
|
+
/**
|
|
129
|
+
* The `DisplayIntent` for a call to AllowanceHolder `exec` on a chain this decoder covers: a swap
|
|
130
|
+
* when the operator calls the taker Settler's own `execute` (operator == target, an on-chain
|
|
131
|
+
* Settler, a canonical inner call) and a generic one-time allowance otherwise. `undefined` when the
|
|
132
|
+
* call is not to AllowanceHolder or not `exec`.
|
|
133
|
+
*/
|
|
134
|
+
export declare const decodeZeroX: (chainId: number, call: {
|
|
135
|
+
readonly to: string | undefined;
|
|
136
|
+
readonly value: bigint;
|
|
137
|
+
readonly data: string;
|
|
138
|
+
}, table: EvmTokenTable) => (Pick<DisplayIntent, "summary" | "outflows" | "approvals" | "verifiability"> & {
|
|
139
|
+
readonly minimumReceived?: DisplayIntent["minimumReceived"];
|
|
140
|
+
}) | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Across SpokePool proxies per origin chain — UUPS upgradeable, so the kernel recognises them by
|
|
143
|
+
* address only. Verified against the Across deployments registry on 2026-11-08.
|
|
144
|
+
*/
|
|
145
|
+
export declare const ACROSS_SPOKEPOOLS: Readonly<Record<number, string>>;
|
|
146
|
+
/** Each pool's `wrappedNativeToken()` — read on-chain on 2026-11-08. */
|
|
147
|
+
export declare const ACROSS_WRAPPED_NATIVE: Readonly<Record<number, string>>;
|
|
148
|
+
type AcrossBridge = {
|
|
149
|
+
readonly outflows: ReadonlyArray<{
|
|
150
|
+
readonly to: string;
|
|
151
|
+
readonly amount: AssetAmount;
|
|
152
|
+
readonly verified: boolean;
|
|
153
|
+
}>;
|
|
154
|
+
readonly minimumReceived: ReadonlyArray<{
|
|
155
|
+
readonly to: string;
|
|
156
|
+
readonly amount: AssetAmount;
|
|
157
|
+
readonly verified: boolean;
|
|
158
|
+
}>;
|
|
159
|
+
readonly bridge: {
|
|
160
|
+
readonly destinationNetwork: string;
|
|
161
|
+
readonly fillDeadline: number;
|
|
162
|
+
readonly refundTo: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Decodes a `deposit`/`depositV3` to the chain's SpokePool — empty `message` only; bytes32 fields
|
|
167
|
+
* must carry left-padded EVM addresses (non-EVM destinations are not recognised). The deposit
|
|
168
|
+
* guarantees `outputAmount` on the destination chain or a refund to `depositor` after
|
|
169
|
+
* `fillDeadline`, so the intent's `minimumReceived` and `bridge` fields carry those terms.
|
|
170
|
+
*/
|
|
171
|
+
export declare const decodeAcross: (chainId: number, call: {
|
|
172
|
+
to: string | undefined;
|
|
173
|
+
data: string;
|
|
174
|
+
value: bigint;
|
|
175
|
+
}, table?: EvmTokenTable) => AcrossBridge | undefined;
|
|
176
|
+
/** The Lido contracts the kernel recognises by address — Ethereum mainnet only. */
|
|
177
|
+
export declare const LIDO_CHAIN = 1;
|
|
178
|
+
export declare const LIDO_STETH = "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84";
|
|
179
|
+
export declare const LIDO_WSTETH = "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0";
|
|
180
|
+
export declare const LIDO_QUEUE = "0x889edC2eDab5f40e902b864aD4d7AdE8E412F9B1";
|
|
75
181
|
/**
|
|
76
182
|
* Normalizes a SignRequest for the EVM family: exact key sets, chainId vs the CAIP-2 `network`,
|
|
77
183
|
* canonical quantities and EIP-55 addresses. Idempotent.
|