@keelcodes/sdk 2.1.2 → 2.1.3
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.
|
@@ -10,6 +10,56 @@ export interface MpcBalanceParams {
|
|
|
10
10
|
chain?: string;
|
|
11
11
|
tokenAddress?: string;
|
|
12
12
|
}
|
|
13
|
+
/** 注册参数:`curve='ed25519'` 时创建 Solana 钱包(可选 seed 导入存量私钥)。 */
|
|
14
|
+
export interface MpcRegisterParams extends MpcVerifyParams {
|
|
15
|
+
/** 签名曲线,默认 `secp256k1`(EVM)。 */
|
|
16
|
+
curve?: 'secp256k1' | 'ed25519';
|
|
17
|
+
/** 仅 ed25519:32B 种子 hex(可带 0x);导入后 base58 地址与导入前逐字节一致。 */
|
|
18
|
+
seed?: string;
|
|
19
|
+
walletAddress?: string;
|
|
20
|
+
}
|
|
21
|
+
/** 注册结果。 */
|
|
22
|
+
export interface MpcRegisterResult {
|
|
23
|
+
walletId: string;
|
|
24
|
+
email: string;
|
|
25
|
+
/** EVM 为 0x 地址;ed25519 为 base58 地址。 */
|
|
26
|
+
walletAddress: string;
|
|
27
|
+
curve: string;
|
|
28
|
+
createdAt: string;
|
|
29
|
+
}
|
|
30
|
+
/** Solana 签名参数。 */
|
|
31
|
+
export interface MpcSolanaSignParams {
|
|
32
|
+
token: string;
|
|
33
|
+
/** Solana 交易 message **原文**(hex,可带 0x),不是 32B 摘要(Ed25519ph 不被 Solana 支持)。 */
|
|
34
|
+
message: string;
|
|
35
|
+
/** 2-of-3 选片,默认 1。 */
|
|
36
|
+
partnerIndex?: number;
|
|
37
|
+
}
|
|
38
|
+
/** Solana 签名结果(Ed25519 无 `v` 恢复 id)。 */
|
|
39
|
+
export interface MpcSolanaSignResult {
|
|
40
|
+
curve: 'ed25519';
|
|
41
|
+
/** 64B `R‖z`,128 hex,无 0x。 */
|
|
42
|
+
signature: string;
|
|
43
|
+
publicKey: string;
|
|
44
|
+
address: string;
|
|
45
|
+
}
|
|
46
|
+
/** Solana 广播参数。 */
|
|
47
|
+
export interface MpcSolanaSendParams {
|
|
48
|
+
token: string;
|
|
49
|
+
/** base64 编码的**已签名**交易(交易构建与签名组装由客户端完成)。 */
|
|
50
|
+
transaction: string;
|
|
51
|
+
/** 是否等待确认,默认 true。 */
|
|
52
|
+
wait?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** Solana 广播结果。 */
|
|
55
|
+
export interface MpcSolanaSendResult {
|
|
56
|
+
chain: 'solana';
|
|
57
|
+
txHash: string | null;
|
|
58
|
+
from: string;
|
|
59
|
+
confirmed: boolean;
|
|
60
|
+
reason: string | null;
|
|
61
|
+
signatureStatus: string | null;
|
|
62
|
+
}
|
|
13
63
|
export interface MpcSignMessageParams {
|
|
14
64
|
token: string;
|
|
15
65
|
message: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { HttpClient } from '../http';
|
|
2
|
+
import type { KeelEnvelope } from '../types';
|
|
2
3
|
import type { CreateWalletParams, WalletCreated, ImportWalletParams, SignParams, SignResult, SendParams, SendResult, ChainParams, ChainResult, WalletBalanceParams, WalletBalanceResult } from './types';
|
|
3
4
|
import type { SolanaDeriveAccountParams, SolanaDerivedAccount, SolanaCreateAccountParams, SolanaInstallPolicyParams, SolanaCreatePolicyTransactionParams, SolanaCreateProposalParams, SolanaApproveProposalParams, SolanaExecutePolicyTransactionParams, SolanaRemovePolicyParams } from './solana-account-types';
|
|
4
5
|
import type { SolanaExecutePolicyPayloadParams, SolanaCloseSettingsParams, SolanaCloseTransactionParams, SolanaExecutePolicyParams, SolanaExecuteParams, SolanaRemoveSignerParams, SolanaSubmitParams, SolanaUnsignedTransaction, SolanaSubmitResult } from './solana-execution-types';
|
|
5
|
-
import type { MpcSendCodeParams, MpcVerifyParams, MpcBalanceParams, MpcSignMessageParams, MpcSignTypedDataParams, MpcSendTransactionParams, MpcContractCallParams, MpcContractWriteParams, MpcGasEstimateParams } from './mpc-types';
|
|
6
|
+
import type { MpcSendCodeParams, MpcVerifyParams, MpcBalanceParams, MpcSignMessageParams, MpcSignTypedDataParams, MpcSendTransactionParams, MpcContractCallParams, MpcContractWriteParams, MpcGasEstimateParams, MpcRegisterParams, MpcRegisterResult, MpcSolanaSignParams, MpcSolanaSignResult, MpcSolanaSendParams, MpcSolanaSendResult } from './mpc-types';
|
|
6
7
|
export declare class WalletAPI {
|
|
7
8
|
private http;
|
|
8
9
|
constructor(http: HttpClient);
|
|
@@ -166,7 +167,7 @@ export declare class WalletAPI {
|
|
|
166
167
|
/** MPC(email 分片钱包)子域:canonical `/v1/wallet/mpc/*`。 */
|
|
167
168
|
mpc: {
|
|
168
169
|
sendCode: (p: MpcSendCodeParams) => Promise<unknown>;
|
|
169
|
-
register: (p:
|
|
170
|
+
register: (p: MpcRegisterParams) => Promise<KeelEnvelope<MpcRegisterResult>>;
|
|
170
171
|
recover: (p: MpcVerifyParams) => Promise<unknown>;
|
|
171
172
|
status: (email: string) => Promise<unknown>;
|
|
172
173
|
wallets: (email?: string) => Promise<unknown>;
|
|
@@ -182,5 +183,13 @@ export declare class WalletAPI {
|
|
|
182
183
|
contractRead: (p: MpcContractCallParams) => Promise<unknown>;
|
|
183
184
|
contractWrite: (p: MpcContractWriteParams) => Promise<unknown>;
|
|
184
185
|
gasEstimate: (p: MpcGasEstimateParams) => Promise<unknown>;
|
|
186
|
+
/**
|
|
187
|
+
* 签 Solana 交易 message **原文**(hex,可带 0x)。
|
|
188
|
+
* ⚠️ 不能传 32B 摘要:Solana 只认对原文的 Ed25519 签名(Ed25519ph 不被支持)。
|
|
189
|
+
* 返回 64B `R‖z`(128 hex,**无 0x**),无 `v` 恢复 id,用 `publicKey` 对账。
|
|
190
|
+
*/
|
|
191
|
+
signSolana: (p: MpcSolanaSignParams) => Promise<KeelEnvelope<MpcSolanaSignResult>>;
|
|
192
|
+
/** 广播 base64 编码的**已签名**交易(经 chain-rpc `sendTransaction` + `getSignatureStatuses`)。 */
|
|
193
|
+
sendSolanaTransaction: (p: MpcSolanaSendParams) => Promise<KeelEnvelope<MpcSolanaSendResult>>;
|
|
185
194
|
};
|
|
186
195
|
}
|
|
@@ -97,6 +97,15 @@ class WalletAPI {
|
|
|
97
97
|
contractRead: (p) => this.http.post('/v1/wallet/mpc/contract-read', p),
|
|
98
98
|
contractWrite: (p) => this.http.post('/v1/wallet/mpc/contract-write', p),
|
|
99
99
|
gasEstimate: (p) => this.http.post('/v1/wallet/mpc/gas-estimate', p),
|
|
100
|
+
// ── Solana(Ed25519 / FROST 2-of-3)──────────────────────────────────
|
|
101
|
+
/**
|
|
102
|
+
* 签 Solana 交易 message **原文**(hex,可带 0x)。
|
|
103
|
+
* ⚠️ 不能传 32B 摘要:Solana 只认对原文的 Ed25519 签名(Ed25519ph 不被支持)。
|
|
104
|
+
* 返回 64B `R‖z`(128 hex,**无 0x**),无 `v` 恢复 id,用 `publicKey` 对账。
|
|
105
|
+
*/
|
|
106
|
+
signSolana: (p) => this.http.post('/v1/wallet/mpc/solana/sign', p),
|
|
107
|
+
/** 广播 base64 编码的**已签名**交易(经 chain-rpc `sendTransaction` + `getSignatureStatuses`)。 */
|
|
108
|
+
sendSolanaTransaction: (p) => this.http.post('/v1/wallet/mpc/solana/send-transaction', p),
|
|
100
109
|
};
|
|
101
110
|
}
|
|
102
111
|
create(params) {
|
package/package.json
CHANGED