@dynamic-labs/starknet 1.4.12 → 1.4.13
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,12 @@
|
|
|
1
1
|
|
|
2
|
+
### [1.4.13](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.12...v1.4.13) (2024-06-05)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* bump @solana/web3.js containing new version of rpc-websockets ([#5864](https://github.com/dynamic-labs/DynamicAuth/issues/5864)) ([562ff9b](https://github.com/dynamic-labs/DynamicAuth/commit/562ff9b706c8be62812ace08bcaef96e26dcd841))
|
|
8
|
+
* wallet improvements
|
|
9
|
+
|
|
2
10
|
### [1.4.12](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.11...v1.4.12) (2024-05-22)
|
|
3
11
|
|
|
4
12
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/starknet",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.13",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"text-encoding": "0.7.0",
|
|
32
32
|
"starknetkit": "1.1.3",
|
|
33
33
|
"@dynamic-labs/sdk-api": "0.0.387",
|
|
34
|
-
"@dynamic-labs/rpc-providers": "1.4.
|
|
35
|
-
"@dynamic-labs/types": "1.4.
|
|
36
|
-
"@dynamic-labs/utils": "1.4.
|
|
37
|
-
"@dynamic-labs/wallet-book": "1.4.
|
|
38
|
-
"@dynamic-labs/wallet-connector-core": "1.4.
|
|
34
|
+
"@dynamic-labs/rpc-providers": "1.4.13",
|
|
35
|
+
"@dynamic-labs/types": "1.4.13",
|
|
36
|
+
"@dynamic-labs/utils": "1.4.13",
|
|
37
|
+
"@dynamic-labs/wallet-book": "1.4.13",
|
|
38
|
+
"@dynamic-labs/wallet-connector-core": "1.4.13"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {}
|
|
41
41
|
}
|
|
@@ -47,6 +47,9 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
47
47
|
};
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
+
get walletBookWallet() {
|
|
51
|
+
return this.walletBook.wallets[this.key];
|
|
52
|
+
}
|
|
50
53
|
// abstracting this method to a function due to some wallets (bitget)
|
|
51
54
|
// having non-standard use of the isConnected flag. This allows for us to use other flags to determine connectivity
|
|
52
55
|
isProviderConnected() {
|
|
@@ -104,6 +107,16 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
104
107
|
fetchPublicAddress() {
|
|
105
108
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
106
109
|
const wallet = this.getWallet();
|
|
110
|
+
if (!this.isInstalledOnBrowser() &&
|
|
111
|
+
utils.isMobile() &&
|
|
112
|
+
this.walletBookWallet.mobile &&
|
|
113
|
+
this.walletBookWallet.mobile.inAppBrowser) {
|
|
114
|
+
const inAppBrowserCompiledTemplate = utils.template(this.walletBookWallet.mobile.inAppBrowser);
|
|
115
|
+
const deepLink = inAppBrowserCompiledTemplate({
|
|
116
|
+
encodedDappURI: encodeURIComponent(window.location.toString()),
|
|
117
|
+
});
|
|
118
|
+
window.location.assign(deepLink);
|
|
119
|
+
}
|
|
107
120
|
if (wallet && !this.isProviderConnected()) {
|
|
108
121
|
yield (wallet === null || wallet === void 0 ? void 0 : wallet.isPreauthorized());
|
|
109
122
|
yield this.connect();
|
|
@@ -30,6 +30,60 @@ declare abstract class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
30
30
|
walletBook: WalletBookSchema;
|
|
31
31
|
});
|
|
32
32
|
createProviderFromConfig(networks: GenericNetwork[]): StarknetRpcProvider[];
|
|
33
|
+
get walletBookWallet(): {
|
|
34
|
+
name: string;
|
|
35
|
+
brand?: {
|
|
36
|
+
alt?: string | undefined;
|
|
37
|
+
primaryColor?: string | undefined;
|
|
38
|
+
spriteId?: string | undefined;
|
|
39
|
+
} | undefined;
|
|
40
|
+
chainGroup?: string | undefined;
|
|
41
|
+
chains?: string[] | undefined;
|
|
42
|
+
desktop?: {
|
|
43
|
+
chromeId?: string | undefined;
|
|
44
|
+
edgeId?: string | undefined;
|
|
45
|
+
firefoxId?: string | undefined;
|
|
46
|
+
native?: string | undefined;
|
|
47
|
+
operaId?: string | undefined;
|
|
48
|
+
safariId?: string | undefined;
|
|
49
|
+
universal?: string | undefined;
|
|
50
|
+
} | undefined;
|
|
51
|
+
eip6963Config?: {
|
|
52
|
+
rdns: string;
|
|
53
|
+
} | undefined;
|
|
54
|
+
filterFromWalletConnect?: boolean | undefined;
|
|
55
|
+
group?: string | undefined;
|
|
56
|
+
hardwareWallets?: string[] | undefined;
|
|
57
|
+
injectedConfig?: {
|
|
58
|
+
chain: string;
|
|
59
|
+
extensionLocators: {
|
|
60
|
+
value: boolean;
|
|
61
|
+
flag: string;
|
|
62
|
+
}[];
|
|
63
|
+
providerInterface?: string | undefined;
|
|
64
|
+
walletStandard?: {
|
|
65
|
+
features: string[];
|
|
66
|
+
name: string;
|
|
67
|
+
} | undefined;
|
|
68
|
+
windowLocations?: string[] | undefined;
|
|
69
|
+
}[] | undefined;
|
|
70
|
+
mobile?: {
|
|
71
|
+
android?: string | null | undefined;
|
|
72
|
+
androidId?: string | undefined;
|
|
73
|
+
inAppBrowser?: string | null | undefined;
|
|
74
|
+
ios?: string | null | undefined;
|
|
75
|
+
iosId?: string | undefined;
|
|
76
|
+
native?: string | undefined;
|
|
77
|
+
universal?: string | undefined;
|
|
78
|
+
} | undefined;
|
|
79
|
+
shortName?: string | undefined;
|
|
80
|
+
showOnlyIfInstalled?: boolean | undefined;
|
|
81
|
+
switchNetworkOnlyFromWallet?: boolean | undefined;
|
|
82
|
+
walletConnect?: {
|
|
83
|
+
sdks?: string[] | undefined;
|
|
84
|
+
} | undefined;
|
|
85
|
+
walletGroup?: string | undefined;
|
|
86
|
+
};
|
|
33
87
|
isProviderConnected(): boolean;
|
|
34
88
|
getPublicClient(): Promise<RpcProvider | undefined>;
|
|
35
89
|
/**
|
|
@@ -2,7 +2,7 @@ import { __awaiter } from '../_virtual/_tslib.js';
|
|
|
2
2
|
import { getStarknet } from 'get-starknet-core';
|
|
3
3
|
import { RpcProvider, Contract, cairo, constants } from 'starknet';
|
|
4
4
|
import { WalletConnectorBase, logger } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
-
import { DynamicError, retryableFn } from '@dynamic-labs/utils';
|
|
5
|
+
import { isMobile, template, DynamicError, retryableFn } from '@dynamic-labs/utils';
|
|
6
6
|
import { ProviderChain } from '@dynamic-labs/rpc-providers';
|
|
7
7
|
import { ETH_STARKNET_ADDRESS } from './constants.js';
|
|
8
8
|
import ETH_CONTRACT_ABI from './ethereumContractAbi.js';
|
|
@@ -43,6 +43,9 @@ class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
43
43
|
};
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
+
get walletBookWallet() {
|
|
47
|
+
return this.walletBook.wallets[this.key];
|
|
48
|
+
}
|
|
46
49
|
// abstracting this method to a function due to some wallets (bitget)
|
|
47
50
|
// having non-standard use of the isConnected flag. This allows for us to use other flags to determine connectivity
|
|
48
51
|
isProviderConnected() {
|
|
@@ -100,6 +103,16 @@ class StarknetWalletConnector extends WalletConnectorBase {
|
|
|
100
103
|
fetchPublicAddress() {
|
|
101
104
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
105
|
const wallet = this.getWallet();
|
|
106
|
+
if (!this.isInstalledOnBrowser() &&
|
|
107
|
+
isMobile() &&
|
|
108
|
+
this.walletBookWallet.mobile &&
|
|
109
|
+
this.walletBookWallet.mobile.inAppBrowser) {
|
|
110
|
+
const inAppBrowserCompiledTemplate = template(this.walletBookWallet.mobile.inAppBrowser);
|
|
111
|
+
const deepLink = inAppBrowserCompiledTemplate({
|
|
112
|
+
encodedDappURI: encodeURIComponent(window.location.toString()),
|
|
113
|
+
});
|
|
114
|
+
window.location.assign(deepLink);
|
|
115
|
+
}
|
|
103
116
|
if (wallet && !this.isProviderConnected()) {
|
|
104
117
|
yield (wallet === null || wallet === void 0 ? void 0 : wallet.isPreauthorized());
|
|
105
118
|
yield this.connect();
|