@openzeppelin/guardian-evm-client 0.14.5

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/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # @openzeppelin/guardian-evm-client
2
+
3
+ TypeScript EVM client for Guardian Accounts-compatible proposal coordination.
4
+
5
+ This package is intentionally isolated from `@openzeppelin/guardian-client`.
6
+ It talks to Guardian's EVM-enabled HTTP routes, uses a wallet-derived cookie
7
+ session, registers EVM accounts through `/evm/accounts`, and treats proposal
8
+ payloads as opaque application data.
9
+
10
+ Guardian servers must be built and run with the Rust `evm` feature enabled.
11
+ Default server builds do not register the `/evm/*` routes.
12
+
13
+ ## Setup
14
+
15
+ Run Guardian with server-owned RPC and EntryPoint mappings:
16
+
17
+ ```bash
18
+ GUARDIAN_EVM_RPC_URLS=31337=http://127.0.0.1:8545 \
19
+ GUARDIAN_EVM_ENTRYPOINTS=31337=0x... \
20
+ cargo run -p guardian-server --features evm --bin server
21
+ ```
22
+
23
+ ```typescript
24
+ import { GuardianEvmClient, signProposalHash } from '@openzeppelin/guardian-evm-client';
25
+
26
+ const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' });
27
+ const signerAddress = accounts[0] as `0x${string}`;
28
+
29
+ const client = new GuardianEvmClient({
30
+ guardianUrl: 'http://localhost:3000',
31
+ provider: window.ethereum,
32
+ signerAddress,
33
+ });
34
+
35
+ await client.login();
36
+ ```
37
+
38
+ ## Configure
39
+
40
+ Configure the smart account once before creating proposals. Guardian resolves
41
+ RPC and EntryPoint addresses from server environment maps; clients only provide
42
+ the chain, smart account, and validator addresses.
43
+
44
+ ```typescript
45
+ await client.configure({
46
+ chainId: 31337,
47
+ smartAccountAddress: '0x...',
48
+ multisigValidatorAddress: '0x...',
49
+ });
50
+
51
+ const accountId = client.accountId(31337, '0x...');
52
+ ```
53
+
54
+ Fetch existing pending proposals for the configured account:
55
+
56
+ ```typescript
57
+ const proposals = await client.listProposals();
58
+
59
+ for (const proposal of proposals) {
60
+ console.log(proposal.accountId, proposal.nonce, proposal.status);
61
+ }
62
+ ```
63
+
64
+ Fetch a specific proposal by Guardian proposal ID:
65
+
66
+ ```typescript
67
+ const proposal = await client.getProposal(created.commitment);
68
+
69
+ console.log(proposal.deltaPayload.mode);
70
+ console.log(proposal.deltaPayload.executionCalldata);
71
+ console.log(proposal.deltaPayload.signatures);
72
+ ```
73
+
74
+ The integrating app builds the UserOperation, computes the hash to be signed,
75
+ collects wallet signatures, and sends the opaque payload to Guardian.
76
+
77
+ ```typescript
78
+ const hash = '0x...' as const;
79
+ const signature = await signProposalHash(window.ethereum, signerAddress, hash);
80
+
81
+ const created = await client.createProposal({
82
+ chainId: 31337,
83
+ smartAccountAddress: '0x...',
84
+ userOpHash: hash,
85
+ payload: JSON.stringify({ packedUserOperation }),
86
+ nonce: '0',
87
+ signature,
88
+ ttlSeconds: 900,
89
+ });
90
+
91
+ const proposals = await client.listProposals(accountId);
92
+ const proposal = await client.getProposal(accountId, created.proposalId);
93
+ ```
94
+
95
+ Approve with another signer session:
96
+
97
+ ```typescript
98
+ const approval = await signProposalHash(window.ethereum, otherSigner, proposal.userOpHash);
99
+
100
+ await client.approveProposal(accountId, proposal.proposalId, {
101
+ signature: approval,
102
+ });
103
+ ```
104
+
105
+ When the signature threshold is met, fetch the payload and ordered signatures
106
+ for the app's own submission flow:
107
+
108
+ ```typescript
109
+ const executable = await client.getExecutableProposal(accountId, proposal.proposalId);
110
+
111
+ console.log(executable.payload, executable.signatures, executable.signers);
112
+ ```
113
+
114
+ Cancel a pending proposal as its creator:
115
+
116
+ ```typescript
117
+ await client.cancelProposal(accountId, proposal.proposalId);
118
+ ```
119
+
120
+ Guardian verifies the validator is installed, snapshots EOA signers from the
121
+ validator, verifies signatures over the supplied hash, and lazily removes
122
+ expired or finalized proposals. Guardian does not build UserOperations, decode
123
+ payloads, or submit transactions on-chain.
package/dist/auth.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ import type { GuardianTypedData } from './typed-data.js';
2
+ export interface Eip1193Provider {
3
+ request(args: {
4
+ method: string;
5
+ params?: unknown[];
6
+ }): Promise<unknown>;
7
+ }
8
+ export declare function requestWalletAddress(provider: Eip1193Provider): Promise<`0x${string}`>;
9
+ export declare function signTypedData(provider: Eip1193Provider, signerAddress: string, typedData: GuardianTypedData): Promise<`0x${string}`>;
10
+ export declare function signProposalHash(provider: Eip1193Provider, signerAddress: string, hash: string): Promise<`0x${string}`>;
11
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACzE;AAED,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAM5F;AAED,wBAAsB,aAAa,CACjC,QAAQ,EAAE,eAAe,EACzB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,iBAAiB,GAC3B,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAUxB;AAED,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,eAAe,EACzB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAWxB"}
package/dist/auth.js ADDED
@@ -0,0 +1,32 @@
1
+ import { normalizeBytes32, normalizeEvmAddress, normalizeSignature } from './encoding.js';
2
+ export async function requestWalletAddress(provider) {
3
+ const accounts = await provider.request({ method: 'eth_requestAccounts' });
4
+ if (!Array.isArray(accounts) || typeof accounts[0] !== 'string') {
5
+ throw new Error('Wallet did not return an account');
6
+ }
7
+ return normalizeEvmAddress(accounts[0]);
8
+ }
9
+ export async function signTypedData(provider, signerAddress, typedData) {
10
+ const signer = normalizeEvmAddress(signerAddress);
11
+ const signature = await provider.request({
12
+ method: 'eth_signTypedData_v4',
13
+ params: [signer, JSON.stringify(typedData)],
14
+ });
15
+ if (typeof signature !== 'string') {
16
+ throw new Error('Wallet returned a non-string EIP-712 signature');
17
+ }
18
+ return normalizeSignature(signature);
19
+ }
20
+ export async function signProposalHash(provider, signerAddress, hash) {
21
+ const signer = normalizeEvmAddress(signerAddress);
22
+ const normalizedHash = normalizeBytes32(hash, 'hash');
23
+ const signature = await provider.request({
24
+ method: 'eth_sign',
25
+ params: [signer, normalizedHash],
26
+ });
27
+ if (typeof signature !== 'string') {
28
+ throw new Error('Wallet returned a non-string hash signature');
29
+ }
30
+ return normalizeSignature(signature);
31
+ }
32
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAM1F,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,QAAyB;IAClE,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAC3E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAyB,EACzB,aAAqB,EACrB,SAA4B;IAE5B,MAAM,MAAM,GAAG,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC;QACvC,MAAM,EAAE,sBAAsB;QAC9B,MAAM,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;KAC5C,CAAC,CAAC;IACH,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,QAAyB,EACzB,aAAqB,EACrB,IAAY;IAEZ,MAAM,MAAM,GAAG,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAClD,MAAM,cAAc,GAAG,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC;QACvC,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC;KACjC,CAAC,CAAC;IACH,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { type Eip1193Provider } from './auth.js';
2
+ import { type AccountRegistration, type ApproveRequest, type ConfigureRequest, type ExecutableProposal, type Proposal, type ProposeRequest } from './proposals.js';
3
+ import { type EvmSessionChallenge } from './typed-data.js';
4
+ export interface GuardianEvmClientOptions {
5
+ guardianUrl: string;
6
+ provider?: Eip1193Provider;
7
+ signerAddress?: string;
8
+ }
9
+ export interface EvmSession {
10
+ address: `0x${string}`;
11
+ expiresAt: number;
12
+ }
13
+ export declare class GuardianEvmClient {
14
+ readonly guardianUrl: string;
15
+ readonly provider?: Eip1193Provider;
16
+ readonly signerAddress?: `0x${string}`;
17
+ private cookieHeader?;
18
+ constructor(options: GuardianEvmClientOptions);
19
+ accountId(chainId: number, smartAccountAddress: string): string;
20
+ challenge(address?: string): Promise<EvmSessionChallenge>;
21
+ login(address?: string): Promise<EvmSession>;
22
+ logout(): Promise<void>;
23
+ configure(request: ConfigureRequest): Promise<AccountRegistration>;
24
+ createProposal(request: ProposeRequest): Promise<Proposal>;
25
+ listProposals(accountId: string): Promise<Proposal[]>;
26
+ getProposal(accountId: string, proposalId: string): Promise<Proposal>;
27
+ approveProposal(accountId: string, proposalId: string, request: ApproveRequest): Promise<Proposal>;
28
+ getExecutableProposal(accountId: string, proposalId: string): Promise<ExecutableProposal>;
29
+ cancelProposal(accountId: string, proposalId: string): Promise<void>;
30
+ private resolveSigner;
31
+ private requireProvider;
32
+ private fetch;
33
+ }
34
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAGtF,OAAO,EAUL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EACb,KAAK,cAAc,EAKpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEhF,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAOD,qBAAa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edData } from './auth.js';
2
+ import { normalizeEvmAddress } from './encoding.js';
3
+ import { GuardianEvmHttpError } from './errors.js';
4
+ import { fromServerAccountRegistration, accountProposalParams, evmAccountId, fromServerExecutable, fromServerProposal, toServerApproveRequest, toServerCancelRequest, toServerCreateProposalRequest, toServerRegisterAccountRequest, } from './proposals.js';
5
+ import { fromServerChallenge } from './typed-data.js';
6
+ export class GuardianEvmClient {
7
+ guardianUrl;
8
+ provider;
9
+ signerAddress;
10
+ cookieHeader;
11
+ constructor(options) {
12
+ this.guardianUrl = options.guardianUrl.replace(/\/$/, '');
13
+ this.provider = options.provider;
14
+ this.signerAddress = options.signerAddress
15
+ ? normalizeEvmAddress(options.signerAddress)
16
+ : undefined;
17
+ }
18
+ accountId(chainId, smartAccountAddress) {
19
+ return evmAccountId(chainId, smartAccountAddress);
20
+ }
21
+ async challenge(address) {
22
+ const signer = await this.resolveSigner(address);
23
+ const params = new URLSearchParams({ address: signer });
24
+ const response = await this.fetch(`/evm/auth/challenge?${params}`, { method: 'GET' });
25
+ return fromServerChallenge(await response.json());
26
+ }
27
+ async login(address) {
28
+ const challenge = await this.challenge(address);
29
+ const provider = this.requireProvider();
30
+ const signature = await signTypedData(provider, challenge.address, challenge.typedData);
31
+ const response = await this.fetch('/evm/auth/verify', {
32
+ method: 'POST',
33
+ body: JSON.stringify({
34
+ address: challenge.address,
35
+ nonce: challenge.nonce,
36
+ signature,
37
+ }),
38
+ });
39
+ const server = (await response.json());
40
+ return {
41
+ address: normalizeEvmAddress(server.address),
42
+ expiresAt: server.expires_at,
43
+ };
44
+ }
45
+ async logout() {
46
+ await this.fetch('/evm/auth/logout', { method: 'POST' });
47
+ }
48
+ async configure(request) {
49
+ const response = await this.fetch('/evm/accounts', {
50
+ method: 'POST',
51
+ body: JSON.stringify(toServerRegisterAccountRequest(request)),
52
+ });
53
+ return fromServerAccountRegistration((await response.json()));
54
+ }
55
+ async createProposal(request) {
56
+ const response = await this.fetch('/evm/proposals', {
57
+ method: 'POST',
58
+ body: JSON.stringify(toServerCreateProposalRequest(request)),
59
+ });
60
+ return fromServerProposal((await response.json()));
61
+ }
62
+ async listProposals(accountId) {
63
+ const params = accountProposalParams(accountId);
64
+ const response = await this.fetch(`/evm/proposals?${params}`, { method: 'GET' });
65
+ const server = (await response.json());
66
+ return server.proposals.map(fromServerProposal);
67
+ }
68
+ async getProposal(accountId, proposalId) {
69
+ const params = accountProposalParams(accountId);
70
+ const response = await this.fetch(`/evm/proposals/${proposalId}?${params}`, { method: 'GET' });
71
+ return fromServerProposal((await response.json()));
72
+ }
73
+ async approveProposal(accountId, proposalId, request) {
74
+ const response = await this.fetch(`/evm/proposals/${proposalId}/approve`, {
75
+ method: 'POST',
76
+ body: JSON.stringify(toServerApproveRequest(accountId, request)),
77
+ });
78
+ return fromServerProposal((await response.json()));
79
+ }
80
+ async getExecutableProposal(accountId, proposalId) {
81
+ const params = accountProposalParams(accountId);
82
+ const response = await this.fetch(`/evm/proposals/${proposalId}/executable?${params}`, {
83
+ method: 'GET',
84
+ });
85
+ return fromServerExecutable((await response.json()));
86
+ }
87
+ async cancelProposal(accountId, proposalId) {
88
+ await this.fetch(`/evm/proposals/${proposalId}/cancel`, {
89
+ method: 'POST',
90
+ body: JSON.stringify(toServerCancelRequest(accountId)),
91
+ });
92
+ }
93
+ async resolveSigner(address) {
94
+ if (address) {
95
+ return normalizeEvmAddress(address);
96
+ }
97
+ if (this.signerAddress) {
98
+ return this.signerAddress;
99
+ }
100
+ return requestWalletAddress(this.requireProvider());
101
+ }
102
+ requireProvider() {
103
+ if (!this.provider) {
104
+ throw new Error('GuardianEvmClient requires a provider for wallet signing');
105
+ }
106
+ return this.provider;
107
+ }
108
+ async fetch(path, init) {
109
+ const response = await fetch(`${this.guardianUrl}${path}`, {
110
+ ...init,
111
+ credentials: 'include',
112
+ headers: {
113
+ 'Content-Type': 'application/json',
114
+ ...(this.cookieHeader ? { Cookie: this.cookieHeader } : {}),
115
+ ...init.headers,
116
+ },
117
+ });
118
+ if (!response.ok) {
119
+ const body = await response.text();
120
+ throw new GuardianEvmHttpError(response.status, response.statusText, body);
121
+ }
122
+ const setCookie = response.headers.get('set-cookie');
123
+ if (setCookie) {
124
+ this.cookieHeader = setCookie.split(';')[0];
125
+ }
126
+ return response;
127
+ }
128
+ }
129
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAwB,MAAM,WAAW,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC7B,8BAA8B,GAW/B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAA4B,MAAM,iBAAiB,CAAC;AAkBhF,MAAM,OAAO,iBAAiB;IACnB,WAAW,CAAS;IACpB,QAAQ,CAAmB;IAC3B,aAAa,CAAiB;IAC/B,YAAY,CAAU;IAE9B,YAAY,OAAiC;QAC3C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa;YACxC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,aAAa,CAAC;YAC5C,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IAED,SAAS,CAAC,OAAe,EAAE,mBAA2B;QACpD,OAAO,YAAY,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,SA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vmAddress(address: string): `0x${string}`;
3
+ export declare function normalizeBytes32(value: string, field: string): Hex;
4
+ export declare function normalizeSignature(value: string): Hex;
5
+ export declare function normalizeUint256String(value: string): string;
6
+ //# sourceMappingURL=encoding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAEnD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,CAElE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,CAKlE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAKrD;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAY5D"}
@@ -0,0 +1,30 @@
1
+ import { getAddress, isHex } from 'viem';
2
+ export function normalizeEvmAddress(address) {
3
+ return getAddress(address).toLowerCase();
4
+ }
5
+ export function normalizeBytes32(value, field) {
6
+ if (!isHex(value) || value.length !== 66) {
7
+ throw new Error(`${field} must be a 32-byte 0x-prefixed hex string`);
8
+ }
9
+ return value.toLowerCase();
10
+ }
11
+ export function normalizeSignature(value) {
12
+ if (!isHex(value) || value.length !== 132) {
13
+ throw new Error('signature must be a 65-byte 0x-prefixed hex string');
14
+ }
15
+ return value.toLowerCase();
16
+ }
17
+ export function normalizeUint256String(value) {
18
+ const trimmed = value.trim();
19
+ if (trimmed.startsWith('0x')) {
20
+ if (!isHex(trimmed) || trimmed.length > 66) {
21
+ throw new Error('nonce must be a uint256 decimal string or 0x-prefixed hex string');
22
+ }
23
+ return trimmed.toLowerCase();
24
+ }
25
+ if (!/^[0-9]+$/.test(trimmed)) {
26
+ throw new Error('nonce must be a uint256 decimal string or 0x-prefixed hex string');
27
+ }
28
+ return trimmed;
29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QAC9B,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare class GuardianEvmHttpError extends Error {
2
+ readonly status: number;
3
+ readonly statusText: string;
4
+ readonly body: string;
5
+ readonly code?: string;
6
+ constructor(status: number, statusText: string, body: string);
7
+ }
8
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,oBAAqB,SAAQ,KAAK;aAI3B,MAAM,EAAE,MAAM;aACd,UAAU,EAAE,MAAM;aAClB,IAAI,EAAE,MAAM;IAL9B,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;gBAGZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM;CAM/B"}
package/dist/errors.js ADDED
@@ -0,0 +1,24 @@
1
+ export class GuardianEvmHttpError extends Error {
2
+ status;
3
+ statusText;
4
+ body;
5
+ code;
6
+ constructor(status, statusText, body) {
7
+ super(`Guardian EVM HTTP error ${status}: ${statusText} - ${body}`);
8
+ this.status = status;
9
+ this.statusText = statusText;
10
+ this.body = body;
11
+ this.name = 'GuardianEvmHttpError';
12
+ this.code = parseErrorCode(body);
13
+ }
14
+ }
15
+ function parseErrorCode(body) {
16
+ try {
17
+ const parsed = JSON.parse(body);
18
+ return typeof parsed.code === 'string' ? parsed.code : undefined;
19
+ }
20
+ catch {
21
+ return undefined;
22
+ }
23
+ }
24
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAI3B;IACA;IACA;IALF,IAAI,CAAU;IAE9B,YACkB,MAAc,EACd,UAAkB,EAClB,IAAY;QAE5B,KAAK,CAAC,2BAA2B,MAAM,KAAK,UAAU,MAAM,IAAI,EAAE,CAAC,CAAC;QAJpD,WAAM,GAAN,MAAM,CAAQ;QACd,eAAU,GAAV,UAAU,CAAQ;QAClB,SAAI,GAAJ,IAAI,CAAQ;QAG5B,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;CACF;AAED,SAAS,cAAc,CAAC,IAAY;IAClC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAuB,CAAC;QACtD,OAAO,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { GuardianEvmClient, type EvmSession } from './client.js';
2
+ export { requestWalletAddress, signProposalHash, signTypedData, type Eip1193Provider, } from './auth.js';
3
+ export { normalizeBytes32, normalizeEvmAddress, normalizeSignature, normalizeUint256String } from './encoding.js';
4
+ export { GuardianEvmHttpError } from './errors.js';
5
+ export { buildEvmSessionTypedData, type EvmSessionChallenge, type GuardianTypedData, type TypedDataField, } from './typed-data.js';
6
+ export { evmAccountId, type AccountRegistration, type ApproveRequest, type ConfigureRequest, type EvmProposalSignature, type ExecutableProposal, type Proposal, type ProposeRequest, } from './proposals.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,KAAK,eAAe,GACrB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAClH,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EACb,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { GuardianEvmClient } from './client.js';
2
+ export { requestWalletAddress, signProposalHash, signTypedData, } from './auth.js';
3
+ export { normalizeBytes32, normalizeEvmAddress, normalizeSignature, normalizeUint256String } from './encoding.js';
4
+ export { GuardianEvmHttpError } from './errors.js';
5
+ export { buildEvmSessionTypedData, } from './typed-data.js';
6
+ export { evmAccountId, } from './proposals.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAmB,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,GAEd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAClH,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,wBAAwB,GAIzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,YAAY,GAQb,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,123 @@
1
+ export interface ConfigureRequest {
2
+ chainId: number;
3
+ smartAccountAddress: `0x${string}` | string;
4
+ multisigValidatorAddress: `0x${string}` | string;
5
+ }
6
+ export interface AccountRegistration {
7
+ accountId: string;
8
+ chainId: number;
9
+ accountAddress: `0x${string}`;
10
+ multisigValidatorAddress: `0x${string}`;
11
+ signers: `0x${string}`[];
12
+ threshold: number;
13
+ }
14
+ export interface EvmProposalSignature {
15
+ signer: `0x${string}`;
16
+ signature: `0x${string}`;
17
+ signedAt: number;
18
+ }
19
+ export interface ProposeRequest {
20
+ accountId?: string;
21
+ chainId: number;
22
+ smartAccountAddress: `0x${string}` | string;
23
+ userOpHash: `0x${string}` | string;
24
+ payload: string;
25
+ nonce: string;
26
+ signature: `0x${string}` | string;
27
+ ttlSeconds: number;
28
+ }
29
+ export interface Proposal {
30
+ proposalId: string;
31
+ accountId: string;
32
+ chainId: number;
33
+ smartAccountAddress: `0x${string}`;
34
+ validatorAddress: `0x${string}`;
35
+ userOpHash: `0x${string}`;
36
+ payload: string;
37
+ nonce: string;
38
+ nonceKey: string;
39
+ proposer: `0x${string}`;
40
+ signerSnapshot: `0x${string}`[];
41
+ threshold: number;
42
+ signatures: EvmProposalSignature[];
43
+ createdAt: number;
44
+ expiresAt: number;
45
+ }
46
+ export interface ApproveRequest {
47
+ signature: `0x${string}` | string;
48
+ }
49
+ export interface ExecutableProposal {
50
+ hash: `0x${string}`;
51
+ payload: string;
52
+ signatures: `0x${string}`[];
53
+ signers: `0x${string}`[];
54
+ }
55
+ export interface ServerRegisterAccountRequest {
56
+ chain_id: number;
57
+ account_address: string;
58
+ multisig_validator_address: string;
59
+ }
60
+ export interface ServerRegisterAccountResponse {
61
+ account_id: string;
62
+ chain_id: number;
63
+ account_address: string;
64
+ multisig_validator_address: string;
65
+ signers: string[];
66
+ threshold: number;
67
+ }
68
+ export interface ServerCreateProposalRequest {
69
+ account_id: string;
70
+ user_op_hash: string;
71
+ payload: string;
72
+ nonce: string;
73
+ ttl_seconds: number;
74
+ signature: string;
75
+ }
76
+ export interface ServerProposal {
77
+ proposal_id: string;
78
+ account_id: string;
79
+ chain_id: number;
80
+ smart_account_address: string;
81
+ validator_address: string;
82
+ user_op_hash: string;
83
+ payload: string;
84
+ nonce: string;
85
+ nonce_key: string;
86
+ proposer: string;
87
+ signer_snapshot: string[];
88
+ threshold: number;
89
+ signatures: ServerProposalSignature[];
90
+ created_at: number;
91
+ expires_at: number;
92
+ }
93
+ export interface ServerProposalSignature {
94
+ signer: string;
95
+ signature: string;
96
+ signed_at: number;
97
+ }
98
+ export interface ServerListProposalsResponse {
99
+ proposals: ServerProposal[];
100
+ }
101
+ export interface ServerApproveProposalRequest {
102
+ account_id: string;
103
+ signature: string;
104
+ }
105
+ export interface ServerCancelProposalRequest {
106
+ account_id: string;
107
+ }
108
+ export interface ServerExecutableProposal {
109
+ hash: string;
110
+ payload: string;
111
+ signatures: string[];
112
+ signers: string[];
113
+ }
114
+ export declare function evmAccountId(chainId: number, smartAccountAddress: string): string;
115
+ export declare function toServerRegisterAccountRequest(request: ConfigureRequest): ServerRegisterAccountRequest;
116
+ export declare function fromServerAccountRegistration(server: ServerRegisterAccountResponse): AccountRegistration;
117
+ export declare function toServerCreateProposalRequest(request: ProposeRequest): ServerCreateProposalRequest;
118
+ export declare function toServerApproveRequest(accountId: string, request: ApproveRequest): ServerApproveProposalRequest;
119
+ export declare function toServerCancelRequest(accountId: string): ServerCancelProposalRequest;
120
+ export declare function fromServerProposal(server: ServerProposal): Proposal;
121
+ export declare function fromServerExecutable(server: ServerExecutableProposal): ExecutableProposal;
122
+ export declare function accountProposalParams(accountId: string): URLSearchParams;
123
+ //# sourceMappingURL=proposals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proposals.d.ts","sourceRoot":"","sources":["../src/proposals.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,EAAE,KAAK,MAAM,EAAE,GAAG,M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