@keelcodes/sdk 2.6.1 → 2.7.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.
|
@@ -13,6 +13,22 @@ export declare function encodeKernelFactoryData(chainConfig: ChainAAConfig, owne
|
|
|
13
13
|
factory: Address;
|
|
14
14
|
factoryData: Hex;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* 构建「用户钱包直接部署智能账户」的普通交易(**不是** UserOp)。
|
|
18
|
+
*
|
|
19
|
+
* 产品上的「点击创建智能账户」应走这条:用户 EOA 直接发这笔交易调 factory,
|
|
20
|
+
* gas 从 EOA 自身 native 余额扣,不经过 EntryPoint / paymaster。部署完成后
|
|
21
|
+
* 账户已存在,后续 UserOp 不再携带 factory/factoryData;账户零 native 时的
|
|
22
|
+
* 首笔 `approve(paymaster, amount)` 才需要 voucher 垫付。
|
|
23
|
+
*
|
|
24
|
+
* 懒部署路径(把 factoryData 塞进首笔 UserOp,由 EntryPoint 统一收 gas)与之
|
|
25
|
+
* 地址一致(同 owner + salt),可随时切换。
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildCreateAccountTx(chainConfig: ChainAAConfig, owner: Address, salt?: bigint): {
|
|
28
|
+
to: Address;
|
|
29
|
+
data: Hex;
|
|
30
|
+
value: 0n;
|
|
31
|
+
};
|
|
16
32
|
/** 从 createAccount 编码中解包 (data, salt) —— 供 factory.getAddress 预测复用。 */
|
|
17
33
|
export declare function unpackFactoryData(factoryData: Hex): {
|
|
18
34
|
data: Hex;
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.encodeKernelInitialize = encodeKernelInitialize;
|
|
21
21
|
exports.encodeKernelFactoryData = encodeKernelFactoryData;
|
|
22
|
+
exports.buildCreateAccountTx = buildCreateAccountTx;
|
|
22
23
|
exports.unpackFactoryData = unpackFactoryData;
|
|
23
24
|
exports.predictAccountAddress = predictAccountAddress;
|
|
24
25
|
const viem_1 = require("viem");
|
|
@@ -99,6 +100,21 @@ function encodeKernelFactoryData(chainConfig, owner, salt = 0n) {
|
|
|
99
100
|
}),
|
|
100
101
|
};
|
|
101
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* 构建「用户钱包直接部署智能账户」的普通交易(**不是** UserOp)。
|
|
105
|
+
*
|
|
106
|
+
* 产品上的「点击创建智能账户」应走这条:用户 EOA 直接发这笔交易调 factory,
|
|
107
|
+
* gas 从 EOA 自身 native 余额扣,不经过 EntryPoint / paymaster。部署完成后
|
|
108
|
+
* 账户已存在,后续 UserOp 不再携带 factory/factoryData;账户零 native 时的
|
|
109
|
+
* 首笔 `approve(paymaster, amount)` 才需要 voucher 垫付。
|
|
110
|
+
*
|
|
111
|
+
* 懒部署路径(把 factoryData 塞进首笔 UserOp,由 EntryPoint 统一收 gas)与之
|
|
112
|
+
* 地址一致(同 owner + salt),可随时切换。
|
|
113
|
+
*/
|
|
114
|
+
function buildCreateAccountTx(chainConfig, owner, salt = 0n) {
|
|
115
|
+
const { factory, factoryData } = encodeKernelFactoryData(chainConfig, owner, salt);
|
|
116
|
+
return { to: factory, data: factoryData, value: 0n };
|
|
117
|
+
}
|
|
102
118
|
/** 从 createAccount 编码中解包 (data, salt) —— 供 factory.getAddress 预测复用。 */
|
|
103
119
|
function unpackFactoryData(factoryData) {
|
|
104
120
|
const body = factoryData.slice(10);
|
package/dist/wallet/types.d.ts
CHANGED
|
@@ -90,17 +90,26 @@ export interface SessionCreated {
|
|
|
90
90
|
/** token paymaster 发现信息(不暴露私钥)。 */
|
|
91
91
|
export interface PaymasterInfo {
|
|
92
92
|
chainId: number;
|
|
93
|
+
/** 支持的链(多链部署时长度 > 1)。 */
|
|
94
|
+
chainIds?: number[];
|
|
93
95
|
paymaster: string;
|
|
94
96
|
/** voucher 签发地址(仅用于核对)。 */
|
|
95
97
|
signer: string;
|
|
96
98
|
voucher: {
|
|
97
99
|
maxCostWei: string;
|
|
100
|
+
/** 按链生效上限(已按调用方租户策略收敛)。 */
|
|
101
|
+
maxCostWeiByChain?: Record<string, string>;
|
|
98
102
|
ttlSec: number;
|
|
99
103
|
maxTtlSec: number;
|
|
100
104
|
perSenderPerDay: number;
|
|
101
105
|
/** 固定意图:只赞助 `approve(paymaster, amount)`。 */
|
|
102
106
|
intent: string;
|
|
103
107
|
};
|
|
108
|
+
/** 命中租户限额策略时返回;未命中为 null(走部署级默认)。 */
|
|
109
|
+
policy?: {
|
|
110
|
+
tenant: string;
|
|
111
|
+
label?: string;
|
|
112
|
+
} | null;
|
|
104
113
|
}
|
|
105
114
|
/** 首笔授权 voucher 申请(无需 native、无需已有 allowance)。 */
|
|
106
115
|
export interface PaymasterVoucherParams {
|
package/package.json
CHANGED