@octaflowlabs/onchain-sdk 1.2.1 → 1.2.2

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/README.md CHANGED
@@ -47,6 +47,22 @@ ABIs and constants
47
47
  - Multicall3 ABI and address for batched reads.
48
48
  - Gas limit defaults per transaction type.
49
49
 
50
+ Networks registry
51
+
52
+ - The SDK includes a predefined networks registry in `src/constants/NETWORKS_REGISTRY.ts`.
53
+ - Networks are grouped by `category` (for example: `popular`, `custom`).
54
+ - Each network entry includes:
55
+ - `id`: stable internal identifier.
56
+ - `name`: human-readable network name.
57
+ - `chainId`: EVM chain ID.
58
+ - `rpcUrl`: primary RPC endpoint.
59
+ - `failoverRpcUrl` (optional): fallback RPC endpoint.
60
+ - `explorerUrl`: block explorer base URL.
61
+ - `iconUrl`: network icon URL.
62
+ - `symbol`: native currency symbol.
63
+ - This registry is useful for network selection UIs, chain metadata lookup, and RPC fallback handling.
64
+ - You can use `chainId` with SDK helpers and pass `rpcUrl` (or `failoverRpcUrl`) to provider-based calls.
65
+
50
66
  ## Design notes
51
67
 
52
68
  - The SDK is stateless and transport-agnostic. It expects a caller-provided RPC URL.
@@ -0,0 +1,15 @@
1
+ export interface NetworkField {
2
+ id: string;
3
+ name: string;
4
+ chainId: number;
5
+ rpcUrl: string;
6
+ explorerUrl: string;
7
+ iconUrl: string;
8
+ symbol: string;
9
+ failoverRpcUrl?: string;
10
+ }
11
+ export interface NetworkRegistry {
12
+ category: string;
13
+ networks: NetworkField[];
14
+ }
15
+ export declare const NETWORKS_REGISTRY: NetworkRegistry[];
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NETWORKS_REGISTRY = void 0;
4
+ exports.NETWORKS_REGISTRY = [
5
+ {
6
+ category: 'popular',
7
+ networks: [
8
+ {
9
+ id: 'ethereum-mainnet',
10
+ name: 'Ethereum Mainnet',
11
+ chainId: 1,
12
+ rpcUrl: 'https://ethereum-rpc.publicnode.com',
13
+ explorerUrl: 'https://etherscan.io',
14
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
15
+ symbol: 'ETH',
16
+ failoverRpcUrl: 'https://eth.llamarpc.com',
17
+ },
18
+ {
19
+ id: 'bnb-smart-chain',
20
+ name: 'BNB Smart Chain',
21
+ chainId: 56,
22
+ rpcUrl: 'https://bsc-dataseed.bnbchain.org',
23
+ explorerUrl: 'https://bscscan.com/',
24
+ iconUrl: 'https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png',
25
+ symbol: 'BNB',
26
+ failoverRpcUrl: 'https://bsc.llamarpc.com',
27
+ },
28
+ {
29
+ id: 'polygon-mainnet',
30
+ name: 'Polygon Mainnet',
31
+ iconUrl: 'https://assets.coingecko.com/coins/images/4713/large/matic-token-icon.png',
32
+ chainId: 137,
33
+ rpcUrl: 'https://polygon.publicnode.com',
34
+ explorerUrl: 'https://polygonscan.com',
35
+ symbol: 'POL',
36
+ failoverRpcUrl: 'https://polygon.llamarpc.com',
37
+ },
38
+ {
39
+ id: 'arbitrum-mainnet',
40
+ name: 'Arbitrum Mainnet',
41
+ chainId: 42161,
42
+ rpcUrl: 'https://public-arb-mainnet.fastnode.io',
43
+ explorerUrl: 'https://arbiscan.io',
44
+ iconUrl: 'https://assets.coingecko.com/coins/images/16547/large/photo_2023-03-29_21.47.00.jpeg',
45
+ symbol: 'ARB',
46
+ failoverRpcUrl: 'https://arb.llamarpc.com',
47
+ },
48
+ ],
49
+ },
50
+ {
51
+ category: 'custom',
52
+ networks: [
53
+ {
54
+ id: 'sepolia-eth',
55
+ name: 'Sepolia Testnet',
56
+ chainId: 11155111,
57
+ rpcUrl: 'https://ethereum-sepolia-rpc.publicnode.com',
58
+ explorerUrl: 'https://sepolia.etherscan.io',
59
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
60
+ symbol: 'ETH',
61
+ failoverRpcUrl: 'https://eth-sepolia.llamarpc.com',
62
+ },
63
+ ],
64
+ },
65
+ ];
@@ -3,6 +3,7 @@ import ERC20_TOKEN_CONTRACT_ABI from './ABIs/ERC20_TOKEN_CONTRACT_ABI';
3
3
  export { ERC20_TOKEN_CONTRACT_ABI };
4
4
  /** constants exports */
5
5
  export { GAS_LIMIT_PER_TX_TYPE, MULTICALL3_ADDRESS } from './constants/constants';
6
+ export { NETWORKS_REGISTRY, NetworkField, NetworkRegistry } from './constants/NETWORKS_REGISTRY';
6
7
  /** basic blockchain exports */
7
8
  export { buildMaxNativeTransferTx, buildUnsignedTransferTx, } from './blockchain/buildUnsignedTransferTx';
8
9
  export { broadcastTransaction } from './blockchain/broadcastTransaction';
package/dist/cjs/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.normalizeAddress = exports.errorMessagesForGasLimitEstimation = exports.errorMessagesForBroadcast = exports.handleErrorMessages = exports.parsedAmount = exports.formattedAmountForDisplay = exports.NATIVE_TOKENS = exports.transformBigInt = exports.getShortenData = exports.getShortenTransactionHashOrAddress = exports.signTransaction = exports.signMessage = exports.createWallet = exports.EvmWalletService = exports.getBalances = exports.getBalance = exports.txStatus = exports.getProvider = exports.estimateGasLimitFromProvider = exports.broadcastTransaction = exports.buildUnsignedTransferTx = exports.buildMaxNativeTransferTx = exports.MULTICALL3_ADDRESS = exports.GAS_LIMIT_PER_TX_TYPE = exports.ERC20_TOKEN_CONTRACT_ABI = void 0;
6
+ exports.normalizeAddress = exports.errorMessagesForGasLimitEstimation = exports.errorMessagesForBroadcast = exports.handleErrorMessages = exports.parsedAmount = exports.formattedAmountForDisplay = exports.NATIVE_TOKENS = exports.transformBigInt = exports.getShortenData = exports.getShortenTransactionHashOrAddress = exports.signTransaction = exports.signMessage = exports.createWallet = exports.EvmWalletService = exports.getBalances = exports.getBalance = exports.txStatus = exports.getProvider = exports.estimateGasLimitFromProvider = exports.broadcastTransaction = exports.buildUnsignedTransferTx = exports.buildMaxNativeTransferTx = exports.NETWORKS_REGISTRY = exports.MULTICALL3_ADDRESS = exports.GAS_LIMIT_PER_TX_TYPE = exports.ERC20_TOKEN_CONTRACT_ABI = void 0;
7
7
  /** ABIs exports */
8
8
  const ERC20_TOKEN_CONTRACT_ABI_1 = __importDefault(require("./ABIs/ERC20_TOKEN_CONTRACT_ABI"));
9
9
  exports.ERC20_TOKEN_CONTRACT_ABI = ERC20_TOKEN_CONTRACT_ABI_1.default;
@@ -11,6 +11,8 @@ exports.ERC20_TOKEN_CONTRACT_ABI = ERC20_TOKEN_CONTRACT_ABI_1.default;
11
11
  var constants_1 = require("./constants/constants");
12
12
  Object.defineProperty(exports, "GAS_LIMIT_PER_TX_TYPE", { enumerable: true, get: function () { return constants_1.GAS_LIMIT_PER_TX_TYPE; } });
13
13
  Object.defineProperty(exports, "MULTICALL3_ADDRESS", { enumerable: true, get: function () { return constants_1.MULTICALL3_ADDRESS; } });
14
+ var NETWORKS_REGISTRY_1 = require("./constants/NETWORKS_REGISTRY");
15
+ Object.defineProperty(exports, "NETWORKS_REGISTRY", { enumerable: true, get: function () { return NETWORKS_REGISTRY_1.NETWORKS_REGISTRY; } });
14
16
  /** basic blockchain exports */
15
17
  var buildUnsignedTransferTx_1 = require("./blockchain/buildUnsignedTransferTx");
16
18
  Object.defineProperty(exports, "buildMaxNativeTransferTx", { enumerable: true, get: function () { return buildUnsignedTransferTx_1.buildMaxNativeTransferTx; } });
@@ -0,0 +1,15 @@
1
+ export interface NetworkField {
2
+ id: string;
3
+ name: string;
4
+ chainId: number;
5
+ rpcUrl: string;
6
+ explorerUrl: string;
7
+ iconUrl: string;
8
+ symbol: string;
9
+ failoverRpcUrl?: string;
10
+ }
11
+ export interface NetworkRegistry {
12
+ category: string;
13
+ networks: NetworkField[];
14
+ }
15
+ export declare const NETWORKS_REGISTRY: NetworkRegistry[];
@@ -0,0 +1,62 @@
1
+ export const NETWORKS_REGISTRY = [
2
+ {
3
+ category: 'popular',
4
+ networks: [
5
+ {
6
+ id: 'ethereum-mainnet',
7
+ name: 'Ethereum Mainnet',
8
+ chainId: 1,
9
+ rpcUrl: 'https://ethereum-rpc.publicnode.com',
10
+ explorerUrl: 'https://etherscan.io',
11
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
12
+ symbol: 'ETH',
13
+ failoverRpcUrl: 'https://eth.llamarpc.com',
14
+ },
15
+ {
16
+ id: 'bnb-smart-chain',
17
+ name: 'BNB Smart Chain',
18
+ chainId: 56,
19
+ rpcUrl: 'https://bsc-dataseed.bnbchain.org',
20
+ explorerUrl: 'https://bscscan.com/',
21
+ iconUrl: 'https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png',
22
+ symbol: 'BNB',
23
+ failoverRpcUrl: 'https://bsc.llamarpc.com',
24
+ },
25
+ {
26
+ id: 'polygon-mainnet',
27
+ name: 'Polygon Mainnet',
28
+ iconUrl: 'https://assets.coingecko.com/coins/images/4713/large/matic-token-icon.png',
29
+ chainId: 137,
30
+ rpcUrl: 'https://polygon.publicnode.com',
31
+ explorerUrl: 'https://polygonscan.com',
32
+ symbol: 'POL',
33
+ failoverRpcUrl: 'https://polygon.llamarpc.com',
34
+ },
35
+ {
36
+ id: 'arbitrum-mainnet',
37
+ name: 'Arbitrum Mainnet',
38
+ chainId: 42161,
39
+ rpcUrl: 'https://public-arb-mainnet.fastnode.io',
40
+ explorerUrl: 'https://arbiscan.io',
41
+ iconUrl: 'https://assets.coingecko.com/coins/images/16547/large/photo_2023-03-29_21.47.00.jpeg',
42
+ symbol: 'ARB',
43
+ failoverRpcUrl: 'https://arb.llamarpc.com',
44
+ },
45
+ ],
46
+ },
47
+ {
48
+ category: 'custom',
49
+ networks: [
50
+ {
51
+ id: 'sepolia-eth',
52
+ name: 'Sepolia Testnet',
53
+ chainId: 11155111,
54
+ rpcUrl: 'https://ethereum-sepolia-rpc.publicnode.com',
55
+ explorerUrl: 'https://sepolia.etherscan.io',
56
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
57
+ symbol: 'ETH',
58
+ failoverRpcUrl: 'https://eth-sepolia.llamarpc.com',
59
+ },
60
+ ],
61
+ },
62
+ ];
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import ERC20_TOKEN_CONTRACT_ABI from './ABIs/ERC20_TOKEN_CONTRACT_ABI';
3
3
  export { ERC20_TOKEN_CONTRACT_ABI };
4
4
  /** constants exports */
5
5
  export { GAS_LIMIT_PER_TX_TYPE, MULTICALL3_ADDRESS } from './constants/constants';
6
+ export { NETWORKS_REGISTRY, NetworkField, NetworkRegistry } from './constants/NETWORKS_REGISTRY';
6
7
  /** basic blockchain exports */
7
8
  export { buildMaxNativeTransferTx, buildUnsignedTransferTx, } from './blockchain/buildUnsignedTransferTx';
8
9
  export { broadcastTransaction } from './blockchain/broadcastTransaction';
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import ERC20_TOKEN_CONTRACT_ABI from './ABIs/ERC20_TOKEN_CONTRACT_ABI';
3
3
  export { ERC20_TOKEN_CONTRACT_ABI };
4
4
  /** constants exports */
5
5
  export { GAS_LIMIT_PER_TX_TYPE, MULTICALL3_ADDRESS } from './constants/constants';
6
+ export { NETWORKS_REGISTRY } from './constants/NETWORKS_REGISTRY';
6
7
  /** basic blockchain exports */
7
8
  export { buildMaxNativeTransferTx, buildUnsignedTransferTx, } from './blockchain/buildUnsignedTransferTx';
8
9
  export { broadcastTransaction } from './blockchain/broadcastTransaction';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octaflowlabs/onchain-sdk",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "onchain methods for web3",
5
5
  "repository": "https://github.com/crisramb665/onchain-sdk.git",
6
6
  "license": "MIT",