@dynamic-labs/sui-core 4.20.9 → 4.20.10
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 +17 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +9 -9
- package/src/SuiWalletConnector.cjs +28 -3
- package/src/SuiWalletConnector.d.ts +8 -3
- package/src/SuiWalletConnector.js +28 -3
- package/src/wallets/injected/fetchSuiInjectedWalletConnectors.cjs +3 -4
- package/src/wallets/injected/fetchSuiInjectedWalletConnectors.d.ts +1 -1
- package/src/wallets/injected/fetchSuiInjectedWalletConnectors.js +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.20.10](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.9...v4.20.10) (2025-06-30)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add refresh user to react native ([#9019](https://github.com/dynamic-labs/dynamic-auth/issues/9019)) ([01adcda](https://github.com/dynamic-labs/dynamic-auth/commit/01adcda39994ba2955cad58bbd1d4e5063cc1122))
|
|
8
|
+
* support sui wallets on mobile ([#9038](https://github.com/dynamic-labs/dynamic-auth/issues/9038)) ([6f077da](https://github.com/dynamic-labs/dynamic-auth/commit/6f077da7deab525b0a3c5692a50a987c98f2b7e9))
|
|
9
|
+
* upgradetoDynamicWaas hook ([#9022](https://github.com/dynamic-labs/dynamic-auth/issues/9022)) ([3f1c42d](https://github.com/dynamic-labs/dynamic-auth/commit/3f1c42d71ab8b5a88d6b622f0b5fb41eb4ca9a4b))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* allow user to retry connecting with metamask on mobile deep link ([#9018](https://github.com/dynamic-labs/dynamic-auth/issues/9018)) ([09494c4](https://github.com/dynamic-labs/dynamic-auth/commit/09494c41680bb9949dc75df843e085c7743adc66))
|
|
15
|
+
* bump react 19 incompatible dependencies in sdk-react-core ([#9034](https://github.com/dynamic-labs/dynamic-auth/issues/9034)) ([e446f9c](https://github.com/dynamic-labs/dynamic-auth/commit/e446f9c26cf6d4566bf55be2e33dd540500d8fa5))
|
|
16
|
+
* filter out policies consent field from user profile view ([#9043](https://github.com/dynamic-labs/dynamic-auth/issues/9043)) ([e0e5003](https://github.com/dynamic-labs/dynamic-auth/commit/e0e500321719f1e1cfb8a67520641a6fb2f26cf8))
|
|
17
|
+
* use sui devnet for sui transactions ([#9042](https://github.com/dynamic-labs/dynamic-auth/issues/9042)) ([c61af4a](https://github.com/dynamic-labs/dynamic-auth/commit/c61af4a544ff35081b1286fc4b871a8ae031c3f3))
|
|
18
|
+
|
|
2
19
|
### [4.20.9](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.8...v4.20.9) (2025-06-24)
|
|
3
20
|
|
|
4
21
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sui-core",
|
|
3
|
-
"version": "4.20.
|
|
3
|
+
"version": "4.20.10",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
21
|
+
"@dynamic-labs/sdk-api-core": "0.0.699",
|
|
22
22
|
"@mysten/wallet-standard": "0.13.29",
|
|
23
23
|
"@mysten/sui": "1.24.0",
|
|
24
24
|
"text-encoding": "0.7.0",
|
|
25
|
-
"@dynamic-labs/assert-package-version": "4.20.
|
|
26
|
-
"@dynamic-labs/logger": "4.20.
|
|
27
|
-
"@dynamic-labs/rpc-providers": "4.20.
|
|
28
|
-
"@dynamic-labs/types": "4.20.
|
|
29
|
-
"@dynamic-labs/utils": "4.20.
|
|
30
|
-
"@dynamic-labs/wallet-book": "4.20.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "4.20.
|
|
25
|
+
"@dynamic-labs/assert-package-version": "4.20.10",
|
|
26
|
+
"@dynamic-labs/logger": "4.20.10",
|
|
27
|
+
"@dynamic-labs/rpc-providers": "4.20.10",
|
|
28
|
+
"@dynamic-labs/types": "4.20.10",
|
|
29
|
+
"@dynamic-labs/utils": "4.20.10",
|
|
30
|
+
"@dynamic-labs/wallet-book": "4.20.10",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "4.20.10"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {}
|
|
34
34
|
}
|
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../_virtual/_tslib.cjs');
|
|
7
7
|
var client = require('@mysten/sui/client');
|
|
8
|
-
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
|
-
var utils = require('@dynamic-labs/utils');
|
|
10
8
|
var logger = require('@dynamic-labs/logger');
|
|
11
|
-
var
|
|
9
|
+
var utils = require('@dynamic-labs/utils');
|
|
10
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
12
11
|
var networkHelpers = require('./utils/network/networkHelpers.cjs');
|
|
13
12
|
var SuiUiTransaction = require('./utils/SuiUiTransaction/SuiUiTransaction.cjs');
|
|
13
|
+
var SuiWallet = require('./wallet/SuiWallet.cjs');
|
|
14
14
|
|
|
15
15
|
class SuiWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
16
16
|
constructor(name, opts) {
|
|
@@ -77,10 +77,33 @@ class SuiWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
77
77
|
this.setupEventListeners();
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* If is inAppBrowser experience, redirects to the inAppBrowser template.
|
|
82
|
+
* Returns true if redirection was triggered.
|
|
83
|
+
*/
|
|
84
|
+
handleInAppBrowserGetAddress() {
|
|
85
|
+
var _a;
|
|
86
|
+
const inAppBrowserUrl = (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.inAppBrowserUrl;
|
|
87
|
+
if (!utils.isMobile() ||
|
|
88
|
+
this.isInstalledOnBrowser() ||
|
|
89
|
+
!inAppBrowserUrl ||
|
|
90
|
+
this.mobileExperience !== 'in-app-browser') {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
const inAppBrowserTemplate = utils.template(inAppBrowserUrl);
|
|
94
|
+
const deepLink = inAppBrowserTemplate({
|
|
95
|
+
encodedDappURI: encodeURIComponent(utils.PlatformService.getUrl().toString()),
|
|
96
|
+
});
|
|
97
|
+
utils.PlatformService.openURL(deepLink);
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
80
100
|
/** Get the wallet address by connecting to the current account */
|
|
81
101
|
getAddress() {
|
|
82
102
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
83
103
|
this.logger.debug('[getAddress] called, attempting to obtain the account address');
|
|
104
|
+
if (this.handleInAppBrowserGetAddress()) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
84
107
|
yield this.connect();
|
|
85
108
|
if (!this.account) {
|
|
86
109
|
throw new utils.DynamicError('No account found');
|
|
@@ -286,6 +309,8 @@ class SuiWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
286
309
|
var _a;
|
|
287
310
|
this.teardownEventListeners();
|
|
288
311
|
this.account = undefined;
|
|
312
|
+
if (!this.isInstalledOnBrowser())
|
|
313
|
+
return;
|
|
289
314
|
const disconnectFeature = (_a = this.getFeatures()) === null || _a === void 0 ? void 0 : _a['standard:disconnect'];
|
|
290
315
|
if (disconnectFeature) {
|
|
291
316
|
yield disconnectFeature.disconnect();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SuiWalletFeatures, WalletAccount, WalletWithFeatures } from '@mysten/wallet-standard';
|
|
2
1
|
import { SuiClient } from '@mysten/sui/client';
|
|
3
|
-
import {
|
|
2
|
+
import { SuiWalletFeatures, WalletAccount, WalletWithFeatures } from '@mysten/wallet-standard';
|
|
4
3
|
import { Logger } from '@dynamic-labs/logger';
|
|
5
4
|
import { GenericNetwork, IUITransaction } from '@dynamic-labs/types';
|
|
6
|
-
import {
|
|
5
|
+
import { Chain, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
7
6
|
import { SuiWalletConnectorProps, SuiWalletStandardEventHandler } from './types';
|
|
7
|
+
import { SuiWallet } from './wallet/SuiWallet';
|
|
8
8
|
export declare abstract class SuiWalletConnector extends WalletConnectorBase<typeof SuiWallet> {
|
|
9
9
|
name: string;
|
|
10
10
|
ChainWallet: typeof SuiWallet;
|
|
@@ -41,6 +41,11 @@ export declare abstract class SuiWalletConnector extends WalletConnectorBase<typ
|
|
|
41
41
|
connect({ silent }?: {
|
|
42
42
|
silent?: boolean;
|
|
43
43
|
}): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* If is inAppBrowser experience, redirects to the inAppBrowser template.
|
|
46
|
+
* Returns true if redirection was triggered.
|
|
47
|
+
*/
|
|
48
|
+
protected handleInAppBrowserGetAddress(): boolean;
|
|
44
49
|
/** Get the wallet address by connecting to the current account */
|
|
45
50
|
getAddress(): Promise<string | undefined>;
|
|
46
51
|
/** Returns the network id of the account's active chain */
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../_virtual/_tslib.js';
|
|
3
3
|
import { SuiClient } from '@mysten/sui/client';
|
|
4
|
-
import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
-
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
4
|
import { Logger } from '@dynamic-labs/logger';
|
|
7
|
-
import {
|
|
5
|
+
import { isMobile, template, PlatformService, DynamicError } from '@dynamic-labs/utils';
|
|
6
|
+
import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
8
7
|
import { getSuiNetworkIdFromName, getPreferredRpcUrl } from './utils/network/networkHelpers.js';
|
|
9
8
|
import { SuiUiTransaction } from './utils/SuiUiTransaction/SuiUiTransaction.js';
|
|
9
|
+
import { SuiWallet } from './wallet/SuiWallet.js';
|
|
10
10
|
|
|
11
11
|
class SuiWalletConnector extends WalletConnectorBase {
|
|
12
12
|
constructor(name, opts) {
|
|
@@ -73,10 +73,33 @@ class SuiWalletConnector extends WalletConnectorBase {
|
|
|
73
73
|
this.setupEventListeners();
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* If is inAppBrowser experience, redirects to the inAppBrowser template.
|
|
78
|
+
* Returns true if redirection was triggered.
|
|
79
|
+
*/
|
|
80
|
+
handleInAppBrowserGetAddress() {
|
|
81
|
+
var _a;
|
|
82
|
+
const inAppBrowserUrl = (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.inAppBrowserUrl;
|
|
83
|
+
if (!isMobile() ||
|
|
84
|
+
this.isInstalledOnBrowser() ||
|
|
85
|
+
!inAppBrowserUrl ||
|
|
86
|
+
this.mobileExperience !== 'in-app-browser') {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const inAppBrowserTemplate = template(inAppBrowserUrl);
|
|
90
|
+
const deepLink = inAppBrowserTemplate({
|
|
91
|
+
encodedDappURI: encodeURIComponent(PlatformService.getUrl().toString()),
|
|
92
|
+
});
|
|
93
|
+
PlatformService.openURL(deepLink);
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
76
96
|
/** Get the wallet address by connecting to the current account */
|
|
77
97
|
getAddress() {
|
|
78
98
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
99
|
this.logger.debug('[getAddress] called, attempting to obtain the account address');
|
|
100
|
+
if (this.handleInAppBrowserGetAddress()) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
80
103
|
yield this.connect();
|
|
81
104
|
if (!this.account) {
|
|
82
105
|
throw new DynamicError('No account found');
|
|
@@ -282,6 +305,8 @@ class SuiWalletConnector extends WalletConnectorBase {
|
|
|
282
305
|
var _a;
|
|
283
306
|
this.teardownEventListeners();
|
|
284
307
|
this.account = undefined;
|
|
308
|
+
if (!this.isInstalledOnBrowser())
|
|
309
|
+
return;
|
|
285
310
|
const disconnectFeature = (_a = this.getFeatures()) === null || _a === void 0 ? void 0 : _a['standard:disconnect'];
|
|
286
311
|
if (disconnectFeature) {
|
|
287
312
|
yield disconnectFeature.disconnect();
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var walletStandard = require('@mysten/wallet-standard');
|
|
7
|
-
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
7
|
var utils = require('@dynamic-labs/utils');
|
|
8
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
9
|
var injected = require('./injected.cjs');
|
|
10
10
|
|
|
11
11
|
const fetchSuiInjectedWalletConnectors = ({ walletBook, }) => {
|
|
@@ -24,7 +24,7 @@ const fetchSuiInjectedWalletConnectors = ({ walletBook, }) => {
|
|
|
24
24
|
return isSuiWallet && !shouldBeFiltered;
|
|
25
25
|
})
|
|
26
26
|
.map(([key, wallet]) => {
|
|
27
|
-
//
|
|
27
|
+
// Currently we only support wallet standard wallets
|
|
28
28
|
const isInstalled = false;
|
|
29
29
|
const metadata = walletConnectorCore.getWalletMetadataFromWalletBook({
|
|
30
30
|
walletBook,
|
|
@@ -38,14 +38,13 @@ const fetchSuiInjectedWalletConnectors = ({ walletBook, }) => {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
});
|
|
41
|
-
// The remaining wallets are wallet standard wallets injected from the browser
|
|
42
|
-
const isInstalled = true;
|
|
43
41
|
// Wallet standard wallets don't always have injectedConfig from wallet book,
|
|
44
42
|
// so we filter them by checking if they support critical sui features.
|
|
45
43
|
const walletStandardConnectors = walletStandardWallets
|
|
46
44
|
.filter((wallet) => { var _a; return (_a = wallet.features) === null || _a === void 0 ? void 0 : _a['sui:signPersonalMessage']; })
|
|
47
45
|
.map((wallet) => {
|
|
48
46
|
const sanitizedName = utils.sanitizeName(wallet.name);
|
|
47
|
+
const isInstalled = true;
|
|
49
48
|
return class extends injected.Injected {
|
|
50
49
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
50
|
constructor(props) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
|
|
2
1
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
2
|
+
import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
export declare const fetchSuiInjectedWalletConnectors: ({ walletBook, }: {
|
|
4
4
|
walletBook?: WalletBookSchema;
|
|
5
5
|
}) => WalletConnectorConstructor[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { getWallets, isWalletWithRequiredFeatureSet } from '@mysten/wallet-standard';
|
|
3
|
-
import { getWalletMetadataFromWalletBook } from '@dynamic-labs/wallet-connector-core';
|
|
4
3
|
import { sanitizeName } from '@dynamic-labs/utils';
|
|
4
|
+
import { getWalletMetadataFromWalletBook } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import { Injected } from './injected.js';
|
|
6
6
|
|
|
7
7
|
const fetchSuiInjectedWalletConnectors = ({ walletBook, }) => {
|
|
@@ -20,7 +20,7 @@ const fetchSuiInjectedWalletConnectors = ({ walletBook, }) => {
|
|
|
20
20
|
return isSuiWallet && !shouldBeFiltered;
|
|
21
21
|
})
|
|
22
22
|
.map(([key, wallet]) => {
|
|
23
|
-
//
|
|
23
|
+
// Currently we only support wallet standard wallets
|
|
24
24
|
const isInstalled = false;
|
|
25
25
|
const metadata = getWalletMetadataFromWalletBook({
|
|
26
26
|
walletBook,
|
|
@@ -34,14 +34,13 @@ const fetchSuiInjectedWalletConnectors = ({ walletBook, }) => {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
});
|
|
37
|
-
// The remaining wallets are wallet standard wallets injected from the browser
|
|
38
|
-
const isInstalled = true;
|
|
39
37
|
// Wallet standard wallets don't always have injectedConfig from wallet book,
|
|
40
38
|
// so we filter them by checking if they support critical sui features.
|
|
41
39
|
const walletStandardConnectors = walletStandardWallets
|
|
42
40
|
.filter((wallet) => { var _a; return (_a = wallet.features) === null || _a === void 0 ? void 0 : _a['sui:signPersonalMessage']; })
|
|
43
41
|
.map((wallet) => {
|
|
44
42
|
const sanitizedName = sanitizeName(wallet.name);
|
|
43
|
+
const isInstalled = true;
|
|
45
44
|
return class extends Injected {
|
|
46
45
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
46
|
constructor(props) {
|