@provablehq/aleo-wallet-adaptor-shield 0.3.0-alpha.0

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,32 @@
1
+ # @provablehq/aleo-wallet-adaptor-shield
2
+
3
+ Prove wallet connector (alpha) built on top of the Aleo wallet adaptor core.
4
+
5
+ ## When to use it
6
+
7
+ - Integrate the Prove wallet (pre-release build) alongside other Aleo wallets.
8
+ - Offer developers a preview experience before the final Prove branding and APIs are finalised.
9
+ - Experiment with Prove-specific features while maintaining the shared adaptor contract.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ pnpm add @provablehq/aleo-wallet-adaptor-shield
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```tsx
20
+ import { ShieldWalletAdapter } from '@provablehq/aleo-wallet-adaptor-shield';
21
+
22
+ const wallets = [new ShieldWalletAdapter()];
23
+ ```
24
+
25
+ > **Note:** The exported class is still named `ShieldWalletAdapter` for internal compatibility. The package name will change again once the final brand is announced.
26
+
27
+ ## Related packages
28
+
29
+ - `@provablehq/aleo-wallet-adaptor-core` – required base implementation.
30
+ - `@provablehq/aleo-wallet-adaptor-react` – provider that wires this adapter into React apps.
31
+
32
+ Live demo: https://aleo-dev-toolkit-react-app.vercel.app/
@@ -0,0 +1,166 @@
1
+ import { TransactionOptions, Network, TransactionStatusResponse, TxHistoryResult, Account } from '@provablehq/aleo-types';
2
+ import { AleoDeployment, EventEmitter, WalletDecryptPermission, WalletName, WalletReadyState } from '@provablehq/aleo-wallet-standard';
3
+ import { BaseAleoWalletAdapter } from '@provablehq/aleo-wallet-adaptor-core';
4
+
5
+ interface ShieldWalletAdapterConfig {
6
+ }
7
+ interface ShieldTransaction extends TransactionOptions {
8
+ network: Network;
9
+ }
10
+ interface ShieldDeployment extends AleoDeployment {
11
+ network: Network;
12
+ }
13
+ interface ShieldWalletEvents {
14
+ networkChanged(network: Network): void;
15
+ disconnect(): void;
16
+ accountChanged(): void;
17
+ }
18
+ interface ShieldWallet extends EventEmitter<ShieldWalletEvents> {
19
+ publicKey?: string;
20
+ connect(network: Network, decryptPermission: WalletDecryptPermission, programs?: string[]): Promise<{
21
+ address: string;
22
+ }>;
23
+ disconnect(): Promise<void>;
24
+ signMessage(message: Uint8Array): Promise<Uint8Array>;
25
+ decrypt(cipherText: string): Promise<string>;
26
+ executeTransaction(transactionOptions: ShieldTransaction): Promise<{
27
+ transactionId?: string;
28
+ }>;
29
+ transactionStatus(transactionId: string): Promise<TransactionStatusResponse>;
30
+ switchNetwork(network: Network): Promise<void>;
31
+ requestRecords(program: string, includePlaintext?: boolean): Promise<unknown[]>;
32
+ executeDeployment(deployment: ShieldDeployment): Promise<{
33
+ transactionId: string;
34
+ }>;
35
+ transitionViewKeys: (transactionId: string) => Promise<string[]>;
36
+ requestTransactionHistory: (program: string) => Promise<TxHistoryResult>;
37
+ }
38
+ interface ShieldWindow extends Window {
39
+ shield?: ShieldWallet;
40
+ }
41
+
42
+ /**
43
+ * Shield wallet adapter
44
+ */
45
+ declare class ShieldWalletAdapter extends BaseAleoWalletAdapter {
46
+ /**
47
+ * The wallet name
48
+ */
49
+ readonly name: WalletName<"Shield Wallet">;
50
+ /**
51
+ * The wallet URL
52
+ */
53
+ url: string;
54
+ /**
55
+ * The wallet icon (base64-encoded SVG)
56
+ */
57
+ readonly icon = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cmVjdCB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiBmaWxsPSIjMDkwNzA3Ii8+CjxwYXRoIGQ9Ik01MTIgODcxQzcxMC4yNyA4NzEgODcxIDcxMC4yNyA4NzEgNTEyQzg3MSA1MDUuMTI0IDg3MC44MDcgNDk4LjI5MyA4NzAuNDI1IDQ5MS41MTJDNzQ2LjQzIDYyNy4wNTggNDYxLjk5NCA3NjIuNDcgMzE0LjM5OSA4MTAuNjY0TDMxMi42ODQgODEwLjYzM0MzNjkuNzA0IDg0OC43NjUgNDM4LjI1NSA4NzEgNTEyIDg3MVoiIGZpbGw9IndoaXRlIi8+CjxwYXRoIGQ9Ik0yNTAuNDA4IDc1Ny44NjhDMTkwLjAwNiA2OTMuNjI4IDE1MyA2MDcuMTM2IDE1MyA1MTJDMTUzIDMxMy43MyAzMTMuNzMgMTUzIDUxMiAxNTNDNjkyLjk5MyAxNTMgODQyLjcwMyAyODYuOTM4IDg2Ny40MiA0NjEuMTA1QzYxMS4yMTIgNjM4LjgyMyAzNzcuNjU5IDcxOC42OCAyNTEuMDQ2IDc1Ny44NjhIMjUwLjQwOFoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=";
58
+ /**
59
+ * The window object
60
+ */
61
+ private _window;
62
+ /**
63
+ * Current network
64
+ */
65
+ network: Network;
66
+ /**
67
+ * The wallet's decrypt permission
68
+ */
69
+ decryptPermission: WalletDecryptPermission;
70
+ /**
71
+ * Public key
72
+ */
73
+ private _publicKey;
74
+ _readyState: WalletReadyState;
75
+ /**
76
+ * Shield wallet instance
77
+ */
78
+ private _shieldWallet;
79
+ /**
80
+ * Create a new Shield wallet adapter
81
+ * @param config Adapter configuration
82
+ */
83
+ constructor(config?: ShieldWalletAdapterConfig);
84
+ /**
85
+ * Check if Shield wallet is available
86
+ */
87
+ private _checkAvailability;
88
+ /**
89
+ * Connect to Shield wallet
90
+ * @returns The connected account
91
+ */
92
+ connect(network: Network, decryptPermission: WalletDecryptPermission, programs?: string[]): Promise<Account>;
93
+ /**
94
+ * Disconnect from Shield wallet
95
+ */
96
+ disconnect(): Promise<void>;
97
+ /**
98
+ * Sign a transaction with Shield wallet
99
+ * @param message The message to sign
100
+ * @returns The signed message
101
+ */
102
+ signMessage(message: Uint8Array): Promise<Uint8Array>;
103
+ decrypt(cipherText: string): Promise<string>;
104
+ /**
105
+ * Execute a transaction with Shield wallet
106
+ * @param options Transaction options
107
+ * @returns The executed temporary transaction ID
108
+ */
109
+ executeTransaction(options: TransactionOptions): Promise<{
110
+ transactionId: string;
111
+ }>;
112
+ /**
113
+ * Get transaction status
114
+ * @param transactionId The transaction ID
115
+ * @returns The transaction status
116
+ */
117
+ transactionStatus(transactionId: string): Promise<TransactionStatusResponse>;
118
+ /**
119
+ * Switch the network
120
+ * @param network The network to switch to
121
+ */
122
+ switchNetwork(_network: Network): Promise<void>;
123
+ /**
124
+ * Request records from Shield wallet
125
+ * @param program The program to request records from
126
+ * @param includePlaintext Whether to include plaintext on each record
127
+ * @returns The records
128
+ */
129
+ requestRecords(program: string, includePlaintext: boolean): Promise<unknown[]>;
130
+ /**
131
+ * Execute a deployment
132
+ * @param deployment The deployment to execute
133
+ * @returns The executed transaction ID
134
+ */
135
+ executeDeployment(deployment: AleoDeployment): Promise<{
136
+ transactionId: string;
137
+ }>;
138
+ /**
139
+ * get transition view keys(tvk) for a transaction
140
+ * @param transactionId The transaction ID
141
+ * @returns The tvk array
142
+ */
143
+ transitionViewKeys(transactionId: string): Promise<string[]>;
144
+ /**
145
+ * get transaction of specific program
146
+ * @param program The program ID
147
+ * @returns array of transactionId
148
+ */
149
+ requestTransactionHistory(program: string): Promise<TxHistoryResult>;
150
+ /**
151
+ * EVENTS HANDLING
152
+ */
153
+ _onNetworkChange: (network: Network) => void;
154
+ _onAccountChange: () => void;
155
+ _onDisconnect: () => void;
156
+ /**
157
+ * Set up event listeners with structured approach
158
+ */
159
+ private _setupListeners;
160
+ /**
161
+ * Clean up all event listeners
162
+ */
163
+ private _cleanupListeners;
164
+ }
165
+
166
+ export { type ShieldDeployment, type ShieldTransaction, type ShieldWallet, ShieldWalletAdapter, type ShieldWalletAdapterConfig, type ShieldWalletEvents, type ShieldWindow };
@@ -0,0 +1,166 @@
1
+ import { TransactionOptions, Network, TransactionStatusResponse, TxHistoryResult, Account } from '@provablehq/aleo-types';
2
+ import { AleoDeployment, EventEmitter, WalletDecryptPermission, WalletName, WalletReadyState } from '@provablehq/aleo-wallet-standard';
3
+ import { BaseAleoWalletAdapter } from '@provablehq/aleo-wallet-adaptor-core';
4
+
5
+ interface ShieldWalletAdapterConfig {
6
+ }
7
+ interface ShieldTransaction extends TransactionOptions {
8
+ network: Network;
9
+ }
10
+ interface ShieldDeployment extends AleoDeployment {
11
+ network: Network;
12
+ }
13
+ interface ShieldWalletEvents {
14
+ networkChanged(network: Network): void;
15
+ disconnect(): void;
16
+ accountChanged(): void;
17
+ }
18
+ interface ShieldWallet extends EventEmitter<ShieldWalletEvents> {
19
+ publicKey?: string;
20
+ connect(network: Network, decryptPermission: WalletDecryptPermission, programs?: string[]): Promise<{
21
+ address: string;
22
+ }>;
23
+ disconnect(): Promise<void>;
24
+ signMessage(message: Uint8Array): Promise<Uint8Array>;
25
+ decrypt(cipherText: string): Promise<string>;
26
+ executeTransaction(transactionOptions: ShieldTransaction): Promise<{
27
+ transactionId?: string;
28
+ }>;
29
+ transactionStatus(transactionId: string): Promise<TransactionStatusResponse>;
30
+ switchNetwork(network: Network): Promise<void>;
31
+ requestRecords(program: string, includePlaintext?: boolean): Promise<unknown[]>;
32
+ executeDeployment(deployment: ShieldDeployment): Promise<{
33
+ transactionId: string;
34
+ }>;
35
+ transitionViewKeys: (transactionId: string) => Promise<string[]>;
36
+ requestTransactionHistory: (program: string) => Promise<TxHistoryResult>;
37
+ }
38
+ interface ShieldWindow extends Window {
39
+ shield?: ShieldWallet;
40
+ }
41
+
42
+ /**
43
+ * Shield wallet adapter
44
+ */
45
+ declare class ShieldWalletAdapter extends BaseAleoWalletAdapter {
46
+ /**
47
+ * The wallet name
48
+ */
49
+ readonly name: WalletName<"Shield Wallet">;
50
+ /**
51
+ * The wallet URL
52
+ */
53
+ url: string;
54
+ /**
55
+ * The wallet icon (base64-encoded SVG)
56
+ */
57
+ readonly icon = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cmVjdCB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiBmaWxsPSIjMDkwNzA3Ii8+CjxwYXRoIGQ9Ik01MTIgODcxQzcxMC4yNyA4NzEgODcxIDcxMC4yNyA4NzEgNTEyQzg3MSA1MDUuMTI0IDg3MC44MDcgNDk4LjI5MyA4NzAuNDI1IDQ5MS41MTJDNzQ2LjQzIDYyNy4wNTggNDYxLjk5NCA3NjIuNDcgMzE0LjM5OSA4MTAuNjY0TDMxMi42ODQgODEwLjYzM0MzNjkuNzA0IDg0OC43NjUgNDM4LjI1NSA4NzEgNTEyIDg3MVoiIGZpbGw9IndoaXRlIi8+CjxwYXRoIGQ9Ik0yNTAuNDA4IDc1Ny44NjhDMTkwLjAwNiA2OTMuNjI4IDE1MyA2MDcuMTM2IDE1MyA1MTJDMTUzIDMxMy43MyAzMTMuNzMgMTUzIDUxMiAxNTNDNjkyLjk5MyAxNTMgODQyLjcwMyAyODYuOTM4IDg2Ny40MiA0NjEuMTA1QzYxMS4yMTIgNjM4LjgyMyAzNzcuNjU5IDcxOC42OCAyNTEuMDQ2IDc1Ny44NjhIMjUwLjQwOFoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=";
58
+ /**
59
+ * The window object
60
+ */
61
+ private _window;
62
+ /**
63
+ * Current network
64
+ */
65
+ network: Network;
66
+ /**
67
+ * The wallet's decrypt permission
68
+ */
69
+ decryptPermission: WalletDecryptPermission;
70
+ /**
71
+ * Public key
72
+ */
73
+ private _publicKey;
74
+ _readyState: WalletReadyState;
75
+ /**
76
+ * Shield wallet instance
77
+ */
78
+ private _shieldWallet;
79
+ /**
80
+ * Create a new Shield wallet adapter
81
+ * @param config Adapter configuration
82
+ */
83
+ constructor(config?: ShieldWalletAdapterConfig);
84
+ /**
85
+ * Check if Shield wallet is available
86
+ */
87
+ private _checkAvailability;
88
+ /**
89
+ * Connect to Shield wallet
90
+ * @returns The connected account
91
+ */
92
+ connect(network: Network, decryptPermission: WalletDecryptPermission, programs?: string[]): Promise<Account>;
93
+ /**
94
+ * Disconnect from Shield wallet
95
+ */
96
+ disconnect(): Promise<void>;
97
+ /**
98
+ * Sign a transaction with Shield wallet
99
+ * @param message The message to sign
100
+ * @returns The signed message
101
+ */
102
+ signMessage(message: Uint8Array): Promise<Uint8Array>;
103
+ decrypt(cipherText: string): Promise<string>;
104
+ /**
105
+ * Execute a transaction with Shield wallet
106
+ * @param options Transaction options
107
+ * @returns The executed temporary transaction ID
108
+ */
109
+ executeTransaction(options: TransactionOptions): Promise<{
110
+ transactionId: string;
111
+ }>;
112
+ /**
113
+ * Get transaction status
114
+ * @param transactionId The transaction ID
115
+ * @returns The transaction status
116
+ */
117
+ transactionStatus(transactionId: string): Promise<TransactionStatusResponse>;
118
+ /**
119
+ * Switch the network
120
+ * @param network The network to switch to
121
+ */
122
+ switchNetwork(_network: Network): Promise<void>;
123
+ /**
124
+ * Request records from Shield wallet
125
+ * @param program The program to request records from
126
+ * @param includePlaintext Whether to include plaintext on each record
127
+ * @returns The records
128
+ */
129
+ requestRecords(program: string, includePlaintext: boolean): Promise<unknown[]>;
130
+ /**
131
+ * Execute a deployment
132
+ * @param deployment The deployment to execute
133
+ * @returns The executed transaction ID
134
+ */
135
+ executeDeployment(deployment: AleoDeployment): Promise<{
136
+ transactionId: string;
137
+ }>;
138
+ /**
139
+ * get transition view keys(tvk) for a transaction
140
+ * @param transactionId The transaction ID
141
+ * @returns The tvk array
142
+ */
143
+ transitionViewKeys(transactionId: string): Promise<string[]>;
144
+ /**
145
+ * get transaction of specific program
146
+ * @param program The program ID
147
+ * @returns array of transactionId
148
+ */
149
+ requestTransactionHistory(program: string): Promise<TxHistoryResult>;
150
+ /**
151
+ * EVENTS HANDLING
152
+ */
153
+ _onNetworkChange: (network: Network) => void;
154
+ _onAccountChange: () => void;
155
+ _onDisconnect: () => void;
156
+ /**
157
+ * Set up event listeners with structured approach
158
+ */
159
+ private _setupListeners;
160
+ /**
161
+ * Clean up all event listeners
162
+ */
163
+ private _cleanupListeners;
164
+ }
165
+
166
+ export { type ShieldDeployment, type ShieldTransaction, type ShieldWallet, ShieldWalletAdapter, type ShieldWalletAdapterConfig, type ShieldWalletEvents, type ShieldWindow };