@dynamic-labs-sdk/evm 0.0.1-alpha.27 → 0.1.0-alpha.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 +21 -0
- package/_extends.cjs.js +1 -1
- package/_extends.esm.js +1 -1
- package/addEIP6963Extension.cjs.js +40 -4
- package/addEIP6963Extension.esm.js +42 -6
- package/addWaasEvmExtension.cjs.js +20 -50
- package/addWaasEvmExtension.esm.js +21 -51
- package/index.cjs.js +16 -5
- package/index.esm.js +17 -5
- package/package.json +5 -4
- package/registerEvmNetworkProviderBuilder.cjs.js +1 -2
- package/registerEvmNetworkProviderBuilder.esm.js +3 -3
- package/src/EvmWalletProvider.types.d.ts +10 -0
- package/src/EvmWalletProvider.types.d.ts.map +1 -1
- package/src/addEvmExtension/addEvmExtension.d.ts +6 -2
- package/src/addEvmExtension/addEvmExtension.d.ts.map +1 -1
- package/src/eip6963/addEIP6963Extension/addEIP6963Extension.d.ts +6 -2
- package/src/eip6963/addEIP6963Extension/addEIP6963Extension.d.ts.map +1 -1
- package/src/exports/index.d.ts +0 -1
- package/src/exports/index.d.ts.map +1 -1
- package/src/exports/viem.d.ts +1 -1
- package/src/exports/viem.d.ts.map +1 -1
- package/src/isEvmNetworkProvider/isEvmNetworkProvider.d.ts +6 -0
- package/src/isEvmNetworkProvider/isEvmNetworkProvider.d.ts.map +1 -1
- package/src/utils/createEvmNetworkProvider/createEvmNetworkProvider.d.ts +2 -2
- package/src/utils/createEvmNetworkProvider/createEvmNetworkProvider.d.ts.map +1 -1
- package/src/utils/createWalletProviderFromEIP1193Provider/createWalletProviderFromEIP1193Provider.d.ts.map +1 -1
- package/src/utils/isEvmWalletAccount/isEvmWalletAccount.d.ts +4 -1
- package/src/utils/isEvmWalletAccount/isEvmWalletAccount.d.ts.map +1 -1
- package/src/viem/createPublicClientFromNetworkData/createPublicClientFromNetworkData.d.ts +22 -0
- package/src/viem/createPublicClientFromNetworkData/createPublicClientFromNetworkData.d.ts.map +1 -0
- package/src/viem/createPublicClientFromNetworkData/index.d.ts +2 -0
- package/src/viem/{createPublicClientFromNetworkProvider → createPublicClientFromNetworkData}/index.d.ts.map +1 -1
- package/src/viem/createWalletClientForWalletAccount/createWalletClientForWalletAccount.d.ts +12 -1
- package/src/viem/createWalletClientForWalletAccount/createWalletClientForWalletAccount.d.ts.map +1 -1
- package/src/waas/WaasEvmWalletProvider.types.d.ts +2 -2
- package/src/waas/WaasEvmWalletProvider.types.d.ts.map +1 -1
- package/src/waas/addWaasEvmExtension/addWaasEvmExtension.d.ts +8 -0
- package/src/waas/addWaasEvmExtension/addWaasEvmExtension.d.ts.map +1 -1
- package/src/waas/utils/createWalletProviderForWaasEvm/createViemWalletClientForWaas/createViemWalletClientForWaas.d.ts.map +1 -1
- package/src/waas/utils/createWalletProviderForWaasEvm/createWalletProviderForWaasEvm.d.ts.map +1 -1
- package/viem.cjs.js +27 -7
- package/viem.esm.js +27 -7
- package/src/viem/createPublicClientFromNetworkProvider/createPublicClientFromNetworkProvider.d.ts +0 -13
- package/src/viem/createPublicClientFromNetworkProvider/createPublicClientFromNetworkProvider.d.ts.map +0 -1
- package/src/viem/createPublicClientFromNetworkProvider/index.d.ts +0 -2
- package/src/waas/utils/createWalletProviderForWaasEvm/signMessage/index.d.ts +0 -2
- package/src/waas/utils/createWalletProviderForWaasEvm/signMessage/index.d.ts.map +0 -1
- package/src/waas/utils/createWalletProviderForWaasEvm/signMessage/signMessage.d.ts +0 -11
- package/src/waas/utils/createWalletProviderForWaasEvm/signMessage/signMessage.d.ts.map +0 -1
- package/src/waas/utils/createWalletProviderForWaasEvm/signTransaction/index.d.ts +0 -2
- package/src/waas/utils/createWalletProviderForWaasEvm/signTransaction/index.d.ts.map +0 -1
- package/src/waas/utils/createWalletProviderForWaasEvm/signTransaction/signTransaction.d.ts +0 -12
- package/src/waas/utils/createWalletProviderForWaasEvm/signTransaction/signTransaction.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## 0.1.0-alpha.1 (2025-09-02)
|
|
2
|
+
|
|
3
|
+
This was a version bump only, there were no code changes.
|
|
4
|
+
|
|
5
|
+
## 0.1.0-alpha.0 (2025-09-02)
|
|
6
|
+
|
|
7
|
+
### 🚀 Features
|
|
8
|
+
|
|
9
|
+
- add connectAndVerifyWithWalletProvider function ([#385](https://github.com/dynamic-labs/dynamic-sdk/pull/385))
|
|
10
|
+
- add event listening for wallet providers ([#389](https://github.com/dynamic-labs/dynamic-sdk/pull/389))
|
|
11
|
+
|
|
12
|
+
### 🩹 Fixes
|
|
13
|
+
|
|
14
|
+
- sending transaction with solana ([#381](https://github.com/dynamic-labs/dynamic-sdk/pull/381))
|
|
15
|
+
|
|
16
|
+
### 🔧 Refactors
|
|
17
|
+
|
|
18
|
+
- waas sign message defined in waas provider ([#377](https://github.com/dynamic-labs/dynamic-sdk/pull/377))
|
|
19
|
+
- ban chain enum ([#386](https://github.com/dynamic-labs/dynamic-sdk/pull/386))
|
|
20
|
+
- ban misplaced waas exports ([#387](https://github.com/dynamic-labs/dynamic-sdk/pull/387))
|
|
21
|
+
|
|
1
22
|
## 0.0.1-alpha.27 (2025-08-29)
|
|
2
23
|
|
|
3
24
|
### 🚀 Features
|
package/_extends.cjs.js
CHANGED
package/_extends.esm.js
CHANGED
|
@@ -121,7 +121,11 @@ const createWalletProviderFromEIP1193Provider = ({ eip1193, icon, displayName },
|
|
|
121
121
|
const disconnect = async ()=>{
|
|
122
122
|
await eip1193.request({
|
|
123
123
|
method: 'wallet_revokePermissions',
|
|
124
|
-
params: [
|
|
124
|
+
params: [
|
|
125
|
+
{
|
|
126
|
+
eth_accounts: {}
|
|
127
|
+
}
|
|
128
|
+
]
|
|
125
129
|
});
|
|
126
130
|
};
|
|
127
131
|
const getConnectedAddresses = async ()=>{
|
|
@@ -149,11 +153,38 @@ const createWalletProviderFromEIP1193Provider = ({ eip1193, icon, displayName },
|
|
|
149
153
|
signature: signedMessage
|
|
150
154
|
};
|
|
151
155
|
};
|
|
156
|
+
const { getEventEmitter, cleanupEventEmitter } = core.createWalletProviderEventEmitter({
|
|
157
|
+
removeEventListeners: ()=>{
|
|
158
|
+
eip1193.removeAllListeners();
|
|
159
|
+
},
|
|
160
|
+
setupEventListeners: ({ handleAccountsChanged, handleDisconnected, handleNetworkChanged })=>{
|
|
161
|
+
eip1193.on('accountsChanged', (addresses)=>{
|
|
162
|
+
handleAccountsChanged({
|
|
163
|
+
addresses
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
eip1193.on('disconnected', ()=>{
|
|
167
|
+
handleDisconnected();
|
|
168
|
+
});
|
|
169
|
+
eip1193.on('chainChanged', (chain)=>{
|
|
170
|
+
const networkId = viem.isHex(chain) ? parseInt(chain, 16).toString() : chain.toString();
|
|
171
|
+
handleNetworkChanged({
|
|
172
|
+
networkId
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
const terminate = async ()=>{
|
|
178
|
+
cleanupEventEmitter();
|
|
179
|
+
};
|
|
152
180
|
return {
|
|
153
181
|
addNetwork: addNetworkWrapped,
|
|
154
182
|
chain,
|
|
155
183
|
connect,
|
|
156
184
|
disconnect,
|
|
185
|
+
get events () {
|
|
186
|
+
return getEventEmitter();
|
|
187
|
+
},
|
|
157
188
|
getActiveNetworkId: ()=>getActiveNetworkId({
|
|
158
189
|
eip1193
|
|
159
190
|
}),
|
|
@@ -172,7 +203,8 @@ const createWalletProviderFromEIP1193Provider = ({ eip1193, icon, displayName },
|
|
|
172
203
|
eip1193,
|
|
173
204
|
networkId,
|
|
174
205
|
walletProviderKey: key
|
|
175
|
-
})
|
|
206
|
+
}),
|
|
207
|
+
terminate
|
|
176
208
|
};
|
|
177
209
|
};
|
|
178
210
|
|
|
@@ -198,9 +230,13 @@ globalWindow = window)=>{
|
|
|
198
230
|
|
|
199
231
|
const EIP6963_EXTENSION_KEY = 'eip6963';
|
|
200
232
|
/**
|
|
201
|
-
* Adds the
|
|
233
|
+
* Adds the EIP-6963 extension to the Dynamic client.
|
|
234
|
+
*
|
|
235
|
+
* This extension enables integration with wallets that support EIP-6963,
|
|
236
|
+
* automatically detecting and registering compatible wallets for use with the Dynamic SDK.
|
|
202
237
|
*
|
|
203
|
-
*
|
|
238
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
239
|
+
* @returns A function that can be used to remove EIP-6963 global event listeners that were added.
|
|
204
240
|
*/ const addEIP6963Extension = (client = core.getDefaultClient())=>{
|
|
205
241
|
registerEvmNetworkProviderBuilder.registerEvmNetworkProviderBuilder(client);
|
|
206
242
|
if (core.hasExtension({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { formatWalletProviderKey, formatWalletProviderGroupKey, getDefaultClient, hasExtension, registerExtension, getWalletProviderRegistry, WalletProviderPriority } from '@dynamic-labs-sdk/client/core';
|
|
1
|
+
import { formatWalletProviderKey, createWalletProviderEventEmitter, formatWalletProviderGroupKey, getDefaultClient, hasExtension, registerExtension, getWalletProviderRegistry, WalletProviderPriority } from '@dynamic-labs-sdk/client/core';
|
|
2
2
|
import { r as registerEvmNetworkProviderBuilder } from './registerEvmNetworkProviderBuilder.esm.js';
|
|
3
3
|
import { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
4
|
-
import { toHex, getAddress } from 'viem';
|
|
4
|
+
import { toHex, isHex, getAddress } from 'viem';
|
|
5
5
|
import { UserRejectedError, NetworkSwitchingUnavailableError, getNetworksData, UnrecognizedNetworkError } from '@dynamic-labs-sdk/client';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -119,7 +119,11 @@ const createWalletProviderFromEIP1193Provider = ({ eip1193, icon, displayName },
|
|
|
119
119
|
const disconnect = async ()=>{
|
|
120
120
|
await eip1193.request({
|
|
121
121
|
method: 'wallet_revokePermissions',
|
|
122
|
-
params: [
|
|
122
|
+
params: [
|
|
123
|
+
{
|
|
124
|
+
eth_accounts: {}
|
|
125
|
+
}
|
|
126
|
+
]
|
|
123
127
|
});
|
|
124
128
|
};
|
|
125
129
|
const getConnectedAddresses = async ()=>{
|
|
@@ -147,11 +151,38 @@ const createWalletProviderFromEIP1193Provider = ({ eip1193, icon, displayName },
|
|
|
147
151
|
signature: signedMessage
|
|
148
152
|
};
|
|
149
153
|
};
|
|
154
|
+
const { getEventEmitter, cleanupEventEmitter } = createWalletProviderEventEmitter({
|
|
155
|
+
removeEventListeners: ()=>{
|
|
156
|
+
eip1193.removeAllListeners();
|
|
157
|
+
},
|
|
158
|
+
setupEventListeners: ({ handleAccountsChanged, handleDisconnected, handleNetworkChanged })=>{
|
|
159
|
+
eip1193.on('accountsChanged', (addresses)=>{
|
|
160
|
+
handleAccountsChanged({
|
|
161
|
+
addresses
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
eip1193.on('disconnected', ()=>{
|
|
165
|
+
handleDisconnected();
|
|
166
|
+
});
|
|
167
|
+
eip1193.on('chainChanged', (chain)=>{
|
|
168
|
+
const networkId = isHex(chain) ? parseInt(chain, 16).toString() : chain.toString();
|
|
169
|
+
handleNetworkChanged({
|
|
170
|
+
networkId
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
const terminate = async ()=>{
|
|
176
|
+
cleanupEventEmitter();
|
|
177
|
+
};
|
|
150
178
|
return {
|
|
151
179
|
addNetwork: addNetworkWrapped,
|
|
152
180
|
chain,
|
|
153
181
|
connect,
|
|
154
182
|
disconnect,
|
|
183
|
+
get events () {
|
|
184
|
+
return getEventEmitter();
|
|
185
|
+
},
|
|
155
186
|
getActiveNetworkId: ()=>getActiveNetworkId({
|
|
156
187
|
eip1193
|
|
157
188
|
}),
|
|
@@ -170,7 +201,8 @@ const createWalletProviderFromEIP1193Provider = ({ eip1193, icon, displayName },
|
|
|
170
201
|
eip1193,
|
|
171
202
|
networkId,
|
|
172
203
|
walletProviderKey: key
|
|
173
|
-
})
|
|
204
|
+
}),
|
|
205
|
+
terminate
|
|
174
206
|
};
|
|
175
207
|
};
|
|
176
208
|
|
|
@@ -196,9 +228,13 @@ globalWindow = window)=>{
|
|
|
196
228
|
|
|
197
229
|
const EIP6963_EXTENSION_KEY = 'eip6963';
|
|
198
230
|
/**
|
|
199
|
-
* Adds the
|
|
231
|
+
* Adds the EIP-6963 extension to the Dynamic client.
|
|
232
|
+
*
|
|
233
|
+
* This extension enables integration with wallets that support EIP-6963,
|
|
234
|
+
* automatically detecting and registering compatible wallets for use with the Dynamic SDK.
|
|
200
235
|
*
|
|
201
|
-
*
|
|
236
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
237
|
+
* @returns A function that can be used to remove EIP-6963 global event listeners that were added.
|
|
202
238
|
*/ const addEIP6963Extension = (client = getDefaultClient())=>{
|
|
203
239
|
registerEvmNetworkProviderBuilder(client);
|
|
204
240
|
if (hasExtension({
|
|
@@ -10,38 +10,6 @@ var viem = require('viem');
|
|
|
10
10
|
var accounts = require('viem/accounts');
|
|
11
11
|
var mapNetworkDataToViemChain = require('./mapNetworkDataToViemChain.cjs.js');
|
|
12
12
|
|
|
13
|
-
const signMessage = async ({ walletAccount, message, dynamicClient, waasProvider })=>{
|
|
14
|
-
const { signature: signedSessionId } = await core.getSignedSessionId(dynamicClient);
|
|
15
|
-
const mfaToken = await core.consumeMfaTokenIfRequiredForAction({
|
|
16
|
-
mfaAction: sdkApiCore.MFAAction.WalletWaasSign
|
|
17
|
-
}, dynamicClient);
|
|
18
|
-
const waasClient = await waasProvider.getWaasClient();
|
|
19
|
-
var _dynamicClient_token;
|
|
20
|
-
return waasClient.signMessage({
|
|
21
|
-
accountAddress: walletAccount.address,
|
|
22
|
-
authToken: (_dynamicClient_token = dynamicClient.token) != null ? _dynamicClient_token : undefined,
|
|
23
|
-
message,
|
|
24
|
-
mfaToken,
|
|
25
|
-
signedSessionId
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const signTransaction = async ({ transaction, walletAccount, dynamicClient, waasProvider })=>{
|
|
30
|
-
const { signature: signedSessionId } = await core.getSignedSessionId(dynamicClient);
|
|
31
|
-
const mfaToken = await core.consumeMfaTokenIfRequiredForAction({
|
|
32
|
-
mfaAction: sdkApiCore.MFAAction.WalletWaasSign
|
|
33
|
-
}, dynamicClient);
|
|
34
|
-
const waasClient = await waasProvider.getWaasClient();
|
|
35
|
-
var _dynamicClient_token;
|
|
36
|
-
return waasClient.signTransaction({
|
|
37
|
-
authToken: (_dynamicClient_token = dynamicClient.token) != null ? _dynamicClient_token : undefined,
|
|
38
|
-
mfaToken,
|
|
39
|
-
senderAddress: walletAccount.address,
|
|
40
|
-
signedSessionId,
|
|
41
|
-
transaction: viem.serializeTransaction(transaction)
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
|
|
45
13
|
const signTypedData = async ({ typedData, walletAccount, dynamicClient, waasProvider })=>{
|
|
46
14
|
const { signature: signedSessionId } = await core.getSignedSessionId(dynamicClient);
|
|
47
15
|
const mfaToken = await core.consumeMfaTokenIfRequiredForAction({
|
|
@@ -59,7 +27,7 @@ const signTypedData = async ({ typedData, walletAccount, dynamicClient, waasProv
|
|
|
59
27
|
};
|
|
60
28
|
|
|
61
29
|
const createViemWalletClientForWaas = async ({ dynamicClient, waasProvider, walletAccount, httpTransportConfig, viemWalletClientConfig })=>{
|
|
62
|
-
const activeNetworkData = await client.getActiveNetworkData({
|
|
30
|
+
const { networkData: activeNetworkData } = await client.getActiveNetworkData({
|
|
63
31
|
walletAccount
|
|
64
32
|
}, dynamicClient);
|
|
65
33
|
core.assertDefined(activeNetworkData, `No network data found for wallet account ${walletAccount.address}`);
|
|
@@ -67,19 +35,15 @@ const createViemWalletClientForWaas = async ({ dynamicClient, waasProvider, wall
|
|
|
67
35
|
account: accounts.toAccount({
|
|
68
36
|
address: walletAccount.address,
|
|
69
37
|
signMessage: async ({ message })=>{
|
|
70
|
-
const signature = await signMessage({
|
|
71
|
-
dynamicClient,
|
|
38
|
+
const { signature } = await waasProvider.signMessage({
|
|
72
39
|
message: message,
|
|
73
|
-
waasProvider,
|
|
74
40
|
walletAccount
|
|
75
41
|
});
|
|
76
42
|
return signature;
|
|
77
43
|
},
|
|
78
44
|
signTransaction: async (transaction)=>{
|
|
79
|
-
const signature = await
|
|
80
|
-
|
|
81
|
-
transaction,
|
|
82
|
-
waasProvider,
|
|
45
|
+
const { signature } = await waasProvider.signSerializedTransaction({
|
|
46
|
+
serializedTransaction: viem.serializeTransaction(transaction),
|
|
83
47
|
walletAccount
|
|
84
48
|
});
|
|
85
49
|
return signature;
|
|
@@ -134,23 +98,21 @@ const createWalletProviderForWaasEvm = ({ dynamicClient })=>{
|
|
|
134
98
|
});
|
|
135
99
|
throw new core.MethodNotImplementedError('request');
|
|
136
100
|
};
|
|
137
|
-
const signMessage
|
|
101
|
+
const signMessage = async ({ message, walletAccount })=>{
|
|
138
102
|
core.assertDefined(walletAccount, 'Wallet account is required');
|
|
139
|
-
|
|
140
|
-
dynamicClient,
|
|
103
|
+
return waasProvider.signMessage({
|
|
141
104
|
message,
|
|
142
|
-
waasProvider,
|
|
143
105
|
walletAccount
|
|
144
106
|
});
|
|
145
|
-
return {
|
|
146
|
-
signature
|
|
147
|
-
};
|
|
148
107
|
};
|
|
149
108
|
const switchActiveNetwork = async ({ networkId })=>core.switchActiveNetworkInLastKnownRegistry({
|
|
150
109
|
client: dynamicClient,
|
|
151
110
|
networkId,
|
|
152
111
|
walletProviderKey: key
|
|
153
112
|
});
|
|
113
|
+
const terminate = async ()=>{
|
|
114
|
+
return waasProvider.terminate();
|
|
115
|
+
};
|
|
154
116
|
return _extends._extends({}, waasProvider, {
|
|
155
117
|
chain,
|
|
156
118
|
createViemWalletClient,
|
|
@@ -164,13 +126,21 @@ const createWalletProviderForWaasEvm = ({ dynamicClient })=>{
|
|
|
164
126
|
icon: core$1.DYNAMIC_WAAS_METADATA.icon
|
|
165
127
|
},
|
|
166
128
|
request,
|
|
167
|
-
signMessage
|
|
168
|
-
switchActiveNetwork
|
|
129
|
+
signMessage,
|
|
130
|
+
switchActiveNetwork,
|
|
131
|
+
terminate
|
|
169
132
|
});
|
|
170
133
|
};
|
|
171
134
|
|
|
172
135
|
const WAAS_EVM_EXTENSION_KEY = 'waasEvm';
|
|
173
|
-
|
|
136
|
+
/**
|
|
137
|
+
* Adds the Dynamic WaaS (Wallet as a Service) EVM extension to the Dynamic client.
|
|
138
|
+
*
|
|
139
|
+
* This extension enables embedded wallet functionality for EVM-compatible blockchains,
|
|
140
|
+
* allowing users to have wallets managed by Dynamic's infrastructure.
|
|
141
|
+
*
|
|
142
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
143
|
+
*/ const addWaasEvmExtension = (client = core.getDefaultClient())=>{
|
|
174
144
|
registerEvmNetworkProviderBuilder.registerEvmNetworkProviderBuilder(client);
|
|
175
145
|
if (core.hasExtension({
|
|
176
146
|
extensionKey: WAAS_EVM_EXTENSION_KEY
|
|
@@ -4,42 +4,10 @@ import { _ as _extends } from './_extends.esm.js';
|
|
|
4
4
|
import { DYNAMIC_WAAS_METADATA, createWaasProvider, getAllUserWaasAddressesForChain } from '@dynamic-labs-sdk/client/waas/core';
|
|
5
5
|
import { MFAAction, WalletProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
6
6
|
import { getActiveNetworkData } from '@dynamic-labs-sdk/client';
|
|
7
|
-
import {
|
|
7
|
+
import { createWalletClient, http, serializeTransaction } from 'viem';
|
|
8
8
|
import { toAccount } from 'viem/accounts';
|
|
9
9
|
import { m as mapNetworkDataToViemChain } from './mapNetworkDataToViemChain.esm.js';
|
|
10
10
|
|
|
11
|
-
const signMessage = async ({ walletAccount, message, dynamicClient, waasProvider })=>{
|
|
12
|
-
const { signature: signedSessionId } = await getSignedSessionId(dynamicClient);
|
|
13
|
-
const mfaToken = await consumeMfaTokenIfRequiredForAction({
|
|
14
|
-
mfaAction: MFAAction.WalletWaasSign
|
|
15
|
-
}, dynamicClient);
|
|
16
|
-
const waasClient = await waasProvider.getWaasClient();
|
|
17
|
-
var _dynamicClient_token;
|
|
18
|
-
return waasClient.signMessage({
|
|
19
|
-
accountAddress: walletAccount.address,
|
|
20
|
-
authToken: (_dynamicClient_token = dynamicClient.token) != null ? _dynamicClient_token : undefined,
|
|
21
|
-
message,
|
|
22
|
-
mfaToken,
|
|
23
|
-
signedSessionId
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const signTransaction = async ({ transaction, walletAccount, dynamicClient, waasProvider })=>{
|
|
28
|
-
const { signature: signedSessionId } = await getSignedSessionId(dynamicClient);
|
|
29
|
-
const mfaToken = await consumeMfaTokenIfRequiredForAction({
|
|
30
|
-
mfaAction: MFAAction.WalletWaasSign
|
|
31
|
-
}, dynamicClient);
|
|
32
|
-
const waasClient = await waasProvider.getWaasClient();
|
|
33
|
-
var _dynamicClient_token;
|
|
34
|
-
return waasClient.signTransaction({
|
|
35
|
-
authToken: (_dynamicClient_token = dynamicClient.token) != null ? _dynamicClient_token : undefined,
|
|
36
|
-
mfaToken,
|
|
37
|
-
senderAddress: walletAccount.address,
|
|
38
|
-
signedSessionId,
|
|
39
|
-
transaction: serializeTransaction(transaction)
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
11
|
const signTypedData = async ({ typedData, walletAccount, dynamicClient, waasProvider })=>{
|
|
44
12
|
const { signature: signedSessionId } = await getSignedSessionId(dynamicClient);
|
|
45
13
|
const mfaToken = await consumeMfaTokenIfRequiredForAction({
|
|
@@ -57,7 +25,7 @@ const signTypedData = async ({ typedData, walletAccount, dynamicClient, waasProv
|
|
|
57
25
|
};
|
|
58
26
|
|
|
59
27
|
const createViemWalletClientForWaas = async ({ dynamicClient, waasProvider, walletAccount, httpTransportConfig, viemWalletClientConfig })=>{
|
|
60
|
-
const activeNetworkData = await getActiveNetworkData({
|
|
28
|
+
const { networkData: activeNetworkData } = await getActiveNetworkData({
|
|
61
29
|
walletAccount
|
|
62
30
|
}, dynamicClient);
|
|
63
31
|
assertDefined(activeNetworkData, `No network data found for wallet account ${walletAccount.address}`);
|
|
@@ -65,19 +33,15 @@ const createViemWalletClientForWaas = async ({ dynamicClient, waasProvider, wall
|
|
|
65
33
|
account: toAccount({
|
|
66
34
|
address: walletAccount.address,
|
|
67
35
|
signMessage: async ({ message })=>{
|
|
68
|
-
const signature = await signMessage({
|
|
69
|
-
dynamicClient,
|
|
36
|
+
const { signature } = await waasProvider.signMessage({
|
|
70
37
|
message: message,
|
|
71
|
-
waasProvider,
|
|
72
38
|
walletAccount
|
|
73
39
|
});
|
|
74
40
|
return signature;
|
|
75
41
|
},
|
|
76
42
|
signTransaction: async (transaction)=>{
|
|
77
|
-
const signature = await
|
|
78
|
-
|
|
79
|
-
transaction,
|
|
80
|
-
waasProvider,
|
|
43
|
+
const { signature } = await waasProvider.signSerializedTransaction({
|
|
44
|
+
serializedTransaction: serializeTransaction(transaction),
|
|
81
45
|
walletAccount
|
|
82
46
|
});
|
|
83
47
|
return signature;
|
|
@@ -132,23 +96,21 @@ const createWalletProviderForWaasEvm = ({ dynamicClient })=>{
|
|
|
132
96
|
});
|
|
133
97
|
throw new MethodNotImplementedError('request');
|
|
134
98
|
};
|
|
135
|
-
const signMessage
|
|
99
|
+
const signMessage = async ({ message, walletAccount })=>{
|
|
136
100
|
assertDefined(walletAccount, 'Wallet account is required');
|
|
137
|
-
|
|
138
|
-
dynamicClient,
|
|
101
|
+
return waasProvider.signMessage({
|
|
139
102
|
message,
|
|
140
|
-
waasProvider,
|
|
141
103
|
walletAccount
|
|
142
104
|
});
|
|
143
|
-
return {
|
|
144
|
-
signature
|
|
145
|
-
};
|
|
146
105
|
};
|
|
147
106
|
const switchActiveNetwork = async ({ networkId })=>switchActiveNetworkInLastKnownRegistry({
|
|
148
107
|
client: dynamicClient,
|
|
149
108
|
networkId,
|
|
150
109
|
walletProviderKey: key
|
|
151
110
|
});
|
|
111
|
+
const terminate = async ()=>{
|
|
112
|
+
return waasProvider.terminate();
|
|
113
|
+
};
|
|
152
114
|
return _extends({}, waasProvider, {
|
|
153
115
|
chain,
|
|
154
116
|
createViemWalletClient,
|
|
@@ -162,13 +124,21 @@ const createWalletProviderForWaasEvm = ({ dynamicClient })=>{
|
|
|
162
124
|
icon: DYNAMIC_WAAS_METADATA.icon
|
|
163
125
|
},
|
|
164
126
|
request,
|
|
165
|
-
signMessage
|
|
166
|
-
switchActiveNetwork
|
|
127
|
+
signMessage,
|
|
128
|
+
switchActiveNetwork,
|
|
129
|
+
terminate
|
|
167
130
|
});
|
|
168
131
|
};
|
|
169
132
|
|
|
170
133
|
const WAAS_EVM_EXTENSION_KEY = 'waasEvm';
|
|
171
|
-
|
|
134
|
+
/**
|
|
135
|
+
* Adds the Dynamic WaaS (Wallet as a Service) EVM extension to the Dynamic client.
|
|
136
|
+
*
|
|
137
|
+
* This extension enables embedded wallet functionality for EVM-compatible blockchains,
|
|
138
|
+
* allowing users to have wallets managed by Dynamic's infrastructure.
|
|
139
|
+
*
|
|
140
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
141
|
+
*/ const addWaasEvmExtension = (client = getDefaultClient())=>{
|
|
172
142
|
registerEvmNetworkProviderBuilder(client);
|
|
173
143
|
if (hasExtension({
|
|
174
144
|
extensionKey: WAAS_EVM_EXTENSION_KEY
|
package/index.cjs.js
CHANGED
|
@@ -14,24 +14,35 @@ require('viem/accounts');
|
|
|
14
14
|
require('./mapNetworkDataToViemChain.cjs.js');
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Adds
|
|
17
|
+
* Adds the EVM extension to the Dynamic client.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
19
|
+
* This is a convenience function that adds both the EIP-6963 extension
|
|
20
|
+
* and the Dynamic WaaS EVM extension, enabling support for all EVM wallet types
|
|
21
|
+
* including standard wallets and embedded wallets managed by Dynamic's infrastructure.
|
|
22
|
+
*
|
|
23
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
20
24
|
*/ const addEvmExtension = (client = core.getDefaultClient())=>{
|
|
21
25
|
addEIP6963Extension.addEIP6963Extension(client);
|
|
22
26
|
addWaasEvmExtension.addWaasEvmExtension(client);
|
|
23
27
|
};
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Type guard function to check if a network provider is an EVM network provider.
|
|
31
|
+
*
|
|
32
|
+
* @param networkProvider - The network provider to check.
|
|
33
|
+
* @returns True if the network provider is an EVM network provider, false otherwise.
|
|
34
|
+
*/ const isEvmNetworkProvider = (networkProvider)=>networkProvider.chain === 'EVM';
|
|
26
35
|
|
|
27
36
|
/**
|
|
28
|
-
*
|
|
37
|
+
* Type guard function to check if a wallet account is an EVM wallet account.
|
|
38
|
+
*
|
|
39
|
+
* @param walletAccount - The wallet account to check.
|
|
40
|
+
* @returns True if the wallet account is an EVM wallet account, false otherwise.
|
|
29
41
|
*/ const isEvmWalletAccount = (walletAccount)=>walletAccount.chain === 'EVM';
|
|
30
42
|
|
|
31
43
|
assertPackageVersion.assertPackageVersion(_extends.name, _extends.version);
|
|
32
44
|
|
|
33
45
|
exports.RpcError = registerEvmNetworkProviderBuilder.RpcError;
|
|
34
|
-
exports.createEvmNetworkProvider = registerEvmNetworkProviderBuilder.createEvmNetworkProvider;
|
|
35
46
|
exports.addEvmExtension = addEvmExtension;
|
|
36
47
|
exports.isEvmNetworkProvider = isEvmNetworkProvider;
|
|
37
48
|
exports.isEvmWalletAccount = isEvmWalletAccount;
|
package/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import { n as name, v as version } from './_extends.esm.js';
|
|
|
3
3
|
import { getDefaultClient } from '@dynamic-labs-sdk/client/core';
|
|
4
4
|
import { a as addEIP6963Extension } from './addEIP6963Extension.esm.js';
|
|
5
5
|
import { a as addWaasEvmExtension } from './addWaasEvmExtension.esm.js';
|
|
6
|
-
export { R as RpcError
|
|
6
|
+
export { R as RpcError } from './registerEvmNetworkProviderBuilder.esm.js';
|
|
7
7
|
import '@dynamic-labs/sdk-api-core';
|
|
8
8
|
import 'viem';
|
|
9
9
|
import '@dynamic-labs-sdk/client';
|
|
@@ -12,18 +12,30 @@ import 'viem/accounts';
|
|
|
12
12
|
import './mapNetworkDataToViemChain.esm.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Adds
|
|
15
|
+
* Adds the EVM extension to the Dynamic client.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* This is a convenience function that adds both the EIP-6963 extension
|
|
18
|
+
* and the Dynamic WaaS EVM extension, enabling support for all EVM wallet types
|
|
19
|
+
* including standard wallets and embedded wallets managed by Dynamic's infrastructure.
|
|
20
|
+
*
|
|
21
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
18
22
|
*/ const addEvmExtension = (client = getDefaultClient())=>{
|
|
19
23
|
addEIP6963Extension(client);
|
|
20
24
|
addWaasEvmExtension(client);
|
|
21
25
|
};
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Type guard function to check if a network provider is an EVM network provider.
|
|
29
|
+
*
|
|
30
|
+
* @param networkProvider - The network provider to check.
|
|
31
|
+
* @returns True if the network provider is an EVM network provider, false otherwise.
|
|
32
|
+
*/ const isEvmNetworkProvider = (networkProvider)=>networkProvider.chain === 'EVM';
|
|
24
33
|
|
|
25
34
|
/**
|
|
26
|
-
*
|
|
35
|
+
* Type guard function to check if a wallet account is an EVM wallet account.
|
|
36
|
+
*
|
|
37
|
+
* @param walletAccount - The wallet account to check.
|
|
38
|
+
* @returns True if the wallet account is an EVM wallet account, false otherwise.
|
|
27
39
|
*/ const isEvmWalletAccount = (walletAccount)=>walletAccount.chain === 'EVM';
|
|
28
40
|
|
|
29
41
|
assertPackageVersion(name, version);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-sdk/evm",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.cjs.js",
|
|
6
6
|
"module": "./index.esm.js",
|
|
@@ -29,12 +29,13 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@dynamic-labs-sdk/assert-package-version": "0.0
|
|
33
|
-
"@dynamic-labs-sdk/client": "0.0
|
|
32
|
+
"@dynamic-labs-sdk/assert-package-version": "0.1.0-alpha.1",
|
|
33
|
+
"@dynamic-labs-sdk/client": "0.1.0-alpha.1",
|
|
34
34
|
"@dynamic-labs/sdk-api-core": "0.0.762"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"viem": "^2.28.4"
|
|
37
|
+
"viem": "^2.28.4",
|
|
38
|
+
"eventemitter3": "^5.0.1"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"viem": "^2.28.4"
|
|
@@ -82,7 +82,7 @@ const fetchEvmBalance = async ({ address, rpcUrl }, client)=>{
|
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
-
const createEvmNetworkProvider = (networkData, client
|
|
85
|
+
const createEvmNetworkProvider = (networkData, client)=>_extends._extends({}, core.createBaseNetworkProvider('EVM', networkData), {
|
|
86
86
|
getBalance: async ({ address })=>({
|
|
87
87
|
balance: await fetchEvmBalance({
|
|
88
88
|
address,
|
|
@@ -105,5 +105,4 @@ const registerEvmNetworkProviderBuilder = (client)=>{
|
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
exports.RpcError = RpcError;
|
|
108
|
-
exports.createEvmNetworkProvider = createEvmNetworkProvider;
|
|
109
108
|
exports.registerEvmNetworkProviderBuilder = registerEvmNetworkProviderBuilder;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getCore,
|
|
1
|
+
import { getCore, createBaseNetworkProvider, getNetworkProviderBuilderRegistry } from '@dynamic-labs-sdk/client/core';
|
|
2
2
|
import { _ as _extends } from './_extends.esm.js';
|
|
3
3
|
import { BaseError } from '@dynamic-labs-sdk/client';
|
|
4
4
|
|
|
@@ -80,7 +80,7 @@ const fetchEvmBalance = async ({ address, rpcUrl }, client)=>{
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
const createEvmNetworkProvider = (networkData, client
|
|
83
|
+
const createEvmNetworkProvider = (networkData, client)=>_extends({}, createBaseNetworkProvider('EVM', networkData), {
|
|
84
84
|
getBalance: async ({ address })=>({
|
|
85
85
|
balance: await fetchEvmBalance({
|
|
86
86
|
address,
|
|
@@ -102,4 +102,4 @@ const registerEvmNetworkProviderBuilder = (client)=>{
|
|
|
102
102
|
});
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
export { RpcError as R,
|
|
105
|
+
export { RpcError as R, registerEvmNetworkProviderBuilder as r };
|
|
@@ -9,7 +9,17 @@ export type EvmWalletProvider = WalletProvider & {
|
|
|
9
9
|
params: unknown[];
|
|
10
10
|
}) => Promise<unknown>;
|
|
11
11
|
};
|
|
12
|
+
export type EIP1193ProviderEvents = {
|
|
13
|
+
accountsChanged: (addresses: string[]) => void;
|
|
14
|
+
chainChanged: (chain: string | number) => void;
|
|
15
|
+
disconnected: () => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* EIP1193 provider that can be used to interact with the EVM chain
|
|
19
|
+
*/
|
|
12
20
|
export type EIP1193Provider = {
|
|
21
|
+
on: <E extends keyof EIP1193ProviderEvents>(event: E, listener: EIP1193ProviderEvents[E]) => void;
|
|
22
|
+
removeAllListeners: () => void;
|
|
13
23
|
request: (args: {
|
|
14
24
|
method: string;
|
|
15
25
|
params: unknown[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EvmWalletProvider.types.d.ts","sourceRoot":"","sources":["../../../../packages/evm/src/EvmWalletProvider.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG;IAC/C,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,EAAE,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5E,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,EAAE,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5E,CAAC"}
|
|
1
|
+
{"version":3,"file":"EvmWalletProvider.types.d.ts","sourceRoot":"","sources":["../../../../packages/evm/src/EvmWalletProvider.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG;IAC/C,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,EAAE,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5E,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC/C,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC/C,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAKF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,CAAC,CAAC,SAAS,MAAM,qBAAqB,EACxC,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,qBAAqB,CAAC,CAAC,CAAC,KAC/B,IAAI,CAAC;IAEV,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAE/B,OAAO,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,EAAE,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5E,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Adds
|
|
2
|
+
* Adds the EVM extension to the Dynamic client.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* This is a convenience function that adds both the EIP-6963 extension
|
|
5
|
+
* and the Dynamic WaaS EVM extension, enabling support for all EVM wallet types
|
|
6
|
+
* including standard wallets and embedded wallets managed by Dynamic's infrastructure.
|
|
7
|
+
*
|
|
8
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
5
9
|
*/
|
|
6
10
|
export declare const addEvmExtension: (client?: any) => void;
|
|
7
11
|
//# sourceMappingURL=addEvmExtension.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addEvmExtension.d.ts","sourceRoot":"","sources":["../../../../../packages/evm/src/addEvmExtension/addEvmExtension.ts"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"addEvmExtension.d.ts","sourceRoot":"","sources":["../../../../../packages/evm/src/addEvmExtension/addEvmExtension.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,oBAAkC,IAG7D,CAAC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export declare const EIP6963_EXTENSION_KEY = "eip6963";
|
|
2
2
|
/**
|
|
3
|
-
* Adds the
|
|
3
|
+
* Adds the EIP-6963 extension to the Dynamic client.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* This extension enables integration with wallets that support EIP-6963,
|
|
6
|
+
* automatically detecting and registering compatible wallets for use with the Dynamic SDK.
|
|
7
|
+
*
|
|
8
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
9
|
+
* @returns A function that can be used to remove EIP-6963 global event listeners that were added.
|
|
6
10
|
*/
|
|
7
11
|
export declare const addEIP6963Extension: (client?: any) => () => void;
|
|
8
12
|
//# sourceMappingURL=addEIP6963Extension.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addEIP6963Extension.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/eip6963/addEIP6963Extension/addEIP6963Extension.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"addEIP6963Extension.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/eip6963/addEIP6963Extension/addEIP6963Extension.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,8BA4B/B,CAAC"}
|
package/src/exports/index.d.ts
CHANGED
|
@@ -3,6 +3,5 @@ export { RpcError } from '../errors/RpcError';
|
|
|
3
3
|
export type { EvmNetworkProvider } from '../EvmNetworkProvider';
|
|
4
4
|
export type { EvmWalletAccount } from '../EvmWalletAccount.types';
|
|
5
5
|
export { isEvmNetworkProvider } from '../isEvmNetworkProvider';
|
|
6
|
-
export { createEvmNetworkProvider } from '../utils/createEvmNetworkProvider';
|
|
7
6
|
export { isEvmWalletAccount } from '../utils/isEvmWalletAccount';
|
|
8
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/evm/src/exports/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/evm/src/exports/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC"}
|
package/src/exports/viem.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { createPublicClientFromNetworkData } from '../viem/createPublicClientFromNetworkData';
|
|
2
2
|
export { createWalletClientForWalletAccount } from '../viem/createWalletClientForWalletAccount';
|
|
3
3
|
//# sourceMappingURL=viem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viem.d.ts","sourceRoot":"","sources":["../../../../../packages/evm/src/exports/viem.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"viem.d.ts","sourceRoot":"","sources":["../../../../../packages/evm/src/exports/viem.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iCAAiC,EAAE,MAAM,2CAA2C,CAAC;AAC9F,OAAO,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { NetworkProvider } from '@dynamic-labs-sdk/client';
|
|
2
2
|
import type { EvmNetworkProvider } from '../EvmNetworkProvider';
|
|
3
|
+
/**
|
|
4
|
+
* Type guard function to check if a network provider is an EVM network provider.
|
|
5
|
+
*
|
|
6
|
+
* @param networkProvider - The network provider to check.
|
|
7
|
+
* @returns True if the network provider is an EVM network provider, false otherwise.
|
|
8
|
+
*/
|
|
3
9
|
export declare const isEvmNetworkProvider: (networkProvider: NetworkProvider) => networkProvider is EvmNetworkProvider;
|
|
4
10
|
//# sourceMappingURL=isEvmNetworkProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isEvmNetworkProvider.d.ts","sourceRoot":"","sources":["../../../../../packages/evm/src/isEvmNetworkProvider/isEvmNetworkProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,eAAO,MAAM,oBAAoB,oBACd,eAAe,KAC/B,eAAe,IAAI,kBAAqD,CAAC"}
|
|
1
|
+
{"version":3,"file":"isEvmNetworkProvider.d.ts","sourceRoot":"","sources":["../../../../../packages/evm/src/isEvmNetworkProvider/isEvmNetworkProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,oBACd,eAAe,KAC/B,eAAe,IAAI,kBAAqD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DynamicClient, NetworkData } from '@dynamic-labs-sdk/client';
|
|
2
2
|
import type { EvmNetworkProvider } from '../../EvmNetworkProvider';
|
|
3
|
-
export declare const createEvmNetworkProvider: (networkData: NetworkData, client
|
|
3
|
+
export declare const createEvmNetworkProvider: (networkData: NetworkData, client: DynamicClient) => EvmNetworkProvider;
|
|
4
4
|
//# sourceMappingURL=createEvmNetworkProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createEvmNetworkProvider.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/utils/createEvmNetworkProvider/createEvmNetworkProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"createEvmNetworkProvider.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/utils/createEvmNetworkProvider/createEvmNetworkProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnE,eAAO,MAAM,wBAAwB,gBACtB,WAAW,UAChB,aAAa,KACpB,kBAYD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWalletProviderFromEIP1193Provider.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/utils/createWalletProviderFromEIP1193Provider/createWalletProviderFromEIP1193Provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,aAAa,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"createWalletProviderFromEIP1193Provider.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/utils/createWalletProviderFromEIP1193Provider/createWalletProviderFromEIP1193Provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,aAAa,EAAE,MAAM,0BAA0B,CAAC;AASrE,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAKvC,KAAK,6CAA6C,GAAG;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,eAAe,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,uCAAuC,mCAClB,6CAA6C,UACrE,aAAa,KACpB,iBAoIF,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { WalletAccount } from '@dynamic-labs-sdk/client';
|
|
2
2
|
import type { EvmWalletAccount } from '../../EvmWalletAccount.types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Type guard function to check if a wallet account is an EVM wallet account.
|
|
5
|
+
*
|
|
6
|
+
* @param walletAccount - The wallet account to check.
|
|
7
|
+
* @returns True if the wallet account is an EVM wallet account, false otherwise.
|
|
5
8
|
*/
|
|
6
9
|
export declare const isEvmWalletAccount: (walletAccount: WalletAccount) => walletAccount is EvmWalletAccount;
|
|
7
10
|
//# sourceMappingURL=isEvmWalletAccount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isEvmWalletAccount.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/utils/isEvmWalletAccount/isEvmWalletAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE
|
|
1
|
+
{"version":3,"file":"isEvmWalletAccount.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/utils/isEvmWalletAccount/isEvmWalletAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,kBACd,aAAa,KAC3B,aAAa,IAAI,gBAAiD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { NetworkData } from '@dynamic-labs-sdk/client';
|
|
2
|
+
import type { Chain, HttpTransport, HttpTransportConfig, PublicClient, PublicClientConfig } from 'viem';
|
|
3
|
+
type CreatePublicClientFromNetworkDataProps = {
|
|
4
|
+
httpTransportConfig?: HttpTransportConfig;
|
|
5
|
+
networkData: NetworkData;
|
|
6
|
+
publicClientConfig?: Partial<PublicClientConfig<HttpTransport, Chain>>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Creates a viem PublicClient from a given NetworkData object.
|
|
10
|
+
*
|
|
11
|
+
* This function configures a viem PublicClient instance for reading data from
|
|
12
|
+
* an EVM-compatible blockchain using the network provider's RPC endpoint.
|
|
13
|
+
*
|
|
14
|
+
* @param props - The configuration object.
|
|
15
|
+
* @param props.networkData - The NetworkData object containing network configuration.
|
|
16
|
+
* @param props.publicClientConfig - Optional additional configuration for the viem PublicClient.
|
|
17
|
+
* @param props.httpTransportConfig - Optional HTTP transport configuration.
|
|
18
|
+
* @returns A configured viem PublicClient instance.
|
|
19
|
+
*/
|
|
20
|
+
export declare const createPublicClientFromNetworkData: ({ networkData, publicClientConfig, httpTransportConfig, }: CreatePublicClientFromNetworkDataProps) => PublicClient<HttpTransport, Chain>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=createPublicClientFromNetworkData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPublicClientFromNetworkData.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/viem/createPublicClientFromNetworkData/createPublicClientFromNetworkData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EACV,KAAK,EACL,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EACnB,MAAM,MAAM,CAAC;AAKd,KAAK,sCAAsC,GAAG;IAC5C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,WAAW,EAAE,WAAW,CAAC;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;CACxE,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iCAAiC,8DAI3C,sCAAsC,KAAG,YAAY,CACtD,aAAa,EACb,KAAK,CAMH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/viem/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/viem/createPublicClientFromNetworkData/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC"}
|
|
@@ -6,7 +6,18 @@ type CreateWalletClientForWalletAccountProps = {
|
|
|
6
6
|
walletClientConfig?: Omit<WalletClientConfig, 'account' | 'chain' | 'transport'>;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* Creates a viem WalletClient from
|
|
9
|
+
* Creates a viem WalletClient from an EVM WalletAccount object.
|
|
10
|
+
*
|
|
11
|
+
* This function configures a viem WalletClient instance for sending transactions
|
|
12
|
+
* and signing messages using the specified wallet account. It automatically
|
|
13
|
+
* handles network configuration and transport setup.
|
|
14
|
+
*
|
|
15
|
+
* @param props - The configuration object.
|
|
16
|
+
* @param props.walletAccount - The EVM wallet account to create the client for.
|
|
17
|
+
* @param [props.walletClientConfig] - Optional additional configuration for the viem WalletClient.
|
|
18
|
+
* @param [props.httpTransportConfig] - Optional HTTP transport configuration.
|
|
19
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
20
|
+
* @returns A promise that resolves to a configured viem WalletClient instance.
|
|
10
21
|
*/
|
|
11
22
|
export declare const createWalletClientForWalletAccount: ({ walletAccount, walletClientConfig, httpTransportConfig, }: CreateWalletClientForWalletAccountProps, client?: any) => Promise<WalletClient<Transport, Chain, Account>>;
|
|
12
23
|
export {};
|
package/src/viem/createWalletClientForWalletAccount/createWalletClientForWalletAccount.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWalletClientForWalletAccount.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/viem/createWalletClientForWalletAccount/createWalletClientForWalletAccount.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EAEL,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,kBAAkB,EACnB,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAKrE,KAAK,uCAAuC,GAAG;IAC7C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,aAAa,EAAE,gBAAgB,CAAC;IAChC,kBAAkB,CAAC,EAAE,IAAI,CACvB,kBAAkB,EAClB,SAAS,GAAG,OAAO,GAAG,WAAW,CAClC,CAAC;CACH,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"createWalletClientForWalletAccount.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/viem/createWalletClientForWalletAccount/createWalletClientForWalletAccount.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EAEL,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,kBAAkB,EACnB,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAKrE,KAAK,uCAAuC,GAAG;IAC7C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,aAAa,EAAE,gBAAgB,CAAC;IAChC,kBAAkB,CAAC,EAAE,IAAI,CACvB,kBAAkB,EAClB,SAAS,GAAG,OAAO,GAAG,WAAW,CAClC,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kCAAkC,gEAK1C,uCAAuC,mBAEzC,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAoCjD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { WaasProvider } from '@dynamic-labs-sdk/client/waas/core';
|
|
2
2
|
import type { EvmWalletProviderWithCustomViemClient } from '../viem/EvmWalletProviderWithCustomViemClient.types';
|
|
3
|
-
export type WaasEvmWalletProvider =
|
|
3
|
+
export type WaasEvmWalletProvider = Omit<WaasProvider, 'signMessage'> & EvmWalletProviderWithCustomViemClient;
|
|
4
4
|
//# sourceMappingURL=WaasEvmWalletProvider.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WaasEvmWalletProvider.types.d.ts","sourceRoot":"","sources":["../../../../../packages/evm/src/waas/WaasEvmWalletProvider.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"WaasEvmWalletProvider.types.d.ts","sourceRoot":"","sources":["../../../../../packages/evm/src/waas/WaasEvmWalletProvider.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,qDAAqD,CAAC;AAEjH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,GACnE,qCAAqC,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export declare const WAAS_EVM_EXTENSION_KEY = "waasEvm";
|
|
2
|
+
/**
|
|
3
|
+
* Adds the Dynamic WaaS (Wallet as a Service) EVM extension to the Dynamic client.
|
|
4
|
+
*
|
|
5
|
+
* This extension enables embedded wallet functionality for EVM-compatible blockchains,
|
|
6
|
+
* allowing users to have wallets managed by Dynamic's infrastructure.
|
|
7
|
+
*
|
|
8
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
9
|
+
*/
|
|
2
10
|
export declare const addWaasEvmExtension: (client?: any) => void;
|
|
3
11
|
//# sourceMappingURL=addWaasEvmExtension.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addWaasEvmExtension.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/waas/addWaasEvmExtension/addWaasEvmExtension.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD,eAAO,MAAM,mBAAmB,oBAAkC,IAmBjE,CAAC"}
|
|
1
|
+
{"version":3,"file":"addWaasEvmExtension.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/waas/addWaasEvmExtension/addWaasEvmExtension.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,oBAAkC,IAmBjE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createViemWalletClientForWaas.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/evm/src/waas/utils/createWalletProviderForWaasEvm/createViemWalletClientForWaas/createViemWalletClientForWaas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EAEL,mBAAmB,EAEnB,SAAS,EAET,YAAY,EACZ,kBAAkB,EACnB,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"createViemWalletClientForWaas.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/evm/src/waas/utils/createWalletProviderForWaasEvm/createViemWalletClientForWaas/createViemWalletClientForWaas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EAEL,mBAAmB,EAEnB,SAAS,EAET,YAAY,EACZ,kBAAkB,EACnB,MAAM,MAAM,CAAC;AAOd,KAAK,mCAAmC,GAAG;IACzC,aAAa,EAAE,aAAa,CAAC;IAC7B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,sBAAsB,CAAC,EAAE,IAAI,CAC3B,kBAAkB,EAClB,SAAS,GAAG,OAAO,GAAG,WAAW,CAClC,CAAC;IACF,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,6BAA6B,iGAMvC,mCAAmC,KAAG,OAAO,CAC9C,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAkDxC,CAAC"}
|
package/src/waas/utils/createWalletProviderForWaasEvm/createWalletProviderForWaasEvm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWalletProviderForWaasEvm.d.ts","sourceRoot":"","sources":["../../../../../../../packages/evm/src/waas/utils/createWalletProviderForWaasEvm/createWalletProviderForWaasEvm.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"createWalletProviderForWaasEvm.d.ts","sourceRoot":"","sources":["../../../../../../../packages/evm/src/waas/utils/createWalletProviderForWaasEvm/createWalletProviderForWaasEvm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAiB1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAG/E,KAAK,oCAAoC,GAAG;IAC1C,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,8BAA8B,uBAExC,oCAAoC,KAAG,qBAuFzC,CAAC"}
|
package/viem.cjs.js
CHANGED
|
@@ -8,10 +8,19 @@ var client = require('@dynamic-labs-sdk/client');
|
|
|
8
8
|
var core = require('@dynamic-labs-sdk/client/core');
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Creates a viem PublicClient from a
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
* Creates a viem PublicClient from a given NetworkData object.
|
|
12
|
+
*
|
|
13
|
+
* This function configures a viem PublicClient instance for reading data from
|
|
14
|
+
* an EVM-compatible blockchain using the network provider's RPC endpoint.
|
|
15
|
+
*
|
|
16
|
+
* @param props - The configuration object.
|
|
17
|
+
* @param props.networkData - The NetworkData object containing network configuration.
|
|
18
|
+
* @param props.publicClientConfig - Optional additional configuration for the viem PublicClient.
|
|
19
|
+
* @param props.httpTransportConfig - Optional HTTP transport configuration.
|
|
20
|
+
* @returns A configured viem PublicClient instance.
|
|
21
|
+
*/ const createPublicClientFromNetworkData = ({ networkData, publicClientConfig = {}, httpTransportConfig = {} })=>viem.createPublicClient(_extends._extends({
|
|
22
|
+
chain: mapNetworkDataToViemChain.mapNetworkDataToViemChain(networkData),
|
|
23
|
+
transport: viem.http(networkData.rpcUrls.http[0], httpTransportConfig)
|
|
15
24
|
}, publicClientConfig));
|
|
16
25
|
|
|
17
26
|
const isEvmWalletProvider = (walletProvider)=>walletProvider.chain === 'EVM';
|
|
@@ -21,7 +30,18 @@ const isEvmWalletProviderWithCustomViemClient = (walletProvider)=>{
|
|
|
21
30
|
};
|
|
22
31
|
|
|
23
32
|
/**
|
|
24
|
-
* Creates a viem WalletClient from
|
|
33
|
+
* Creates a viem WalletClient from an EVM WalletAccount object.
|
|
34
|
+
*
|
|
35
|
+
* This function configures a viem WalletClient instance for sending transactions
|
|
36
|
+
* and signing messages using the specified wallet account. It automatically
|
|
37
|
+
* handles network configuration and transport setup.
|
|
38
|
+
*
|
|
39
|
+
* @param props - The configuration object.
|
|
40
|
+
* @param props.walletAccount - The EVM wallet account to create the client for.
|
|
41
|
+
* @param [props.walletClientConfig] - Optional additional configuration for the viem WalletClient.
|
|
42
|
+
* @param [props.httpTransportConfig] - Optional HTTP transport configuration.
|
|
43
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
44
|
+
* @returns A promise that resolves to a configured viem WalletClient instance.
|
|
25
45
|
*/ const createWalletClientForWalletAccount = async ({ walletAccount, walletClientConfig = {}, httpTransportConfig = {} }, client$1 = core.getDefaultClient())=>{
|
|
26
46
|
const walletProvider = core.getWalletProviderFromWalletAccount({
|
|
27
47
|
walletAccount
|
|
@@ -36,7 +56,7 @@ const isEvmWalletProviderWithCustomViemClient = (walletProvider)=>{
|
|
|
36
56
|
walletAccount
|
|
37
57
|
});
|
|
38
58
|
}
|
|
39
|
-
const activeNetworkData = await client.getActiveNetworkData({
|
|
59
|
+
const { networkData: activeNetworkData } = await client.getActiveNetworkData({
|
|
40
60
|
walletAccount
|
|
41
61
|
}, client$1);
|
|
42
62
|
core.assertDefined(activeNetworkData, `No network data found for wallet account ${walletAccount.address}`);
|
|
@@ -49,5 +69,5 @@ const isEvmWalletProviderWithCustomViemClient = (walletProvider)=>{
|
|
|
49
69
|
|
|
50
70
|
assertPackageVersion.assertPackageVersion(_extends.name, _extends.version);
|
|
51
71
|
|
|
52
|
-
exports.
|
|
72
|
+
exports.createPublicClientFromNetworkData = createPublicClientFromNetworkData;
|
|
53
73
|
exports.createWalletClientForWalletAccount = createWalletClientForWalletAccount;
|
package/viem.esm.js
CHANGED
|
@@ -6,10 +6,19 @@ import { InvalidParamError, getActiveNetworkData } from '@dynamic-labs-sdk/clien
|
|
|
6
6
|
import { getDefaultClient, getWalletProviderFromWalletAccount, assertDefined } from '@dynamic-labs-sdk/client/core';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Creates a viem PublicClient from a
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
* Creates a viem PublicClient from a given NetworkData object.
|
|
10
|
+
*
|
|
11
|
+
* This function configures a viem PublicClient instance for reading data from
|
|
12
|
+
* an EVM-compatible blockchain using the network provider's RPC endpoint.
|
|
13
|
+
*
|
|
14
|
+
* @param props - The configuration object.
|
|
15
|
+
* @param props.networkData - The NetworkData object containing network configuration.
|
|
16
|
+
* @param props.publicClientConfig - Optional additional configuration for the viem PublicClient.
|
|
17
|
+
* @param props.httpTransportConfig - Optional HTTP transport configuration.
|
|
18
|
+
* @returns A configured viem PublicClient instance.
|
|
19
|
+
*/ const createPublicClientFromNetworkData = ({ networkData, publicClientConfig = {}, httpTransportConfig = {} })=>createPublicClient(_extends({
|
|
20
|
+
chain: mapNetworkDataToViemChain(networkData),
|
|
21
|
+
transport: http(networkData.rpcUrls.http[0], httpTransportConfig)
|
|
13
22
|
}, publicClientConfig));
|
|
14
23
|
|
|
15
24
|
const isEvmWalletProvider = (walletProvider)=>walletProvider.chain === 'EVM';
|
|
@@ -19,7 +28,18 @@ const isEvmWalletProviderWithCustomViemClient = (walletProvider)=>{
|
|
|
19
28
|
};
|
|
20
29
|
|
|
21
30
|
/**
|
|
22
|
-
* Creates a viem WalletClient from
|
|
31
|
+
* Creates a viem WalletClient from an EVM WalletAccount object.
|
|
32
|
+
*
|
|
33
|
+
* This function configures a viem WalletClient instance for sending transactions
|
|
34
|
+
* and signing messages using the specified wallet account. It automatically
|
|
35
|
+
* handles network configuration and transport setup.
|
|
36
|
+
*
|
|
37
|
+
* @param props - The configuration object.
|
|
38
|
+
* @param props.walletAccount - The EVM wallet account to create the client for.
|
|
39
|
+
* @param [props.walletClientConfig] - Optional additional configuration for the viem WalletClient.
|
|
40
|
+
* @param [props.httpTransportConfig] - Optional HTTP transport configuration.
|
|
41
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
42
|
+
* @returns A promise that resolves to a configured viem WalletClient instance.
|
|
23
43
|
*/ const createWalletClientForWalletAccount = async ({ walletAccount, walletClientConfig = {}, httpTransportConfig = {} }, client = getDefaultClient())=>{
|
|
24
44
|
const walletProvider = getWalletProviderFromWalletAccount({
|
|
25
45
|
walletAccount
|
|
@@ -34,7 +54,7 @@ const isEvmWalletProviderWithCustomViemClient = (walletProvider)=>{
|
|
|
34
54
|
walletAccount
|
|
35
55
|
});
|
|
36
56
|
}
|
|
37
|
-
const activeNetworkData = await getActiveNetworkData({
|
|
57
|
+
const { networkData: activeNetworkData } = await getActiveNetworkData({
|
|
38
58
|
walletAccount
|
|
39
59
|
}, client);
|
|
40
60
|
assertDefined(activeNetworkData, `No network data found for wallet account ${walletAccount.address}`);
|
|
@@ -47,4 +67,4 @@ const isEvmWalletProviderWithCustomViemClient = (walletProvider)=>{
|
|
|
47
67
|
|
|
48
68
|
assertPackageVersion(name, version);
|
|
49
69
|
|
|
50
|
-
export {
|
|
70
|
+
export { createPublicClientFromNetworkData, createWalletClientForWalletAccount };
|
package/src/viem/createPublicClientFromNetworkProvider/createPublicClientFromNetworkProvider.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Chain, HttpTransport, HttpTransportConfig, PublicClient, PublicClientConfig } from 'viem';
|
|
2
|
-
import type { EvmNetworkProvider } from '../../EvmNetworkProvider';
|
|
3
|
-
type CreatePublicClientFromNetworkProviderProps = {
|
|
4
|
-
httpTransportConfig?: HttpTransportConfig;
|
|
5
|
-
networkProvider: EvmNetworkProvider;
|
|
6
|
-
publicClientConfig?: Partial<PublicClientConfig<HttpTransport, Chain>>;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Creates a viem PublicClient from a NetworkProvider object.
|
|
10
|
-
*/
|
|
11
|
-
export declare const createPublicClientFromNetworkProvider: ({ networkProvider, publicClientConfig, httpTransportConfig, }: CreatePublicClientFromNetworkProviderProps) => PublicClient<HttpTransport, Chain>;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=createPublicClientFromNetworkProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createPublicClientFromNetworkProvider.d.ts","sourceRoot":"","sources":["../../../../../../packages/evm/src/viem/createPublicClientFromNetworkProvider/createPublicClientFromNetworkProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EACnB,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnE,KAAK,0CAA0C,GAAG;IAChD,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,eAAe,EAAE,kBAAkB,CAAC;IACpC,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;CACxE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qCAAqC,kEAI/C,0CAA0C,KAAG,YAAY,CAC1D,aAAa,EACb,KAAK,CAMH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/evm/src/waas/utils/createWalletProviderForWaasEvm/signMessage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DynamicClient, WalletAccount } from '@dynamic-labs-sdk/client';
|
|
2
|
-
import type { WaasProvider } from '@dynamic-labs-sdk/client/waas/core';
|
|
3
|
-
type SignMessageParams = {
|
|
4
|
-
dynamicClient: DynamicClient;
|
|
5
|
-
message: string;
|
|
6
|
-
waasProvider: WaasProvider;
|
|
7
|
-
walletAccount: WalletAccount;
|
|
8
|
-
};
|
|
9
|
-
export declare const signMessage: ({ walletAccount, message, dynamicClient, waasProvider, }: SignMessageParams) => Promise<any>;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=signMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signMessage.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/evm/src/waas/utils/createWalletProviderForWaasEvm/signMessage/signMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAGvE,KAAK,iBAAiB,GAAG;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,WAAW,6DAKrB,iBAAiB,iBAmBnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/evm/src/waas/utils/createWalletProviderForWaasEvm/signTransaction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type DynamicClient, type WalletAccount } from '@dynamic-labs-sdk/client';
|
|
2
|
-
import type { WaasProvider } from '@dynamic-labs-sdk/client/waas/core';
|
|
3
|
-
import { type TransactionSerializable } from 'viem';
|
|
4
|
-
type SignTransactionParams = {
|
|
5
|
-
dynamicClient: DynamicClient;
|
|
6
|
-
transaction: TransactionSerializable;
|
|
7
|
-
waasProvider: WaasProvider;
|
|
8
|
-
walletAccount: WalletAccount;
|
|
9
|
-
};
|
|
10
|
-
export declare const signTransaction: ({ transaction, walletAccount, dynamicClient, waasProvider, }: SignTransactionParams) => Promise<any>;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=signTransaction.d.ts.map
|
package/src/waas/utils/createWalletProviderForWaasEvm/signTransaction/signTransaction.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"signTransaction.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/evm/src/waas/utils/createWalletProviderForWaasEvm/signTransaction/signTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AAKlC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,MAAM,CAAC;AAE1E,KAAK,qBAAqB,GAAG;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,uBAAuB,CAAC;IACrC,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,eAAe,iEAKzB,qBAAqB,iBAmBvB,CAAC"}
|