@dynamic-labs/viem-extension 3.0.0-alpha.53 → 3.0.0-alpha.55

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 CHANGED
@@ -1,4 +1,25 @@
1
1
 
2
+ ## [3.0.0-alpha.55](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.54...v3.0.0-alpha.55) (2024-09-02)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * remove network prop from wallet ([#6716](https://github.com/dynamic-labs/DynamicAuth/issues/6716)) ([b3f90aa](https://github.com/dynamic-labs/DynamicAuth/commit/b3f90aa57cb494f35e3e8b4bc94343d676b2bb4f))
8
+
9
+ ### Bug Fixes
10
+
11
+ * override viem chain data with evmNetworks override data ([#6779](https://github.com/dynamic-labs/DynamicAuth/issues/6779)) ([0d836a0](https://github.com/dynamic-labs/DynamicAuth/commit/0d836a0897b7e950e1e91e991f06da338d0cd0db))
12
+ * sdkHasLoaded waits for session validation ([#6769](https://github.com/dynamic-labs/DynamicAuth/issues/6769)) ([72a700b](https://github.com/dynamic-labs/DynamicAuth/commit/72a700b697aad7eca7e8a9b61eddd135aece8da3))
13
+ * send transaction cropping on insufficient funds ([#6776](https://github.com/dynamic-labs/DynamicAuth/issues/6776)) ([995c1f0](https://github.com/dynamic-labs/DynamicAuth/commit/995c1f0b6957112cfa50e4487bdaaa5993c0691d))
14
+
15
+
16
+ ## [3.0.0-alpha.54](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.53...v3.0.0-alpha.54) (2024-08-29)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * transaction hanging in confirmation modal ([#6740](https://github.com/dynamic-labs/DynamicAuth/issues/6740)) ([f03d286](https://github.com/dynamic-labs/DynamicAuth/commit/f03d286aaf471dbc7a6149acee10512be7b56b18))
22
+
2
23
  ## [3.0.0-alpha.53](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.52...v3.0.0-alpha.53) (2024-08-29)
3
24
 
4
25
 
@@ -30,9 +30,20 @@ function __rest(s, e) {
30
30
  return t;
31
31
  }
32
32
 
33
+ function __awaiter(thisArg, _arguments, P, generator) {
34
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
35
+ return new (P || (P = Promise))(function (resolve, reject) {
36
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
37
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
38
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
39
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
40
+ });
41
+ }
42
+
33
43
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
34
44
  var e = new Error(message);
35
45
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
36
46
  };
37
47
 
48
+ exports.__awaiter = __awaiter;
38
49
  exports.__rest = __rest;
@@ -26,9 +26,19 @@ function __rest(s, e) {
26
26
  return t;
27
27
  }
28
28
 
29
+ function __awaiter(thisArg, _arguments, P, generator) {
30
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
31
+ return new (P || (P = Promise))(function (resolve, reject) {
32
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
33
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
34
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
35
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
36
+ });
37
+ }
38
+
29
39
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
30
40
  var e = new Error(message);
31
41
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
32
42
  };
33
43
 
34
- export { __rest };
44
+ export { __awaiter, __rest };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/viem-extension",
3
- "version": "3.0.0-alpha.53",
3
+ "version": "3.0.0-alpha.55",
4
4
  "main": "./src/index.cjs",
5
5
  "module": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -14,11 +14,11 @@
14
14
  "./package.json": "./package.json"
15
15
  },
16
16
  "dependencies": {
17
- "@dynamic-labs/message-transport": "3.0.0-alpha.53"
17
+ "@dynamic-labs/message-transport": "3.0.0-alpha.55"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "viem": "^2.7.6",
21
- "@dynamic-labs/client": "3.0.0-alpha.53",
22
- "@dynamic-labs/types": "3.0.0-alpha.53"
21
+ "@dynamic-labs/client": "3.0.0-alpha.55",
22
+ "@dynamic-labs/types": "3.0.0-alpha.55"
23
23
  }
24
24
  }
@@ -32,23 +32,27 @@ const getChainFromId = (chainId) => {
32
32
  const idNumber = typeof chainId === 'string' ? parseInt(chainId) : chainId;
33
33
  return Object.values(chains__namespace).find((chain) => chain.id === idNumber);
34
34
  };
35
- const createWalletClientForDynamic = (messageTransport$1, _a) => {
35
+ const createWalletClientForDynamic = (messageTransport$1, _a) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
36
36
  var _b;
37
37
  var { wallet } = _a, params = _tslib.__rest(_a, ["wallet"]);
38
- const requestChannel = messageTransport.createRequestChannel(messageTransport$1);
38
+ const ethRequestChannel = messageTransport.createRequestChannel(messageTransport$1);
39
+ const walletRequestChannel = messageTransport.createRequestChannel(messageTransport$1);
39
40
  const providerProxy = {
40
- request: (requestArguments) => requestChannel.request('ethRequest', {
41
+ request: (requestArguments) => ethRequestChannel.request('ethRequest', {
41
42
  address: wallet.address,
42
43
  method: requestArguments.method,
43
44
  params: requestArguments.params,
44
45
  }),
45
46
  };
46
- return viem.createWalletClient(Object.assign(Object.assign({}, params), { account: wallet.address, chain: (_b = params.chain) !== null && _b !== void 0 ? _b : (wallet.network ? getChainFromId(wallet.network) : undefined), transport: viem.custom(providerProxy, {
47
+ const { network } = yield walletRequestChannel.request('getNetwork', {
48
+ wallet,
49
+ });
50
+ return viem.createWalletClient(Object.assign(Object.assign({}, params), { account: wallet.address, chain: (_b = params.chain) !== null && _b !== void 0 ? _b : getChainFromId(network), transport: viem.custom(providerProxy, {
47
51
  key: 'dynamic-client-transport',
48
52
  name: 'Dynamic Client Transport',
49
53
  retryCount: 3,
50
54
  retryDelay: 200,
51
55
  }) }));
52
- };
56
+ });
53
57
 
54
58
  exports.createWalletClientForDynamic = createWalletClientForDynamic;
@@ -1,4 +1,4 @@
1
1
  import { Account, Chain, CustomTransport, WalletClient } from 'viem';
2
2
  import { MessageTransportWithDefaultOrigin } from '@dynamic-labs/message-transport';
3
3
  import { WalletClientConfigDynamic } from '../../types';
4
- export declare const createWalletClientForDynamic: <C extends Chain | undefined = undefined>(messageTransport: MessageTransportWithDefaultOrigin, { wallet, ...params }: WalletClientConfigDynamic<C>) => WalletClient<CustomTransport, C, Account>;
4
+ export declare const createWalletClientForDynamic: <C extends Chain = Chain>(messageTransport: MessageTransportWithDefaultOrigin, { wallet, ...params }: WalletClientConfigDynamic<C>) => Promise<WalletClient<CustomTransport, C, Account>>;
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- import { __rest } from '../../../_virtual/_tslib.js';
2
+ import { __awaiter, __rest } from '../../../_virtual/_tslib.js';
3
3
  import { createWalletClient, custom } from 'viem';
4
4
  import * as chains from 'viem/chains';
5
5
  import { createRequestChannel } from '@dynamic-labs/message-transport';
@@ -8,23 +8,27 @@ const getChainFromId = (chainId) => {
8
8
  const idNumber = typeof chainId === 'string' ? parseInt(chainId) : chainId;
9
9
  return Object.values(chains).find((chain) => chain.id === idNumber);
10
10
  };
11
- const createWalletClientForDynamic = (messageTransport, _a) => {
11
+ const createWalletClientForDynamic = (messageTransport, _a) => __awaiter(void 0, void 0, void 0, function* () {
12
12
  var _b;
13
13
  var { wallet } = _a, params = __rest(_a, ["wallet"]);
14
- const requestChannel = createRequestChannel(messageTransport);
14
+ const ethRequestChannel = createRequestChannel(messageTransport);
15
+ const walletRequestChannel = createRequestChannel(messageTransport);
15
16
  const providerProxy = {
16
- request: (requestArguments) => requestChannel.request('ethRequest', {
17
+ request: (requestArguments) => ethRequestChannel.request('ethRequest', {
17
18
  address: wallet.address,
18
19
  method: requestArguments.method,
19
20
  params: requestArguments.params,
20
21
  }),
21
22
  };
22
- return createWalletClient(Object.assign(Object.assign({}, params), { account: wallet.address, chain: (_b = params.chain) !== null && _b !== void 0 ? _b : (wallet.network ? getChainFromId(wallet.network) : undefined), transport: custom(providerProxy, {
23
+ const { network } = yield walletRequestChannel.request('getNetwork', {
24
+ wallet,
25
+ });
26
+ return createWalletClient(Object.assign(Object.assign({}, params), { account: wallet.address, chain: (_b = params.chain) !== null && _b !== void 0 ? _b : getChainFromId(network), transport: custom(providerProxy, {
23
27
  key: 'dynamic-client-transport',
24
28
  name: 'Dynamic Client Transport',
25
29
  retryCount: 3,
26
30
  retryDelay: 200,
27
31
  }) }));
28
- };
32
+ });
29
33
 
30
34
  export { createWalletClientForDynamic };
package/src/types.d.ts CHANGED
@@ -21,6 +21,6 @@ export type IViemExtension = {
21
21
  /**
22
22
  * Creates a wallet viem client, using a custom Dynamic transport
23
23
  */
24
- createWalletClient: <C extends Chain | undefined = undefined>(params: WalletClientConfigDynamic<C>) => WalletClient<CustomTransport, C, Account>;
24
+ createWalletClient: <C extends Chain = Chain>(params: WalletClientConfigDynamic<C>) => Promise<WalletClient<CustomTransport, C, Account>>;
25
25
  };
26
26
  };