@bloxchain/sdk 1.0.0-alpha

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 (132) hide show
  1. package/README.md +338 -0
  2. package/abi/BareBlox.abi.json +1341 -0
  3. package/abi/BaseStateMachine.abi.json +1308 -0
  4. package/abi/ControlBlox.abi.json +6210 -0
  5. package/abi/EngineBlox.abi.json +872 -0
  6. package/abi/GuardController.abi.json +3045 -0
  7. package/abi/IDefinition.abi.json +94 -0
  8. package/abi/RoleBlox.abi.json +4569 -0
  9. package/abi/RuntimeRBAC.abi.json +1857 -0
  10. package/abi/RuntimeRBACDefinitions.abi.json +133 -0
  11. package/abi/SecureBlox.abi.json +4085 -0
  12. package/abi/SecureOwnable.abi.json +4085 -0
  13. package/abi/SecureOwnableDefinitions.abi.json +354 -0
  14. package/abi/SimpleRWA20.abi.json +5545 -0
  15. package/abi/SimpleRWA20Definitions.abi.json +172 -0
  16. package/abi/SimpleVault.abi.json +5208 -0
  17. package/abi/SimpleVaultDefinitions.abi.json +250 -0
  18. package/dist/abi/BaseStateMachine.abi.json +1308 -0
  19. package/dist/abi/GuardController.abi.json +3045 -0
  20. package/dist/abi/IDefinition.abi.json +94 -0
  21. package/dist/abi/RuntimeRBAC.abi.json +1857 -0
  22. package/dist/abi/SecureOwnable.abi.json +4085 -0
  23. package/dist/contracts/BaseStateMachine.d.ts +83 -0
  24. package/dist/contracts/BaseStateMachine.d.ts.map +1 -0
  25. package/dist/contracts/BaseStateMachine.js +251 -0
  26. package/dist/contracts/BaseStateMachine.js.map +1 -0
  27. package/dist/contracts/GuardController.d.ts +120 -0
  28. package/dist/contracts/GuardController.d.ts.map +1 -0
  29. package/dist/contracts/GuardController.js +149 -0
  30. package/dist/contracts/GuardController.js.map +1 -0
  31. package/dist/contracts/RuntimeRBAC.d.ts +56 -0
  32. package/dist/contracts/RuntimeRBAC.d.ts.map +1 -0
  33. package/dist/contracts/RuntimeRBAC.js +57 -0
  34. package/dist/contracts/RuntimeRBAC.js.map +1 -0
  35. package/dist/contracts/SecureOwnable.d.ts +41 -0
  36. package/dist/contracts/SecureOwnable.d.ts.map +1 -0
  37. package/dist/contracts/SecureOwnable.js +82 -0
  38. package/dist/contracts/SecureOwnable.js.map +1 -0
  39. package/dist/index.d.ts +30 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +32 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/interfaces/base.index.d.ts +18 -0
  44. package/dist/interfaces/base.index.d.ts.map +1 -0
  45. package/dist/interfaces/base.index.js +2 -0
  46. package/dist/interfaces/base.index.js.map +1 -0
  47. package/dist/interfaces/base.state.machine.index.d.ts +72 -0
  48. package/dist/interfaces/base.state.machine.index.d.ts.map +1 -0
  49. package/dist/interfaces/base.state.machine.index.js +2 -0
  50. package/dist/interfaces/base.state.machine.index.js.map +1 -0
  51. package/dist/interfaces/core.access.index.d.ts +37 -0
  52. package/dist/interfaces/core.access.index.d.ts.map +1 -0
  53. package/dist/interfaces/core.access.index.js +2 -0
  54. package/dist/interfaces/core.access.index.js.map +1 -0
  55. package/dist/interfaces/core.execution.index.d.ts +44 -0
  56. package/dist/interfaces/core.execution.index.d.ts.map +1 -0
  57. package/dist/interfaces/core.execution.index.js +2 -0
  58. package/dist/interfaces/core.execution.index.js.map +1 -0
  59. package/dist/interfaces/core.security.index.d.ts +83 -0
  60. package/dist/interfaces/core.security.index.d.ts.map +1 -0
  61. package/dist/interfaces/core.security.index.js +2 -0
  62. package/dist/interfaces/core.security.index.js.map +1 -0
  63. package/dist/interfaces/definition.index.d.ts +38 -0
  64. package/dist/interfaces/definition.index.d.ts.map +1 -0
  65. package/dist/interfaces/definition.index.js +2 -0
  66. package/dist/interfaces/definition.index.js.map +1 -0
  67. package/dist/interfaces/lib.index.d.ts +83 -0
  68. package/dist/interfaces/lib.index.d.ts.map +1 -0
  69. package/dist/interfaces/lib.index.js +2 -0
  70. package/dist/interfaces/lib.index.js.map +1 -0
  71. package/dist/lib/Definition.d.ts +84 -0
  72. package/dist/lib/Definition.d.ts.map +1 -0
  73. package/dist/lib/Definition.js +159 -0
  74. package/dist/lib/Definition.js.map +1 -0
  75. package/dist/lib/EngineBlox.d.ts +167 -0
  76. package/dist/lib/EngineBlox.d.ts.map +1 -0
  77. package/dist/lib/EngineBlox.js +266 -0
  78. package/dist/lib/EngineBlox.js.map +1 -0
  79. package/dist/types/base.state.machine.index.d.ts +45 -0
  80. package/dist/types/base.state.machine.index.d.ts.map +1 -0
  81. package/dist/types/base.state.machine.index.js +49 -0
  82. package/dist/types/base.state.machine.index.js.map +1 -0
  83. package/dist/types/core.access.index.d.ts +51 -0
  84. package/dist/types/core.access.index.d.ts.map +1 -0
  85. package/dist/types/core.access.index.js +41 -0
  86. package/dist/types/core.access.index.js.map +1 -0
  87. package/dist/types/core.execution.index.d.ts +36 -0
  88. package/dist/types/core.execution.index.d.ts.map +1 -0
  89. package/dist/types/core.execution.index.js +30 -0
  90. package/dist/types/core.execution.index.js.map +1 -0
  91. package/dist/types/core.security.index.d.ts +36 -0
  92. package/dist/types/core.security.index.d.ts.map +1 -0
  93. package/dist/types/core.security.index.js +37 -0
  94. package/dist/types/core.security.index.js.map +1 -0
  95. package/dist/types/definition.index.d.ts +36 -0
  96. package/dist/types/definition.index.d.ts.map +1 -0
  97. package/dist/types/definition.index.js +4 -0
  98. package/dist/types/definition.index.js.map +1 -0
  99. package/dist/types/lib.index.d.ts +66 -0
  100. package/dist/types/lib.index.d.ts.map +1 -0
  101. package/dist/types/lib.index.js +68 -0
  102. package/dist/types/lib.index.js.map +1 -0
  103. package/dist/utils/bitmap.d.ts +75 -0
  104. package/dist/utils/bitmap.d.ts.map +1 -0
  105. package/dist/utils/bitmap.js +124 -0
  106. package/dist/utils/bitmap.js.map +1 -0
  107. package/dist/utils/contract-errors.d.ts +536 -0
  108. package/dist/utils/contract-errors.d.ts.map +1 -0
  109. package/dist/utils/contract-errors.js +412 -0
  110. package/dist/utils/contract-errors.js.map +1 -0
  111. package/dist/utils/erc20/ERC20Token.abi.json +217 -0
  112. package/dist/utils/erc20/erc20Token.d.ts +83 -0
  113. package/dist/utils/erc20/erc20Token.d.ts.map +1 -0
  114. package/dist/utils/erc20/erc20Token.js +173 -0
  115. package/dist/utils/erc20/erc20Token.js.map +1 -0
  116. package/dist/utils/interface-ids.d.ts +59 -0
  117. package/dist/utils/interface-ids.d.ts.map +1 -0
  118. package/dist/utils/interface-ids.js +149 -0
  119. package/dist/utils/interface-ids.js.map +1 -0
  120. package/dist/utils/metaTx/metaTransaction.d.ts +138 -0
  121. package/dist/utils/metaTx/metaTransaction.d.ts.map +1 -0
  122. package/dist/utils/metaTx/metaTransaction.js +271 -0
  123. package/dist/utils/metaTx/metaTransaction.js.map +1 -0
  124. package/dist/utils/validations.d.ts +104 -0
  125. package/dist/utils/validations.d.ts.map +1 -0
  126. package/dist/utils/validations.js +254 -0
  127. package/dist/utils/validations.js.map +1 -0
  128. package/dist/utils/viem-error-handler.d.ts +48 -0
  129. package/dist/utils/viem-error-handler.d.ts.map +1 -0
  130. package/dist/utils/viem-error-handler.js +172 -0
  131. package/dist/utils/viem-error-handler.js.map +1 -0
  132. package/package.json +65 -0
@@ -0,0 +1,412 @@
1
+ /**
2
+ * @file contract-errors.ts
3
+ * @description Official error definitions and utilities for Guardian contracts
4
+ *
5
+ * This file provides TypeScript interfaces and utilities for handling
6
+ * custom errors from Guardian smart contracts, particularly those defined
7
+ * in SharedValidation.sol. It enables proper error decoding and user-friendly
8
+ * error messages in the frontend.
9
+ *
10
+ * @author Guardian Framework Team
11
+ * @version 1.0.0
12
+ */
13
+ /**
14
+ * Error signature mapping for quick lookup
15
+ * Maps the keccak256 hash of the error signature to error information
16
+ * Note: These are placeholder signatures - in practice, you would use the actual keccak256 hashes
17
+ */
18
+ export const ERROR_SIGNATURES = {
19
+ // Address validation errors (placeholder signatures)
20
+ '0x2c7b6e7f': {
21
+ name: 'InvalidAddress',
22
+ params: ['provided'],
23
+ userMessage: (params) => `InvalidAddress: Invalid address provided: ${params.provided}`
24
+ },
25
+ '0x8c5be1e6': {
26
+ name: 'InvalidTargetAddress',
27
+ params: ['target'],
28
+ userMessage: (params) => `InvalidTargetAddress: Invalid target address: ${params.target}`
29
+ },
30
+ '0x5c60da1c': {
31
+ name: 'InvalidRequesterAddress',
32
+ params: ['requester'],
33
+ userMessage: (params) => `InvalidRequesterAddress: Invalid requester address: ${params.requester}`
34
+ },
35
+ '0x8da5cb5c': {
36
+ name: 'InvalidHandlerContract',
37
+ params: ['handler'],
38
+ userMessage: (params) => `InvalidHandlerContract: Invalid handler contract: ${params.handler}`
39
+ },
40
+ '0x8c5be1e7': {
41
+ name: 'InvalidSignerAddress',
42
+ params: ['signer'],
43
+ userMessage: (params) => `InvalidSignerAddress: Invalid signer address: ${params.signer}`
44
+ },
45
+ '0x5c60da1d': {
46
+ name: 'NotNewAddress',
47
+ params: ['newAddress', 'currentAddress'],
48
+ userMessage: () => `NotNewAddress: New address must be different from current address`
49
+ },
50
+ // Permission errors
51
+ '0x8da5cb5d': {
52
+ name: 'NoPermission',
53
+ params: ['caller'],
54
+ userMessage: (params) => `NoPermission: Caller ${params.caller} does not have permission`
55
+ },
56
+ '0x8c5be1e8': {
57
+ name: 'RestrictedOwner',
58
+ params: ['caller', 'owner'],
59
+ userMessage: () => `RestrictedOwner: Only the owner can perform this action`
60
+ },
61
+ '0x5c60da1e': {
62
+ name: 'RestrictedBroadcaster',
63
+ params: ['caller', 'broadcaster'],
64
+ userMessage: () => `RestrictedBroadcaster: Only the broadcaster can perform this action`
65
+ },
66
+ '0x8da5cb5e': {
67
+ name: 'SignerNotAuthorized',
68
+ params: ['signer'],
69
+ userMessage: (params) => `SignerNotAuthorized: Signer ${params.signer} is not authorized`
70
+ },
71
+ // Resource and item management errors
72
+ '0x9da5cb5f': {
73
+ name: 'ItemAlreadyExists',
74
+ params: ['item'],
75
+ userMessage: (params) => `ItemAlreadyExists: Item ${params.item} already exists`
76
+ },
77
+ '0x9da5cb60': {
78
+ name: 'ItemNotFound',
79
+ params: ['item'],
80
+ userMessage: (params) => `ItemNotFound: Item ${params.item} not found`
81
+ },
82
+ '0x9da5cb61': {
83
+ name: 'TargetNotWhitelisted',
84
+ params: ['target', 'functionSelector', 'roleHash'],
85
+ userMessage: (params) => `TargetNotWhitelisted: Target ${params.target} is not whitelisted for function selector ${params.functionSelector} and role ${params.roleHash}`
86
+ },
87
+ '0x9da5cb62': {
88
+ name: 'ResourceNotFound',
89
+ params: ['resource'],
90
+ userMessage: (params) => `ResourceNotFound: Resource ${params.resource} not found`
91
+ },
92
+ // Operation errors
93
+ '0x8c5be1e9': {
94
+ name: 'OperationNotSupported',
95
+ params: [],
96
+ userMessage: () => `OperationNotSupported: This operation is not supported`
97
+ },
98
+ '0x5c60da1f': {
99
+ name: 'RequestAlreadyPending',
100
+ params: ['txId'],
101
+ userMessage: (params) => `RequestAlreadyPending: Request is already pending (Transaction ID: ${params.txId})`
102
+ },
103
+ '0x8da5cb5f': {
104
+ name: 'TransactionNotFound',
105
+ params: ['txId'],
106
+ userMessage: (params) => `TransactionNotFound: Transaction not found: ${params.txId}`
107
+ },
108
+ // Time errors
109
+ '0x8c5be1ea': {
110
+ name: 'DeadlineInPast',
111
+ params: ['deadline', 'currentTime'],
112
+ userMessage: () => `DeadlineInPast: Transaction deadline has passed`
113
+ },
114
+ '0x5c60da20': {
115
+ name: 'MetaTxExpired',
116
+ params: ['deadline', 'currentTime'],
117
+ userMessage: () => `MetaTxExpired: Meta-transaction has expired`
118
+ },
119
+ // Role errors
120
+ '0x8da5cb60': {
121
+ name: 'RoleDoesNotExist',
122
+ params: [],
123
+ userMessage: () => `RoleDoesNotExist: Role does not exist`
124
+ },
125
+ '0x8c5be1eb': {
126
+ name: 'WalletAlreadyInRole',
127
+ params: ['wallet'],
128
+ userMessage: (params) => `WalletAlreadyInRole: Wallet ${params.wallet} is already in this role`
129
+ },
130
+ '0x5c60da21': {
131
+ name: 'RoleWalletLimitReached',
132
+ params: ['currentCount', 'maxWallets'],
133
+ userMessage: (params) => `RoleWalletLimitReached: Role wallet limit reached (${params.currentCount}/${params.maxWallets})`
134
+ },
135
+ // Signature errors
136
+ '0x8da5cb61': {
137
+ name: 'InvalidSignatureLength',
138
+ params: ['providedLength', 'expectedLength'],
139
+ userMessage: (params) => `InvalidSignatureLength: Invalid signature length: ${params.providedLength} (expected: ${params.expectedLength})`
140
+ },
141
+ '0x8c5be1ec': {
142
+ name: 'InvalidNonce',
143
+ params: ['providedNonce', 'expectedNonce'],
144
+ userMessage: (params) => `InvalidNonce: Invalid nonce: ${params.providedNonce} (expected: ${params.expectedNonce})`
145
+ },
146
+ '0x5c60da22': {
147
+ name: 'ChainIdMismatch',
148
+ params: ['providedChainId', 'expectedChainId'],
149
+ userMessage: (params) => `ChainIdMismatch: Chain ID mismatch: ${params.providedChainId} (expected: ${params.expectedChainId})`
150
+ },
151
+ // Balance errors
152
+ '0x8da5cb62': {
153
+ name: 'InsufficientBalance',
154
+ params: ['currentBalance', 'requiredAmount'],
155
+ userMessage: (params) => `InsufficientBalance: Insufficient balance: ${params.currentBalance} (required: ${params.requiredAmount})`
156
+ },
157
+ // Function validation errors
158
+ '0x8c5be1ee': {
159
+ name: 'HandlerForSelectorMismatch',
160
+ params: ['schemaHandlerForSelector', 'permissionHandlerForSelector'],
161
+ userMessage: (params) => `HandlerForSelectorMismatch: Handler selector mismatch - schema handler: ${params.schemaHandlerForSelector}, permission handler: ${params.permissionHandlerForSelector}`
162
+ },
163
+ '0x51d89ea2': {
164
+ name: 'ContractFunctionMustBeProtected',
165
+ params: ['functionSelector', 'functionSignature'],
166
+ userMessage: (params) => `ContractFunctionMustBeProtected: Internal function ${params.functionSignature} (selector: ${params.functionSelector}) must be protected`
167
+ },
168
+ // Array errors
169
+ '0x8c5be1ed': {
170
+ name: 'ArrayLengthMismatch',
171
+ params: ['array1Length', 'array2Length'],
172
+ userMessage: (params) => `ArrayLengthMismatch: Array length mismatch: ${params.array1Length} vs ${params.array2Length}`
173
+ },
174
+ '0x5c60da23': {
175
+ name: 'IndexOutOfBounds',
176
+ params: ['index', 'arrayLength'],
177
+ userMessage: (params) => `IndexOutOfBounds: Index out of bounds: ${params.index} (array length: ${params.arrayLength})`
178
+ }
179
+ };
180
+ /**
181
+ * Common error patterns that can be extracted from revert data
182
+ */
183
+ export const COMMON_ERROR_PATTERNS = [
184
+ 'OWNER_ROLE',
185
+ 'ADMIN_ROLE',
186
+ 'OPERATOR_ROLE',
187
+ 'GUARDIAN_ROLE',
188
+ 'Only owner',
189
+ 'Access denied',
190
+ 'Not authorized',
191
+ 'Invalid role',
192
+ 'Unauthorized',
193
+ 'Permission denied',
194
+ 'Caller is not',
195
+ 'Only one',
196
+ 'already exists',
197
+ 'not found',
198
+ 'insufficient',
199
+ 'overflow',
200
+ 'underflow',
201
+ 'division by zero',
202
+ 'invalid opcode',
203
+ 'execution reverted',
204
+ 'revert',
205
+ 'require',
206
+ 'assert'
207
+ ];
208
+ /**
209
+ * Decode a revert reason from hex data
210
+ * @param data Hex string containing the revert data
211
+ * @returns Decoded error information or null if decoding fails
212
+ */
213
+ export function decodeRevertReason(data) {
214
+ try {
215
+ // Ensure data is hex string without 0x prefix
216
+ if (data.startsWith('0x')) {
217
+ data = data.slice(2);
218
+ }
219
+ // Check if it starts with Error(string) selector (0x08c379a0)
220
+ if (data.length >= 8 && data.startsWith('08c379a0')) {
221
+ const stringData = data.slice(8); // Remove selector
222
+ if (stringData.length < 64)
223
+ return null;
224
+ // Get the length of the string (first 32 bytes after selector)
225
+ const lengthHex = stringData.slice(0, 64);
226
+ const length = parseInt(lengthHex, 16);
227
+ if (length <= 0 || length > 1000)
228
+ return null; // Sanity check
229
+ // Get the string data (after length)
230
+ const stringHex = stringData.slice(64, 64 + length * 2);
231
+ const bytes = Buffer.from(stringHex, 'hex');
232
+ const message = bytes.toString('utf8').replace(/\0/g, ''); // Remove null bytes
233
+ return {
234
+ name: 'CustomError',
235
+ signature: 'Error(string)',
236
+ params: { message },
237
+ message
238
+ };
239
+ }
240
+ // Try to decode custom errors with parameters
241
+ // Look for common custom error patterns in the hex data
242
+ const bytes = Buffer.from(data, 'hex');
243
+ const hexString = data.toLowerCase();
244
+ // Check for specific Guardian contract errors
245
+ // Look for OWNER_ROLE, ADMIN_ROLE, etc. as parameters in custom errors
246
+ for (const pattern of COMMON_ERROR_PATTERNS) {
247
+ const hexPattern = Buffer.from(pattern, 'utf8').toString('hex');
248
+ if (hexString.includes(hexPattern)) {
249
+ // Try to determine which specific error this is based on the pattern
250
+ let errorName = 'UnknownError';
251
+ let errorParams = {};
252
+ if (pattern === 'OWNER_ROLE') {
253
+ errorName = 'RestrictedOwner';
254
+ errorParams = { caller: 'unknown', owner: 'unknown' };
255
+ }
256
+ else if (pattern === 'ADMIN_ROLE') {
257
+ errorName = 'NoPermission';
258
+ errorParams = { caller: 'unknown' };
259
+ }
260
+ else if (pattern === 'OPERATOR_ROLE') {
261
+ errorName = 'NoPermission';
262
+ errorParams = { caller: 'unknown' };
263
+ }
264
+ else if (pattern === 'GUARDIAN_ROLE') {
265
+ errorName = 'NoPermission';
266
+ errorParams = { caller: 'unknown' };
267
+ }
268
+ else if (pattern.includes('already exists')) {
269
+ errorName = 'RequestAlreadyPending';
270
+ errorParams = { txId: 'unknown' };
271
+ }
272
+ else if (pattern.includes('not found')) {
273
+ errorName = 'TransactionNotFound';
274
+ errorParams = { txId: 'unknown' };
275
+ }
276
+ else if (pattern.includes('insufficient')) {
277
+ errorName = 'InsufficientBalance';
278
+ errorParams = { currentBalance: 'unknown', requiredAmount: 'unknown' };
279
+ }
280
+ return {
281
+ name: errorName,
282
+ signature: `CustomError(${Object.keys(errorParams).join(',')})`,
283
+ params: errorParams,
284
+ message: pattern
285
+ };
286
+ }
287
+ }
288
+ // Try to extract readable ASCII from the data
289
+ let readableText = '';
290
+ for (let i = 0; i < bytes.length; i++) {
291
+ const byte = bytes[i];
292
+ if (byte >= 32 && byte <= 126) { // Printable ASCII
293
+ readableText += String.fromCharCode(byte);
294
+ }
295
+ else if (byte === 0) {
296
+ readableText += ' '; // Replace null bytes with spaces
297
+ }
298
+ }
299
+ // Clean up the text
300
+ readableText = readableText.trim().replace(/\s+/g, ' ');
301
+ if (readableText.length > 3 && readableText.length < 200) {
302
+ return {
303
+ name: 'ReadableText',
304
+ signature: 'Custom',
305
+ params: { text: readableText },
306
+ message: readableText
307
+ };
308
+ }
309
+ return null;
310
+ }
311
+ catch (error) {
312
+ return null;
313
+ }
314
+ }
315
+ /**
316
+ * Get user-friendly error message from contract error
317
+ * @param error The contract error
318
+ * @returns User-friendly error message
319
+ */
320
+ export function getUserFriendlyErrorMessage(error) {
321
+ // Check if it's a known error signature
322
+ const errorSignature = ERROR_SIGNATURES[error.signature];
323
+ if (errorSignature) {
324
+ return errorSignature.userMessage(error.params);
325
+ }
326
+ // Handle specific error names with custom messages
327
+ switch (error.name) {
328
+ case 'RestrictedOwner':
329
+ return 'RestrictedOwner: Only the owner can perform this action';
330
+ case 'NoPermission':
331
+ return 'NoPermission: Caller does not have permission to perform this action';
332
+ case 'RequestAlreadyPending':
333
+ return 'RequestAlreadyPending: A request is already pending for this operation';
334
+ case 'TransactionNotFound':
335
+ return 'TransactionNotFound: Transaction not found';
336
+ case 'InsufficientBalance':
337
+ return 'InsufficientBalance: Insufficient balance for this operation';
338
+ case 'ItemAlreadyExists':
339
+ return `ItemAlreadyExists: Item ${error.params.item} already exists`;
340
+ case 'ItemNotFound':
341
+ return `ItemNotFound: Item ${error.params.item} not found`;
342
+ case 'TargetNotWhitelisted':
343
+ return `TargetNotWhitelisted: Target ${error.params.target} is not whitelisted for function selector ${error.params.functionSelector} and role ${error.params.roleHash}`;
344
+ case 'ResourceNotFound':
345
+ return `ResourceNotFound: Resource ${error.params.resource} not found`;
346
+ case 'HandlerForSelectorMismatch':
347
+ return `HandlerForSelectorMismatch: Handler selector mismatch - schema handler: ${error.params.schemaHandlerForSelector}, permission handler: ${error.params.permissionHandlerForSelector}`;
348
+ case 'ContractFunctionMustBeProtected':
349
+ return `ContractFunctionMustBeProtected: Internal function ${error.params.functionSignature} (selector: ${error.params.functionSelector}) must be protected`;
350
+ case 'PatternMatch':
351
+ // For pattern matches, return a more descriptive message
352
+ if (error.params.pattern === 'OWNER_ROLE') {
353
+ return 'RestrictedOwner: Only the owner can perform this action';
354
+ }
355
+ else if (error.params.pattern === 'ADMIN_ROLE') {
356
+ return 'NoPermission: Only administrators can perform this action';
357
+ }
358
+ else if (error.params.pattern === 'OPERATOR_ROLE') {
359
+ return 'NoPermission: Only operators can perform this action';
360
+ }
361
+ else if (error.params.pattern === 'GUARDIAN_ROLE') {
362
+ return 'NoPermission: Only guardians can perform this action';
363
+ }
364
+ return `PatternMatch: Access denied: ${error.params.pattern}`;
365
+ case 'ReadableText':
366
+ return `ReadableText: Contract error: ${error.params.text}`;
367
+ case 'CustomError':
368
+ return `CustomError: ${error.params.message || 'Custom contract error occurred'}`;
369
+ default:
370
+ return `${error.name}: ${error.message || 'Unknown contract error occurred'}`;
371
+ }
372
+ }
373
+ /**
374
+ * Check if an error is a specific type
375
+ * @param error The contract error
376
+ * @param errorName The error name to check
377
+ * @returns True if the error matches the specified type
378
+ */
379
+ export function isErrorType(error, errorName) {
380
+ return error.name === errorName;
381
+ }
382
+ /**
383
+ * Extract error information from a transaction revert
384
+ * @param revertData Hex string containing revert data
385
+ * @returns Error information or null if extraction fails
386
+ */
387
+ export function extractErrorInfo(revertData) {
388
+ const error = decodeRevertReason(revertData);
389
+ if (!error) {
390
+ return {
391
+ error: null,
392
+ userMessage: 'Transaction reverted with unknown error',
393
+ isKnownError: false
394
+ };
395
+ }
396
+ const userMessage = getUserFriendlyErrorMessage(error);
397
+ const isKnownError = ERROR_SIGNATURES[error.signature] !== undefined;
398
+ return {
399
+ error,
400
+ userMessage,
401
+ isKnownError
402
+ };
403
+ }
404
+ export default {
405
+ ERROR_SIGNATURES,
406
+ COMMON_ERROR_PATTERNS,
407
+ decodeRevertReason,
408
+ getUserFriendlyErrorMessage,
409
+ isErrorType,
410
+ extractErrorInfo
411
+ };
412
+ //# sourceMappingURL=contract-errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-errors.js","sourceRoot":"","sources":["../../utils/contract-errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA6cH;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAIxB;IACH,qDAAqD;IACrD,YAAY,EAAE;QACZ,IAAI,EAAE,gBAAgB;QACtB,MAAM,EAAE,CAAC,UAAU,CAAC;QACpB,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,6CAA6C,MAAM,CAAC,QAAQ,EAAE;KACxF;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,sBAAsB;QAC5B,MAAM,EAAE,CAAC,QAAQ,CAAC;QAClB,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iDAAiD,MAAM,CAAC,MAAM,EAAE;KAC1F;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,yBAAyB;QAC/B,MAAM,EAAE,CAAC,WAAW,CAAC;QACrB,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,uDAAuD,MAAM,CAAC,SAAS,EAAE;KACnG;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,wBAAwB;QAC9B,MAAM,EAAE,CAAC,SAAS,CAAC;QACnB,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,qDAAqD,MAAM,CAAC,OAAO,EAAE;KAC/F;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,sBAAsB;QAC5B,MAAM,EAAE,CAAC,QAAQ,CAAC;QAClB,WAAW,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iDAAiD,MAAM,CAAC,MAAM,EAAE;KAC1F;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC;QACxC,WAAW,EAAE,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E,IAAI;YACX,WAAW,EAAE,yCAAyC;YACtD,YAAY,EAAE,KAAK;SACpB,CAAA;IACH,CAAC;IAED,MAAM,WAAW,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAA;IACtD,MAAM,YAAY,GAAG,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,SAAS,CAAA;IAEpE,OAAO;QACL,KAAK;QACL,WAAW;QACX,YAAY;KACb,CAAA;AACH,CAAC;AAED,eAAe;IACb,gBAAgB;IAChB,qBAAqB;IACrB,kBAAkB;IAClB,2BAA2B;IAC3B,WAAW;IACX,gBAAgB;CACjB,CAAA"}
@@ -0,0 +1,217 @@
1
+ [
2
+ {
3
+ "constant": true,
4
+ "inputs": [],
5
+ "name": "name",
6
+ "outputs": [
7
+ {
8
+ "name": "",
9
+ "type": "string"
10
+ }
11
+ ],
12
+ "payable": false,
13
+ "stateMutability": "view",
14
+ "type": "function"
15
+ },
16
+ {
17
+ "constant": false,
18
+ "inputs": [
19
+ {
20
+ "name": "_spender",
21
+ "type": "address"
22
+ },
23
+ {
24
+ "name": "_value",
25
+ "type": "uint256"
26
+ }
27
+ ],
28
+ "name": "approve",
29
+ "outputs": [
30
+ {
31
+ "name": "",
32
+ "type": "bool"
33
+ }
34
+ ],
35
+ "payable": false,
36
+ "stateMutability": "nonpayable",
37
+ "type": "function"
38
+ },
39
+ {
40
+ "constant": true,
41
+ "inputs": [],
42
+ "name": "totalSupply",
43
+ "outputs": [
44
+ {
45
+ "name": "",
46
+ "type": "uint256"
47
+ }
48
+ ],
49
+ "payable": false,
50
+ "stateMutability": "view",
51
+ "type": "function"
52
+ },
53
+ {
54
+ "constant": false,
55
+ "inputs": [
56
+ {
57
+ "name": "_from",
58
+ "type": "address"
59
+ },
60
+ {
61
+ "name": "_to",
62
+ "type": "address"
63
+ },
64
+ {
65
+ "name": "_value",
66
+ "type": "uint256"
67
+ }
68
+ ],
69
+ "name": "transferFrom",
70
+ "outputs": [
71
+ {
72
+ "name": "",
73
+ "type": "bool"
74
+ }
75
+ ],
76
+ "payable": false,
77
+ "stateMutability": "nonpayable",
78
+ "type": "function"
79
+ },
80
+ {
81
+ "constant": true,
82
+ "inputs": [],
83
+ "name": "decimals",
84
+ "outputs": [
85
+ {
86
+ "name": "",
87
+ "type": "uint8"
88
+ }
89
+ ],
90
+ "payable": false,
91
+ "stateMutability": "view",
92
+ "type": "function"
93
+ },
94
+ {
95
+ "constant": true,
96
+ "inputs": [],
97
+ "name": "symbol",
98
+ "outputs": [
99
+ {
100
+ "name": "",
101
+ "type": "string"
102
+ }
103
+ ],
104
+ "payable": false,
105
+ "stateMutability": "view",
106
+ "type": "function"
107
+ },
108
+ {
109
+ "constant": true,
110
+ "inputs": [
111
+ {
112
+ "name": "_owner",
113
+ "type": "address"
114
+ }
115
+ ],
116
+ "name": "balanceOf",
117
+ "outputs": [
118
+ {
119
+ "name": "balance",
120
+ "type": "uint256"
121
+ }
122
+ ],
123
+ "payable": false,
124
+ "stateMutability": "view",
125
+ "type": "function"
126
+ },
127
+ {
128
+ "constant": false,
129
+ "inputs": [
130
+ {
131
+ "name": "_to",
132
+ "type": "address"
133
+ },
134
+ {
135
+ "name": "_value",
136
+ "type": "uint256"
137
+ }
138
+ ],
139
+ "name": "transfer",
140
+ "outputs": [
141
+ {
142
+ "name": "",
143
+ "type": "bool"
144
+ }
145
+ ],
146
+ "payable": false,
147
+ "stateMutability": "nonpayable",
148
+ "type": "function"
149
+ },
150
+ {
151
+ "constant": true,
152
+ "inputs": [
153
+ {
154
+ "name": "_owner",
155
+ "type": "address"
156
+ },
157
+ {
158
+ "name": "_spender",
159
+ "type": "address"
160
+ }
161
+ ],
162
+ "name": "allowance",
163
+ "outputs": [
164
+ {
165
+ "name": "",
166
+ "type": "uint256"
167
+ }
168
+ ],
169
+ "payable": false,
170
+ "stateMutability": "view",
171
+ "type": "function"
172
+ },
173
+ {
174
+ "anonymous": false,
175
+ "inputs": [
176
+ {
177
+ "indexed": true,
178
+ "name": "owner",
179
+ "type": "address"
180
+ },
181
+ {
182
+ "indexed": true,
183
+ "name": "spender",
184
+ "type": "address"
185
+ },
186
+ {
187
+ "indexed": false,
188
+ "name": "value",
189
+ "type": "uint256"
190
+ }
191
+ ],
192
+ "name": "Approval",
193
+ "type": "event"
194
+ },
195
+ {
196
+ "anonymous": false,
197
+ "inputs": [
198
+ {
199
+ "indexed": true,
200
+ "name": "from",
201
+ "type": "address"
202
+ },
203
+ {
204
+ "indexed": true,
205
+ "name": "to",
206
+ "type": "address"
207
+ },
208
+ {
209
+ "indexed": false,
210
+ "name": "value",
211
+ "type": "uint256"
212
+ }
213
+ ],
214
+ "name": "Transfer",
215
+ "type": "event"
216
+ }
217
+ ]