Skip to content

Commit 543cb8d

Browse files
author
azeth-sync[bot]
committed
v0.2.6: sync from monorepo 2026-03-07
1 parent 5e82589 commit 543cb8d

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@azeth/sdk",
3-
"version": "0.2.5",
3+
"version": "0.2.6",
44
"type": "module",
55
"description": "TypeScript SDK for the Azeth trust infrastructure — smart accounts, x402 payments, reputation, and service discovery",
66
"license": "MIT",
@@ -38,7 +38,7 @@
3838
"test:mutation": "npx stryker run"
3939
},
4040
"dependencies": {
41-
"@azeth/common": "^0.2.5",
41+
"@azeth/common": "^0.2.6",
4242
"@x402/core": "^2.4.0",
4343
"@x402/extensions": "^2.4.0",
4444
"@xmtp/agent-sdk": "^2.2.0",

src/client.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,35 @@ export class AzethKit {
415415
return accounts[0];
416416
}
417417

418+
/** Set the active smart account for subsequent operations (payments, transfers, etc.).
419+
* Reorders the internal accounts array so the specified address becomes the default.
420+
* All methods that use `resolveSmartAccount()` or `_smartAccounts[0]` will use it.
421+
*
422+
* @param address - Address of one of your smart accounts (must already be in the accounts list)
423+
* @throws AzethError if no accounts are loaded or the address is not found
424+
*/
425+
setActiveAccount(address: `0x${string}`): void {
426+
if (!this._smartAccounts || this._smartAccounts.length === 0) {
427+
throw new AzethError(
428+
'No smart accounts loaded. Call getSmartAccounts() first.',
429+
'ACCOUNT_NOT_FOUND',
430+
);
431+
}
432+
const normalized = getAddress(address);
433+
const idx = this._smartAccounts.findIndex(a => getAddress(a) === normalized);
434+
if (idx === -1) {
435+
throw new AzethError(
436+
`Address ${address} is not one of your smart accounts.`,
437+
'ACCOUNT_NOT_FOUND',
438+
{ address },
439+
);
440+
}
441+
if (idx > 0) {
442+
const [target] = this._smartAccounts.splice(idx, 1);
443+
this._smartAccounts.unshift(target!);
444+
}
445+
}
446+
418447
/** Deploy a new Azeth smart account via the AzethFactory v11 (one-call setup).
419448
*
420449
* Single atomic transaction: deploys ERC-1967 proxy, installs all 4 modules,

0 commit comments

Comments
 (0)