@cowprotocol/sdk-viem-adapter 0.2.2-beta.0 → 0.3.0-beta.0
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 +2 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -0
- package/dist/index.mjs +6 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@ const transport = http('YOUR_RPC_URL')
|
|
|
33
33
|
const provider = createPublicClient({ chain: sepolia, transport })
|
|
34
34
|
|
|
35
35
|
// Initialize the adapter
|
|
36
|
+
// You also can set `walletClient` instead of `signer` using `useWalletClient` from wagmi
|
|
36
37
|
const adapter = new ViemAdapter({ provider, signer: account })
|
|
37
38
|
```
|
|
38
39
|
|
|
@@ -48,6 +49,7 @@ import { sepolia } from 'viem/chains'
|
|
|
48
49
|
const account = privateKeyToAccount('YOUR_PRIVATE_KEY' as `0x${string}`)
|
|
49
50
|
const transport = http('YOUR_RPC_URL')
|
|
50
51
|
const provider = createPublicClient({ chain: sepolia, transport })
|
|
52
|
+
// You also can set `walletClient` instead of `signer` using `useWalletClient` from wagmi
|
|
51
53
|
const adapter = new ViemAdapter({ provider, signer: account })
|
|
52
54
|
|
|
53
55
|
// Initialize the unified SDK
|
package/dist/index.d.mts
CHANGED
|
@@ -166,6 +166,7 @@ interface ViemTypes extends AdapterTypes {
|
|
|
166
166
|
interface ViemAdapterOptions {
|
|
167
167
|
provider: PublicClient;
|
|
168
168
|
signer?: Account | PrivateKey;
|
|
169
|
+
walletClient?: WalletClient;
|
|
169
170
|
}
|
|
170
171
|
declare class ViemAdapter extends AbstractProviderAdapter<ViemTypes> {
|
|
171
172
|
private _publicClient;
|
package/dist/index.d.ts
CHANGED
|
@@ -166,6 +166,7 @@ interface ViemTypes extends AdapterTypes {
|
|
|
166
166
|
interface ViemAdapterOptions {
|
|
167
167
|
provider: PublicClient;
|
|
168
168
|
signer?: Account | PrivateKey;
|
|
169
|
+
walletClient?: WalletClient;
|
|
169
170
|
}
|
|
170
171
|
declare class ViemAdapter extends AbstractProviderAdapter<ViemTypes> {
|
|
171
172
|
private _publicClient;
|
package/dist/index.js
CHANGED
|
@@ -729,6 +729,12 @@ var ViemAdapter = class extends import_sdk_common4.AbstractProviderAdapter {
|
|
|
729
729
|
if (options.signer) {
|
|
730
730
|
this.setSigner(options.signer);
|
|
731
731
|
}
|
|
732
|
+
if (options.walletClient) {
|
|
733
|
+
this._walletClient = options.walletClient;
|
|
734
|
+
const signerAdapter = new ViemSignerAdapter(this._walletClient);
|
|
735
|
+
signerAdapter.connect(this._publicClient);
|
|
736
|
+
this._signerAdapter = signerAdapter;
|
|
737
|
+
}
|
|
732
738
|
this.utils = new ViemUtils();
|
|
733
739
|
}
|
|
734
740
|
get signer() {
|
package/dist/index.mjs
CHANGED
|
@@ -753,6 +753,12 @@ var ViemAdapter = class extends AbstractProviderAdapter {
|
|
|
753
753
|
if (options.signer) {
|
|
754
754
|
this.setSigner(options.signer);
|
|
755
755
|
}
|
|
756
|
+
if (options.walletClient) {
|
|
757
|
+
this._walletClient = options.walletClient;
|
|
758
|
+
const signerAdapter = new ViemSignerAdapter(this._walletClient);
|
|
759
|
+
signerAdapter.connect(this._publicClient);
|
|
760
|
+
this._signerAdapter = signerAdapter;
|
|
761
|
+
}
|
|
756
762
|
this.utils = new ViemUtils();
|
|
757
763
|
}
|
|
758
764
|
get signer() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowprotocol/sdk-viem-adapter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-beta.0",
|
|
4
4
|
"description": "Viem adapter for CoW Protocol SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@cowprotocol/sdk-common": "0.
|
|
16
|
+
"@cowprotocol/sdk-common": "0.4.0-beta.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"viem": "^2.28.4"
|