Skip to content

Commit 71d17ed

Browse files
authored
Update param name in omni_getSmartWalletRootSigner (#3605)
* update * update ts
1 parent a545e16 commit 71d17ed

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

tee-worker/omni-executor/aa-contracts/aa-demo-app/src/lib/tee-worker-client.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ interface UserLoginResponse {
2828

2929
interface GetSmartWalletRootSignerParams {
3030
chain_type: "Evm" | "Solana" | "Tron";
31-
index: number;
31+
wallet_index: number;
3232
}
3333

3434
// JSON-RPC request helper
@@ -49,7 +49,7 @@ async function makeRpcRequest<T>(
4949
// If params is already an array (for methods like omni_getWeb3SignInMessage), it's the actual params
5050
// If params is an object or null/undefined, use it directly
5151
const rpcParams = params ?? null;
52-
52+
5353
const requestBody = {
5454
jsonrpc: "2.0",
5555
method,
@@ -82,8 +82,8 @@ async function makeRpcRequest<T>(
8282
if (data.error) {
8383
console.error(`[TEE Worker RPC] Error from ${method}:`, data.error);
8484
// Include error code in the error message for better debugging
85-
const errorMessage = data.error.data
86-
? `${data.error.message} (${data.error.data})`
85+
const errorMessage = data.error.data
86+
? `${data.error.message} (${data.error.data})`
8787
: data.error.message || "RPC error";
8888
throw new Error(errorMessage);
8989
}
@@ -99,10 +99,10 @@ export async function getWeb3SignInMessage(
9999
// The omniAccount should already be a properly formatted 32-byte hex string (64 chars) with 0x prefix
100100
// from calculateOmniAccount function
101101
console.log('[TEE Worker] Using omni account:', omniAccount);
102-
102+
103103
// Pass parameters as an array for positional arguments
104104
return makeRpcRequest<Web3SignInMessageResponse>(
105-
"omni_getWeb3SignInMessage",
105+
"omni_getWeb3SignInMessage",
106106
[clientId, omniAccount]
107107
);
108108
}
@@ -118,7 +118,7 @@ export async function loginWithEvm(
118118
// The server expects the message to be a JSON string of the payload
119119
const message = JSON.stringify(messagePayload);
120120
console.log("[TEE Worker] Message to sign:", message);
121-
121+
122122
const signature = await walletClient.signMessage({
123123
account: evmAddress as `0x${string}`,
124124
message,
@@ -140,7 +140,7 @@ export async function loginWithEvm(
140140
};
141141

142142
console.log("[TEE Worker] UserLogin params:", JSON.stringify(params, null, 2));
143-
143+
144144
// Pass the params object directly
145145
return makeRpcRequest<UserLoginResponse>("omni_userLogin", params);
146146
}
@@ -153,7 +153,7 @@ export async function getSmartWalletRootSigner(
153153
): Promise<string> {
154154
const params: GetSmartWalletRootSignerParams = {
155155
chain_type: chainType,
156-
index,
156+
wallet_index: index,
157157
};
158158

159159
return makeRpcRequest<string>("omni_getSmartWalletRootSigner", params, idToken);
@@ -205,16 +205,16 @@ export async function authorizeTEEWorker(
205205
};
206206
} catch (error) {
207207
console.error(`[TEE Worker] Authorization attempt ${retryCount + 1} failed:`, error);
208-
208+
209209
// If this was our last retry, throw the error
210210
if (retryCount >= maxRetries) {
211211
throw error;
212212
}
213-
213+
214214
// Wait a bit before retrying to ensure any server-side state is cleared
215215
console.log("[TEE Worker] Waiting 1 second before retry...");
216216
await new Promise(resolve => setTimeout(resolve, 1000));
217-
217+
218218
retryCount++;
219219
}
220220
}

tee-worker/omni-executor/rpc-server/src/methods/omni/get_smart_wallet_root_signer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use tracing::{debug, error};
1111
pub struct GetSmartWalletRootSignerParams {
1212
pub omni_account: String,
1313
pub chain_type: ChainType,
14-
pub index: u32,
14+
pub wallet_index: u32,
1515
}
1616

1717
pub fn register_get_smart_wallet_root_signer(module: &mut RpcModule<RpcContext>) {
@@ -22,7 +22,7 @@ pub fn register_get_smart_wallet_root_signer(module: &mut RpcModule<RpcContext>)
2222
PumpxRpcError::from_error_code(ErrorCode::ParseError)
2323
})?;
2424

25-
debug!("Received omni_getSmartWalletRootSigner");
25+
debug!("Received omni_getSmartWalletRootSigner, params: {:?}", params);
2626

2727
let Ok(address) = Address32::from_hex(&params.omni_account) else {
2828
error!("Failed to parse from omni account token");
@@ -31,7 +31,7 @@ pub fn register_get_smart_wallet_root_signer(module: &mut RpcModule<RpcContext>)
3131

3232
let pubkey = ctx
3333
.signer_client
34-
.request_wallet(params.chain_type, params.index, address.as_ref().to_owned())
34+
.request_wallet(params.chain_type, params.wallet_index, address.as_ref().to_owned())
3535
.await
3636
.map_err(|_| {
3737
error!("Failed to request wallet from signer client");

0 commit comments

Comments
 (0)