@smartagentkit/sdk 0.1.2 → 0.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.
- package/dist/index.d.mts +29 -7
- package/dist/index.d.ts +29 -7
- package/dist/index.js +320 -155
- package/dist/index.mjs +324 -157
- package/package.json +1 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -208,7 +208,6 @@ interface ISmartAgentKitClient {
|
|
|
208
208
|
unpause(walletAddress: Address, guardianKey: SignerKey): Promise<Hex>;
|
|
209
209
|
createSession(wallet: AgentWallet, params: CreateSessionParams, ownerKey: SignerKey): Promise<{
|
|
210
210
|
sessionKey: Address;
|
|
211
|
-
privateKey: Hex;
|
|
212
211
|
permissionId: Hex;
|
|
213
212
|
}>;
|
|
214
213
|
revokeSession(wallet: AgentWallet, permissionId: Hex, ownerKey: SignerKey): Promise<void>;
|
|
@@ -248,11 +247,16 @@ declare class SmartAgentKitClient implements ISmartAgentKitClient {
|
|
|
248
247
|
* the smart account via Smart Sessions. The session is scoped to
|
|
249
248
|
* specific target contracts, function selectors, and time window.
|
|
250
249
|
*
|
|
251
|
-
* @returns The session key address
|
|
250
|
+
* @returns The session key address and permission ID.
|
|
251
|
+
*
|
|
252
|
+
* SECURITY: The session private key is intentionally NOT returned or stored
|
|
253
|
+
* by the SDK. The caller should use the `sessionKey` address to identify
|
|
254
|
+
* the session on-chain, and manage key material externally via a secure
|
|
255
|
+
* key management system. To use a pre-generated key pair, provide the
|
|
256
|
+
* session key address in `params.sessionKey`.
|
|
252
257
|
*/
|
|
253
258
|
createSession(wallet: AgentWallet, params: CreateSessionParams, ownerKey: SignerKey): Promise<{
|
|
254
259
|
sessionKey: Address;
|
|
255
|
-
privateKey: Hex;
|
|
256
260
|
permissionId: Hex;
|
|
257
261
|
}>;
|
|
258
262
|
/**
|
|
@@ -319,13 +323,31 @@ declare class SmartAgentKitClient implements ISmartAgentKitClient {
|
|
|
319
323
|
*/
|
|
320
324
|
private initializePolicies;
|
|
321
325
|
/**
|
|
322
|
-
* Push the
|
|
323
|
-
* 1. onInstall(initData) on the sub-hook
|
|
324
|
-
* 2.
|
|
325
|
-
*
|
|
326
|
+
* Push the 2 calls needed to initialize a sub-hook:
|
|
327
|
+
* 1. onInstall(initData) on the sub-hook — sets trusted forwarder from init data
|
|
328
|
+
* 2. addHook(hookAddr, GLOBAL) on the HookMultiPlexer
|
|
329
|
+
*
|
|
330
|
+
* Note: The trusted forwarder is now set during onInstall via the encoded init data
|
|
331
|
+
* (passed as the first parameter). A separate setTrustedForwarder call is no longer
|
|
332
|
+
* needed, reducing gas cost and batch size.
|
|
326
333
|
*/
|
|
327
334
|
private pushSubHookInitCalls;
|
|
328
335
|
private mapPoliciesToInstalled;
|
|
336
|
+
/**
|
|
337
|
+
* Collect all known infrastructure addresses that must never be
|
|
338
|
+
* targeted by agent-initiated transactions. This prevents an AI agent
|
|
339
|
+
* from calling hook admin functions (setGuardian, clearTrustedForwarder,
|
|
340
|
+
* removeSpendingLimit, removeHook, etc.) to weaken its own policy constraints.
|
|
341
|
+
*/
|
|
342
|
+
private getProtectedAddresses;
|
|
343
|
+
/**
|
|
344
|
+
* Validate a transaction before submission. Blocks calls to infrastructure
|
|
345
|
+
* addresses and validates input parameters.
|
|
346
|
+
*
|
|
347
|
+
* @throws ExecutionError if the transaction targets a protected address
|
|
348
|
+
* or has invalid parameters.
|
|
349
|
+
*/
|
|
350
|
+
private validateTransaction;
|
|
329
351
|
private getWalletClient;
|
|
330
352
|
}
|
|
331
353
|
|
package/dist/index.d.ts
CHANGED
|
@@ -208,7 +208,6 @@ interface ISmartAgentKitClient {
|
|
|
208
208
|
unpause(walletAddress: Address, guardianKey: SignerKey): Promise<Hex>;
|
|
209
209
|
createSession(wallet: AgentWallet, params: CreateSessionParams, ownerKey: SignerKey): Promise<{
|
|
210
210
|
sessionKey: Address;
|
|
211
|
-
privateKey: Hex;
|
|
212
211
|
permissionId: Hex;
|
|
213
212
|
}>;
|
|
214
213
|
revokeSession(wallet: AgentWallet, permissionId: Hex, ownerKey: SignerKey): Promise<void>;
|
|
@@ -248,11 +247,16 @@ declare class SmartAgentKitClient implements ISmartAgentKitClient {
|
|
|
248
247
|
* the smart account via Smart Sessions. The session is scoped to
|
|
249
248
|
* specific target contracts, function selectors, and time window.
|
|
250
249
|
*
|
|
251
|
-
* @returns The session key address
|
|
250
|
+
* @returns The session key address and permission ID.
|
|
251
|
+
*
|
|
252
|
+
* SECURITY: The session private key is intentionally NOT returned or stored
|
|
253
|
+
* by the SDK. The caller should use the `sessionKey` address to identify
|
|
254
|
+
* the session on-chain, and manage key material externally via a secure
|
|
255
|
+
* key management system. To use a pre-generated key pair, provide the
|
|
256
|
+
* session key address in `params.sessionKey`.
|
|
252
257
|
*/
|
|
253
258
|
createSession(wallet: AgentWallet, params: CreateSessionParams, ownerKey: SignerKey): Promise<{
|
|
254
259
|
sessionKey: Address;
|
|
255
|
-
privateKey: Hex;
|
|
256
260
|
permissionId: Hex;
|
|
257
261
|
}>;
|
|
258
262
|
/**
|
|
@@ -319,13 +323,31 @@ declare class SmartAgentKitClient implements ISmartAgentKitClient {
|
|
|
319
323
|
*/
|
|
320
324
|
private initializePolicies;
|
|
321
325
|
/**
|
|
322
|
-
* Push the
|
|
323
|
-
* 1. onInstall(initData) on the sub-hook
|
|
324
|
-
* 2.
|
|
325
|
-
*
|
|
326
|
+
* Push the 2 calls needed to initialize a sub-hook:
|
|
327
|
+
* 1. onInstall(initData) on the sub-hook — sets trusted forwarder from init data
|
|
328
|
+
* 2. addHook(hookAddr, GLOBAL) on the HookMultiPlexer
|
|
329
|
+
*
|
|
330
|
+
* Note: The trusted forwarder is now set during onInstall via the encoded init data
|
|
331
|
+
* (passed as the first parameter). A separate setTrustedForwarder call is no longer
|
|
332
|
+
* needed, reducing gas cost and batch size.
|
|
326
333
|
*/
|
|
327
334
|
private pushSubHookInitCalls;
|
|
328
335
|
private mapPoliciesToInstalled;
|
|
336
|
+
/**
|
|
337
|
+
* Collect all known infrastructure addresses that must never be
|
|
338
|
+
* targeted by agent-initiated transactions. This prevents an AI agent
|
|
339
|
+
* from calling hook admin functions (setGuardian, clearTrustedForwarder,
|
|
340
|
+
* removeSpendingLimit, removeHook, etc.) to weaken its own policy constraints.
|
|
341
|
+
*/
|
|
342
|
+
private getProtectedAddresses;
|
|
343
|
+
/**
|
|
344
|
+
* Validate a transaction before submission. Blocks calls to infrastructure
|
|
345
|
+
* addresses and validates input parameters.
|
|
346
|
+
*
|
|
347
|
+
* @throws ExecutionError if the transaction targets a protected address
|
|
348
|
+
* or has invalid parameters.
|
|
349
|
+
*/
|
|
350
|
+
private validateTransaction;
|
|
329
351
|
private getWalletClient;
|
|
330
352
|
}
|
|
331
353
|
|