@miden-sdk/miden-wallet-adapter-base 0.16.2 → 0.16.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.
Files changed (114) hide show
  1. package/dist/adapter.js.map +1 -1
  2. package/dist/errors.js.map +1 -1
  3. package/dist/helpers.js.map +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/signer.js.map +1 -1
  6. package/dist/transaction.js.map +1 -1
  7. package/dist/types.js.map +1 -1
  8. package/package.json +9 -3
  9. package/__tests__/adapter.test.ts +0 -82
  10. package/__tests__/errors.test.ts +0 -100
  11. package/__tests__/helpers.test.ts +0 -39
  12. package/__tests__/signer.test.ts +0 -20
  13. package/__tests__/transaction.test.ts +0 -166
  14. package/adapter.ts +0 -146
  15. package/dist/__tests__/adapter.test.d.ts +0 -1
  16. package/dist/__tests__/adapter.test.js +0 -66
  17. package/dist/__tests__/adapter.test.js.map +0 -1
  18. package/dist/__tests__/errors.test.d.ts +0 -1
  19. package/dist/__tests__/errors.test.js +0 -70
  20. package/dist/__tests__/errors.test.js.map +0 -1
  21. package/dist/__tests__/helpers.test.d.ts +0 -1
  22. package/dist/__tests__/helpers.test.js +0 -35
  23. package/dist/__tests__/helpers.test.js.map +0 -1
  24. package/dist/__tests__/signer.test.d.ts +0 -1
  25. package/dist/__tests__/signer.test.js +0 -18
  26. package/dist/__tests__/signer.test.js.map +0 -1
  27. package/dist/__tests__/transaction.test.d.ts +0 -1
  28. package/dist/__tests__/transaction.test.js +0 -113
  29. package/dist/__tests__/transaction.test.js.map +0 -1
  30. package/dist/vitest.config.d.ts +0 -2
  31. package/dist/vitest.config.js +0 -8
  32. package/dist/vitest.config.js.map +0 -1
  33. package/docs/@miden-sdk/namespaces/EventEmitter/README.md +0 -24
  34. package/docs/@miden-sdk/namespaces/EventEmitter/interfaces/EventEmitterStatic.md +0 -17
  35. package/docs/@miden-sdk/namespaces/EventEmitter/interfaces/ListenerFn.md +0 -25
  36. package/docs/@miden-sdk/namespaces/EventEmitter/type-aliases/ArgumentMap.md +0 -15
  37. package/docs/@miden-sdk/namespaces/EventEmitter/type-aliases/EventArgs.md +0 -19
  38. package/docs/@miden-sdk/namespaces/EventEmitter/type-aliases/EventListener.md +0 -19
  39. package/docs/@miden-sdk/namespaces/EventEmitter/type-aliases/EventNames.md +0 -15
  40. package/docs/@miden-sdk/namespaces/EventEmitter/type-aliases/ValidEventTypes.md +0 -17
  41. package/docs/@miden-sdk/namespaces/EventEmitter/variables/EventEmitter.md +0 -9
  42. package/docs/README.md +0 -88
  43. package/docs/classes/BaseMessageSignerWalletAdapter.md +0 -755
  44. package/docs/classes/BaseSignerWalletAdapter.md +0 -579
  45. package/docs/classes/BaseWalletAdapter.md +0 -535
  46. package/docs/classes/ConsumeTransaction.md +0 -93
  47. package/docs/classes/CustomTransaction.md +0 -93
  48. package/docs/classes/EventEmitter.md +0 -305
  49. package/docs/classes/SendTransaction.md +0 -107
  50. package/docs/classes/Transaction.md +0 -151
  51. package/docs/classes/WalletAccountError.md +0 -223
  52. package/docs/classes/WalletAddressError.md +0 -223
  53. package/docs/classes/WalletConfigError.md +0 -223
  54. package/docs/classes/WalletConnectionError.md +0 -223
  55. package/docs/classes/WalletDecryptionError.md +0 -223
  56. package/docs/classes/WalletDecryptionNotAllowedError.md +0 -223
  57. package/docs/classes/WalletDisconnectedError.md +0 -223
  58. package/docs/classes/WalletDisconnectionError.md +0 -223
  59. package/docs/classes/WalletError.md +0 -244
  60. package/docs/classes/WalletKeypairError.md +0 -223
  61. package/docs/classes/WalletLoadError.md +0 -223
  62. package/docs/classes/WalletNotConnectedError.md +0 -223
  63. package/docs/classes/WalletNotReadyError.md +0 -223
  64. package/docs/classes/WalletNotSelectedError.md +0 -223
  65. package/docs/classes/WalletPrivateDataPermissionError.md +0 -223
  66. package/docs/classes/WalletRecordsError.md +0 -223
  67. package/docs/classes/WalletSendTransactionError.md +0 -223
  68. package/docs/classes/WalletSignMessageError.md +0 -223
  69. package/docs/classes/WalletSignTransactionError.md +0 -223
  70. package/docs/classes/WalletTimeoutError.md +0 -223
  71. package/docs/classes/WalletTransactionError.md +0 -223
  72. package/docs/classes/WalletWindowBlockedError.md +0 -223
  73. package/docs/classes/WalletWindowClosedError.md +0 -223
  74. package/docs/enumerations/AllowedPrivateData.md +0 -37
  75. package/docs/enumerations/PrivateDataPermission.md +0 -19
  76. package/docs/enumerations/TransactionType.md +0 -25
  77. package/docs/enumerations/WalletAdapterNetwork.md +0 -19
  78. package/docs/enumerations/WalletReadyState.md +0 -49
  79. package/docs/functions/b64ToU8.md +0 -19
  80. package/docs/functions/scopePollingDetectionStrategy.md +0 -19
  81. package/docs/functions/u8ToB64.md +0 -19
  82. package/docs/interfaces/Asset.md +0 -19
  83. package/docs/interfaces/IFailedTransactionOutput.md +0 -13
  84. package/docs/interfaces/MessageSignerWalletAdapterProps.md +0 -293
  85. package/docs/interfaces/MidenConsumeTransaction.md +0 -37
  86. package/docs/interfaces/MidenCustomTransaction.md +0 -37
  87. package/docs/interfaces/MidenSendTransaction.md +0 -43
  88. package/docs/interfaces/MidenTransaction.md +0 -19
  89. package/docs/interfaces/SignerWalletAdapterProps.md +0 -149
  90. package/docs/interfaces/TransactionOutput.md +0 -19
  91. package/docs/interfaces/WalletAdapterEvents.md +0 -69
  92. package/docs/interfaces/WalletAdapterProps.md +0 -106
  93. package/docs/interfaces/WalletTransactionSuccessOutput.md +0 -19
  94. package/docs/type-aliases/Adapter.md +0 -9
  95. package/docs/type-aliases/FungibleAssetDetails.md +0 -21
  96. package/docs/type-aliases/InputNoteDetails.md +0 -45
  97. package/docs/type-aliases/MessageSignerWalletAdapter.md +0 -15
  98. package/docs/type-aliases/NoteTypeString.md +0 -9
  99. package/docs/type-aliases/SignKind.md +0 -9
  100. package/docs/type-aliases/SignerWalletAdapter.md +0 -15
  101. package/docs/type-aliases/SupportedTransactionVersions.md +0 -9
  102. package/docs/type-aliases/TransactionOrVersionedTransaction.md +0 -15
  103. package/docs/type-aliases/TransactionPayload.md +0 -9
  104. package/docs/type-aliases/WalletAdapter.md +0 -15
  105. package/docs/type-aliases/WalletName.md +0 -21
  106. package/docs/type-aliases/WalletTransactionOutput.md +0 -9
  107. package/errors.ts +0 -97
  108. package/helpers.ts +0 -28
  109. package/index.ts +0 -6
  110. package/signer.ts +0 -84
  111. package/transaction.ts +0 -178
  112. package/tsconfig.json +0 -15
  113. package/types.ts +0 -93
  114. package/vitest.config.ts +0 -8
package/transaction.ts DELETED
@@ -1,178 +0,0 @@
1
- import type { TransactionRequest } from "@miden-sdk/miden-sdk";
2
- import { u8ToB64 } from "./helpers";
3
-
4
- export type NoteTypeString = "public" | "private";
5
-
6
- export interface MidenSendTransaction {
7
- senderAddress: string;
8
- recipientAddress: string;
9
- faucetId: string;
10
- noteType: NoteTypeString;
11
- amount: number;
12
- recallBlocks?: number;
13
- }
14
-
15
- export class SendTransaction implements MidenSendTransaction {
16
- senderAddress: string;
17
- recipientAddress: string;
18
- faucetId: string;
19
- noteType: NoteTypeString;
20
- amount: number;
21
- recallBlocks?: number;
22
-
23
- constructor(
24
- sender: string,
25
- recipient: string,
26
- faucetId: string,
27
- noteType: NoteTypeString,
28
- amount: number,
29
- recallBlocks?: number
30
- ) {
31
- this.senderAddress = sender;
32
- this.recipientAddress = recipient;
33
- this.faucetId = faucetId;
34
- this.noteType = noteType;
35
- this.amount = amount;
36
- this.recallBlocks = recallBlocks;
37
- }
38
- }
39
-
40
- export interface MidenConsumeTransaction {
41
- faucetId: string;
42
- noteId: string;
43
- noteType: NoteTypeString;
44
- amount: number;
45
- noteBytes?: string;
46
- }
47
-
48
- export class ConsumeTransaction implements MidenConsumeTransaction {
49
- faucetId: string;
50
- noteId: string;
51
- noteType: NoteTypeString;
52
- amount: number;
53
- noteBytes?: string;
54
-
55
- constructor(
56
- faucetId: string,
57
- noteId: string,
58
- noteType: NoteTypeString,
59
- amount: number,
60
- noteBytes?: Uint8Array
61
- ) {
62
- this.faucetId = faucetId;
63
- this.noteId = noteId;
64
- this.noteType = noteType;
65
- this.amount = amount;
66
- this.noteBytes = noteBytes ? u8ToB64(noteBytes) : undefined;
67
- }
68
- }
69
-
70
- export interface MidenCustomTransaction {
71
- address: string;
72
- recipientAddress: string;
73
- transactionRequest: string;
74
- inputNoteIds?: string[];
75
- importNotes?: string[];
76
- }
77
-
78
- export class CustomTransaction implements MidenCustomTransaction {
79
- address: string;
80
- recipientAddress: string;
81
- transactionRequest: string;
82
- inputNoteIds?: string[];
83
- importNotes?: string[];
84
-
85
- constructor(
86
- address: string,
87
- recipientAddress: string,
88
- transactionRequest: TransactionRequest,
89
- inputNotesIds?: string[],
90
- inputNoteBytes?: Uint8Array[]
91
- ) {
92
- this.address = address;
93
- this.recipientAddress = recipientAddress;
94
- const requestBytes = transactionRequest.serialize();
95
- const base64 = u8ToB64(requestBytes);
96
- this.transactionRequest = base64;
97
- this.inputNoteIds = inputNotesIds;
98
- this.importNotes = inputNoteBytes?.map((note) => u8ToB64(note));
99
- }
100
- }
101
-
102
- export enum TransactionType {
103
- Send = "send",
104
- Consume = "consume",
105
- Custom = "custom",
106
- }
107
- export type TransactionPayload =
108
- | MidenSendTransaction
109
- | MidenConsumeTransaction
110
- | MidenCustomTransaction;
111
-
112
- export interface MidenTransaction {
113
- type: TransactionType;
114
- payload: TransactionPayload;
115
- }
116
-
117
- export class Transaction implements MidenTransaction {
118
- type: TransactionType;
119
- payload: TransactionPayload;
120
-
121
- constructor(type: TransactionType, payload: TransactionPayload) {
122
- this.type = type;
123
- this.payload = payload;
124
- }
125
-
126
- static createSendTransaction(
127
- sender: string,
128
- recipient: string,
129
- faucetId: string,
130
- noteType: NoteTypeString,
131
- amount: number,
132
- recallBlocks?: number
133
- ) {
134
- const sendTransaction = new SendTransaction(
135
- sender,
136
- recipient,
137
- faucetId,
138
- noteType,
139
- amount,
140
- recallBlocks
141
- );
142
- return new Transaction(TransactionType.Send, sendTransaction);
143
- }
144
-
145
- static createConsumeTransaction(
146
- faucetId: string,
147
- noteId: string,
148
- noteType: NoteTypeString,
149
- amount: number,
150
- noteBytes?: Uint8Array
151
- ) {
152
- const consumeTransaction = new ConsumeTransaction(
153
- faucetId,
154
- noteId,
155
- noteType,
156
- amount,
157
- noteBytes
158
- );
159
- return new Transaction(TransactionType.Consume, consumeTransaction);
160
- }
161
-
162
- static createCustomTransaction(
163
- address: string,
164
- recipientAddress: string,
165
- transactionRequest: TransactionRequest,
166
- inputNoteIds?: string[],
167
- noteBytes?: Uint8Array[]
168
- ) {
169
- const transactionBytes = new CustomTransaction(
170
- address,
171
- recipientAddress,
172
- transactionRequest,
173
- inputNoteIds,
174
- noteBytes
175
- );
176
- return new Transaction(TransactionType.Custom, transactionBytes);
177
- }
178
- }
package/tsconfig.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "module": "ESNext",
5
- "declaration": true,
6
- "outDir": "dist",
7
- "sourceMap": true,
8
- "moduleResolution": "node",
9
- "esModuleInterop": true,
10
- "forceConsistentCasingInFileNames": true,
11
- "allowSyntheticDefaultImports": true,
12
- "skipLibCheck": true
13
- },
14
- "exclude": ["node_modules", "dist"]
15
- }
package/types.ts DELETED
@@ -1,93 +0,0 @@
1
- import type { InputNoteState, Note, NoteType } from "@miden-sdk/miden-sdk";
2
-
3
- export enum WalletAdapterNetwork {
4
- Devnet = "devnet",
5
- Testnet = "testnet",
6
- Localnet = "localnet",
7
- }
8
-
9
- export type SupportedTransactionVersions = ReadonlySet<any> | null;
10
-
11
- export type TransactionOrVersionedTransaction<
12
- S extends SupportedTransactionVersions,
13
- > = S extends null ? any : any | any;
14
-
15
- export enum PrivateDataPermission {
16
- UponRequest = "UPON_REQUEST", // The App must ask for permission to access private data every time
17
- Auto = "AUTO", // The App can access private data without confirmation
18
- }
19
-
20
- export enum AllowedPrivateData {
21
- None = 0,
22
- Assets = 1 << 0, // 1
23
- Notes = 1 << 1, // 2
24
- Storage = 1 << 2, // 4
25
- All = (1 << 16) - 1, // 65535 (allows for new permissions without requiring a migration)
26
- }
27
-
28
- export type SignKind = "word" | "signingInputs";
29
-
30
- export interface Asset {
31
- faucetId: string;
32
- amount: string;
33
- }
34
-
35
- export interface GuardianInfo {
36
- isGuardianAccount: boolean;
37
- guardianEndpoint: string | null;
38
- guardianProvider:
39
- | "open-zeppelin"
40
- | "gateway"
41
- | "lambda-class"
42
- | "custom"
43
- | null;
44
- guardianSyncStatus: "in-sync" | "out-of-sync" | null;
45
- }
46
-
47
- export type InputNoteDetails = {
48
- noteId: string;
49
- senderAccountId: string | undefined;
50
- assets: FungibleAssetDetails[];
51
- noteType: NoteType | undefined;
52
- nullifier: string;
53
- state: InputNoteState;
54
- };
55
-
56
- export type FungibleAssetDetails = {
57
- amount: string;
58
- faucetId: string;
59
- };
60
-
61
- // Developer-facing transaction output interface
62
- // Errors from the wallet are thrown as exceptions
63
- export interface TransactionOutput {
64
- txHash: string;
65
- outputNotes: Note[];
66
- }
67
-
68
- export interface IFailedTransactionOutput {
69
- errorMessage: string;
70
- }
71
-
72
- // Internal wallet response format - uses serialized note data (string[])
73
- // Converted to Note objects for the public API (TransactionOutput)
74
- export interface WalletTransactionSuccessOutput {
75
- txHash: string;
76
- outputNotes: string[];
77
- }
78
-
79
- export type WalletTransactionOutput =
80
- | WalletTransactionSuccessOutput
81
- | IFailedTransactionOutput;
82
-
83
- export type CreateAccountType =
84
- | "RegularAccountImmutableCode"
85
- | "RegularAccountUpdatableCode";
86
-
87
- export type CreateAccountStorageMode = "private" | "public";
88
-
89
- export interface CreateAccountParams {
90
- accountType?: CreateAccountType;
91
- storageMode?: CreateAccountStorageMode;
92
- customComponents?: Uint8Array[];
93
- }
package/vitest.config.ts DELETED
@@ -1,8 +0,0 @@
1
- import { defineConfig } from "vitest/config";
2
-
3
- export default defineConfig({
4
- test: {
5
- environment: "jsdom",
6
- globals: true,
7
- },
8
- });