@dynamic-labs/embedded-wallet-solana 3.0.0-alpha.14 → 3.0.0-alpha.16

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,32 @@
1
1
 
2
+ ## [3.0.0-alpha.16](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.15...v3.0.0-alpha.16) (2024-07-11)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * remove isConnected prop from wallets and have it as a method instead (#6265)
8
+
9
+ ### Features
10
+
11
+ * add bundlerRpc and paymasterRpc parameters to zerodev ([#6304](https://github.com/dynamic-labs/DynamicAuth/issues/6304)) ([156469b](https://github.com/dynamic-labs/DynamicAuth/commit/156469bf703f0c7fa455a24b8e4e328d3a0c58fc))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * headless embedded wallet export session refresh ([#6307](https://github.com/dynamic-labs/DynamicAuth/issues/6307)) ([5423cc1](https://github.com/dynamic-labs/DynamicAuth/commit/5423cc14c370968acf718b7deff6ea8df9228189))
17
+
18
+
19
+ * remove isConnected prop from wallets and have it as a method instead ([#6265](https://github.com/dynamic-labs/DynamicAuth/issues/6265)) ([652dcc2](https://github.com/dynamic-labs/DynamicAuth/commit/652dcc2d34c9a9719238606c67f600e40621183b))
20
+
21
+ ## [3.0.0-alpha.15](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.14...v3.0.0-alpha.15) (2024-07-11)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * catch third party wallet construction errors ([#6268](https://github.com/dynamic-labs/DynamicAuth/issues/6268)) ([badef39](https://github.com/dynamic-labs/DynamicAuth/commit/badef39d753c7d29925c6c8680053027bd99b69b))
27
+ * decode all solana transactions ([#6294](https://github.com/dynamic-labs/DynamicAuth/issues/6294)) ([5220ab2](https://github.com/dynamic-labs/DynamicAuth/commit/5220ab29381f3a7f1afc7043332b5a018b47eb0a))
28
+ * passkey cta ([#6255](https://github.com/dynamic-labs/DynamicAuth/issues/6255)) ([1b1b152](https://github.com/dynamic-labs/DynamicAuth/commit/1b1b152a24b409c5d941a9c92a003daf0bbe48a1))
29
+
2
30
  ## [3.0.0-alpha.14](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.13...v3.0.0-alpha.14) (2024-07-09)
3
31
 
4
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/embedded-wallet-solana",
3
- "version": "3.0.0-alpha.14",
3
+ "version": "3.0.0-alpha.16",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -33,14 +33,14 @@
33
33
  "@turnkey/iframe-stamper": "2.0.0",
34
34
  "@turnkey/solana": "0.3.1",
35
35
  "@turnkey/webauthn-stamper": "0.5.0",
36
- "@dynamic-labs/embedded-wallet": "3.0.0-alpha.14",
37
- "@dynamic-labs/rpc-provider-solana": "3.0.0-alpha.14",
38
- "@dynamic-labs/rpc-providers": "3.0.0-alpha.14",
39
- "@dynamic-labs/solana-utils": "3.0.0-alpha.14",
40
- "@dynamic-labs/types": "3.0.0-alpha.14",
41
- "@dynamic-labs/utils": "3.0.0-alpha.14",
42
- "@dynamic-labs/wallet-book": "3.0.0-alpha.14",
43
- "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.14",
36
+ "@dynamic-labs/embedded-wallet": "3.0.0-alpha.16",
37
+ "@dynamic-labs/rpc-provider-solana": "3.0.0-alpha.16",
38
+ "@dynamic-labs/rpc-providers": "3.0.0-alpha.16",
39
+ "@dynamic-labs/solana-utils": "3.0.0-alpha.16",
40
+ "@dynamic-labs/types": "3.0.0-alpha.16",
41
+ "@dynamic-labs/utils": "3.0.0-alpha.16",
42
+ "@dynamic-labs/wallet-book": "3.0.0-alpha.16",
43
+ "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.16",
44
44
  "viem": "2.9.25"
45
45
  },
46
46
  "peerDependencies": {}
@@ -54,7 +54,7 @@ const decodeTransaction = (transaction, connection, thisAddress) => _tslib.__awa
54
54
  let decodedInstructions = [];
55
55
  if ('version' in transaction) {
56
56
  const lookupTableAddresses = transaction.message.addressTableLookups.map((lookup) => new web3_js.PublicKey(lookup.accountKey));
57
- // for NON simple sol transfers we need to fetch the lookup table accounts
57
+ // For non-simple SOL transfers, we need to fetch the lookup table accounts
58
58
  if (lookupTableAddresses.length > 0) {
59
59
  const lookupTables = yield Promise.all(lookupTableAddresses.map((address) => connection.getAddressLookupTable(address)));
60
60
  const lookupTableAccounts = lookupTables
@@ -80,7 +80,7 @@ const decodeTransaction = (transaction, connection, thisAddress) => _tslib.__awa
80
80
  throw new utils.DynamicError('Bad formatted instruction');
81
81
  }
82
82
  const solTransfers = decodedInstructions.filter((instruction) => instruction.programId.equals(web3_js.SystemProgram.programId));
83
- // non SPL transfers, just SOL
83
+ // Non-SPL transfers, just SOL
84
84
  if (solTransfers.length > 0) {
85
85
  return solTransfers.map((decodedInstruction) => {
86
86
  const decodedTransferInstruction = web3_js.SystemInstruction.decodeTransfer(decodedInstruction);
@@ -91,13 +91,13 @@ const decodeTransaction = (transaction, connection, thisAddress) => _tslib.__awa
91
91
  });
92
92
  }
93
93
  // SPL transfers
94
- return Promise.all(decodedInstructions.map((instruction) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
94
+ let splTransfers = yield Promise.all(decodedInstructions.map((instruction) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
95
95
  var _h, _j, _k, _l, _m, _o, _p;
96
96
  if (instruction.programId.equals(splToken.TOKEN_PROGRAM_ID)) {
97
97
  const decodedTokenInstruction = splToken.decodeTransferInstructionUnchecked(instruction);
98
98
  const { source, destination } = decodedTokenInstruction.keys;
99
99
  if (destination) {
100
- // for contract interactions, ex. swaps, the destination is the turnkey address, flip sender and receiver
100
+ // For contract interactions, e.g., swaps, the destination is the turnkey address, flip sender and receiver
101
101
  if ((destination === null || destination === void 0 ? void 0 : destination.pubkey.toBase58()) === thisAddress) {
102
102
  return {
103
103
  from: thisAddress,
@@ -121,6 +121,17 @@ const decodeTransaction = (transaction, connection, thisAddress) => _tslib.__awa
121
121
  }
122
122
  return null;
123
123
  })));
124
+ splTransfers = splTransfers.filter((transfer) => transfer !== null);
125
+ if (splTransfers === null || splTransfers === void 0 ? void 0 : splTransfers.length)
126
+ return splTransfers;
127
+ // Return program IDs for non-SOL and non-SPL transfers
128
+ const noTransferDestinations = decodedInstructions.map((instruction) => ({
129
+ from: thisAddress,
130
+ to: instruction.programId.toBase58(),
131
+ }));
132
+ if (noTransferDestinations.length)
133
+ return noTransferDestinations;
134
+ return { from: thisAddress, to: 'Unknown' };
124
135
  });
125
136
  const summarizeTransactionDecodedData = (transactionsData) => {
126
137
  const recipients = new Set();
@@ -50,7 +50,7 @@ const decodeTransaction = (transaction, connection, thisAddress) => __awaiter(vo
50
50
  let decodedInstructions = [];
51
51
  if ('version' in transaction) {
52
52
  const lookupTableAddresses = transaction.message.addressTableLookups.map((lookup) => new PublicKey(lookup.accountKey));
53
- // for NON simple sol transfers we need to fetch the lookup table accounts
53
+ // For non-simple SOL transfers, we need to fetch the lookup table accounts
54
54
  if (lookupTableAddresses.length > 0) {
55
55
  const lookupTables = yield Promise.all(lookupTableAddresses.map((address) => connection.getAddressLookupTable(address)));
56
56
  const lookupTableAccounts = lookupTables
@@ -76,7 +76,7 @@ const decodeTransaction = (transaction, connection, thisAddress) => __awaiter(vo
76
76
  throw new DynamicError('Bad formatted instruction');
77
77
  }
78
78
  const solTransfers = decodedInstructions.filter((instruction) => instruction.programId.equals(SystemProgram.programId));
79
- // non SPL transfers, just SOL
79
+ // Non-SPL transfers, just SOL
80
80
  if (solTransfers.length > 0) {
81
81
  return solTransfers.map((decodedInstruction) => {
82
82
  const decodedTransferInstruction = SystemInstruction.decodeTransfer(decodedInstruction);
@@ -87,13 +87,13 @@ const decodeTransaction = (transaction, connection, thisAddress) => __awaiter(vo
87
87
  });
88
88
  }
89
89
  // SPL transfers
90
- return Promise.all(decodedInstructions.map((instruction) => __awaiter(void 0, void 0, void 0, function* () {
90
+ let splTransfers = yield Promise.all(decodedInstructions.map((instruction) => __awaiter(void 0, void 0, void 0, function* () {
91
91
  var _h, _j, _k, _l, _m, _o, _p;
92
92
  if (instruction.programId.equals(TOKEN_PROGRAM_ID)) {
93
93
  const decodedTokenInstruction = decodeTransferInstructionUnchecked(instruction);
94
94
  const { source, destination } = decodedTokenInstruction.keys;
95
95
  if (destination) {
96
- // for contract interactions, ex. swaps, the destination is the turnkey address, flip sender and receiver
96
+ // For contract interactions, e.g., swaps, the destination is the turnkey address, flip sender and receiver
97
97
  if ((destination === null || destination === void 0 ? void 0 : destination.pubkey.toBase58()) === thisAddress) {
98
98
  return {
99
99
  from: thisAddress,
@@ -117,6 +117,17 @@ const decodeTransaction = (transaction, connection, thisAddress) => __awaiter(vo
117
117
  }
118
118
  return null;
119
119
  })));
120
+ splTransfers = splTransfers.filter((transfer) => transfer !== null);
121
+ if (splTransfers === null || splTransfers === void 0 ? void 0 : splTransfers.length)
122
+ return splTransfers;
123
+ // Return program IDs for non-SOL and non-SPL transfers
124
+ const noTransferDestinations = decodedInstructions.map((instruction) => ({
125
+ from: thisAddress,
126
+ to: instruction.programId.toBase58(),
127
+ }));
128
+ if (noTransferDestinations.length)
129
+ return noTransferDestinations;
130
+ return { from: thisAddress, to: 'Unknown' };
120
131
  });
121
132
  const summarizeTransactionDecodedData = (transactionsData) => {
122
133
  const recipients = new Set();