@ryanrfox/sdk 0.0.2 → 2.0.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 (153) hide show
  1. package/README.md +145 -29
  2. package/package.json +84 -8
  3. package/src/_esm/actions/index.d.ts +8 -0
  4. package/src/_esm/actions/index.d.ts.map +1 -0
  5. package/src/_esm/actions/index.js +8 -0
  6. package/src/_esm/actions/index.js.map +1 -0
  7. package/src/_esm/actions/sendTransactionBatch.d.ts +77 -0
  8. package/src/_esm/actions/sendTransactionBatch.d.ts.map +1 -0
  9. package/src/_esm/actions/sendTransactionBatch.js +245 -0
  10. package/src/_esm/actions/sendTransactionBatch.js.map +1 -0
  11. package/src/_esm/chains/chainConfig.d.ts +30 -0
  12. package/src/_esm/chains/chainConfig.d.ts.map +1 -0
  13. package/src/_esm/chains/chainConfig.js +30 -0
  14. package/src/_esm/chains/chainConfig.js.map +1 -0
  15. package/src/_esm/chains/index.d.ts +4 -0
  16. package/src/_esm/chains/index.d.ts.map +1 -0
  17. package/src/_esm/chains/index.js +4 -0
  18. package/src/_esm/chains/index.js.map +1 -0
  19. package/src/_esm/chains/radius.d.ts +64 -0
  20. package/src/_esm/chains/radius.d.ts.map +1 -0
  21. package/src/_esm/chains/radius.js +39 -0
  22. package/src/_esm/chains/radius.js.map +1 -0
  23. package/src/_esm/chains/radiusTestnet.d.ts +61 -0
  24. package/src/_esm/chains/radiusTestnet.d.ts.map +1 -0
  25. package/src/_esm/chains/radiusTestnet.js +45 -0
  26. package/src/_esm/chains/radiusTestnet.js.map +1 -0
  27. package/src/_esm/decorators/index.d.ts +8 -0
  28. package/src/_esm/decorators/index.d.ts.map +1 -0
  29. package/src/_esm/decorators/index.js +8 -0
  30. package/src/_esm/decorators/index.js.map +1 -0
  31. package/src/_esm/decorators/radius.d.ts +66 -0
  32. package/src/_esm/decorators/radius.d.ts.map +1 -0
  33. package/src/_esm/decorators/radius.js +36 -0
  34. package/src/_esm/decorators/radius.js.map +1 -0
  35. package/src/_esm/errors/account.d.ts +78 -0
  36. package/src/_esm/errors/account.d.ts.map +1 -0
  37. package/src/_esm/errors/account.js +97 -0
  38. package/src/_esm/errors/account.js.map +1 -0
  39. package/src/_esm/errors/base.d.ts +56 -0
  40. package/src/_esm/errors/base.d.ts.map +1 -0
  41. package/src/_esm/errors/base.js +51 -0
  42. package/src/_esm/errors/base.js.map +1 -0
  43. package/src/_esm/errors/contract.d.ts +51 -0
  44. package/src/_esm/errors/contract.d.ts.map +1 -0
  45. package/src/_esm/errors/contract.js +65 -0
  46. package/src/_esm/errors/contract.js.map +1 -0
  47. package/src/_esm/errors/index.d.ts +63 -0
  48. package/src/_esm/errors/index.d.ts.map +1 -0
  49. package/src/_esm/errors/index.js +40 -0
  50. package/src/_esm/errors/index.js.map +1 -0
  51. package/src/_esm/errors/transaction.d.ts +132 -0
  52. package/src/_esm/errors/transaction.d.ts.map +1 -0
  53. package/src/_esm/errors/transaction.js +143 -0
  54. package/src/_esm/errors/transaction.js.map +1 -0
  55. package/src/_esm/events/decodeEventLogs.d.ts +136 -0
  56. package/src/_esm/events/decodeEventLogs.d.ts.map +1 -0
  57. package/src/_esm/events/decodeEventLogs.js +93 -0
  58. package/src/_esm/events/decodeEventLogs.js.map +1 -0
  59. package/src/_esm/events/getLogs.d.ts +137 -0
  60. package/src/_esm/events/getLogs.d.ts.map +1 -0
  61. package/src/_esm/events/getLogs.js +171 -0
  62. package/src/_esm/events/getLogs.js.map +1 -0
  63. package/src/_esm/events/index.d.ts +17 -0
  64. package/src/_esm/events/index.d.ts.map +1 -0
  65. package/src/_esm/events/index.js +24 -0
  66. package/src/_esm/events/index.js.map +1 -0
  67. package/src/_esm/events/watchApproval.d.ts +184 -0
  68. package/src/_esm/events/watchApproval.d.ts.map +1 -0
  69. package/src/_esm/events/watchApproval.js +254 -0
  70. package/src/_esm/events/watchApproval.js.map +1 -0
  71. package/src/_esm/events/watchBlock.d.ts +192 -0
  72. package/src/_esm/events/watchBlock.d.ts.map +1 -0
  73. package/src/_esm/events/watchBlock.js +162 -0
  74. package/src/_esm/events/watchBlock.js.map +1 -0
  75. package/src/_esm/events/watchLogs.d.ts +128 -0
  76. package/src/_esm/events/watchLogs.d.ts.map +1 -0
  77. package/src/_esm/events/watchLogs.js +100 -0
  78. package/src/_esm/events/watchLogs.js.map +1 -0
  79. package/src/_esm/events/watchTransfer.d.ts +164 -0
  80. package/src/_esm/events/watchTransfer.d.ts.map +1 -0
  81. package/src/_esm/events/watchTransfer.js +234 -0
  82. package/src/_esm/events/watchTransfer.js.map +1 -0
  83. package/src/_esm/index.d.ts +16 -0
  84. package/src/_esm/index.d.ts.map +1 -0
  85. package/src/_esm/index.js +22 -0
  86. package/src/_esm/index.js.map +1 -0
  87. package/src/_esm/package.json +1 -0
  88. package/src/_esm/transport/index.d.ts +9 -0
  89. package/src/_esm/transport/index.d.ts.map +1 -0
  90. package/src/_esm/transport/index.js +9 -0
  91. package/src/_esm/transport/index.js.map +1 -0
  92. package/src/_esm/transport/interceptor.d.ts +48 -0
  93. package/src/_esm/transport/interceptor.d.ts.map +1 -0
  94. package/src/_esm/transport/interceptor.js +209 -0
  95. package/src/_esm/transport/interceptor.js.map +1 -0
  96. package/src/_esm/transport/types.d.ts +29 -0
  97. package/src/_esm/transport/types.d.ts.map +1 -0
  98. package/src/_esm/transport/types.js +2 -0
  99. package/src/_esm/transport/types.js.map +1 -0
  100. package/src/_esm/transport/websocket.d.ts +51 -0
  101. package/src/_esm/transport/websocket.d.ts.map +1 -0
  102. package/src/_esm/transport/websocket.js +70 -0
  103. package/src/_esm/transport/websocket.js.map +1 -0
  104. package/src/_types/actions/index.d.ts +8 -0
  105. package/src/_types/actions/index.d.ts.map +1 -0
  106. package/src/_types/actions/sendTransactionBatch.d.ts +77 -0
  107. package/src/_types/actions/sendTransactionBatch.d.ts.map +1 -0
  108. package/src/_types/chains/chainConfig.d.ts +30 -0
  109. package/src/_types/chains/chainConfig.d.ts.map +1 -0
  110. package/src/_types/chains/index.d.ts +4 -0
  111. package/src/_types/chains/index.d.ts.map +1 -0
  112. package/src/_types/chains/radius.d.ts +64 -0
  113. package/src/_types/chains/radius.d.ts.map +1 -0
  114. package/src/_types/chains/radiusTestnet.d.ts +61 -0
  115. package/src/_types/chains/radiusTestnet.d.ts.map +1 -0
  116. package/src/_types/decorators/index.d.ts +8 -0
  117. package/src/_types/decorators/index.d.ts.map +1 -0
  118. package/src/_types/decorators/radius.d.ts +66 -0
  119. package/src/_types/decorators/radius.d.ts.map +1 -0
  120. package/src/_types/errors/account.d.ts +78 -0
  121. package/src/_types/errors/account.d.ts.map +1 -0
  122. package/src/_types/errors/base.d.ts +56 -0
  123. package/src/_types/errors/base.d.ts.map +1 -0
  124. package/src/_types/errors/contract.d.ts +51 -0
  125. package/src/_types/errors/contract.d.ts.map +1 -0
  126. package/src/_types/errors/index.d.ts +63 -0
  127. package/src/_types/errors/index.d.ts.map +1 -0
  128. package/src/_types/errors/transaction.d.ts +132 -0
  129. package/src/_types/errors/transaction.d.ts.map +1 -0
  130. package/src/_types/events/decodeEventLogs.d.ts +136 -0
  131. package/src/_types/events/decodeEventLogs.d.ts.map +1 -0
  132. package/src/_types/events/getLogs.d.ts +137 -0
  133. package/src/_types/events/getLogs.d.ts.map +1 -0
  134. package/src/_types/events/index.d.ts +17 -0
  135. package/src/_types/events/index.d.ts.map +1 -0
  136. package/src/_types/events/watchApproval.d.ts +184 -0
  137. package/src/_types/events/watchApproval.d.ts.map +1 -0
  138. package/src/_types/events/watchBlock.d.ts +192 -0
  139. package/src/_types/events/watchBlock.d.ts.map +1 -0
  140. package/src/_types/events/watchLogs.d.ts +128 -0
  141. package/src/_types/events/watchLogs.d.ts.map +1 -0
  142. package/src/_types/events/watchTransfer.d.ts +164 -0
  143. package/src/_types/events/watchTransfer.d.ts.map +1 -0
  144. package/src/_types/index.d.ts +16 -0
  145. package/src/_types/index.d.ts.map +1 -0
  146. package/src/_types/transport/index.d.ts +9 -0
  147. package/src/_types/transport/index.d.ts.map +1 -0
  148. package/src/_types/transport/interceptor.d.ts +48 -0
  149. package/src/_types/transport/interceptor.d.ts.map +1 -0
  150. package/src/_types/transport/types.d.ts +29 -0
  151. package/src/_types/transport/types.d.ts.map +1 -0
  152. package/src/_types/transport/websocket.d.ts +51 -0
  153. package/src/_types/transport/websocket.d.ts.map +1 -0
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Radius SDK Error Hierarchy
3
+ *
4
+ * Extends viem's BaseError for ecosystem compatibility.
5
+ * All Radius errors can be caught using `instanceof BaseError` from viem.
6
+ */
7
+ import { BaseError } from 'viem';
8
+ /**
9
+ * Options for creating a RadiusError
10
+ */
11
+ export interface RadiusErrorOptions {
12
+ /** Detailed error information */
13
+ details?: string;
14
+ /** URL path to relevant documentation */
15
+ docsPath?: string;
16
+ /** The underlying cause of this error */
17
+ cause?: BaseError | Error | undefined;
18
+ /** Additional hint messages to help resolve the error */
19
+ metaMessages?: string[];
20
+ /** Additional metadata about the error (Radius-specific extension) */
21
+ meta?: Record<string, unknown>;
22
+ }
23
+ /**
24
+ * Base error class for all Radius SDK errors.
25
+ *
26
+ * Extends viem's BaseError for ecosystem compatibility. This means:
27
+ * - `error instanceof BaseError` from viem will catch Radius errors
28
+ * - Compatible with wagmi error handling
29
+ * - Inherits viem's error formatting and walk() method
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * import { BaseError } from 'viem';
34
+ *
35
+ * try {
36
+ * await walletClient.sendTransaction({ to, value });
37
+ * } catch (error) {
38
+ * if (error instanceof RadiusError) {
39
+ * console.log(error.shortMessage); // Quick description
40
+ * console.log(error.details); // Full details
41
+ * console.log(error.docsPath); // Link to docs
42
+ * }
43
+ * // Also works with viem's BaseError check
44
+ * if (error instanceof BaseError) {
45
+ * console.log('Caught viem-compatible error');
46
+ * }
47
+ * }
48
+ * ```
49
+ */
50
+ export declare class RadiusError extends BaseError {
51
+ /** Additional metadata (Radius-specific extension) */
52
+ readonly meta?: Record<string, unknown>;
53
+ name: string;
54
+ constructor(shortMessage: string, options?: RadiusErrorOptions);
55
+ }
56
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../errors/base.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,KAAK,CAAC,EAAE,SAAS,GAAG,KAAK,GAAG,SAAS,CAAC;IACtC,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,WAAY,SAAQ,SAAS;IACzC,sDAAsD;IACtD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/B,IAAI,SAAiB;gBAElB,YAAY,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB;CAYlE"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Radius SDK Error Hierarchy
3
+ *
4
+ * Extends viem's BaseError for ecosystem compatibility.
5
+ * All Radius errors can be caught using `instanceof BaseError` from viem.
6
+ */
7
+ import { BaseError } from 'viem';
8
+ /**
9
+ * Base error class for all Radius SDK errors.
10
+ *
11
+ * Extends viem's BaseError for ecosystem compatibility. This means:
12
+ * - `error instanceof BaseError` from viem will catch Radius errors
13
+ * - Compatible with wagmi error handling
14
+ * - Inherits viem's error formatting and walk() method
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * import { BaseError } from 'viem';
19
+ *
20
+ * try {
21
+ * await walletClient.sendTransaction({ to, value });
22
+ * } catch (error) {
23
+ * if (error instanceof RadiusError) {
24
+ * console.log(error.shortMessage); // Quick description
25
+ * console.log(error.details); // Full details
26
+ * console.log(error.docsPath); // Link to docs
27
+ * }
28
+ * // Also works with viem's BaseError check
29
+ * if (error instanceof BaseError) {
30
+ * console.log('Caught viem-compatible error');
31
+ * }
32
+ * }
33
+ * ```
34
+ */
35
+ export class RadiusError extends BaseError {
36
+ /** Additional metadata (Radius-specific extension) */
37
+ meta;
38
+ name = 'RadiusError';
39
+ constructor(shortMessage, options = {}) {
40
+ super(shortMessage, {
41
+ cause: options.cause,
42
+ details: options.details,
43
+ docsPath: options.docsPath,
44
+ docsBaseUrl: 'https://docs.radiustech.xyz',
45
+ metaMessages: options.metaMessages,
46
+ name: 'RadiusError',
47
+ });
48
+ this.meta = options.meta;
49
+ }
50
+ }
51
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../errors/base.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAkBjC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,OAAO,WAAY,SAAQ,SAAS;IACzC,sDAAsD;IAC7C,IAAI,CAA2B;IAE/B,IAAI,GAAG,aAAa,CAAC;IAE9B,YAAY,YAAoB,EAAE,UAA8B,EAAE;QACjE,KAAK,CAAC,YAAY,EAAE;YACnB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,WAAW,EAAE,6BAA6B;YAC1C,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,IAAI,EAAE,aAAa;SACnB,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,CAAC;CACD"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Contract-related errors
3
+ */
4
+ import type { Address, Hex } from 'viem';
5
+ import { RadiusError, type RadiusErrorOptions } from './base';
6
+ /**
7
+ * Error thrown when a contract call fails.
8
+ */
9
+ export declare class ContractCallError extends RadiusError {
10
+ readonly name = "ContractCallError";
11
+ /** The contract address */
12
+ readonly contractAddress?: Address;
13
+ /** The function name that was called */
14
+ readonly functionName?: string;
15
+ /** The arguments passed to the function */
16
+ readonly args?: readonly unknown[];
17
+ constructor(message: string, options?: RadiusErrorOptions & {
18
+ contractAddress?: Address;
19
+ functionName?: string;
20
+ args?: readonly unknown[];
21
+ });
22
+ }
23
+ /**
24
+ * Error thrown when contract deployment fails.
25
+ */
26
+ export declare class ContractDeploymentError extends RadiusError {
27
+ readonly name = "ContractDeploymentError";
28
+ /** The contract bytecode */
29
+ readonly bytecode?: Hex;
30
+ /** The constructor arguments */
31
+ readonly constructorArgs?: readonly unknown[];
32
+ constructor(message: string, options?: RadiusErrorOptions & {
33
+ bytecode?: Hex;
34
+ constructorArgs?: readonly unknown[];
35
+ });
36
+ }
37
+ /**
38
+ * Error thrown when ABI encoding/decoding fails.
39
+ */
40
+ export declare class AbiError extends RadiusError {
41
+ readonly name = "AbiError";
42
+ constructor(message: string, options?: RadiusErrorOptions);
43
+ }
44
+ /**
45
+ * Error thrown when a required contract ABI is missing.
46
+ */
47
+ export declare class MissingAbiError extends RadiusError {
48
+ readonly name = "MissingAbiError";
49
+ constructor(message?: string, options?: RadiusErrorOptions);
50
+ }
51
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../errors/contract.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE9D;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IACjD,SAAkB,IAAI,uBAAuB;IAE7C,2BAA2B;IAC3B,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,wCAAwC;IACxC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;gBAGlC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,kBAAkB,GAAG;QAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;KACrB;CAUP;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,WAAW;IACvD,SAAkB,IAAI,6BAA6B;IAEnD,4BAA4B;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC;IACxB,gCAAgC;IAChC,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;gBAG7C,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,kBAAkB,GAAG;QAC7B,QAAQ,CAAC,EAAE,GAAG,CAAC;QACf,eAAe,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;KAChC;CASP;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,WAAW;IACxC,SAAkB,IAAI,cAAc;gBAExB,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB;CAM7D;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,WAAW;IAC/C,SAAkB,IAAI,qBAAqB;gBAE/B,OAAO,SAA6B,EAAE,OAAO,GAAE,kBAAuB;CAMlF"}
@@ -0,0 +1,65 @@
1
+ import { RadiusError } from './base';
2
+ /**
3
+ * Error thrown when a contract call fails.
4
+ */
5
+ export class ContractCallError extends RadiusError {
6
+ name = 'ContractCallError';
7
+ /** The contract address */
8
+ contractAddress;
9
+ /** The function name that was called */
10
+ functionName;
11
+ /** The arguments passed to the function */
12
+ args;
13
+ constructor(message, options = {}) {
14
+ super(message, {
15
+ ...options,
16
+ docsPath: options.docsPath ?? '/docs/sdk/errors#contract-call',
17
+ });
18
+ this.contractAddress = options.contractAddress;
19
+ this.functionName = options.functionName;
20
+ this.args = options.args;
21
+ }
22
+ }
23
+ /**
24
+ * Error thrown when contract deployment fails.
25
+ */
26
+ export class ContractDeploymentError extends RadiusError {
27
+ name = 'ContractDeploymentError';
28
+ /** The contract bytecode */
29
+ bytecode;
30
+ /** The constructor arguments */
31
+ constructorArgs;
32
+ constructor(message, options = {}) {
33
+ super(message, {
34
+ ...options,
35
+ docsPath: options.docsPath ?? '/docs/sdk/errors#contract-deployment',
36
+ });
37
+ this.bytecode = options.bytecode;
38
+ this.constructorArgs = options.constructorArgs;
39
+ }
40
+ }
41
+ /**
42
+ * Error thrown when ABI encoding/decoding fails.
43
+ */
44
+ export class AbiError extends RadiusError {
45
+ name = 'AbiError';
46
+ constructor(message, options = {}) {
47
+ super(message, {
48
+ ...options,
49
+ docsPath: options.docsPath ?? '/docs/sdk/errors#abi',
50
+ });
51
+ }
52
+ }
53
+ /**
54
+ * Error thrown when a required contract ABI is missing.
55
+ */
56
+ export class MissingAbiError extends RadiusError {
57
+ name = 'MissingAbiError';
58
+ constructor(message = 'Contract ABI is required', options = {}) {
59
+ super(message, {
60
+ ...options,
61
+ docsPath: options.docsPath ?? '/docs/sdk/errors#missing-abi',
62
+ });
63
+ }
64
+ }
65
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../../errors/contract.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAA2B,MAAM,QAAQ,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAC/B,IAAI,GAAG,mBAAmB,CAAC;IAE7C,2BAA2B;IAClB,eAAe,CA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,CAAC,OAAO,EAAE;YACd,GAAG,OAAO;YACV,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,8BAA8B;SAC5D,CAAC,CAAC;IACJ,CAAC;CACD"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Radius SDK Error Types
3
+ *
4
+ * This module provides a rich error hierarchy for better error handling
5
+ * and debugging. All errors extend RadiusError which provides:
6
+ * - Short messages for quick understanding
7
+ * - Detailed error information
8
+ * - Documentation links
9
+ * - Error cause chain traversal via .walk()
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import {
14
+ * RadiusError,
15
+ * TransactionFailedError,
16
+ * InsufficientBalanceError,
17
+ * } from '@radiustechsystems/sdk';
18
+ *
19
+ * try {
20
+ * await client.sendTransaction({ to, value });
21
+ * } catch (error) {
22
+ * if (error instanceof InsufficientBalanceError) {
23
+ * console.log('Not enough funds:', error.balance, 'required:', error.required);
24
+ * } else if (error instanceof TransactionFailedError) {
25
+ * console.log('Transaction failed:', error.transactionHash);
26
+ * } else if (error instanceof RadiusError) {
27
+ * console.log('SDK error:', error.shortMessage);
28
+ * }
29
+ * }
30
+ * ```
31
+ */
32
+ export { InsufficientBalanceError, InvalidAddressError, InvalidPrivateKeyError, SignerNotFoundError, SigningError, } from './account.js';
33
+ export { RadiusError, type RadiusErrorOptions } from './base.js';
34
+ export { AbiError, ContractCallError, ContractDeploymentError, MissingAbiError, } from './contract.js';
35
+ export { BatchTransactionError, type BatchTransactionResult, GasEstimationError, NonceError, TransactionFailedError, TransactionRevertedError, TransactionTimeoutError, } from './transaction.js';
36
+ /**
37
+ * Error types that can be thrown by sendTransaction operations.
38
+ */
39
+ export type SendTransactionErrorType = InsufficientBalanceError | TransactionFailedError | TransactionRevertedError | TransactionTimeoutError | SignerNotFoundError | GasEstimationError | NonceError;
40
+ /**
41
+ * Error types that can be thrown by batch transaction operations.
42
+ */
43
+ export type BatchTransactionErrorType = BatchTransactionError | GasEstimationError | NonceError;
44
+ /**
45
+ * Error types that can be thrown by contract call operations.
46
+ */
47
+ export type CallContractErrorType = ContractCallError | MissingAbiError | AbiError;
48
+ /**
49
+ * Error types that can be thrown by contract execution operations.
50
+ */
51
+ export type ExecuteContractErrorType = ContractCallError | TransactionFailedError | TransactionRevertedError | SignerNotFoundError | GasEstimationError | MissingAbiError | AbiError;
52
+ /**
53
+ * Error types that can be thrown by contract deployment operations.
54
+ */
55
+ export type DeployContractErrorType = ContractDeploymentError | TransactionFailedError | TransactionRevertedError | SignerNotFoundError | GasEstimationError | AbiError;
56
+ /**
57
+ * Error types that can be thrown by signing operations.
58
+ */
59
+ export type SigningErrorType = SigningError | SignerNotFoundError | InvalidPrivateKeyError;
60
+ import type { InsufficientBalanceError, InvalidPrivateKeyError, SignerNotFoundError, SigningError } from './account.js';
61
+ import type { AbiError, ContractCallError, ContractDeploymentError, MissingAbiError } from './contract.js';
62
+ import type { BatchTransactionError, GasEstimationError, NonceError, TransactionFailedError, TransactionRevertedError, TransactionTimeoutError } from './transaction.js';
63
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../errors/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,EACN,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,YAAY,GACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,EACN,QAAQ,EACR,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,GACf,MAAM,eAAe,CAAC;AAGvB,OAAO,EACN,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,GACvB,MAAM,kBAAkB,CAAC;AAG1B;;GAEG;AACH,MAAM,MAAM,wBAAwB,GACjC,wBAAwB,GACxB,sBAAsB,GACtB,wBAAwB,GACxB,uBAAuB,GACvB,mBAAmB,GACnB,kBAAkB,GAClB,UAAU,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,qBAAqB,GAAG,kBAAkB,GAAG,UAAU,CAAC;AAEhG;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG,eAAe,GAAG,QAAQ,CAAC;AAEnF;;GAEG;AACH,MAAM,MAAM,wBAAwB,GACjC,iBAAiB,GACjB,sBAAsB,GACtB,wBAAwB,GACxB,mBAAmB,GACnB,kBAAkB,GAClB,eAAe,GACf,QAAQ,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAChC,uBAAuB,GACvB,sBAAsB,GACtB,wBAAwB,GACxB,mBAAmB,GACnB,kBAAkB,GAClB,QAAQ,CAAC;AAEZ;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,mBAAmB,GAAG,sBAAsB,CAAC;AAG3F,OAAO,KAAK,EACX,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,EACnB,YAAY,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACX,QAAQ,EACR,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACX,qBAAqB,EACrB,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Radius SDK Error Types
3
+ *
4
+ * This module provides a rich error hierarchy for better error handling
5
+ * and debugging. All errors extend RadiusError which provides:
6
+ * - Short messages for quick understanding
7
+ * - Detailed error information
8
+ * - Documentation links
9
+ * - Error cause chain traversal via .walk()
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import {
14
+ * RadiusError,
15
+ * TransactionFailedError,
16
+ * InsufficientBalanceError,
17
+ * } from '@radiustechsystems/sdk';
18
+ *
19
+ * try {
20
+ * await client.sendTransaction({ to, value });
21
+ * } catch (error) {
22
+ * if (error instanceof InsufficientBalanceError) {
23
+ * console.log('Not enough funds:', error.balance, 'required:', error.required);
24
+ * } else if (error instanceof TransactionFailedError) {
25
+ * console.log('Transaction failed:', error.transactionHash);
26
+ * } else if (error instanceof RadiusError) {
27
+ * console.log('SDK error:', error.shortMessage);
28
+ * }
29
+ * }
30
+ * ```
31
+ */
32
+ // Account errors
33
+ export { InsufficientBalanceError, InvalidAddressError, InvalidPrivateKeyError, SignerNotFoundError, SigningError, } from './account.js';
34
+ // Base error
35
+ export { RadiusError } from './base.js';
36
+ // Contract errors
37
+ export { AbiError, ContractCallError, ContractDeploymentError, MissingAbiError, } from './contract.js';
38
+ // Transaction errors
39
+ export { BatchTransactionError, GasEstimationError, NonceError, TransactionFailedError, TransactionRevertedError, TransactionTimeoutError, } from './transaction.js';
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../errors/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,iBAAiB;AACjB,OAAO,EACN,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,YAAY,GACZ,MAAM,cAAc,CAAC;AACtB,aAAa;AACb,OAAO,EAAE,WAAW,EAA2B,MAAM,WAAW,CAAC;AAEjE,kBAAkB;AAClB,OAAO,EACN,QAAQ,EACR,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,GACf,MAAM,eAAe,CAAC;AAEvB,qBAAqB;AACrB,OAAO,EACN,qBAAqB,EAErB,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,GACvB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Transaction-related errors
3
+ */
4
+ import type { Address, Hash, Hex } from 'viem';
5
+ import { RadiusError, type RadiusErrorOptions } from './base';
6
+ /**
7
+ * Error thrown when a transaction fails to execute.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * try {
12
+ * await walletClient.sendTransaction({ to, value });
13
+ * } catch (error) {
14
+ * if (error instanceof TransactionFailedError) {
15
+ * console.log('Transaction failed:', error.transactionHash);
16
+ * console.log('Reason:', error.shortMessage);
17
+ * }
18
+ * }
19
+ * ```
20
+ */
21
+ export declare class TransactionFailedError extends RadiusError {
22
+ readonly name = "TransactionFailedError";
23
+ /** The transaction hash (if available) */
24
+ readonly transactionHash?: Hash;
25
+ /** The reason for failure */
26
+ readonly reason?: string;
27
+ constructor(message: string, options?: RadiusErrorOptions & {
28
+ transactionHash?: Hash;
29
+ reason?: string;
30
+ });
31
+ }
32
+ /**
33
+ * Error thrown when a transaction reverts on-chain.
34
+ */
35
+ export declare class TransactionRevertedError extends RadiusError {
36
+ readonly name = "TransactionRevertedError";
37
+ /** The transaction hash (if available) */
38
+ readonly transactionHash?: Hash;
39
+ /** The reason for failure */
40
+ readonly reason?: string;
41
+ /** The revert reason (decoded if available) */
42
+ readonly revertReason?: string;
43
+ /** The raw revert data */
44
+ readonly revertData?: Hex;
45
+ constructor(message: string, options?: RadiusErrorOptions & {
46
+ transactionHash?: Hash;
47
+ reason?: string;
48
+ revertReason?: string;
49
+ revertData?: Hex;
50
+ });
51
+ }
52
+ /**
53
+ * Error thrown when gas estimation fails.
54
+ */
55
+ export declare class GasEstimationError extends RadiusError {
56
+ readonly name = "GasEstimationError";
57
+ /** The address being called */
58
+ readonly to?: Address;
59
+ /** The call data */
60
+ readonly data?: Hex;
61
+ constructor(message: string, options?: RadiusErrorOptions & {
62
+ to?: Address;
63
+ data?: Hex;
64
+ });
65
+ }
66
+ /**
67
+ * Error thrown when transaction nonce is invalid.
68
+ */
69
+ export declare class NonceError extends RadiusError {
70
+ readonly name = "NonceError";
71
+ /** The nonce that was used */
72
+ readonly nonce?: number;
73
+ /** The expected nonce */
74
+ readonly expectedNonce?: number;
75
+ constructor(message: string, options?: RadiusErrorOptions & {
76
+ nonce?: number;
77
+ expectedNonce?: number;
78
+ });
79
+ }
80
+ /**
81
+ * Error thrown when a transaction times out waiting for confirmation.
82
+ */
83
+ export declare class TransactionTimeoutError extends RadiusError {
84
+ readonly name = "TransactionTimeoutError";
85
+ /** The transaction hash */
86
+ readonly transactionHash?: Hash;
87
+ /** How long we waited (in ms) */
88
+ readonly timeout?: number;
89
+ constructor(message: string, options?: RadiusErrorOptions & {
90
+ transactionHash?: Hash;
91
+ timeout?: number;
92
+ });
93
+ }
94
+ /**
95
+ * Result of a single transaction in a batch.
96
+ */
97
+ export interface BatchTransactionResult {
98
+ /** The index of this transaction in the batch */
99
+ index: number;
100
+ /** The transaction hash (if successful) */
101
+ hash?: Hash;
102
+ /** The error message (if failed) */
103
+ error?: string;
104
+ }
105
+ /**
106
+ * Error thrown when one or more transactions in a batch fail.
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * try {
111
+ * await walletClient.sendTransactionBatch({ transactions });
112
+ * } catch (error) {
113
+ * if (error instanceof BatchTransactionError) {
114
+ * console.log('Batch failed:', error.message);
115
+ * error.results.forEach((r, i) => {
116
+ * if (r.error) {
117
+ * console.log(` Transaction ${i} failed: ${r.error}`);
118
+ * } else {
119
+ * console.log(` Transaction ${i} succeeded: ${r.hash}`);
120
+ * }
121
+ * });
122
+ * }
123
+ * }
124
+ * ```
125
+ */
126
+ export declare class BatchTransactionError extends RadiusError {
127
+ readonly name = "BatchTransactionError";
128
+ /** Results for each transaction in the batch */
129
+ readonly results: BatchTransactionResult[];
130
+ constructor(message: string, results: BatchTransactionResult[], options?: RadiusErrorOptions);
131
+ }
132
+ //# sourceMappingURL=transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../errors/transaction.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,IA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ACjC,OAAO,GAAE,kBAAuB;CAQjC"}
@@ -0,0 +1,143 @@
1
+ import { RadiusError } from './base';
2
+ /**
3
+ * Error thrown when a transaction fails to execute.
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * try {
8
+ * await walletClient.sendTransaction({ to, value });
9
+ * } catch (error) {
10
+ * if (error instanceof TransactionFailedError) {
11
+ * console.log('Transaction failed:', error.transactionHash);
12
+ * console.log('Reason:', error.shortMessage);
13
+ * }
14
+ * }
15
+ * ```
16
+ */
17
+ export class TransactionFailedError extends RadiusError {
18
+ name = 'TransactionFailedError';
19
+ /** The transaction hash (if available) */
20
+ transactionHash;
21
+ /** The reason for failure */
22
+ reason;
23
+ constructor(message, options = {}) {
24
+ super(message, {
25
+ ...options,
26
+ docsPath: options.docsPath ?? '/docs/sdk/errors#transaction-failed',
27
+ });
28
+ this.transactionHash = options.transactionHash;
29
+ this.reason = options.reason;
30
+ }
31
+ }
32
+ /**
33
+ * Error thrown when a transaction reverts on-chain.
34
+ */
35
+ export class TransactionRevertedError extends RadiusError {
36
+ name = 'TransactionRevertedError';
37
+ /** The transaction hash (if available) */
38
+ transactionHash;
39
+ /** The reason for failure */
40
+ reason;
41
+ /** The revert reason (decoded if available) */
42
+ revertReason;
43
+ /** The raw revert data */
44
+ revertData;
45
+ constructor(message, options = {}) {
46
+ super(message, {
47
+ ...options,
48
+ docsPath: options.docsPath ?? '/docs/sdk/errors#transaction-reverted',
49
+ });
50
+ this.transactionHash = options.transactionHash;
51
+ this.reason = options.reason;
52
+ this.revertReason = options.revertReason;
53
+ this.revertData = options.revertData;
54
+ }
55
+ }
56
+ /**
57
+ * Error thrown when gas estimation fails.
58
+ */
59
+ export class GasEstimationError extends RadiusError {
60
+ name = 'GasEstimationError';
61
+ /** The address being called */
62
+ to;
63
+ /** The call data */
64
+ data;
65
+ constructor(message, options = {}) {
66
+ super(message, {
67
+ ...options,
68
+ docsPath: options.docsPath ?? '/docs/sdk/errors#gas-estimation',
69
+ });
70
+ this.to = options.to;
71
+ this.data = options.data;
72
+ }
73
+ }
74
+ /**
75
+ * Error thrown when transaction nonce is invalid.
76
+ */
77
+ export class NonceError extends RadiusError {
78
+ name = 'NonceError';
79
+ /** The nonce that was used */
80
+ nonce;
81
+ /** The expected nonce */
82
+ expectedNonce;
83
+ constructor(message, options = {}) {
84
+ super(message, {
85
+ ...options,
86
+ docsPath: options.docsPath ?? '/docs/sdk/errors#nonce',
87
+ });
88
+ this.nonce = options.nonce;
89
+ this.expectedNonce = options.expectedNonce;
90
+ }
91
+ }
92
+ /**
93
+ * Error thrown when a transaction times out waiting for confirmation.
94
+ */
95
+ export class TransactionTimeoutError extends RadiusError {
96
+ name = 'TransactionTimeoutError';
97
+ /** The transaction hash */
98
+ transactionHash;
99
+ /** How long we waited (in ms) */
100
+ timeout;
101
+ constructor(message, options = {}) {
102
+ super(message, {
103
+ ...options,
104
+ docsPath: options.docsPath ?? '/docs/sdk/errors#transaction-timeout',
105
+ });
106
+ this.transactionHash = options.transactionHash;
107
+ this.timeout = options.timeout;
108
+ }
109
+ }
110
+ /**
111
+ * Error thrown when one or more transactions in a batch fail.
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * try {
116
+ * await walletClient.sendTransactionBatch({ transactions });
117
+ * } catch (error) {
118
+ * if (error instanceof BatchTransactionError) {
119
+ * console.log('Batch failed:', error.message);
120
+ * error.results.forEach((r, i) => {
121
+ * if (r.error) {
122
+ * console.log(` Transaction ${i} failed: ${r.error}`);
123
+ * } else {
124
+ * console.log(` Transaction ${i} succeeded: ${r.hash}`);
125
+ * }
126
+ * });
127
+ * }
128
+ * }
129
+ * ```
130
+ */
131
+ export class BatchTransactionError extends RadiusError {
132
+ name = 'BatchTransactionError';
133
+ /** Results for each transaction in the batch */
134
+ results;
135
+ constructor(message, results, options = {}) {
136
+ super(message, {
137
+ ...options,
138
+ docsPath: options.docsPath ?? '/docs/sdk/errors#batch-transaction',
139
+ });
140
+ this.results = results;
141
+ }
142
+ }
143
+ //# sourceMappingURL=transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../errors/transaction.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAA2B,MAAM,QAAQ,CAAC;AAE9D;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,sBAAuB,SAAQ,WAAW;IACpC,IAAI,GAAG,wBAAwB,CAAC;IAElD,0CAA0C;IACjC,eAAe,CAAQ;IAChC,6BAA6B;IACpB,MAAM,CAAU;IAEzB,YACC,OAAe,EACf,UAGI,EAAE;QAEN,KAAK,CAAC,OAAO,EAAE;YACd,GAAG,OAAO;YACV,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,qCAAqC;SACnE,CAAC,CAAC;QACH,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9B,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,WAAW;IACtC,IAAI,GAAG,0BAA0B,CAAC;IAEpD,0CAA0C;IACjC,eAAe,CAAQ;IAChC,6BAA6B;IACpB,MAAM,CAAU;IACzB,+CAA+C;IACtC,YAAY,CAAU;IAC/B,0BAA0B;IACjB,UAAU,CAAO;IAE1B,YACC,OAAe,EACf,UAKI,EAAE;QAEN,KAAK,CAAC,OAAO,EAAE;YACd,GAAG,OAAO;YACV,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,uCAAuC;SACrE,CAAC,CAAC;QACH,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACtC,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,k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