Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
35f6e88
feat: add rust package names to cspell
cpb8010 Nov 11, 2025
43921ee
feat: add new session plan
cpb8010 Nov 11, 2025
af27407
feat: add first phase
cpb8010 Nov 11, 2025
20b535e
feat: next phase complete
cpb8010 Nov 11, 2025
bedce41
fix: formatting and linting
cpb8010 Nov 11, 2025
1a0fde4
feat: add bindings with tests
cpb8010 Nov 12, 2025
571c104
feat: add viem modules
cpb8010 Nov 12, 2025
308d545
chore: failing tests
cpb8010 Nov 12, 2025
b336d94
fix: lockfile
cpb8010 Nov 12, 2025
c5b513e
fix: more linting
cpb8010 Nov 12, 2025
0c52752
chore: more test setup
cpb8010 Nov 13, 2025
2f5d996
fix: changed from complicated to simple
cpb8010 Nov 13, 2025
d14970c
fix: more test debugging
cpb8010 Nov 14, 2025
c0aadf6
fix: update test usage
cpb8010 Nov 14, 2025
62d984c
fix: pnpm lock fix
cpb8010 Nov 14, 2025
717188b
fix: rust nightly format changes
cpb8010 Nov 14, 2025
48ee657
docs: add comprehensive session API documentation and migration guide
cpb8010 Nov 14, 2025
5b46b91
feat: code cleanup
cpb8010 Nov 14, 2025
8677d22
feat: add tests
cpb8010 Nov 14, 2025
b9da4e3
fix: test failure message
cpb8010 Nov 14, 2025
12521c2
chore: more rust fmt
cpb8010 Nov 14, 2025
4a0537a
chore: plan cleanup
cpb8010 Nov 14, 2025
16c739b
fix: clean build in ci
cpb8010 Nov 15, 2025
65063ef
fix: add missing constraint limit field in sessionSpecToJSON
cpb8010 Nov 15, 2025
e99be86
fix: undo session enum changes
cpb8010 Nov 15, 2025
00e7305
Merge branch 'main' into viem-session-sdk
cpb8010 Nov 15, 2025
83171d9
fix: remove compat
cpb8010 Nov 17, 2025
9696b28
fix: remove session abi from ts sdk
cpb8010 Nov 17, 2025
597bac1
feat: create client for session sdk
cpb8010 Nov 17, 2025
5cd2992
chore: cleanup bonus changes
cpb8010 Nov 17, 2025
ba6b791
Merge main into session-revert: resolve conflicts
cpb8010 Nov 17, 2025
429b073
fix: more rust fmt
cpb8010 Nov 17, 2025
46e44c2
fix: undo demo project changes
cpb8010 Nov 18, 2025
d61b725
fix: remove clean builds
cpb8010 Nov 18, 2025
40a69a9
fix: remove expect errors after adding package
cpb8010 Nov 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ config:
code_blocks: false
line_length: 80
tables: false
headings: false # Allow long headings
MD033: false
MD024: false
MD029: false
gitignore: true
ignores:
- ".github/**/*.md"
- "**/docs/**/*.md" # Skip strict line length for detailed documentation
1 change: 1 addition & 0 deletions cspell-config/cspell-misc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dockerized
ethereum
sepolia
foundryup
unpermitted

// examples/bank-demo
ctap
Expand Down
3 changes: 3 additions & 0 deletions cspell-config/cspell-rust.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// package names
tokio
serde
6 changes: 6 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"dict-zksync",
"dict-packages",
"dict-misc",
"dict-rust",
"dict-sol"
],
"dictionaryDefinitions": [
Expand All @@ -80,6 +81,11 @@
"addWords": true,
"path": "./cspell-config/cspell-sol.txt"
},
{
"name": "dict-rust",
"addWords": true,
"path": "./cspell-config/cspell-rust.txt"
},
{
"name": "dict-circom",
"addWords": true,
Expand Down
154 changes: 154 additions & 0 deletions examples/demo-app/components/SessionConfig.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<template>
<div class="bg-indigo-50 p-4 rounded-lg mb-4 border border-indigo-200">
<h2 class="text-xl font-semibold mb-3">
Session Configuration
</h2>

<label class="flex items-center mb-2">
<input
v-model="config!.deployWithSession"
type="checkbox"
class="mr-2"
:disabled="isDeployed"
>
<span>
Deploy with Session Support
<span
v-if="isDeployed"
class="text-xs text-gray-500 ml-1"
>(Set before deployment)</span>
</span>
</label>
<p
v-if="config?.deployWithSession"
class="text-xs text-gray-600 mb-3 ml-6"
>
Session validator will be pre-installed during account deployment
</p>

<label class="flex items-center mb-2">
<input
v-model="config!.enabled"
type="checkbox"
class="mr-2"
>
Enable Session Configuration
</label>

<div
v-if="config?.enabled"
class="space-y-2"
>
<div>
<label class="block text-sm font-medium mb-1">Session Validator Address</label>
<input
v-model="config!.validatorAddress"
type="text"
placeholder="0x..."
class="w-full p-2 border rounded"
readonly
>
<p class="text-xs text-gray-500 mt-1">
Loaded from contracts.json
</p>
</div>

<div>
<label class="block text-sm font-medium mb-1">Session Signer (auto-generated)</label>
<input
:value="config?.sessionSigner"
type="text"
readonly
class="w-full p-2 border rounded bg-gray-100"
>
<p class="text-xs text-gray-500 mt-1">
This address will be authorized to send transactions on behalf of the smart account
</p>
</div>

<div>
<label class="block text-sm font-medium mb-1">Expires At (timestamp)</label>
<input
v-model.number="config!.expiresAt"
type="number"
class="w-full p-2 border rounded"
>
<p class="text-xs text-gray-500 mt-1">
Unix timestamp (default: {{ formatTimestamp(config!.expiresAt) }})
</p>
</div>

<div>
<label class="block text-sm font-medium mb-1">Max Fee (wei)</label>
<input
v-model="config!.feeLimit"
type="text"
class="w-full p-2 border rounded"
>
<p class="text-xs text-gray-500 mt-1">
Maximum fee the session can spend (1 ETH = 1000000000000000000 wei)
</p>
</div>

<div>
<label class="block text-sm font-medium mb-1">Allowed Recipient (address)</label>
<input
v-model="config!.allowedRecipient"
type="text"
placeholder="0x..."
class="w-full p-2 border rounded"
>
<p class="text-xs text-gray-500 mt-1">
The session validator currently requires an explicit transfer policy target. Set this to the recipient you will send to.
</p>
</div>
</div>
</div>
</template>

<script setup lang="ts">
import { watch } from "vue";
import { privateKeyToAccount, generatePrivateKey } from "viem/accounts";

interface SessionConfig {
enabled: boolean;
deployWithSession: boolean;
validatorAddress: string;
sessionPrivateKey: string;
sessionSigner: string;
expiresAt: number;
feeLimit: string;
// Optional: Restrict transfers to a single recipient (required by current validator)
allowedRecipient?: string;
}

defineProps<{
isDeployed?: boolean;
}>();

const config = defineModel<SessionConfig>();

// Format timestamp to readable date
function formatTimestamp(timestamp: number): string {
return new Date(timestamp * 1000).toLocaleDateString("en-US", {
year: "numeric",
month: "short",
day: "numeric",
});
}

// Auto-generate session signer on enable or deployWithSession
watch(
() => [config.value?.enabled, config.value?.deployWithSession],
([enabled, deployWithSession]) => {
if ((enabled || deployWithSession) && !config.value?.sessionPrivateKey) {
const privateKey = generatePrivateKey();
if (config.value) {
config.value.sessionPrivateKey = privateKey;
const account = privateKeyToAccount(privateKey);
config.value.sessionSigner = account.address;
}
}
},
);
</script>
Loading
Loading