@dynamic-labs/solana-core 4.0.0-alpha.30 → 4.0.0-alpha.32
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 +15 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +7 -7
- package/src/index.cjs +2 -0
- package/src/index.js +1 -0
- package/src/utils/SolanaUiTransaction/SolanaUiTransaction.cjs +14 -1
- package/src/utils/SolanaUiTransaction/SolanaUiTransaction.js +14 -1
- package/src/utils/index.d.ts +1 -0
- package/src/utils/isTransactionSigned/index.d.ts +1 -0
- package/src/utils/isTransactionSigned/isTransactionSigned.cjs +17 -0
- package/src/utils/isTransactionSigned/isTransactionSigned.d.ts +2 -0
- package/src/utils/isTransactionSigned/isTransactionSigned.js +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.0.0-alpha.32](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.31...v4.0.0-alpha.32) (2024-11-13)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **client:** convert the wallet when using wallets.embedded.getWallet ([#7430](https://github.com/dynamic-labs/dynamic-auth/issues/7430)) ([f852a09](https://github.com/dynamic-labs/dynamic-auth/commit/f852a09695141389c275d1ca27c26595a78d8051))
|
|
8
|
+
* refresh blockhash for solana embedded and use confirmed commitment ([#7425](https://github.com/dynamic-labs/dynamic-auth/issues/7425)) ([25b4169](https://github.com/dynamic-labs/dynamic-auth/commit/25b4169950b32619731f10f3372f80e71ede4ae5))
|
|
9
|
+
|
|
10
|
+
## [4.0.0-alpha.31](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.30...v4.0.0-alpha.31) (2024-11-13)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* allow passing telegram auth token into telegramSignIn function ([#7423](https://github.com/dynamic-labs/dynamic-auth/issues/7423)) ([4b8d594](https://github.com/dynamic-labs/dynamic-auth/commit/4b8d594984d1ac7851ce8d94fe4329ba94730f35))
|
|
16
|
+
|
|
2
17
|
## [4.0.0-alpha.30](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.29...v4.0.0-alpha.30) (2024-11-13)
|
|
3
18
|
|
|
4
19
|
|
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.32",
|
|
4
4
|
"description": "Core package for utilities and types for solana",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,12 +23,12 @@
|
|
|
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.32",
|
|
27
|
+
"@dynamic-labs/rpc-providers": "4.0.0-alpha.32",
|
|
28
|
+
"@dynamic-labs/types": "4.0.0-alpha.32",
|
|
29
|
+
"@dynamic-labs/utils": "4.0.0-alpha.32",
|
|
30
|
+
"@dynamic-labs/wallet-book": "4.0.0-alpha.32",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.32",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/index.cjs
CHANGED
|
@@ -14,6 +14,7 @@ var decodeTransactionFromBase64 = require('./utils/decodeTransactionFromBase64/d
|
|
|
14
14
|
var isVersionedTransaction = require('./utils/isVersionedTransaction/isVersionedTransaction.cjs');
|
|
15
15
|
var encodeTransactionToBase64 = require('./utils/encodeTransactionToBase64/encodeTransactionToBase64.cjs');
|
|
16
16
|
var getGenesisHashLSKey = require('./utils/getGenesisHashLSKey/getGenesisHashLSKey.cjs');
|
|
17
|
+
var isTransactionSigned = require('./utils/isTransactionSigned/isTransactionSigned.cjs');
|
|
17
18
|
var SolanaWallet = require('./wallet/SolanaWallet.cjs');
|
|
18
19
|
var isSolanaWallet = require('./wallet/isSolanaWallet/isSolanaWallet.cjs');
|
|
19
20
|
var isLedgerSolanaWallet = require('./wallet/isLedgerSolanaWallet/isLedgerSolanaWallet.cjs');
|
|
@@ -28,6 +29,7 @@ exports.decodeTransactionFromBase64 = decodeTransactionFromBase64.decodeTransact
|
|
|
28
29
|
exports.isVersionedTransaction = isVersionedTransaction.isVersionedTransaction;
|
|
29
30
|
exports.encodeTransactionToBase64 = encodeTransactionToBase64.encodeTransactionToBase64;
|
|
30
31
|
exports.getGenesisHashLSKey = getGenesisHashLSKey.getGenesisHashLSKey;
|
|
32
|
+
exports.isTxAlreadySigned = isTransactionSigned.isTxAlreadySigned;
|
|
31
33
|
exports.SolanaWallet = SolanaWallet.SolanaWallet;
|
|
32
34
|
exports.isSolanaWallet = isSolanaWallet.isSolanaWallet;
|
|
33
35
|
exports.isLedgerSolanaWallet = isLedgerSolanaWallet.isLedgerSolanaWallet;
|
package/src/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { decodeTransactionFromBase64 } from './utils/decodeTransactionFromBase64
|
|
|
10
10
|
export { isVersionedTransaction } from './utils/isVersionedTransaction/isVersionedTransaction.js';
|
|
11
11
|
export { encodeTransactionToBase64 } from './utils/encodeTransactionToBase64/encodeTransactionToBase64.js';
|
|
12
12
|
export { getGenesisHashLSKey } from './utils/getGenesisHashLSKey/getGenesisHashLSKey.js';
|
|
13
|
+
export { isTxAlreadySigned } from './utils/isTransactionSigned/isTransactionSigned.js';
|
|
13
14
|
export { SolanaWallet } from './wallet/SolanaWallet.js';
|
|
14
15
|
export { isSolanaWallet } from './wallet/isSolanaWallet/isSolanaWallet.js';
|
|
15
16
|
export { isLedgerSolanaWallet } from './wallet/isLedgerSolanaWallet/isLedgerSolanaWallet.js';
|
|
@@ -7,6 +7,7 @@ var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
|
7
7
|
var web3_js = require('@solana/web3.js');
|
|
8
8
|
var splToken = require('@solana/spl-token');
|
|
9
9
|
var utils = require('@dynamic-labs/utils');
|
|
10
|
+
var isTransactionSigned = require('../isTransactionSigned/isTransactionSigned.cjs');
|
|
10
11
|
|
|
11
12
|
const LAMPORTS_PER_SOL = 1000000000;
|
|
12
13
|
class SolanaUiTransaction {
|
|
@@ -32,7 +33,19 @@ class SolanaUiTransaction {
|
|
|
32
33
|
return;
|
|
33
34
|
transactions = tx instanceof Array ? tx : [tx];
|
|
34
35
|
}
|
|
35
|
-
const
|
|
36
|
+
const { blockhash } = yield this.connection.getLatestBlockhash();
|
|
37
|
+
const compiledMessages = yield Promise.all(transactions.map((tx) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
if ('version' in tx) {
|
|
39
|
+
if (!(yield isTransactionSigned.isTxAlreadySigned(tx))) {
|
|
40
|
+
tx.message.recentBlockhash = blockhash;
|
|
41
|
+
}
|
|
42
|
+
return tx.message;
|
|
43
|
+
}
|
|
44
|
+
if (!(yield isTransactionSigned.isTxAlreadySigned(tx))) {
|
|
45
|
+
tx.recentBlockhash = blockhash;
|
|
46
|
+
}
|
|
47
|
+
return tx.compileMessage();
|
|
48
|
+
})));
|
|
36
49
|
if (compiledMessages.some((msg) => !msg)) {
|
|
37
50
|
throw new Error('Invalid transaction');
|
|
38
51
|
}
|
|
@@ -3,6 +3,7 @@ import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { PublicKey, Transaction, SystemProgram } from '@solana/web3.js';
|
|
4
4
|
import { getAssociatedTokenAddress, createAssociatedTokenAccountInstruction, createTransferInstruction } from '@solana/spl-token';
|
|
5
5
|
import { formatNumberText } from '@dynamic-labs/utils';
|
|
6
|
+
import { isTxAlreadySigned } from '../isTransactionSigned/isTransactionSigned.js';
|
|
6
7
|
|
|
7
8
|
const LAMPORTS_PER_SOL = 1000000000;
|
|
8
9
|
class SolanaUiTransaction {
|
|
@@ -28,7 +29,19 @@ class SolanaUiTransaction {
|
|
|
28
29
|
return;
|
|
29
30
|
transactions = tx instanceof Array ? tx : [tx];
|
|
30
31
|
}
|
|
31
|
-
const
|
|
32
|
+
const { blockhash } = yield this.connection.getLatestBlockhash();
|
|
33
|
+
const compiledMessages = yield Promise.all(transactions.map((tx) => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
if ('version' in tx) {
|
|
35
|
+
if (!(yield isTxAlreadySigned(tx))) {
|
|
36
|
+
tx.message.recentBlockhash = blockhash;
|
|
37
|
+
}
|
|
38
|
+
return tx.message;
|
|
39
|
+
}
|
|
40
|
+
if (!(yield isTxAlreadySigned(tx))) {
|
|
41
|
+
tx.recentBlockhash = blockhash;
|
|
42
|
+
}
|
|
43
|
+
return tx.compileMessage();
|
|
44
|
+
})));
|
|
32
45
|
if (compiledMessages.some((msg) => !msg)) {
|
|
33
46
|
throw new Error('Invalid transaction');
|
|
34
47
|
}
|
package/src/utils/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export { decodeTransactionFromBase64 } from './decodeTransactionFromBase64';
|
|
|
3
3
|
export { isVersionedTransaction } from './isVersionedTransaction';
|
|
4
4
|
export { encodeTransactionToBase64, type EncodedTransaction, } from './encodeTransactionToBase64';
|
|
5
5
|
export { getGenesisHashLSKey } from './getGenesisHashLSKey';
|
|
6
|
+
export { isTxAlreadySigned } from './isTransactionSigned';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './isTransactionSigned';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const isTxAlreadySigned = (transaction) => {
|
|
7
|
+
let alreadySigned = false;
|
|
8
|
+
if ('version' in transaction) {
|
|
9
|
+
alreadySigned = transaction.signatures.some((sig) => !sig.every((byte) => byte === 0));
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
alreadySigned = transaction.signatures.some((sig) => sig.signature);
|
|
13
|
+
}
|
|
14
|
+
return alreadySigned;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.isTxAlreadySigned = isTxAlreadySigned;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const isTxAlreadySigned = (transaction) => {
|
|
3
|
+
let alreadySigned = false;
|
|
4
|
+
if ('version' in transaction) {
|
|
5
|
+
alreadySigned = transaction.signatures.some((sig) => !sig.every((byte) => byte === 0));
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
alreadySigned = transaction.signatures.some((sig) => sig.signature);
|
|
9
|
+
}
|
|
10
|
+
return alreadySigned;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { isTxAlreadySigned };
|