@circle-fin/adapter-ethers-v6 1.0.1 → 1.1.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/CHANGELOG.md +105 -0
- package/README.md +41 -29
- package/{index.cjs.js → index.cjs} +739 -62
- package/index.cjs.map +1 -0
- package/index.d.ts +34 -21
- package/index.mjs +738 -61
- package/package.json +5 -3
- package/index.cjs.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# @circle-fin/adapter-ethers-v6
|
|
2
|
+
|
|
3
|
+
## 1.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed adapter `getAddress()` types to match function logic by requiring a `chain` parameter, and updated documentation accordingly.
|
|
8
|
+
- Improved error handling with more informative and consistent error messages.
|
|
9
|
+
|
|
10
|
+
Errors now include:
|
|
11
|
+
- Specific error codes for programmatic handling
|
|
12
|
+
- Error type categorization (BALANCE, ONCHAIN, RPC, NETWORK)
|
|
13
|
+
- Recoverability information (FATAL vs RETRYABLE)
|
|
14
|
+
- Clearer error messages with chain context
|
|
15
|
+
- Original error details preserved for debugging
|
|
16
|
+
|
|
17
|
+
- Fixed bug where tokens could be burned when bridging to unsupported chains. Bridge operations now fail immediately if the adapter doesn't support the source or destination chain, before any tokens are approved or burned. Error messages now clearly list all supported chains when an unsupported chain is used, and chain validation errors use the correct `INVALID_CHAIN` error code instead of `UNSUPPORTED_ROUTE`.
|
|
18
|
+
|
|
19
|
+
## 1.1.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- Improves static gas estimate values for contract calls. Updates adapters' `prepare()` method so that transaction simulation is now performed only during `execute()`, not during `estimate()`. Adds an optional fallback parameter to `estimate()` for cases where gas estimation fails.
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Fix CommonJS compatibility by correcting file extensions and package exports. This resolves a "ReferenceError: require is not defined" error that occurred when using packages in CommonJS projects with ts-node.
|
|
28
|
+
|
|
29
|
+
## 1.0.1
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Add support for Arc Testnet chain definition. Arc is Circle's EVM-compatible Layer-1 blockchain designed for stablecoin finance and asset
|
|
34
|
+
tokenization, featuring USDC as the native gas token and sub-second finality via the Malachite BFT consensus engine.
|
|
35
|
+
- Improve error messages for developer-controlled address contexts. Calling `getAddress()` on an adapter configured with `addressContext: 'developer-controlled'` now throws a clear error explaining that addresses must be provided explicitly in the operation context.
|
|
36
|
+
- Update Sonic Testnet chain definition to canonical network. The `SonicTestnet` chain definition now points to the official Sonic Testnet (chainId: 14601) instead of the deprecated Sonic Blaze Testnet (chainId: 57054). The RPC endpoint has been updated to `https://rpc.testnet.soniclabs.com`, the display name simplified to "Sonic Testnet", and the USDC contract address updated to the new deployment.
|
|
37
|
+
|
|
38
|
+
**Breaking Changes:**
|
|
39
|
+
- **Chain ID:** 57054 → 14601
|
|
40
|
+
- **RPC Endpoint:** `https://rpc.blaze.soniclabs.com` → `https://rpc.testnet.soniclabs.com`
|
|
41
|
+
- **USDC Address:** `0xA4879Fed32Ecbef99399e5cbC247E533421C4eC6` → `0x0BA304580ee7c9a980CF72e55f5Ed2E9fd30Bc51`
|
|
42
|
+
|
|
43
|
+
**Migration:** If you were using `SonicTestnet`, your application will automatically connect to the new network upon upgrading. Any accounts, contracts, or transactions on the old Blaze testnet (chainId: 57054) will need to be recreated on the new testnet.
|
|
44
|
+
|
|
45
|
+
## 1.0.0
|
|
46
|
+
|
|
47
|
+
### Major Changes
|
|
48
|
+
|
|
49
|
+
- # Ethers v6 Adapter 1.0.0 Release 🎉
|
|
50
|
+
|
|
51
|
+
Full-featured EVM blockchain adapter built on ethers.js v6 - providing comprehensive support for Ethereum and EVM-compatible chains with familiar ethers.js APIs.
|
|
52
|
+
|
|
53
|
+
## 🚀 Core EVM Features
|
|
54
|
+
- **Complete EVM Support**: Full compatibility with Ethereum and EVM-compatible chains
|
|
55
|
+
- **Ethers.js v6 Integration**: Built on the latest ethers.js with improved performance
|
|
56
|
+
- **Multi-chain Support**: Seamless switching between different EVM networks
|
|
57
|
+
- **Wallet Integration**: Support for various wallet types and signing methods
|
|
58
|
+
|
|
59
|
+
## 🔗 Supported Networks
|
|
60
|
+
- **Ethereum Mainnet & Testnets**: Full support for Ethereum ecosystem
|
|
61
|
+
- **Layer 2 Solutions**: Optimism, Arbitrum, Polygon, and other L2s
|
|
62
|
+
- **EVM Sidechains**: Base, Avalanche, and other EVM-compatible networks
|
|
63
|
+
- **Custom Networks**: Easy configuration for private or custom EVM chains
|
|
64
|
+
|
|
65
|
+
## 💼 Address Management
|
|
66
|
+
|
|
67
|
+
**User-Controlled Adapters**
|
|
68
|
+
- Automatic address resolution from connected wallets
|
|
69
|
+
- Support for MetaMask, WalletConnect, and other wallet providers
|
|
70
|
+
- Real-time account switching and network detection
|
|
71
|
+
|
|
72
|
+
**Developer-Controlled Adapters**
|
|
73
|
+
- Private key-based signing for server-side applications
|
|
74
|
+
- Deterministic address management for automated systems
|
|
75
|
+
- Secure key handling with ethers.js security practices
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// User-controlled adapter (wallet-based)
|
|
79
|
+
const adapter = createAdapterFromWallet(wallet)
|
|
80
|
+
|
|
81
|
+
// Developer-controlled adapter (private key)
|
|
82
|
+
const adapter = createAdapterFromPrivateKey({
|
|
83
|
+
privateKey: '0x...',
|
|
84
|
+
})
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## ⛽ Gas Management
|
|
88
|
+
- **Intelligent Gas Estimation**: Automatic gas limit calculation with safety buffers
|
|
89
|
+
- **Dynamic Fee Calculation**: Real-time gas price fetching with configurable buffers
|
|
90
|
+
- **EIP-1559 Support**: Type 2 transaction support for modern fee markets
|
|
91
|
+
- **Gas Optimization**: Efficient transaction batching and optimization
|
|
92
|
+
|
|
93
|
+
## 🔐 Security Features
|
|
94
|
+
- **Type Safety**: Full TypeScript support with strict type checking
|
|
95
|
+
- **Parameter Validation**: Runtime validation of all transaction parameters
|
|
96
|
+
- **Secure Signing**: Leverages ethers.js battle-tested signing infrastructure
|
|
97
|
+
- **Error Handling**: Comprehensive error handling with detailed error messages
|
|
98
|
+
|
|
99
|
+
## 🛠️ Developer Experience
|
|
100
|
+
- **Rich JSDoc Documentation**: Complete API documentation with examples
|
|
101
|
+
- **TypeScript First**: Built with TypeScript for superior developer experience
|
|
102
|
+
- **Familiar APIs**: Consistent with ethers.js patterns and conventions
|
|
103
|
+
- **Comprehensive Testing**: Extensive test coverage for reliability
|
|
104
|
+
|
|
105
|
+
This adapter provides a robust foundation for EVM-based cross-chain USDC transfers, leveraging the mature ethers.js ecosystem while providing the specialized functionality needed for bridge operations.
|
package/README.md
CHANGED
|
@@ -14,34 +14,46 @@ _Seamlessly interact with 16+ EVM networks using a single, strongly-typed interf
|
|
|
14
14
|
|
|
15
15
|
## Table of Contents
|
|
16
16
|
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
19
|
-
- [
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- [
|
|
25
|
-
- [
|
|
26
|
-
|
|
27
|
-
- [
|
|
28
|
-
|
|
29
|
-
- [
|
|
30
|
-
|
|
31
|
-
- [
|
|
32
|
-
|
|
33
|
-
- [Usage
|
|
34
|
-
|
|
35
|
-
- [
|
|
36
|
-
|
|
37
|
-
- [
|
|
38
|
-
- [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
- [
|
|
42
|
-
- [
|
|
43
|
-
- [
|
|
44
|
-
- [
|
|
17
|
+
- [Ethers v6 Adapter](#ethers-v6-adapter)
|
|
18
|
+
- [Table of Contents](#table-of-contents)
|
|
19
|
+
- [Overview](#overview)
|
|
20
|
+
- [Why Ethers v6 Adapter?](#why-ethers-v6-adapter)
|
|
21
|
+
- [When to Use This Adapter](#when-to-use-this-adapter)
|
|
22
|
+
- [For Kit Users](#for-kit-users)
|
|
23
|
+
- [For Kit Provider Developers](#for-kit-provider-developers)
|
|
24
|
+
- [Installation](#installation)
|
|
25
|
+
- [Peer Dependencies](#peer-dependencies)
|
|
26
|
+
- [Troubleshooting Version Conflicts](#troubleshooting-version-conflicts)
|
|
27
|
+
- [Quick Start](#quick-start)
|
|
28
|
+
- [Zero-Config Setup (Recommended)](#zero-config-setup-recommended)
|
|
29
|
+
- [Production Setup](#production-setup)
|
|
30
|
+
- [Browser Wallet Setup](#browser-wallet-setup)
|
|
31
|
+
- [OperationContext Pattern](#operationcontext-pattern)
|
|
32
|
+
- [Why OperationContext?](#why-operationcontext)
|
|
33
|
+
- [Basic Usage](#basic-usage)
|
|
34
|
+
- [Multi-Chain Operations](#multi-chain-operations)
|
|
35
|
+
- [Address Context Guide](#address-context-guide)
|
|
36
|
+
- [User-Controlled (Recommended)](#user-controlled-recommended)
|
|
37
|
+
- [Developer-Controlled (Advanced)](#developer-controlled-advanced)
|
|
38
|
+
- [Usage Examples](#usage-examples)
|
|
39
|
+
- [Contract Interactions](#contract-interactions)
|
|
40
|
+
- [EIP-712 Signatures](#eip-712-signatures)
|
|
41
|
+
- [Cross-Chain Bridging](#cross-chain-bridging)
|
|
42
|
+
- [API Reference](#api-reference)
|
|
43
|
+
- [Factory Functions](#factory-functions)
|
|
44
|
+
- [`createAdapterFromPrivateKey(params)`](#createadapterfromprivatekeyparams)
|
|
45
|
+
- [`createAdapterFromProvider(params)`](#createadapterfromproviderparams)
|
|
46
|
+
- [Core Methods](#core-methods)
|
|
47
|
+
- [`prepare(params, ctx)`](#prepareparams-ctx)
|
|
48
|
+
- [`signTypedData(typedData, ctx)`](#signtypeddatatypeddata-ctx)
|
|
49
|
+
- [`waitForTransaction(txHash, config?)`](#waitfortransactiontxhash-config)
|
|
50
|
+
- [`getAddress(chain)`](#getaddresschain)
|
|
51
|
+
- [Token Operations](#token-operations)
|
|
52
|
+
- [Supported Chains \& Routes](#supported-chains--routes)
|
|
53
|
+
- [Mainnet Chains (17 chains)](#mainnet-chains-17-chains)
|
|
54
|
+
- [Testnet Chains (17 chains)](#testnet-chains-17-chains)
|
|
55
|
+
- [Development](#development)
|
|
56
|
+
- [License](#license)
|
|
45
57
|
|
|
46
58
|
## Overview
|
|
47
59
|
|
|
@@ -574,7 +586,7 @@ Waits for transaction confirmation.
|
|
|
574
586
|
const receipt = await adapter.waitForTransaction('0x...')
|
|
575
587
|
```
|
|
576
588
|
|
|
577
|
-
#### `getAddress(chain
|
|
589
|
+
#### `getAddress(chain)`
|
|
578
590
|
|
|
579
591
|
Gets the connected wallet address. Chain parameter is provided automatically by OperationContext resolution.
|
|
580
592
|
|