@fogo/sessions-sdk 0.1.6 → 0.1.7
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/cjs/connection.js +10 -3
- package/esm/connection.js +10 -3
- package/package.json +1 -1
package/cjs/connection.js
CHANGED
|
@@ -157,9 +157,16 @@ const buildTollboothInstructionIfNeeded = ({ sessionKeyAddress, walletPublicKey,
|
|
|
157
157
|
return undefined;
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
|
-
const addSignaturesToExistingTransaction = (transaction, signerKeys) =>
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
const addSignaturesToExistingTransaction = async (transaction, signerKeys) => {
|
|
161
|
+
const kitTransaction = transaction instanceof web3_js_1.VersionedTransaction
|
|
162
|
+
? (0, compat_1.fromVersionedTransaction)(transaction) // VersionedTransaction has a lifetime so it's fine to cast it so we can call partiallySignTransaction
|
|
163
|
+
: transaction;
|
|
164
|
+
const signerAddresses = await Promise.all(signerKeys.map(async (signer) => [signer, await (0, kit_1.getAddressFromPublicKey)(signer.publicKey)]));
|
|
165
|
+
const filteredSignerKeys = signerAddresses
|
|
166
|
+
.filter(([, address]) => kitTransaction.signatures[address] !== undefined)
|
|
167
|
+
.map(([signer]) => signer);
|
|
168
|
+
return (0, kit_1.partiallySignTransaction)(filteredSignerKeys, kitTransaction);
|
|
169
|
+
};
|
|
163
170
|
const getSignerKeys = async (sessionKey, extraSigners) => {
|
|
164
171
|
const extraSignerKeys = extraSigners === undefined
|
|
165
172
|
? []
|
package/esm/connection.js
CHANGED
|
@@ -150,9 +150,16 @@ const buildTollboothInstructionIfNeeded = ({ sessionKeyAddress, walletPublicKey,
|
|
|
150
150
|
return undefined;
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
|
-
const addSignaturesToExistingTransaction = (transaction, signerKeys) =>
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
const addSignaturesToExistingTransaction = async (transaction, signerKeys) => {
|
|
154
|
+
const kitTransaction = transaction instanceof VersionedTransaction
|
|
155
|
+
? fromVersionedTransaction(transaction) // VersionedTransaction has a lifetime so it's fine to cast it so we can call partiallySignTransaction
|
|
156
|
+
: transaction;
|
|
157
|
+
const signerAddresses = await Promise.all(signerKeys.map(async (signer) => [signer, await getAddressFromPublicKey(signer.publicKey)]));
|
|
158
|
+
const filteredSignerKeys = signerAddresses
|
|
159
|
+
.filter(([, address]) => kitTransaction.signatures[address] !== undefined)
|
|
160
|
+
.map(([signer]) => signer);
|
|
161
|
+
return partiallySignTransaction(filteredSignerKeys, kitTransaction);
|
|
162
|
+
};
|
|
156
163
|
const getSignerKeys = async (sessionKey, extraSigners) => {
|
|
157
164
|
const extraSignerKeys = extraSigners === undefined
|
|
158
165
|
? []
|