@keelcodes/sdk 2.5.0 → 2.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/dist/http.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { KeelConfig } from './types';
2
2
  /** SDK 版本(契约 §5,随包版本同步)。 */
3
- export declare const SDK_VERSION = "2.5.0";
3
+ export declare const SDK_VERSION = "2.5.1";
4
4
  export declare class HttpClient {
5
5
  private baseUrl;
6
6
  private headers;
package/dist/http.js CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.HttpClient = exports.SDK_VERSION = void 0;
7
7
  const errors_1 = require("./errors");
8
8
  /** SDK 版本(契约 §5,随包版本同步)。 */
9
- exports.SDK_VERSION = '2.5.0';
9
+ exports.SDK_VERSION = '2.5.1';
10
10
  /**
11
11
  * 钱包签名的复用时长(ms):首次签名后在该窗口内复用,避免每个请求都触发钱包弹窗。
12
12
  * 服务端会话 TTL 为 24h,此处取 1h 留足余量。
@@ -138,6 +138,15 @@ export interface SolanaDexSwapResult {
138
138
  feePayer: string;
139
139
  feeLamports: string;
140
140
  };
141
+ /** 同交易扣费信息(费用已在内层指令里;无需账本预付) */
142
+ fee?: {
143
+ mint: string;
144
+ symbol: string;
145
+ amountAtomic: string;
146
+ position: 'first' | 'last';
147
+ };
148
+ /** 费用凭证(HMAC 绑定本笔交易);`dexSwapAndSubmit` 会自动转交 `/submit` */
149
+ feeProof?: string;
141
150
  }
142
151
  /**
143
152
  * 本地签名回调:入参为未签名交易(base64 v0)与需要签名的公钥,
@@ -80,6 +80,11 @@ export interface SolanaSubmitParams {
80
80
  * relay 会把固定服务费 + 实际垫付 lamports 扣在该地址。
81
81
  */
82
82
  payer?: string;
83
+ /**
84
+ * 同交易扣费凭证(`/dex/swap` 响应里的 `feeProof`)。给出且校验通过时,
85
+ * relay 不再从账本扣服务费(费用已在交易内由智能账户直接支付)。
86
+ */
87
+ feeProof?: string;
83
88
  }
84
89
  /** 构建端点返回的未签名交易(base64)。 */
85
90
  export interface SolanaUnsignedTransaction {
@@ -92,4 +97,8 @@ export interface SolanaSubmitResult {
92
97
  chain: string;
93
98
  signature: string;
94
99
  feePayer?: string;
100
+ /** 同交易扣费:服务费已由智能账户在交易内支付(无账本扣费) */
101
+ fee?: {
102
+ mode: 'onchain';
103
+ };
95
104
  }
@@ -168,7 +168,13 @@ class WalletAPI {
168
168
  const { sign, payer, ...swap } = p;
169
169
  const built = await buildDexSwapRequest(this.http, swap);
170
170
  const signed = await sign(built.transaction, [...new Set([swap.feePayer, swap.sessionKey])]);
171
- const submit = await this.http.post('/v1/wallet/session/solana/submit', { chain: swap.chain, transaction: signed, ...(payer ? { payer } : {}) });
171
+ const submit = await this.http.post('/v1/wallet/session/solana/submit', {
172
+ chain: swap.chain,
173
+ transaction: signed,
174
+ ...(payer ? { payer } : {}),
175
+ // 同交易扣费:把构建时签发的凭证一并交给 /submit,避免账本重复扣费
176
+ ...(built.feeProof ? { feeProof: built.feeProof } : {}),
177
+ });
172
178
  return { ...built, submit };
173
179
  },
174
180
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keelcodes/sdk",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
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",