@keelcodes/sdk 2.6.1 → 2.7.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.
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keelcodes/sdk",
3
- "version": "2.6.1",
3
+ "version": "2.7.0",
4
4
  "description": "Keel SDK — unified access to payment / wallet / data / account modules over https://keel.codes",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",