@dynamic-labs/solana-core 4.0.0-alpha.45 → 4.0.0-alpha.47
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 +28 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/wallet/SolanaWallet.cjs +28 -0
- package/src/wallet/SolanaWallet.d.ts +10 -0
- package/src/wallet/SolanaWallet.js +29 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.0.0-alpha.47](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.46...v4.0.0-alpha.47) (2024-12-17)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* stop exposing authToken and minAuthToken from dynamic context (#7629)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* allow re-linking unknown wallet when there's another account of the same wallet provider already linked ([#7628](https://github.com/dynamic-labs/dynamic-auth/issues/7628)) ([20c6dc3](https://github.com/dynamic-labs/dynamic-auth/commit/20c6dc3b1847d82bd46f0df5abaef4efe1e24e38))
|
|
12
|
+
* ensure wallet connector will not get removed ([#7625](https://github.com/dynamic-labs/dynamic-auth/issues/7625)) ([b764846](https://github.com/dynamic-labs/dynamic-auth/commit/b764846b56428e2997d33858e29a87f44359eb6c))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
* stop exposing authToken and minAuthToken from dynamic context ([#7629](https://github.com/dynamic-labs/dynamic-auth/issues/7629)) ([9648870](https://github.com/dynamic-labs/dynamic-auth/commit/9648870478cdcecde279117ada2a1095dab54e2c))
|
|
16
|
+
|
|
17
|
+
## [4.0.0-alpha.46](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.45...v4.0.0-alpha.46) (2024-12-17)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **GVTY-2484:** add subdomain handle field ([#7613](https://github.com/dynamic-labs/dynamic-auth/issues/7613)) ([ee8df3b](https://github.com/dynamic-labs/dynamic-auth/commit/ee8df3b34fa9fed96d92d0b414334c370c9791bc))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* increase wait for transactions ([#7624](https://github.com/dynamic-labs/dynamic-auth/issues/7624)) ([2f7f01b](https://github.com/dynamic-labs/dynamic-auth/commit/2f7f01b024c2733f71ea0fd09dff24f815120acb))
|
|
28
|
+
* solana wallet standard signer connect ([#7614](https://github.com/dynamic-labs/dynamic-auth/issues/7614)) ([1836cf3](https://github.com/dynamic-labs/dynamic-auth/commit/1836cf343b45bae01cfdcf0c0d010bf38bf54d83))
|
|
29
|
+
|
|
2
30
|
## [4.0.0-alpha.45](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.44...v4.0.0-alpha.45) (2024-12-11)
|
|
3
31
|
|
|
4
32
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/solana-core",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.47",
|
|
4
4
|
"description": "Core package for utilities and types for solana",
|
|
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.576",
|
|
22
22
|
"@solana/web3.js": "1.92.1",
|
|
23
23
|
"@solana/spl-token": "0.4.6"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@dynamic-labs/assert-package-version": "4.0.0-alpha.
|
|
27
|
-
"@dynamic-labs/rpc-providers": "4.0.0-alpha.
|
|
28
|
-
"@dynamic-labs/types": "4.0.0-alpha.
|
|
29
|
-
"@dynamic-labs/utils": "4.0.0-alpha.
|
|
30
|
-
"@dynamic-labs/wallet-book": "4.0.0-alpha.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.
|
|
26
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.47",
|
|
27
|
+
"@dynamic-labs/rpc-providers": "4.0.0-alpha.47",
|
|
28
|
+
"@dynamic-labs/types": "4.0.0-alpha.47",
|
|
29
|
+
"@dynamic-labs/utils": "4.0.0-alpha.47",
|
|
30
|
+
"@dynamic-labs/wallet-book": "4.0.0-alpha.47",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.47",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -4,10 +4,38 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
|
+
var web3_js = require('@solana/web3.js');
|
|
7
8
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
9
|
var utils = require('@dynamic-labs/utils');
|
|
9
10
|
|
|
10
11
|
class SolanaWallet extends walletConnectorCore.Wallet {
|
|
12
|
+
/**
|
|
13
|
+
* Sends the native balance of the wallet to the given address.
|
|
14
|
+
* @param amount - The amount of balance to send (in SOL).
|
|
15
|
+
* @param toAddress - The address to send the balance to.
|
|
16
|
+
* @returns The signature of the sent transaction.
|
|
17
|
+
*/
|
|
18
|
+
sendBalance(_a) {
|
|
19
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
|
|
20
|
+
const connection = yield this.getConnection();
|
|
21
|
+
const signer = yield this.getSigner();
|
|
22
|
+
const { blockhash } = yield connection.getLatestBlockhash('finalized');
|
|
23
|
+
const message = new web3_js.TransactionMessage({
|
|
24
|
+
instructions: [
|
|
25
|
+
web3_js.SystemProgram.transfer({
|
|
26
|
+
fromPubkey: new web3_js.PublicKey(this.address),
|
|
27
|
+
lamports: utils.solToLamports(Number(amount)),
|
|
28
|
+
toPubkey: new web3_js.PublicKey(toAddress),
|
|
29
|
+
}),
|
|
30
|
+
],
|
|
31
|
+
payerKey: new web3_js.PublicKey(this.address),
|
|
32
|
+
recentBlockhash: blockhash,
|
|
33
|
+
}).compileToV0Message();
|
|
34
|
+
const transaction = new web3_js.VersionedTransaction(message);
|
|
35
|
+
const { signature } = yield signer.signAndSendTransaction(transaction);
|
|
36
|
+
return signature;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
11
39
|
/**
|
|
12
40
|
* Retrieves the RPC connection
|
|
13
41
|
* @returns A promise that resolves to the RPC connection
|
|
@@ -3,6 +3,16 @@ import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
|
3
3
|
import { SolanaWalletConnector } from '../connector';
|
|
4
4
|
import { ISolana } from '../types';
|
|
5
5
|
export declare class SolanaWallet extends Wallet<SolanaWalletConnector> {
|
|
6
|
+
/**
|
|
7
|
+
* Sends the native balance of the wallet to the given address.
|
|
8
|
+
* @param amount - The amount of balance to send (in SOL).
|
|
9
|
+
* @param toAddress - The address to send the balance to.
|
|
10
|
+
* @returns The signature of the sent transaction.
|
|
11
|
+
*/
|
|
12
|
+
sendBalance({ amount, toAddress, }: {
|
|
13
|
+
amount: string;
|
|
14
|
+
toAddress: string;
|
|
15
|
+
}): Promise<string | undefined>;
|
|
6
16
|
/**
|
|
7
17
|
* Retrieves the RPC connection
|
|
8
18
|
* @returns A promise that resolves to the RPC connection
|
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
|
+
import { TransactionMessage, SystemProgram, PublicKey, VersionedTransaction } from '@solana/web3.js';
|
|
3
4
|
import { Wallet, logger } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
-
import { cloneObjectWithOverrides } from '@dynamic-labs/utils';
|
|
5
|
+
import { solToLamports, cloneObjectWithOverrides } from '@dynamic-labs/utils';
|
|
5
6
|
|
|
6
7
|
class SolanaWallet extends Wallet {
|
|
8
|
+
/**
|
|
9
|
+
* Sends the native balance of the wallet to the given address.
|
|
10
|
+
* @param amount - The amount of balance to send (in SOL).
|
|
11
|
+
* @param toAddress - The address to send the balance to.
|
|
12
|
+
* @returns The signature of the sent transaction.
|
|
13
|
+
*/
|
|
14
|
+
sendBalance(_a) {
|
|
15
|
+
return __awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
|
|
16
|
+
const connection = yield this.getConnection();
|
|
17
|
+
const signer = yield this.getSigner();
|
|
18
|
+
const { blockhash } = yield connection.getLatestBlockhash('finalized');
|
|
19
|
+
const message = new TransactionMessage({
|
|
20
|
+
instructions: [
|
|
21
|
+
SystemProgram.transfer({
|
|
22
|
+
fromPubkey: new PublicKey(this.address),
|
|
23
|
+
lamports: solToLamports(Number(amount)),
|
|
24
|
+
toPubkey: new PublicKey(toAddress),
|
|
25
|
+
}),
|
|
26
|
+
],
|
|
27
|
+
payerKey: new PublicKey(this.address),
|
|
28
|
+
recentBlockhash: blockhash,
|
|
29
|
+
}).compileToV0Message();
|
|
30
|
+
const transaction = new VersionedTransaction(message);
|
|
31
|
+
const { signature } = yield signer.signAndSendTransaction(transaction);
|
|
32
|
+
return signature;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
7
35
|
/**
|
|
8
36
|
* Retrieves the RPC connection
|
|
9
37
|
* @returns A promise that resolves to the RPC connection
|