@dynamic-labs/embedded-wallet-solana 3.4.6 → 3.5.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 +19 -0
- package/package.cjs +4 -4
- package/package.js +4 -4
- package/package.json +11 -11
- package/src/lib/TurnkeySolanaWalletConnector/TurnkeySolanaWalletConnector.cjs +12 -8
- package/src/lib/TurnkeySolanaWalletConnector/TurnkeySolanaWalletConnector.d.ts +7 -5
- package/src/lib/TurnkeySolanaWalletConnector/TurnkeySolanaWalletConnector.js +12 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
|
|
2
|
+
### [3.5.1](https://github.com/dynamic-labs/DynamicAuth/compare/v3.5.0...v3.5.1) (2024-11-05)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* allow passing connection config to solana wallet connectors ([#7364](https://github.com/dynamic-labs/DynamicAuth/issues/7364)) ([5dd5176](https://github.com/dynamic-labs/DynamicAuth/commit/5dd5176e6f91d9771ce1d1af031ab1adb25f5b74))
|
|
8
|
+
|
|
9
|
+
## [3.5.0](https://github.com/dynamic-labs/DynamicAuth/compare/v3.4.6...v3.5.0) (2024-11-05)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* add support for line social ([61b23fd](https://github.com/dynamic-labs/dynamic-auth/commit/61b23fde9f4b0bc56c1cdc2f7456784931bdb878))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* global connectivity transaction failures and confirmation modal ([#7355](https://github.com/dynamic-labs/DynamicAuth/issues/7355)) ([eb1c5d7](https://github.com/dynamic-labs/DynamicAuth/commit/eb1c5d794df972dfb2f84fdcaa6c581ba68285c0)), closes [#7347](https://github.com/dynamic-labs/DynamicAuth/issues/7347)
|
|
20
|
+
|
|
2
21
|
### [3.4.6](https://github.com/dynamic-labs/DynamicAuth/compare/v3.4.5...v3.4.6) (2024-10-31)
|
|
3
22
|
|
|
4
23
|
|
package/package.cjs
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "3.
|
|
6
|
+
var version = "3.5.1";
|
|
7
7
|
var dependencies = {
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "0.0.559",
|
|
9
|
-
"@dynamic-labs/utils": "3.
|
|
10
|
-
"@dynamic-labs/logger": "3.
|
|
11
|
-
"@dynamic-labs/types": "3.
|
|
9
|
+
"@dynamic-labs/utils": "3.5.1",
|
|
10
|
+
"@dynamic-labs/logger": "3.5.1",
|
|
11
|
+
"@dynamic-labs/types": "3.5.1",
|
|
12
12
|
eventemitter3: "5.0.1",
|
|
13
13
|
"@solana/spl-token": "0.4.6",
|
|
14
14
|
"@solana/web3.js": "1.92.1",
|
package/package.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "3.
|
|
2
|
+
var version = "3.5.1";
|
|
3
3
|
var dependencies = {
|
|
4
4
|
"@dynamic-labs/sdk-api-core": "0.0.559",
|
|
5
|
-
"@dynamic-labs/utils": "3.
|
|
6
|
-
"@dynamic-labs/logger": "3.
|
|
7
|
-
"@dynamic-labs/types": "3.
|
|
5
|
+
"@dynamic-labs/utils": "3.5.1",
|
|
6
|
+
"@dynamic-labs/logger": "3.5.1",
|
|
7
|
+
"@dynamic-labs/types": "3.5.1",
|
|
8
8
|
eventemitter3: "5.0.1",
|
|
9
9
|
"@solana/spl-token": "0.4.6",
|
|
10
10
|
"@solana/web3.js": "1.92.1",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/embedded-wallet-solana",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@dynamic-labs/sdk-api-core": "0.0.559",
|
|
30
|
-
"@dynamic-labs/utils": "3.
|
|
31
|
-
"@dynamic-labs/logger": "3.
|
|
32
|
-
"@dynamic-labs/types": "3.
|
|
30
|
+
"@dynamic-labs/utils": "3.5.1",
|
|
31
|
+
"@dynamic-labs/logger": "3.5.1",
|
|
32
|
+
"@dynamic-labs/types": "3.5.1",
|
|
33
33
|
"eventemitter3": "5.0.1",
|
|
34
34
|
"@solana/spl-token": "0.4.6",
|
|
35
35
|
"@solana/web3.js": "1.92.1",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"@turnkey/iframe-stamper": "2.0.0",
|
|
38
38
|
"@turnkey/solana": "0.3.9",
|
|
39
39
|
"@turnkey/webauthn-stamper": "0.5.0",
|
|
40
|
-
"@dynamic-labs/assert-package-version": "3.
|
|
41
|
-
"@dynamic-labs/embedded-wallet": "3.
|
|
42
|
-
"@dynamic-labs/rpc-providers": "3.
|
|
43
|
-
"@dynamic-labs/solana-core": "3.
|
|
44
|
-
"@dynamic-labs/wallet-book": "3.
|
|
45
|
-
"@dynamic-labs/wallet-connector-core": "3.
|
|
46
|
-
"@dynamic-labs/webauthn": "3.
|
|
40
|
+
"@dynamic-labs/assert-package-version": "3.5.1",
|
|
41
|
+
"@dynamic-labs/embedded-wallet": "3.5.1",
|
|
42
|
+
"@dynamic-labs/rpc-providers": "3.5.1",
|
|
43
|
+
"@dynamic-labs/solana-core": "3.5.1",
|
|
44
|
+
"@dynamic-labs/wallet-book": "3.5.1",
|
|
45
|
+
"@dynamic-labs/wallet-connector-core": "3.5.1",
|
|
46
|
+
"@dynamic-labs/webauthn": "3.5.1",
|
|
47
47
|
"react-dom": "18.2.0",
|
|
48
48
|
"viem": "2.9.25"
|
|
49
49
|
},
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
7
|
var web3_js = require('@solana/web3.js');
|
|
8
|
-
var webauthnStamper = require('@turnkey/webauthn-stamper');
|
|
9
8
|
var http = require('@turnkey/http');
|
|
10
|
-
var solana = require('@turnkey/solana');
|
|
11
9
|
var iframeStamper = require('@turnkey/iframe-stamper');
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var solanaCore = require('@dynamic-labs/solana-core');
|
|
10
|
+
var solana = require('@turnkey/solana');
|
|
11
|
+
var webauthnStamper = require('@turnkey/webauthn-stamper');
|
|
15
12
|
var embeddedWallet = require('@dynamic-labs/embedded-wallet');
|
|
13
|
+
var solanaCore = require('@dynamic-labs/solana-core');
|
|
14
|
+
var utils = require('@dynamic-labs/utils');
|
|
15
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
16
16
|
var createSolanaConnection = require('../utils/createSolanaConnection/createSolanaConnection.cjs');
|
|
17
17
|
var transactionDecoder = require('../utils/transactionDecoder/transactionDecoder.cjs');
|
|
18
18
|
var api = require('../utils/api/api.cjs');
|
|
@@ -54,7 +54,8 @@ class TurnkeySolanaWalletConnector extends embeddedWallet.TurnkeyWalletConnector
|
|
|
54
54
|
this._turnkeyAccount = undefined;
|
|
55
55
|
this._connectionClient = undefined;
|
|
56
56
|
this.chainRpcProviders = props.chainRpcProviders;
|
|
57
|
-
|
|
57
|
+
this.connectionConfig = props.connectionConfig;
|
|
58
|
+
(_a = this.chainRpcProviders) === null || _a === void 0 ? void 0 : _a.registerSolanaProviders(this.connectionConfig);
|
|
58
59
|
this.__turnkeyClient = this.getTurnkeyClient();
|
|
59
60
|
}
|
|
60
61
|
getRpcUrl() {
|
|
@@ -70,7 +71,9 @@ class TurnkeySolanaWalletConnector extends embeddedWallet.TurnkeyWalletConnector
|
|
|
70
71
|
const rpcUrl = this.getRpcUrl();
|
|
71
72
|
if (!rpcUrl)
|
|
72
73
|
throw new utils.DynamicError('No rpcUrl');
|
|
73
|
-
|
|
74
|
+
const config = typeof commitmentOrConfig === 'string'
|
|
75
|
+
? Object.assign(Object.assign({}, this.connectionConfig), { commitment: commitmentOrConfig }) : Object.assign(Object.assign({}, this.connectionConfig), commitmentOrConfig);
|
|
76
|
+
this._connectionClient = createSolanaConnection.createSolanaConnection(rpcUrl, config);
|
|
74
77
|
}
|
|
75
78
|
return this._connectionClient;
|
|
76
79
|
}
|
|
@@ -319,9 +322,10 @@ class TurnkeySolanaWalletConnector extends embeddedWallet.TurnkeyWalletConnector
|
|
|
319
322
|
}
|
|
320
323
|
internalSignAndSendTransaction(transaction, options) {
|
|
321
324
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
325
|
+
var _a, _b;
|
|
322
326
|
if (!this.turnkeyAddress)
|
|
323
327
|
throw new utils.DynamicError('Solana wallet not found');
|
|
324
|
-
const currentConnection = this.getConnection('confirmed');
|
|
328
|
+
const currentConnection = this.getConnection((_b = (_a = this.connectionConfig) === null || _a === void 0 ? void 0 : _a.commitment) !== null && _b !== void 0 ? _b : 'confirmed');
|
|
325
329
|
const signedTransaction = yield this.signTransaction(transaction);
|
|
326
330
|
const signature = yield currentConnection.sendRawTransaction(signedTransaction.serialize(), options);
|
|
327
331
|
// listen for tx confirmation until 60 seconds, which is ~150 blocks expiration
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Commitment, Connection, ConnectionConfig,
|
|
1
|
+
import { Commitment, ConfirmOptions, Connection, ConnectionConfig, SendOptions, Signer, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
2
2
|
import { TurnkeyApiTypes } from '@turnkey/http';
|
|
3
|
-
import {
|
|
4
|
-
import { Chain, ISendBalanceWalletConnector, InternalWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
-
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
3
|
+
import { TurnkeyWalletConnectorBase, TurnkeyWalletConnectorNameAndKey } from '@dynamic-labs/embedded-wallet';
|
|
6
4
|
import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
|
|
7
5
|
import { IChainRpcProviders, SolanaWallet } from '@dynamic-labs/solana-core';
|
|
8
|
-
import {
|
|
6
|
+
import { GenericNetwork, IUITransaction, WalletUiUtils } from '@dynamic-labs/types';
|
|
7
|
+
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
8
|
+
import { Chain, InternalWalletConnector, ISendBalanceWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
9
9
|
import { TurnkeySolanaSigner } from './TurnkeySolanaSigner';
|
|
10
10
|
type SendTransactionOptions = ConfirmOptions & {
|
|
11
11
|
signers?: Signer[];
|
|
@@ -16,6 +16,7 @@ export type TurnkeySolanaConnectorProps = {
|
|
|
16
16
|
solNetworks: GenericNetwork[];
|
|
17
17
|
appName?: string;
|
|
18
18
|
chainRpcProviders: IChainRpcProviders;
|
|
19
|
+
connectionConfig?: ConnectionConfig;
|
|
19
20
|
};
|
|
20
21
|
export declare class TurnkeySolanaWalletConnector extends TurnkeyWalletConnectorBase implements ISendBalanceWalletConnector {
|
|
21
22
|
ChainWallet: typeof SolanaWallet;
|
|
@@ -27,6 +28,7 @@ export declare class TurnkeySolanaWalletConnector extends TurnkeyWalletConnector
|
|
|
27
28
|
private _turnkeyAccount;
|
|
28
29
|
private _connectionClient;
|
|
29
30
|
private __turnkeyClient;
|
|
31
|
+
private connectionConfig;
|
|
30
32
|
constructor(nameAndKey: TurnkeyWalletConnectorNameAndKey, props: TurnkeySolanaConnectorProps);
|
|
31
33
|
getRpcUrl(): string;
|
|
32
34
|
getConnection(commitmentOrConfig?: Commitment | ConnectionConfig): Connection;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter, __rest } from '../../../_virtual/_tslib.js';
|
|
3
3
|
import { LAMPORTS_PER_SOL, PublicKey } from '@solana/web3.js';
|
|
4
|
-
import { WebauthnStamper } from '@turnkey/webauthn-stamper';
|
|
5
4
|
import { TurnkeyClient } from '@turnkey/http';
|
|
6
|
-
import { TurnkeySigner } from '@turnkey/solana';
|
|
7
5
|
import { IframeStamper } from '@turnkey/iframe-stamper';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { SolanaWallet, ProviderChain, getGenesisHashLSKey, SolanaUiTransaction } from '@dynamic-labs/solana-core';
|
|
6
|
+
import { TurnkeySigner } from '@turnkey/solana';
|
|
7
|
+
import { WebauthnStamper } from '@turnkey/webauthn-stamper';
|
|
11
8
|
import { TurnkeyWalletConnectorBase, findTurnkeyVerifiedCredentials, PasskeyService, TURNKEY_API_BASE_URL, TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS, logger } from '@dynamic-labs/embedded-wallet';
|
|
9
|
+
import { SolanaWallet, ProviderChain, getGenesisHashLSKey, SolanaUiTransaction } from '@dynamic-labs/solana-core';
|
|
10
|
+
import { DynamicError, getTLD, PlatformService, bufferToBase64 } from '@dynamic-labs/utils';
|
|
11
|
+
import { isSameAddress } from '@dynamic-labs/wallet-connector-core';
|
|
12
12
|
import { createSolanaConnection } from '../utils/createSolanaConnection/createSolanaConnection.js';
|
|
13
13
|
import { decodeTransaction, getTotalSolanaSpend, summarizeTransactionDecodedData } from '../utils/transactionDecoder/transactionDecoder.js';
|
|
14
14
|
import { optimizeSolanaTransaction } from '../utils/api/api.js';
|
|
@@ -50,7 +50,8 @@ class TurnkeySolanaWalletConnector extends TurnkeyWalletConnectorBase {
|
|
|
50
50
|
this._turnkeyAccount = undefined;
|
|
51
51
|
this._connectionClient = undefined;
|
|
52
52
|
this.chainRpcProviders = props.chainRpcProviders;
|
|
53
|
-
|
|
53
|
+
this.connectionConfig = props.connectionConfig;
|
|
54
|
+
(_a = this.chainRpcProviders) === null || _a === void 0 ? void 0 : _a.registerSolanaProviders(this.connectionConfig);
|
|
54
55
|
this.__turnkeyClient = this.getTurnkeyClient();
|
|
55
56
|
}
|
|
56
57
|
getRpcUrl() {
|
|
@@ -66,7 +67,9 @@ class TurnkeySolanaWalletConnector extends TurnkeyWalletConnectorBase {
|
|
|
66
67
|
const rpcUrl = this.getRpcUrl();
|
|
67
68
|
if (!rpcUrl)
|
|
68
69
|
throw new DynamicError('No rpcUrl');
|
|
69
|
-
|
|
70
|
+
const config = typeof commitmentOrConfig === 'string'
|
|
71
|
+
? Object.assign(Object.assign({}, this.connectionConfig), { commitment: commitmentOrConfig }) : Object.assign(Object.assign({}, this.connectionConfig), commitmentOrConfig);
|
|
72
|
+
this._connectionClient = createSolanaConnection(rpcUrl, config);
|
|
70
73
|
}
|
|
71
74
|
return this._connectionClient;
|
|
72
75
|
}
|
|
@@ -315,9 +318,10 @@ class TurnkeySolanaWalletConnector extends TurnkeyWalletConnectorBase {
|
|
|
315
318
|
}
|
|
316
319
|
internalSignAndSendTransaction(transaction, options) {
|
|
317
320
|
return __awaiter(this, void 0, void 0, function* () {
|
|
321
|
+
var _a, _b;
|
|
318
322
|
if (!this.turnkeyAddress)
|
|
319
323
|
throw new DynamicError('Solana wallet not found');
|
|
320
|
-
const currentConnection = this.getConnection('confirmed');
|
|
324
|
+
const currentConnection = this.getConnection((_b = (_a = this.connectionConfig) === null || _a === void 0 ? void 0 : _a.commitment) !== null && _b !== void 0 ? _b : 'confirmed');
|
|
321
325
|
const signedTransaction = yield this.signTransaction(transaction);
|
|
322
326
|
const signature = yield currentConnection.sendRawTransaction(signedTransaction.serialize(), options);
|
|
323
327
|
// listen for tx confirmation until 60 seconds, which is ~150 blocks expiration
|