@appliedblockchain/silentdatarollup-viem-fireblocks 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Applied Blockchain Ltd.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # Silent Data Providers - Viem Fireblocks Transport Package
2
+
3
+ ## Table of Contents
4
+
5
+ - [Introduction](#introduction)
6
+ - [Prerequisites](#prerequisites)
7
+ - [Integration](#integration)
8
+ - [Basic Usage](#basic-usage)
9
+ - [Installing Dependencies](#installing-dependencies)
10
+ - [Basic Usage Example](#basic-usage-example)
11
+ - [Troubleshooting](#troubleshooting)
12
+ - [License](#license)
13
+ - [Additional Resources](#additional-resources)
14
+
15
+ ## Introduction
16
+
17
+ Viem custom transport for Silent Data with Fireblocks integration. This package allows you to use Fireblocks for transaction signing while interacting with the Silent Data Rollup network using the viem library.
18
+
19
+ ## Prerequisites
20
+
21
+ - Node.js (version 18 or higher)
22
+ - pnpm
23
+ - Basic knowledge of Ethereum and smart contracts
24
+ - Viem
25
+ - A Fireblocks account with API credentials
26
+
27
+ ## Integration
28
+
29
+ ### Basic Usage
30
+
31
+ #### Installing Dependencies
32
+
33
+ ```bash
34
+ pnpm add @appliedblockchain/silentdatarollup-viem-fireblocks
35
+ ```
36
+
37
+ #### Basic Usage Example
38
+
39
+ ```typescript
40
+ import { defineChain, createPublicClient, createWalletClient } from 'viem'
41
+ import { ApiBaseUrl, ChainId } from '@fireblocks/fireblocks-web3-provider'
42
+ import { sdFireblocksTransport } from '@appliedblockchain/silentdatarollup-viem-fireblocks'
43
+
44
+ const config = {
45
+ rpcUrl: 'SILENT_DATA_ROLLUP_RPC_URL',
46
+ chainId: 'SILENT_DATA_CHAIN_ID',
47
+ fireblocksApiKey: 'YOUR_FIREBLOCKS_API_KEY',
48
+ fireblocksPrivateKey: 'YOUR_FIREBLOCKS_PRIVATE_KEY_PATH',
49
+ fireblocksVaultAccountId: 'YOUR_FIREBLOCKS_VAULT_ACCOUNT_ID',
50
+ }
51
+
52
+ const transport = sdFireblocksTransport({
53
+ apiKey: config.fireblocksApiKey,
54
+ privateKey: config.fireblocksPrivateKey,
55
+ vaultAccountIds: config.fireblocksVaultAccountId,
56
+ chainId: ChainId.SEPOLIA,
57
+ apiBaseUrl: ApiBaseUrl.Sandbox, // Change to ApiBaseUrl.Production for production
58
+ rpcUrl: config.rpcUrl,
59
+ })
60
+
61
+ const sdChain = defineChain({
62
+ id: config.chainId,
63
+ name: 'SILENT_DATA_CHAIN_NAME',
64
+ nativeCurrency: {
65
+ name: 'Ether',
66
+ symbol: 'ETH',
67
+ decimals: 18,
68
+ },
69
+ rpcUrls: {
70
+ default: {
71
+ http: [config.rpcUrl],
72
+ },
73
+ },
74
+ })
75
+
76
+ const publicClient = createPublicClient({
77
+ chain: sdChain,
78
+ transport,
79
+ })
80
+
81
+ const walletClient = createWalletClient({
82
+ chain: sdChain,
83
+ transport,
84
+ })
85
+
86
+ // Get accounts from Fireblocks
87
+ const [walletAddress] = await walletClient.getAddresses()
88
+
89
+ // Get balance
90
+ const balance = await publicClient.getBalance({ address: walletAddress })
91
+ console.log('Balance:', balance)
92
+
93
+ const recipientAddress = 'RECIPIENT_ADDRESS'
94
+ const amountInWei = BigInt('1')
95
+
96
+ // Send transaction (signed via Fireblocks)
97
+ const transactionHash = await walletClient.sendTransaction({
98
+ account: walletAddress,
99
+ to: recipientAddress,
100
+ value: amountInWei,
101
+ })
102
+ console.log('Transaction Hash:', transactionHash)
103
+ ```
104
+
105
+ ## License
106
+
107
+ This project is licensed under the [MIT License](LICENSE).
108
+
109
+ ## Troubleshooting
110
+
111
+ If you encounter any issues, please check the following:
112
+
113
+ 1. Ensure your Fireblocks API credentials are correct and have the necessary permissions.
114
+ 2. Verify that your vault account ID is correctly configured.
115
+ 3. Ensure you're using the correct RPC URL for your desired network.
116
+ 4. Ensure that your token is active on the SilentData AppChains dashboard.
117
+ 5. Check that your Fireblocks account has sufficient funds for transactions.
118
+
119
+ ## Additional Resources
120
+
121
+ - [Silent Data Documentation](https://docs.silentdata.com)
122
+ - [Viem Documentation](https://viem.sh/docs/)
123
+ - [Fireblocks Web3 Provider Documentation](https://developers.fireblocks.com/docs/ethereum-web3-provider)
@@ -0,0 +1,6 @@
1
+ import { FireblocksProviderConfig } from '@fireblocks/fireblocks-web3-provider';
2
+ import { CustomTransport } from 'viem';
3
+
4
+ declare function sdFireblocksTransport(fireblocksConfig: FireblocksProviderConfig): CustomTransport;
5
+
6
+ export { sdFireblocksTransport };
@@ -0,0 +1,6 @@
1
+ import { FireblocksProviderConfig } from '@fireblocks/fireblocks-web3-provider';
2
+ import { CustomTransport } from 'viem';
3
+
4
+ declare function sdFireblocksTransport(fireblocksConfig: FireblocksProviderConfig): CustomTransport;
5
+
6
+ export { sdFireblocksTransport };
package/dist/index.js ADDED
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ sdFireblocksTransport: () => sdFireblocksTransport
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+
27
+ // src/transport.ts
28
+ var import_fireblocks_web3_provider = require("@fireblocks/fireblocks-web3-provider");
29
+ var import_silentdatarollup_ethers_provider_fireblocks = require("@appliedblockchain/silentdatarollup-ethers-provider-fireblocks");
30
+ var import_viem = require("viem");
31
+ function sdFireblocksTransport(fireblocksConfig) {
32
+ const fireblocksWeb3Provider = new import_fireblocks_web3_provider.FireblocksWeb3Provider(fireblocksConfig);
33
+ const provider = new import_silentdatarollup_ethers_provider_fireblocks.SilentDataRollupFireblocksProvider({
34
+ ethereum: fireblocksWeb3Provider
35
+ });
36
+ return (0, import_viem.custom)({
37
+ request: async ({ method, params }) => {
38
+ if (method === "eth_sendTransaction" && Array.isArray(params) && params.length > 0) {
39
+ const tx = params[0];
40
+ let gasLimit = tx.gasLimit;
41
+ if (!gasLimit) {
42
+ gasLimit = await provider.estimateGas(tx);
43
+ }
44
+ const payload = {
45
+ method,
46
+ params: [{ ...tx, gasLimit }]
47
+ };
48
+ const txHash = await provider.sendTransaction(payload);
49
+ return txHash;
50
+ }
51
+ return await provider.send(method, params || []);
52
+ }
53
+ });
54
+ }
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ sdFireblocksTransport
58
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,33 @@
1
+ // src/transport.ts
2
+ import {
3
+ FireblocksWeb3Provider
4
+ } from "@fireblocks/fireblocks-web3-provider";
5
+ import { SilentDataRollupFireblocksProvider } from "@appliedblockchain/silentdatarollup-ethers-provider-fireblocks";
6
+ import { custom } from "viem";
7
+ function sdFireblocksTransport(fireblocksConfig) {
8
+ const fireblocksWeb3Provider = new FireblocksWeb3Provider(fireblocksConfig);
9
+ const provider = new SilentDataRollupFireblocksProvider({
10
+ ethereum: fireblocksWeb3Provider
11
+ });
12
+ return custom({
13
+ request: async ({ method, params }) => {
14
+ if (method === "eth_sendTransaction" && Array.isArray(params) && params.length > 0) {
15
+ const tx = params[0];
16
+ let gasLimit = tx.gasLimit;
17
+ if (!gasLimit) {
18
+ gasLimit = await provider.estimateGas(tx);
19
+ }
20
+ const payload = {
21
+ method,
22
+ params: [{ ...tx, gasLimit }]
23
+ };
24
+ const txHash = await provider.sendTransaction(payload);
25
+ return txHash;
26
+ }
27
+ return await provider.send(method, params || []);
28
+ }
29
+ });
30
+ }
31
+ export {
32
+ sdFireblocksTransport
33
+ };
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@appliedblockchain/silentdatarollup-viem-fireblocks",
3
+ "version": "1.0.10",
4
+ "description": "Viem package for Silent Data with Fireblocks integration",
5
+ "author": "Applied Blockchain",
6
+ "homepage": "https://github.com/appliedblockchain/silent-data-rollup-providers#readme",
7
+ "keywords": [
8
+ "ethereum",
9
+ "provider",
10
+ "silentdata",
11
+ "rollup",
12
+ "viem",
13
+ "fireblocks"
14
+ ],
15
+ "license": "MIT",
16
+ "repository": "https://github.com/appliedblockchain/silent-data-rollup-providers",
17
+ "main": "dist/index.js",
18
+ "module": "dist/index.mjs",
19
+ "types": "dist/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "import": "./dist/index.mjs",
23
+ "require": "./dist/index.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "dependencies": {
30
+ "@fireblocks/fireblocks-web3-provider": "1.3.8",
31
+ "viem": "2.31.4",
32
+ "@appliedblockchain/silentdatarollup-ethers-provider-fireblocks": "1.0.10"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "24.10.1",
36
+ "ts-node": "10.9.2",
37
+ "typescript": "5.6.2"
38
+ },
39
+ "engines": {
40
+ "node": ">=18.0.0"
41
+ },
42
+ "scripts": {
43
+ "build": "tsc --noEmit && tsup src/index.ts --format cjs,esm --dts --clean",
44
+ "check-exports": "attw --pack . --profile node16"
45
+ }
46
+ }