@dynamic-labs/embedded-wallet-solana 3.0.0-alpha.64 → 3.0.0-alpha.65
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,11 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.65](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.64...v3.0.0-alpha.65) (2024-09-11)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* gracefully handle errors when trying to find solana tx destination ([#6847](https://github.com/dynamic-labs/DynamicAuth/issues/6847)) ([19359ad](https://github.com/dynamic-labs/DynamicAuth/commit/19359ad40b16af0edb822d1fc6643fecdbc89adf))
|
|
8
|
+
|
|
2
9
|
## [3.0.0-alpha.64](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.63...v3.0.0-alpha.64) (2024-09-10)
|
|
3
10
|
|
|
4
11
|
|
package/package.cjs
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "3.0.0-alpha.
|
|
6
|
+
var version = "3.0.0-alpha.65";
|
|
7
7
|
var dependencies = {
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "0.0.526",
|
|
9
|
-
"@dynamic-labs/utils": "3.0.0-alpha.
|
|
10
|
-
"@dynamic-labs/logger": "3.0.0-alpha.
|
|
11
|
-
"@dynamic-labs/types": "3.0.0-alpha.
|
|
9
|
+
"@dynamic-labs/utils": "3.0.0-alpha.65",
|
|
10
|
+
"@dynamic-labs/logger": "3.0.0-alpha.65",
|
|
11
|
+
"@dynamic-labs/types": "3.0.0-alpha.65",
|
|
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.0.0-alpha.
|
|
2
|
+
var version = "3.0.0-alpha.65";
|
|
3
3
|
var dependencies = {
|
|
4
4
|
"@dynamic-labs/sdk-api-core": "0.0.526",
|
|
5
|
-
"@dynamic-labs/utils": "3.0.0-alpha.
|
|
6
|
-
"@dynamic-labs/logger": "3.0.0-alpha.
|
|
7
|
-
"@dynamic-labs/types": "3.0.0-alpha.
|
|
5
|
+
"@dynamic-labs/utils": "3.0.0-alpha.65",
|
|
6
|
+
"@dynamic-labs/logger": "3.0.0-alpha.65",
|
|
7
|
+
"@dynamic-labs/types": "3.0.0-alpha.65",
|
|
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.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.65",
|
|
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.526",
|
|
30
|
-
"@dynamic-labs/utils": "3.0.0-alpha.
|
|
31
|
-
"@dynamic-labs/logger": "3.0.0-alpha.
|
|
32
|
-
"@dynamic-labs/types": "3.0.0-alpha.
|
|
30
|
+
"@dynamic-labs/utils": "3.0.0-alpha.65",
|
|
31
|
+
"@dynamic-labs/logger": "3.0.0-alpha.65",
|
|
32
|
+
"@dynamic-labs/types": "3.0.0-alpha.65",
|
|
33
33
|
"eventemitter3": "5.0.1",
|
|
34
34
|
"@solana/spl-token": "0.4.6",
|
|
35
35
|
"@solana/web3.js": "1.92.1",
|
|
@@ -37,12 +37,12 @@
|
|
|
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/embedded-wallet": "3.0.0-alpha.
|
|
41
|
-
"@dynamic-labs/rpc-providers": "3.0.0-alpha.
|
|
42
|
-
"@dynamic-labs/solana-core": "3.0.0-alpha.
|
|
43
|
-
"@dynamic-labs/wallet-book": "3.0.0-alpha.
|
|
44
|
-
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.
|
|
45
|
-
"@dynamic-labs/webauthn": "3.0.0-alpha.
|
|
40
|
+
"@dynamic-labs/embedded-wallet": "3.0.0-alpha.65",
|
|
41
|
+
"@dynamic-labs/rpc-providers": "3.0.0-alpha.65",
|
|
42
|
+
"@dynamic-labs/solana-core": "3.0.0-alpha.65",
|
|
43
|
+
"@dynamic-labs/wallet-book": "3.0.0-alpha.65",
|
|
44
|
+
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.65",
|
|
45
|
+
"@dynamic-labs/webauthn": "3.0.0-alpha.65",
|
|
46
46
|
"react-dom": "18.2.0",
|
|
47
47
|
"viem": "2.9.25"
|
|
48
48
|
},
|
|
@@ -51,94 +51,100 @@ const decodeTransaction = (transaction, connection, thisAddress) => _tslib.__awa
|
|
|
51
51
|
if (!transaction) {
|
|
52
52
|
throw new utils.DynamicError('Transaction is required');
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
try {
|
|
55
|
+
let decodedInstructions = [];
|
|
56
|
+
if ('version' in transaction) {
|
|
57
|
+
const lookupTableAddresses = transaction.message.addressTableLookups.map((lookup) => new web3_js.PublicKey(lookup.accountKey));
|
|
58
|
+
// For non-simple SOL transfers, we need to fetch the lookup table accounts
|
|
59
|
+
if (lookupTableAddresses.length > 0) {
|
|
60
|
+
const lookupTables = yield Promise.all(lookupTableAddresses.map((address) => connection.getAddressLookupTable(address)));
|
|
61
|
+
const lookupTableAccounts = lookupTables
|
|
62
|
+
.filter((result) => result !== null)
|
|
63
|
+
.map((result) => result.value);
|
|
64
|
+
if (lookupTableAccounts.length > 0) {
|
|
65
|
+
decodedInstructions = web3_js.TransactionMessage.decompile(transaction.message, {
|
|
66
|
+
addressLookupTableAccounts: lookupTableAccounts,
|
|
67
|
+
}).instructions;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
decodedInstructions = web3_js.TransactionMessage.decompile(transaction.message).instructions;
|
|
67
72
|
}
|
|
68
73
|
}
|
|
74
|
+
else if (!transaction.instructions) {
|
|
75
|
+
decodedInstructions = (_g = web3_js.Transaction.from(Buffer.from(transaction.serialize()))) === null || _g === void 0 ? void 0 : _g.instructions;
|
|
76
|
+
}
|
|
69
77
|
else {
|
|
70
|
-
decodedInstructions =
|
|
78
|
+
decodedInstructions = transaction.instructions;
|
|
71
79
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
80
|
+
if (!(decodedInstructions === null || decodedInstructions === void 0 ? void 0 : decodedInstructions.length)) {
|
|
81
|
+
throw new utils.DynamicError('Bad formatted instruction');
|
|
82
|
+
}
|
|
83
|
+
const solTransfers = decodedInstructions.filter((instruction) => instruction.programId.equals(web3_js.SystemProgram.programId));
|
|
84
|
+
// Non-SPL transfers, just SOL
|
|
85
|
+
if (solTransfers.length > 0) {
|
|
86
|
+
return solTransfers.map((decodedInstruction) => {
|
|
87
|
+
let decodedTransferInstruction;
|
|
88
|
+
try {
|
|
89
|
+
decodedTransferInstruction =
|
|
90
|
+
web3_js.SystemInstruction.decodeTransfer(decodedInstruction);
|
|
91
|
+
}
|
|
92
|
+
catch (e) {
|
|
93
|
+
return { from: thisAddress, to: 'Unknown' };
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
from: decodedTransferInstruction === null || decodedTransferInstruction === void 0 ? void 0 : decodedTransferInstruction.fromPubkey.toBase58(),
|
|
97
|
+
to: decodedTransferInstruction === null || decodedTransferInstruction === void 0 ? void 0 : decodedTransferInstruction.toPubkey.toBase58(),
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
// SPL transfers
|
|
102
|
+
let splTransfers = yield Promise.all(decodedInstructions.map((instruction) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
103
|
+
var _h, _j, _k, _l, _m, _o, _p;
|
|
104
|
+
if (instruction.programId.equals(splToken.TOKEN_PROGRAM_ID)) {
|
|
105
|
+
const decodedTokenInstruction = splToken.decodeTransferInstructionUnchecked(instruction);
|
|
106
|
+
const { source, destination } = decodedTokenInstruction.keys;
|
|
107
|
+
if (destination) {
|
|
108
|
+
// For contract interactions, e.g., swaps, the destination is the turnkey address, flip sender and receiver
|
|
109
|
+
if ((destination === null || destination === void 0 ? void 0 : destination.pubkey.toBase58()) === thisAddress) {
|
|
110
|
+
return {
|
|
111
|
+
from: thisAddress,
|
|
112
|
+
to: source === null || source === void 0 ? void 0 : source.pubkey.toBase58(),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// Pure SPL transfers, get the address from the destination token account to display to user
|
|
116
|
+
const destinationAccountInfo = yield connection.getParsedAccountInfo(destination.pubkey);
|
|
117
|
+
const isTokenAccount = ((_k = (_j = (_h = destinationAccountInfo.value) === null || _h === void 0 ? void 0 : _h.data) === null || _j === void 0 ? void 0 : _j.parsed) === null || _k === void 0 ? void 0 : _k.type) === 'account';
|
|
118
|
+
const destinationOwner = isTokenAccount
|
|
119
|
+
? (_p = (_o = (_m = (_l = destinationAccountInfo.value) === null || _l === void 0 ? void 0 : _l.data) === null || _m === void 0 ? void 0 : _m.parsed) === null || _o === void 0 ? void 0 : _o.info) === null || _p === void 0 ? void 0 : _p.owner
|
|
120
|
+
: null;
|
|
121
|
+
const toAddress = destinationOwner
|
|
122
|
+
? destinationOwner
|
|
123
|
+
: destination === null || destination === void 0 ? void 0 : destination.pubkey.toBase58();
|
|
109
124
|
return {
|
|
110
125
|
from: thisAddress,
|
|
111
|
-
to:
|
|
126
|
+
to: toAddress,
|
|
112
127
|
};
|
|
113
128
|
}
|
|
114
|
-
// Pure SPL transfers, get the address from the destination token account to display to user
|
|
115
|
-
const destinationAccountInfo = yield connection.getParsedAccountInfo(destination.pubkey);
|
|
116
|
-
const isTokenAccount = ((_k = (_j = (_h = destinationAccountInfo.value) === null || _h === void 0 ? void 0 : _h.data) === null || _j === void 0 ? void 0 : _j.parsed) === null || _k === void 0 ? void 0 : _k.type) === 'account';
|
|
117
|
-
const destinationOwner = isTokenAccount
|
|
118
|
-
? (_p = (_o = (_m = (_l = destinationAccountInfo.value) === null || _l === void 0 ? void 0 : _l.data) === null || _m === void 0 ? void 0 : _m.parsed) === null || _o === void 0 ? void 0 : _o.info) === null || _p === void 0 ? void 0 : _p.owner
|
|
119
|
-
: null;
|
|
120
|
-
const toAddress = destinationOwner
|
|
121
|
-
? destinationOwner
|
|
122
|
-
: destination === null || destination === void 0 ? void 0 : destination.pubkey.toBase58();
|
|
123
|
-
return {
|
|
124
|
-
from: thisAddress,
|
|
125
|
-
to: toAddress,
|
|
126
|
-
};
|
|
127
129
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return
|
|
141
|
-
|
|
130
|
+
return null;
|
|
131
|
+
})));
|
|
132
|
+
splTransfers = splTransfers.filter((transfer) => transfer !== null);
|
|
133
|
+
if (splTransfers === null || splTransfers === void 0 ? void 0 : splTransfers.length)
|
|
134
|
+
return splTransfers;
|
|
135
|
+
// Return program IDs for non-SOL and non-SPL transfers
|
|
136
|
+
const noTransferDestinations = decodedInstructions.map((instruction) => ({
|
|
137
|
+
from: thisAddress,
|
|
138
|
+
to: instruction.programId.toBase58(),
|
|
139
|
+
}));
|
|
140
|
+
if (noTransferDestinations.length)
|
|
141
|
+
return noTransferDestinations;
|
|
142
|
+
return { from: thisAddress, to: 'Unknown' };
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
walletConnectorCore.logger.warn('[decodeTransaction]', error);
|
|
146
|
+
return { from: thisAddress, to: 'Unknown' };
|
|
147
|
+
}
|
|
142
148
|
});
|
|
143
149
|
const summarizeTransactionDecodedData = (transactionsData) => {
|
|
144
150
|
const recipients = new Set();
|
|
@@ -47,94 +47,100 @@ const decodeTransaction = (transaction, connection, thisAddress) => __awaiter(vo
|
|
|
47
47
|
if (!transaction) {
|
|
48
48
|
throw new DynamicError('Transaction is required');
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
50
|
+
try {
|
|
51
|
+
let decodedInstructions = [];
|
|
52
|
+
if ('version' in transaction) {
|
|
53
|
+
const lookupTableAddresses = transaction.message.addressTableLookups.map((lookup) => new PublicKey(lookup.accountKey));
|
|
54
|
+
// For non-simple SOL transfers, we need to fetch the lookup table accounts
|
|
55
|
+
if (lookupTableAddresses.length > 0) {
|
|
56
|
+
const lookupTables = yield Promise.all(lookupTableAddresses.map((address) => connection.getAddressLookupTable(address)));
|
|
57
|
+
const lookupTableAccounts = lookupTables
|
|
58
|
+
.filter((result) => result !== null)
|
|
59
|
+
.map((result) => result.value);
|
|
60
|
+
if (lookupTableAccounts.length > 0) {
|
|
61
|
+
decodedInstructions = TransactionMessage.decompile(transaction.message, {
|
|
62
|
+
addressLookupTableAccounts: lookupTableAccounts,
|
|
63
|
+
}).instructions;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
decodedInstructions = TransactionMessage.decompile(transaction.message).instructions;
|
|
63
68
|
}
|
|
64
69
|
}
|
|
70
|
+
else if (!transaction.instructions) {
|
|
71
|
+
decodedInstructions = (_g = Transaction.from(Buffer.from(transaction.serialize()))) === null || _g === void 0 ? void 0 : _g.instructions;
|
|
72
|
+
}
|
|
65
73
|
else {
|
|
66
|
-
decodedInstructions =
|
|
74
|
+
decodedInstructions = transaction.instructions;
|
|
67
75
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
76
|
+
if (!(decodedInstructions === null || decodedInstructions === void 0 ? void 0 : decodedInstructions.length)) {
|
|
77
|
+
throw new DynamicError('Bad formatted instruction');
|
|
78
|
+
}
|
|
79
|
+
const solTransfers = decodedInstructions.filter((instruction) => instruction.programId.equals(SystemProgram.programId));
|
|
80
|
+
// Non-SPL transfers, just SOL
|
|
81
|
+
if (solTransfers.length > 0) {
|
|
82
|
+
return solTransfers.map((decodedInstruction) => {
|
|
83
|
+
let decodedTransferInstruction;
|
|
84
|
+
try {
|
|
85
|
+
decodedTransferInstruction =
|
|
86
|
+
SystemInstruction.decodeTransfer(decodedInstruction);
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
return { from: thisAddress, to: 'Unknown' };
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
from: decodedTransferInstruction === null || decodedTransferInstruction === void 0 ? void 0 : decodedTransferInstruction.fromPubkey.toBase58(),
|
|
93
|
+
to: decodedTransferInstruction === null || decodedTransferInstruction === void 0 ? void 0 : decodedTransferInstruction.toPubkey.toBase58(),
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
// SPL transfers
|
|
98
|
+
let splTransfers = yield Promise.all(decodedInstructions.map((instruction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
99
|
+
var _h, _j, _k, _l, _m, _o, _p;
|
|
100
|
+
if (instruction.programId.equals(TOKEN_PROGRAM_ID)) {
|
|
101
|
+
const decodedTokenInstruction = decodeTransferInstructionUnchecked(instruction);
|
|
102
|
+
const { source, destination } = decodedTokenInstruction.keys;
|
|
103
|
+
if (destination) {
|
|
104
|
+
// For contract interactions, e.g., swaps, the destination is the turnkey address, flip sender and receiver
|
|
105
|
+
if ((destination === null || destination === void 0 ? void 0 : destination.pubkey.toBase58()) === thisAddress) {
|
|
106
|
+
return {
|
|
107
|
+
from: thisAddress,
|
|
108
|
+
to: source === null || source === void 0 ? void 0 : source.pubkey.toBase58(),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
// Pure SPL transfers, get the address from the destination token account to display to user
|
|
112
|
+
const destinationAccountInfo = yield connection.getParsedAccountInfo(destination.pubkey);
|
|
113
|
+
const isTokenAccount = ((_k = (_j = (_h = destinationAccountInfo.value) === null || _h === void 0 ? void 0 : _h.data) === null || _j === void 0 ? void 0 : _j.parsed) === null || _k === void 0 ? void 0 : _k.type) === 'account';
|
|
114
|
+
const destinationOwner = isTokenAccount
|
|
115
|
+
? (_p = (_o = (_m = (_l = destinationAccountInfo.value) === null || _l === void 0 ? void 0 : _l.data) === null || _m === void 0 ? void 0 : _m.parsed) === null || _o === void 0 ? void 0 : _o.info) === null || _p === void 0 ? void 0 : _p.owner
|
|
116
|
+
: null;
|
|
117
|
+
const toAddress = destinationOwner
|
|
118
|
+
? destinationOwner
|
|
119
|
+
: destination === null || destination === void 0 ? void 0 : destination.pubkey.toBase58();
|
|
105
120
|
return {
|
|
106
121
|
from: thisAddress,
|
|
107
|
-
to:
|
|
122
|
+
to: toAddress,
|
|
108
123
|
};
|
|
109
124
|
}
|
|
110
|
-
// Pure SPL transfers, get the address from the destination token account to display to user
|
|
111
|
-
const destinationAccountInfo = yield connection.getParsedAccountInfo(destination.pubkey);
|
|
112
|
-
const isTokenAccount = ((_k = (_j = (_h = destinationAccountInfo.value) === null || _h === void 0 ? void 0 : _h.data) === null || _j === void 0 ? void 0 : _j.parsed) === null || _k === void 0 ? void 0 : _k.type) === 'account';
|
|
113
|
-
const destinationOwner = isTokenAccount
|
|
114
|
-
? (_p = (_o = (_m = (_l = destinationAccountInfo.value) === null || _l === void 0 ? void 0 : _l.data) === null || _m === void 0 ? void 0 : _m.parsed) === null || _o === void 0 ? void 0 : _o.info) === null || _p === void 0 ? void 0 : _p.owner
|
|
115
|
-
: null;
|
|
116
|
-
const toAddress = destinationOwner
|
|
117
|
-
? destinationOwner
|
|
118
|
-
: destination === null || destination === void 0 ? void 0 : destination.pubkey.toBase58();
|
|
119
|
-
return {
|
|
120
|
-
from: thisAddress,
|
|
121
|
-
to: toAddress,
|
|
122
|
-
};
|
|
123
125
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return
|
|
137
|
-
|
|
126
|
+
return null;
|
|
127
|
+
})));
|
|
128
|
+
splTransfers = splTransfers.filter((transfer) => transfer !== null);
|
|
129
|
+
if (splTransfers === null || splTransfers === void 0 ? void 0 : splTransfers.length)
|
|
130
|
+
return splTransfers;
|
|
131
|
+
// Return program IDs for non-SOL and non-SPL transfers
|
|
132
|
+
const noTransferDestinations = decodedInstructions.map((instruction) => ({
|
|
133
|
+
from: thisAddress,
|
|
134
|
+
to: instruction.programId.toBase58(),
|
|
135
|
+
}));
|
|
136
|
+
if (noTransferDestinations.length)
|
|
137
|
+
return noTransferDestinations;
|
|
138
|
+
return { from: thisAddress, to: 'Unknown' };
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
logger.warn('[decodeTransaction]', error);
|
|
142
|
+
return { from: thisAddress, to: 'Unknown' };
|
|
143
|
+
}
|
|
138
144
|
});
|
|
139
145
|
const summarizeTransactionDecodedData = (transactionsData) => {
|
|
140
146
|
const recipients = new Set();
|