@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
package/README.md CHANGED
@@ -1,45 +1,161 @@
1
- # @ryanrfox/sdk
1
+ # Radius TypeScript SDK
2
2
 
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
3
+ [![Version](https://img.shields.io/badge/version-2.0.0--alpha.7-blue)](package.json)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](../LICENSE)
4
5
 
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
6
+ The official TypeScript SDK for [Radius](https://radiustech.xyz/). Built on [viem](https://viem.sh/) for seamless EVM compatibility.
6
7
 
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
8
+ > **V2 Alpha Notice:** This SDK is in pre-release and not yet published to npm. You must build and link locally to use it.
8
9
 
9
- ## Purpose
10
+ > **ESM Only:** This SDK is published as ES Modules only. CommonJS (`require()`) is not supported. Your project must use `"type": "module"` in package.json or use `.mjs` extensions.
10
11
 
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@ryanrfox/sdk`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
12
+ ## Local Installation
15
13
 
16
- ## What is OIDC Trusted Publishing?
14
+ V2 is not yet on npm. Build and link locally:
17
15
 
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
16
+ ```bash
17
+ # In this directory (typescript/)
18
+ pnpm install
19
+ pnpm build
20
+ pnpm link --global
21
+ ```
19
22
 
20
- ## Setup Instructions
23
+ Then in your project:
21
24
 
22
- To properly configure OIDC trusted publishing for this package:
25
+ ```bash
26
+ pnpm link --global @radiustechsystems/sdk
27
+ # Or: npm link @radiustechsystems/sdk
28
+ ```
23
29
 
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
30
+ When done testing:
28
31
 
29
- ## DO NOT USE THIS PACKAGE
32
+ ```bash
33
+ pnpm unlink --global @radiustechsystems/sdk
34
+ ```
30
35
 
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
36
+ ## Quick Start
36
37
 
37
- ## More Information
38
+ ```typescript
39
+ import { createPublicClient, createWalletClient, http } from 'viem';
40
+ import { privateKeyToAccount } from 'viem/accounts';
41
+ import { radiusTestnet, radiusWalletActions } from '@radiustechsystems/sdk';
38
42
 
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
43
+ // Public client for reading blockchain state
44
+ const publicClient = createPublicClient({
45
+ chain: radiusTestnet,
46
+ transport: http(),
47
+ });
42
48
 
43
- ---
49
+ // Wallet client for sending transactions
50
+ const walletClient = createWalletClient({
51
+ account: privateKeyToAccount('0x...'),
52
+ chain: radiusTestnet,
53
+ transport: http(),
54
+ }).extend(radiusWalletActions());
44
55
 
45
- **Maintained for OIDC setup purposes only**
56
+ // Check balance (standard viem API)
57
+ const balance = await publicClient.getBalance({
58
+ address: walletClient.account.address,
59
+ });
60
+
61
+ // Send transaction (standard viem API)
62
+ const hash = await walletClient.sendTransaction({
63
+ to: '0x...recipient',
64
+ value: 1000000000000000000n,
65
+ });
66
+
67
+ // Wait for receipt
68
+ const receipt = await publicClient.waitForTransactionReceipt({ hash });
69
+ ```
70
+
71
+ ## Batch Transactions
72
+
73
+ Radius doesn't queue future-nonce transactions like Ethereum. Use `sendTransactionBatch` to send multiple transactions atomically:
74
+
75
+ ```typescript
76
+ const hashes = await walletClient.sendTransactionBatch({
77
+ transactions: [
78
+ { to: '0x...', value: 1000000000000000000n },
79
+ { to: '0x...', data: '0x...' },
80
+ ],
81
+ });
82
+ ```
83
+
84
+ ## SDK Architecture
85
+
86
+ The SDK follows viem's decorator pattern:
87
+
88
+ ```
89
+ @radiustechsystems/sdk/
90
+ ├── chains/ # Chain definitions (radius, radiusTestnet)
91
+ ├── decorators/ # Client extension decorators (radiusWalletActions)
92
+ ├── actions/ # Standalone action functions
93
+ ├── contracts/ # Typed contract utilities
94
+ ├── errors/ # Typed error classes
95
+ ├── events/ # Event watching utilities
96
+ └── transport/ # Transport utilities
97
+ ```
98
+
99
+ ## Extending Viem Clients
100
+
101
+ ```typescript
102
+ import { createWalletClient, http } from 'viem';
103
+ import { privateKeyToAccount } from 'viem/accounts';
104
+ import { radiusTestnet, radiusWalletActions } from '@radiustechsystems/sdk';
105
+
106
+ const client = createWalletClient({
107
+ account: privateKeyToAccount('0x...'),
108
+ chain: radiusTestnet,
109
+ transport: http(),
110
+ }).extend(radiusWalletActions());
111
+
112
+ // Now has sendTransactionBatch available
113
+ const hashes = await client.sendTransactionBatch({
114
+ transactions: [{ to: '0x...', value: 1n }],
115
+ });
116
+ ```
117
+
118
+ ## Features
119
+
120
+ - **Chain Configs** — Pre-configured chains for Radius mainnet and testnet
121
+ - **Batch Transactions** — Send multiple transactions atomically
122
+ - **Events** — Watch blocks, transfers, approvals, and logs
123
+ - **Multicall3** — Batch contract reads (configured on testnet)
124
+
125
+ ## Subpath Exports
126
+
127
+ ```typescript
128
+ import { radiusTestnet, radiusWalletActions, MAX_GAS } from '@radiustechsystems/sdk';
129
+ import { radius, radiusTestnet } from '@radiustechsystems/sdk/chains';
130
+ import { decodeEventLogs, filterEventLogs } from '@radiustechsystems/sdk/events';
131
+ ```
132
+
133
+ ## Documentation
134
+
135
+ **[docs.radiustech.xyz](https://docs.radiustech.xyz/)** — Full documentation, guides, and API reference.
136
+
137
+ - [Getting Started](https://docs.radiustech.xyz/getting-started)
138
+ - [TypeScript SDK Guide](https://docs.radiustech.xyz/sdk/typescript)
139
+ - [API Reference](https://docs.radiustech.xyz/sdk/typescript/api)
140
+
141
+ ## Requirements
142
+
143
+ - Node.js >= 22
144
+ - ESM project (`"type": "module"` in package.json)
145
+ - pnpm (for local development)
146
+ - [Testnet Access](https://docs.radiustech.xyz/radius-testnet-access)
147
+
148
+ ## Environment Variables
149
+
150
+ | Variable | Description |
151
+ |----------|-------------|
152
+ | `RADIUS_RPC_URL` | RPC endpoint URL |
153
+ | `RADIUS_PRIVATE_KEY` | Account private key (for scripts) |
154
+
155
+ ## Contributing
156
+
157
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
158
+
159
+ ## License
160
+
161
+ [MIT](../LICENSE)
package/package.json CHANGED
@@ -1,10 +1,86 @@
1
1
  {
2
- "name": "@ryanrfox/sdk",
3
- "version": "0.0.2",
4
- "description": "OIDC trusted publishing setup package for @ryanrfox/sdk",
5
- "keywords": [
6
- "oidc",
7
- "trusted-publishing",
8
- "setup"
9
- ]
2
+ "name": "@ryanrfox/sdk",
3
+ "version": "2.0.3",
4
+ "description": "TypeScript SDK for interacting with the Radius Platform",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/ryanRfox/sdk.git"
8
+ },
9
+ "type": "module",
10
+ "scripts": {
11
+ "build": "pnpm clean && pnpm build:esm && pnpm build:types",
12
+ "build:esm": "tsc --project ./tsconfig.build.json --module esnext --moduleResolution bundler --outDir ./src/_esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./src/_esm/package.json",
13
+ "build:types": "tsc --project ./tsconfig.build.json --module esnext --moduleResolution bundler --declarationDir ./src/_types --emitDeclarationOnly --declaration --declarationMap",
14
+ "check": "biome check . --fix --unsafe",
15
+ "check:types": "tsc --noEmit",
16
+ "clean": "rimraf src/_types src/_esm ./tsconfig.build.tsbuildinfo src/tsconfig.build.tsbuildinfo",
17
+ "format": "biome format --write",
18
+ "lint": "biome check .",
19
+ "lint:fix": "biome check --write .",
20
+ "test": "vitest --run",
21
+ "test:watch": "vitest",
22
+ "generate:api": "typedoc",
23
+ "generate:guides": "npx tsx scripts/generate-guides.ts",
24
+ "generate:docs": "pnpm generate:api && pnpm generate:guides",
25
+ "docs:check": "npx tsx scripts/validate-docs.ts",
26
+ "prepublishOnly": "pnpm run check && pnpm run test && pnpm run build"
27
+ },
28
+ "devDependencies": {
29
+ "@biomejs/biome": "^2.2.2",
30
+ "@types/node": "^22.10.0",
31
+ "@vitest/coverage-v8": "^4.0.15",
32
+ "rimraf": "^6.0.1",
33
+ "typedoc": "0.28.16",
34
+ "typedoc-plugin-markdown": "4.9.0",
35
+ "typescript": "^5.9.3",
36
+ "vitest": "^4.0.15"
37
+ },
38
+ "peerDependencies": {
39
+ "typescript": ">=5.0.0",
40
+ "viem": ">=2.0.0"
41
+ },
42
+ "engines": {
43
+ "node": ">=24"
44
+ },
45
+ "license": "MIT",
46
+ "packageManager": "pnpm@9.14.2",
47
+ "main": "./src/_esm/index.js",
48
+ "module": "./src/_esm/index.js",
49
+ "types": "./src/_types/index.d.ts",
50
+ "exports": {
51
+ ".": {
52
+ "types": "./src/_types/index.d.ts",
53
+ "import": "./src/_esm/index.js",
54
+ "default": "./src/_esm/index.js"
55
+ },
56
+ "./chains": {
57
+ "types": "./src/_types/chains/index.d.ts",
58
+ "import": "./src/_esm/chains/index.js",
59
+ "default": "./src/_esm/chains/index.js"
60
+ },
61
+ "./events": {
62
+ "types": "./src/_types/events/index.d.ts",
63
+ "import": "./src/_esm/events/index.js",
64
+ "default": "./src/_esm/events/index.js"
65
+ }
66
+ },
67
+ "files": [
68
+ "src/_esm",
69
+ "src/_types"
70
+ ],
71
+ "keywords": [
72
+ "radius",
73
+ "evm",
74
+ "viem",
75
+ "sdk",
76
+ "ethereum",
77
+ "crypto"
78
+ ],
79
+ "homepage": "https://github.com/ryanRfox/sdk/tree/main/typescript#readme",
80
+ "bugs": {
81
+ "url": "https://github.com/ryanRfox/sdk/issues"
82
+ },
83
+ "publishConfig": {
84
+ "access": "public"
85
+ }
10
86
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Radius SDK Actions
3
+ *
4
+ * Standalone action functions that can be used with viem clients.
5
+ * These follow viem's action pattern and are composed into decorators.
6
+ */
7
+ export { type SendTransactionBatchParameters, type SendTransactionBatchReturnType, sendTransactionBatch, } from './sendTransactionBatch.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACN,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACnC,oBAAoB,GACpB,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Radius SDK Actions
3
+ *
4
+ * Standalone action functions that can be used with viem clients.
5
+ * These follow viem's action pattern and are composed into decorators.
6
+ */
7
+ export { sendTransactionBatch, } from './sendTransactionBatch.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAGN,oBAAoB,GACpB,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * sendTransactionBatch action - sends multiple transactions in a single JSON-RPC batch request.
3
+ *
4
+ * Radius does not queue future-nonce transactions like Ethereum. This action ensures
5
+ * all transactions arrive in nonce order by using JSON-RPC batching.
6
+ */
7
+ import type { Account, Address, Chain, Client, Hash, Hex, Transport } from 'viem';
8
+ /** Default maximum number of transactions in a single batch */
9
+ export declare const DEFAULT_MAX_BATCH_SIZE = 100;
10
+ /** Default timeout for batch fetch requests in milliseconds (30 seconds) */
11
+ export declare const DEFAULT_BATCH_TIMEOUT = 30000;
12
+ /**
13
+ * Transaction request for batch submission.
14
+ */
15
+ export interface SendTransactionBatchParameters {
16
+ /** Array of transactions to send in the batch */
17
+ transactions: Array<{
18
+ /** The recipient address */
19
+ to: Address;
20
+ /** The amount to send in wei (default: 0n) */
21
+ value?: bigint;
22
+ /** The transaction data (for contract calls) */
23
+ data?: Hex;
24
+ /** Gas limit (if not provided, will be estimated) */
25
+ gas?: bigint;
26
+ }>;
27
+ /** Maximum number of transactions allowed in the batch (default: 100) */
28
+ maxBatchSize?: number;
29
+ /** Timeout in milliseconds for the batch fetch request (default: 30000) */
30
+ timeout?: number;
31
+ }
32
+ /**
33
+ * Return type for sendTransactionBatch action.
34
+ */
35
+ export type SendTransactionBatchReturnType = Hash[];
36
+ /**
37
+ * Send multiple transactions in a single JSON-RPC batch request.
38
+ * Transactions are automatically assigned sequential nonces and sent atomically.
39
+ *
40
+ * @param client - The viem client (must have an account attached)
41
+ * @param params - The batch transaction parameters
42
+ * @param params.transactions - Array of transaction objects to send
43
+ * @param params.maxBatchSize - Maximum batch size (default: 100)
44
+ * @param params.timeout - Fetch timeout in milliseconds (default: 30000)
45
+ * @returns Array of transaction hashes in the same order as input
46
+ * @throws {BatchTransactionError} If any transaction in the batch fails
47
+ * @throws {GasEstimationError} If gas estimation fails for any transaction
48
+ * @throws {RadiusError} If input validation fails, HTTP request fails, or request times out
49
+ *
50
+ * @remarks
51
+ * **Transport Note:** This function uses a direct `fetch()` call rather than
52
+ * the client's configured transport. Custom transport interceptors, retry logic,
53
+ * or middleware will not be applied to batch requests. This is necessary because
54
+ * viem's transport layer does not expose batch JSON-RPC capabilities.
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * import { createWalletClient, http } from 'viem';
59
+ * import { privateKeyToAccount } from 'viem/accounts';
60
+ * import { radiusTestnet, radiusWalletActions } from '@radiustechsystems/sdk';
61
+ *
62
+ * const client = createWalletClient({
63
+ * account: privateKeyToAccount('0x...'),
64
+ * chain: radiusTestnet,
65
+ * transport: http(),
66
+ * }).extend(radiusWalletActions());
67
+ *
68
+ * const hashes = await client.sendTransactionBatch({
69
+ * transactions: [
70
+ * { to: '0x...', value: 1000000000000000000n },
71
+ * { to: '0x...', data: '0x...' },
72
+ * ],
73
+ * });
74
+ * ```
75
+ */
76
+ export declare function sendTransactionBatch<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, params: SendTransactionBatchParameters): Promise<SendTransactionBatchReturnType>;
77
+ //# sourceMappingURL=sendTransactionBatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendTransactionBatch.d.ts","sourceRoot":"","sources":["../../actions/sendTransactionBatch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AASlF,+DAA+D;AAC/D,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C,iDAAiD;IACjD,YAAY,EAAE,KAAK,CAAC;QACnB,4BAA4B;QAC5B,EAAE,EAAE,OAAO,CAAC;QACZ,8CAA8C;QAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,gDAAgD;QAChD,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,qDAAqD;QACrD,GAAG,CAAC,EAAE,MAAM,CAAC;KACb,CAAC,CAAC;IACH,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,IAAI,EAAE,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAsB,oBAAoB,CACzC,KAAK,SAAS,KAAK,GAAG,SAAS,EAC/B,OAAO,SAAS,OAAO,GAAG,SAAS,EAEnC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,EACzC,MAAM,EAAE,8BAA8B,GACpC,OAAO,CAAC,8BAA8B,CAAC,CAgNzC"}
@@ -0,0 +1,245 @@
1
+ import { MAX_GAS } from '../chains/chainConfig.js';
2
+ import { BatchTransactionError, GasEstimationError, RadiusError, } from '../errors/index.js';
3
+ /** Default maximum number of transactions in a single batch */
4
+ export const DEFAULT_MAX_BATCH_SIZE = 100;
5
+ /** Default timeout for batch fetch requests in milliseconds (30 seconds) */
6
+ export const DEFAULT_BATCH_TIMEOUT = 30000;
7
+ /**
8
+ * Send multiple transactions in a single JSON-RPC batch request.
9
+ * Transactions are automatically assigned sequential nonces and sent atomically.
10
+ *
11
+ * @param client - The viem client (must have an account attached)
12
+ * @param params - The batch transaction parameters
13
+ * @param params.transactions - Array of transaction objects to send
14
+ * @param params.maxBatchSize - Maximum batch size (default: 100)
15
+ * @param params.timeout - Fetch timeout in milliseconds (default: 30000)
16
+ * @returns Array of transaction hashes in the same order as input
17
+ * @throws {BatchTransactionError} If any transaction in the batch fails
18
+ * @throws {GasEstimationError} If gas estimation fails for any transaction
19
+ * @throws {RadiusError} If input validation fails, HTTP request fails, or request times out
20
+ *
21
+ * @remarks
22
+ * **Transport Note:** This function uses a direct `fetch()` call rather than
23
+ * the client's configured transport. Custom transport interceptors, retry logic,
24
+ * or middleware will not be applied to batch requests. This is necessary because
25
+ * viem's transport layer does not expose batch JSON-RPC capabilities.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * import { createWalletClient, http } from 'viem';
30
+ * import { privateKeyToAccount } from 'viem/accounts';
31
+ * import { radiusTestnet, radiusWalletActions } from '@radiustechsystems/sdk';
32
+ *
33
+ * const client = createWalletClient({
34
+ * account: privateKeyToAccount('0x...'),
35
+ * chain: radiusTestnet,
36
+ * transport: http(),
37
+ * }).extend(radiusWalletActions());
38
+ *
39
+ * const hashes = await client.sendTransactionBatch({
40
+ * transactions: [
41
+ * { to: '0x...', value: 1000000000000000000n },
42
+ * { to: '0x...', data: '0x...' },
43
+ * ],
44
+ * });
45
+ * ```
46
+ */
47
+ export async function sendTransactionBatch(client, params) {
48
+ const { transactions, maxBatchSize = DEFAULT_MAX_BATCH_SIZE, timeout = DEFAULT_BATCH_TIMEOUT, } = params;
49
+ // Validate input
50
+ if (!Array.isArray(transactions)) {
51
+ throw new RadiusError('sendTransactionBatch expects an array of transactions', {
52
+ metaMessages: [
53
+ 'Example: client.sendTransactionBatch({ transactions: [{ to: "0x...", value: 1n }] })',
54
+ ],
55
+ details: `Received: ${typeof transactions}`,
56
+ });
57
+ }
58
+ if (transactions.length === 0) {
59
+ throw new RadiusError('sendTransactionBatch requires at least one transaction', {
60
+ metaMessages: ['Pass an array with at least one transaction request.'],
61
+ });
62
+ }
63
+ if (transactions.length > maxBatchSize) {
64
+ throw new RadiusError(`Batch size ${transactions.length} exceeds maximum allowed size of ${maxBatchSize}`, {
65
+ metaMessages: [
66
+ `Split your transactions into smaller batches of ${maxBatchSize} or fewer.`,
67
+ 'You can also increase the limit by passing maxBatchSize option.',
68
+ ],
69
+ details: `Received ${transactions.length} transactions, max is ${maxBatchSize}`,
70
+ });
71
+ }
72
+ // Ensure we have an account
73
+ const account = client.account;
74
+ if (!account) {
75
+ throw new RadiusError('sendTransactionBatch requires an account', {
76
+ metaMessages: [
77
+ 'Create a wallet client with an account:',
78
+ 'createWalletClient({ account: privateKeyToAccount("0x..."), ... })',
79
+ ],
80
+ });
81
+ }
82
+ // Get the chain ID
83
+ const chainId = client.chain?.id;
84
+ if (!chainId) {
85
+ throw new RadiusError('sendTransactionBatch requires a chain', {
86
+ metaMessages: ['Create a wallet client with a chain: createWalletClient({ chain, ... })'],
87
+ });
88
+ }
89
+ // Get RPC URL from transport
90
+ const rpcUrl = getRpcUrl(client);
91
+ // Get current nonce once
92
+ const startNonce = await client.request({
93
+ method: 'eth_getTransactionCount',
94
+ params: [account.address, 'pending'],
95
+ });
96
+ const nonce = Number(startNonce);
97
+ // Estimate gas for each transaction (in parallel for efficiency)
98
+ const gasEstimates = await Promise.all(transactions.map(async (tx, i) => {
99
+ if (tx.gas !== undefined) {
100
+ return tx.gas;
101
+ }
102
+ try {
103
+ const estimate = await client.request({
104
+ method: 'eth_estimateGas',
105
+ params: [
106
+ {
107
+ from: account.address,
108
+ to: tx.to,
109
+ data: tx.data,
110
+ value: tx.value ? `0x${tx.value.toString(16)}` : undefined,
111
+ },
112
+ ],
113
+ });
114
+ // Apply 20% safety margin
115
+ const estimatedGas = BigInt(estimate);
116
+ const margin = estimatedGas / 5n;
117
+ let gas = estimatedGas + margin;
118
+ // Cap at MAX_GAS
119
+ if (gas > MAX_GAS) {
120
+ gas = MAX_GAS;
121
+ }
122
+ return gas;
123
+ }
124
+ catch (error) {
125
+ throw new GasEstimationError(`Gas estimation failed for transaction at index ${i}`, {
126
+ to: tx.to,
127
+ data: tx.data,
128
+ cause: error instanceof Error ? error : undefined,
129
+ metaMessages: [
130
+ 'The transaction may revert on-chain.',
131
+ 'Check that the recipient address is valid and the contract call is correct.',
132
+ ],
133
+ });
134
+ }
135
+ }));
136
+ // Ensure the account has signTransaction
137
+ if (!account.signTransaction) {
138
+ throw new RadiusError('Account does not support signTransaction', {
139
+ metaMessages: ['Use an account that supports signing, like privateKeyToAccount()'],
140
+ });
141
+ }
142
+ // Sign all transactions with sequential nonces
143
+ const signedTxs = await Promise.all(transactions.map(async (tx, i) => {
144
+ // Use the account's signTransaction method
145
+ const signedTx = await account.signTransaction?.({
146
+ to: tx.to,
147
+ data: tx.data,
148
+ value: tx.value ?? 0n,
149
+ nonce: nonce + i,
150
+ gas: gasEstimates[i],
151
+ gasPrice: 0n, // Radius uses zero gas price
152
+ chainId,
153
+ });
154
+ return signedTx;
155
+ }));
156
+ // Build JSON-RPC batch request
157
+ const batchRequest = signedTxs.map((raw, i) => ({
158
+ jsonrpc: '2.0',
159
+ id: i,
160
+ method: 'eth_sendRawTransaction',
161
+ params: [raw],
162
+ }));
163
+ // Send single HTTP POST request with timeout
164
+ const controller = new AbortController();
165
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
166
+ let response;
167
+ try {
168
+ response = await fetch(rpcUrl, {
169
+ method: 'POST',
170
+ headers: { 'Content-Type': 'application/json' },
171
+ body: JSON.stringify(batchRequest),
172
+ signal: controller.signal,
173
+ });
174
+ }
175
+ catch (error) {
176
+ clearTimeout(timeoutId);
177
+ if (error instanceof Error && error.name === 'AbortError') {
178
+ throw new RadiusError(`Batch request timed out after ${timeout}ms`, {
179
+ metaMessages: [
180
+ 'The RPC endpoint did not respond in time.',
181
+ 'You can increase the timeout by passing the timeout option.',
182
+ ],
183
+ details: `Timeout: ${timeout}ms`,
184
+ });
185
+ }
186
+ throw error;
187
+ }
188
+ finally {
189
+ clearTimeout(timeoutId);
190
+ }
191
+ if (!response.ok) {
192
+ throw new RadiusError(`Batch request failed with status ${response.status}`, {
193
+ details: await response.text(),
194
+ });
195
+ }
196
+ const batchResponse = (await response.json());
197
+ // Parse responses and match by id to preserve order
198
+ const results = [];
199
+ const hashes = [];
200
+ let hasError = false;
201
+ // Sort responses by id to ensure order matches input
202
+ const sortedResponses = [...batchResponse].sort((a, b) => a.id - b.id);
203
+ for (let i = 0; i < transactions.length; i++) {
204
+ const res = sortedResponses[i];
205
+ if (res?.result) {
206
+ results.push({ index: i, hash: res.result });
207
+ hashes.push(res.result);
208
+ }
209
+ else {
210
+ const errorMsg = res?.error?.data || res?.error?.message || 'Unknown error';
211
+ results.push({ index: i, error: errorMsg });
212
+ hasError = true;
213
+ }
214
+ }
215
+ // If any transaction failed, throw with details
216
+ if (hasError) {
217
+ const failedCount = results.filter((r) => r.error).length;
218
+ throw new BatchTransactionError(`${failedCount} of ${transactions.length} transactions failed`, results);
219
+ }
220
+ return hashes;
221
+ }
222
+ /**
223
+ * Extract RPC URL from client transport.
224
+ */
225
+ function getRpcUrl(client) {
226
+ // Try to get URL from chain config first
227
+ const chainUrl = client.chain?.rpcUrls?.default?.http?.[0];
228
+ if (chainUrl) {
229
+ return chainUrl;
230
+ }
231
+ // Check environment variables (Node.js only)
232
+ if (typeof process !== 'undefined' && process.env) {
233
+ const envUrl = process.env.RADIUS_RPC_URL || process.env.RADIUS_ENDPOINT;
234
+ if (envUrl) {
235
+ return envUrl;
236
+ }
237
+ }
238
+ throw new RadiusError('Unable to determine RPC URL', {
239
+ metaMessages: [
240
+ 'Ensure your client has a chain configured with rpcUrls',
241
+ 'Or set RADIUS_RPC_URL environment variable',
242
+ ],
243
+ });
244
+ }
245
+ //# sourceMappingURL=sendTransactionBatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendTransactionBatch.js","sourceRoot":"","sources":["../../actions/sendTransactionBatch.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EACN,qBAAqB,EAErB,kBAAkB,EAClB,WAAW,GACX,MAAM,oBAAoB,CAAC;AAE5B,+DAA+D;AAC/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAE1C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AA4B3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAIzC,MAAyC,EACzC,MAAsC;IAEtC,MAAM,EACL,YAAY,EACZ,YAAY,GAAG,sBAAsB,EACrC,OAAO,GAAG,qBAAqB,GAC/B,GAAG,MAAM,CAAC;IAEX,iBAAiB;IACjB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,WAAW,CAAC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