@octaflowlabs/onchain-sdk 1.4.2 → 1.5.1
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 +17 -1
- package/dist/cjs/constants/BASIC_TOKENS_REGISTRY.d.ts +1 -1
- package/dist/cjs/constants/BASIC_TOKENS_REGISTRY.js +935 -38
- package/dist/cjs/constants/NETWORKS_REGISTRY.js +156 -1
- package/dist/cjs/constants/STABLECOINS_REGISTRY.d.ts +13 -0
- package/dist/cjs/constants/STABLECOINS_REGISTRY.js +101 -0
- package/dist/cjs/index.d.ts +4 -1
- package/dist/cjs/index.js +10 -1
- package/dist/cjs/utils/activityDedupe.d.ts +7 -0
- package/dist/cjs/utils/activityDedupe.js +11 -0
- package/dist/cjs/utils/normalizeAddress.d.ts +1 -0
- package/dist/cjs/utils/normalizeAddress.js +12 -1
- package/dist/cjs/webhooks/alchemyAddressActivity.d.ts +39 -0
- package/dist/cjs/webhooks/alchemyAddressActivity.js +75 -0
- package/dist/constants/BASIC_TOKENS_REGISTRY.d.ts +1 -1
- package/dist/constants/BASIC_TOKENS_REGISTRY.js +935 -38
- package/dist/constants/NETWORKS_REGISTRY.js +156 -1
- package/dist/constants/STABLECOINS_REGISTRY.d.ts +13 -0
- package/dist/constants/STABLECOINS_REGISTRY.js +95 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/utils/activityDedupe.d.ts +7 -0
- package/dist/utils/activityDedupe.js +7 -0
- package/dist/utils/normalizeAddress.d.ts +1 -0
- package/dist/utils/normalizeAddress.js +10 -0
- package/dist/webhooks/alchemyAddressActivity.d.ts +39 -0
- package/dist/webhooks/alchemyAddressActivity.js +72 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -72,6 +72,7 @@ import {
|
|
|
72
72
|
| `formattedAmountForDisplay` | `(amount, decimals, options?) => string` | Locale-aware formatting with group separators, scientific notation for large numbers, and threshold display for tiny amounts. |
|
|
73
73
|
| `parsedAmount` | `(amount: string, decimals: number) => bigint` | Parse a human-readable amount string into its smallest-unit `bigint`. |
|
|
74
74
|
| `normalizeAddress` | `(address: string) => string` | Validate and checksum an Ethereum address. |
|
|
75
|
+
| `normalizeEvmAddress` | `(address: string \| null \| undefined) => string \| null` | Validate, trim, and lowercase an EVM address, returning `null` for empty or invalid values. |
|
|
75
76
|
| `getShortenTransactionHashOrAddress` | `(value, first?, last?) => string` | Shorten a tx hash or address (e.g. `0xAbCd…1234`). |
|
|
76
77
|
| `getShortenData` | `(data, first?, last?) => string` | Shorten arbitrary hex data. |
|
|
77
78
|
| `transformBigInt` | `(obj: ContractTransaction) => object` | Convert all `bigint` properties to strings for JSON serialization. |
|
|
@@ -103,11 +104,26 @@ Each `NetworkField` entry includes `id`, `name`, `chainId`, `rpcUrl`, optional `
|
|
|
103
104
|
|---|---|
|
|
104
105
|
| `BASIC_TOKENS_BY_CHAIN` | Hardcoded ERC-20 token metadata (USDC, USDT, etc.) grouped by chain ID for Ethereum, BSC, Polygon, and Arbitrum. |
|
|
105
106
|
|
|
107
|
+
### Stablecoin registry
|
|
108
|
+
|
|
109
|
+
| Export | Description |
|
|
110
|
+
|---|---|
|
|
111
|
+
| `STABLECOIN_CONTRACTS_BY_CHAIN_ID` | Allowlisted USDC, USDT, and OSC test stablecoin contracts grouped by chain ID. |
|
|
112
|
+
| `getStablecoinContractsByChainId` | `(chainId) => readonly StablecoinContractData[]` — return allowlisted stablecoin metadata for one chain. |
|
|
113
|
+
| `getStablecoinContractBySymbolAndChainId` | `(symbol, chainId) => StablecoinContractData \| null` — resolve one allowlisted stablecoin contract by symbol and chain ID. |
|
|
114
|
+
| `isAllowedStablecoinContract` | `(chainId, contractAddress) => boolean` — normalize and check whether a contract is an allowlisted stablecoin on a chain. |
|
|
115
|
+
|
|
116
|
+
### Alchemy webhooks
|
|
117
|
+
|
|
118
|
+
| Export | Description |
|
|
119
|
+
|---|---|
|
|
120
|
+
| `extractPoolInboundStablecoinEvents` | `(payload, poolAddress) => PoolInboundStablecoinEvent[]` — extract inbound token transfers to a pool when the token contract is an allowlisted stablecoin. |
|
|
121
|
+
|
|
106
122
|
### Types
|
|
107
123
|
|
|
108
124
|
All interfaces and type aliases are exported for consumer use:
|
|
109
125
|
|
|
110
|
-
`BroadcastTransactionOptions`, `BuildMaxNativeTransferTxOptions`, `BuildUnsignedTransferTxOptions`, `BuildBaseUnsignedTransferTxParams`, `EstimateGasLimitFromProviderProps`, `GasEstimateResult`, `EstimateTransactionOptions`, `EstimateTransactionResult`, `PrepareTransactionParams`, `PrepareTransactionResult`, `TxStatusOptions`, `TxStatusResponse`, `FormatAmountOptions`, `TransactionRequest`, `GetBalanceParams`, `GetBalancesParams`, `GetBalancesChainRequest`, `GetBalanceResult`, `ChainBalances`, `TokenBalance`, `ChainGroup`, `NetworkField`, `NetworkId`, `NetworkCategory`, `BasicTokenData`, `BasicTokenSymbol`, `ChainTokenDataMap`, `EvmGeneratedWallet`, `EvmDerivedWallet`, `EntropySource`.
|
|
126
|
+
`BroadcastTransactionOptions`, `BuildMaxNativeTransferTxOptions`, `BuildUnsignedTransferTxOptions`, `BuildBaseUnsignedTransferTxParams`, `EstimateGasLimitFromProviderProps`, `GasEstimateResult`, `EstimateTransactionOptions`, `EstimateTransactionResult`, `PrepareTransactionParams`, `PrepareTransactionResult`, `TxStatusOptions`, `TxStatusResponse`, `FormatAmountOptions`, `TransactionRequest`, `GetBalanceParams`, `GetBalancesParams`, `GetBalancesChainRequest`, `GetBalanceResult`, `ChainBalances`, `TokenBalance`, `ChainGroup`, `NetworkField`, `NetworkId`, `NetworkCategory`, `BasicTokenData`, `BasicTokenSymbol`, `ChainTokenDataMap`, `StablecoinContractData`, `StablecoinContractsByChainId`, `StablecoinSymbol`, `EvmGeneratedWallet`, `EvmDerivedWallet`, `EntropySource`.
|
|
111
127
|
|
|
112
128
|
## Design notes
|
|
113
129
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type BasicTokenSymbol = 'ETH' | 'BNB' | 'POL' | 'USDC' | 'USDT' | 'USD₮0' | 'DAI' | 'WETH' | 'WBNB' | 'WBTC' | 'UNI' | 'NTK';
|
|
1
|
+
export type BasicTokenSymbol = 'ETH' | 'BNB' | 'POL' | 'USDC' | 'USDT' | 'USD₮0' | 'USD₮' | 'DAI' | 'DAI.e' | 'WETH' | 'WBNB' | 'WBTC' | 'WBTC.e' | 'UNI' | 'UNI.e' | 'NTK' | 'OP' | 'AVAX' | 'USDt' | 'xDAI' | 'MNT' | 'CELO' | 'HYPE' | 'WHYPE' | 'BERA' | 'XPL' | 'USDC.e';
|
|
2
2
|
export interface BasicTokenData {
|
|
3
3
|
id: string;
|
|
4
4
|
address: string | null;
|