@solana/connector 0.1.8 → 0.1.9
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/dist/{chunk-FTXIXM43.js → chunk-5HRJKCIL.js} +49 -7
- package/dist/chunk-5HRJKCIL.js.map +1 -0
- package/dist/{chunk-AOIXHVRH.js → chunk-I6TJLYNA.js} +6 -6
- package/dist/{chunk-AOIXHVRH.js.map → chunk-I6TJLYNA.js.map} +1 -1
- package/dist/{chunk-G575OAT4.mjs → chunk-JOBLG62A.mjs} +3 -3
- package/dist/{chunk-G575OAT4.mjs.map → chunk-JOBLG62A.mjs.map} +1 -1
- package/dist/{chunk-6F6M6L7R.mjs → chunk-MAXA3HEP.mjs} +49 -7
- package/dist/chunk-MAXA3HEP.mjs.map +1 -0
- package/dist/{chunk-TTOKQAPX.mjs → chunk-P5LXUDP6.mjs} +3 -3
- package/dist/{chunk-TTOKQAPX.mjs.map → chunk-P5LXUDP6.mjs.map} +1 -1
- package/dist/{chunk-K3BNIGPX.js → chunk-WDXEP4AJ.js} +17 -17
- package/dist/{chunk-K3BNIGPX.js.map → chunk-WDXEP4AJ.js.map} +1 -1
- package/dist/headless.js +94 -94
- package/dist/headless.mjs +2 -2
- package/dist/index.js +129 -129
- package/dist/index.mjs +3 -3
- package/dist/react.js +36 -36
- package/dist/react.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-6F6M6L7R.mjs.map +0 -1
- package/dist/chunk-FTXIXM43.js.map +0 -1
|
@@ -5,8 +5,8 @@ var react = require('react');
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var webcryptoEd25519Polyfill = require('@solana/webcrypto-ed25519-polyfill');
|
|
7
7
|
var addresses = require('@solana/addresses');
|
|
8
|
-
var transactions = require('@solana/transactions');
|
|
9
8
|
var codecs = require('@solana/codecs');
|
|
9
|
+
var transactions = require('@solana/transactions');
|
|
10
10
|
|
|
11
11
|
// src/lib/wallet/standard-shim.ts
|
|
12
12
|
var registry = null, registryInitPromise = null, registryInitResolve = null, ready = new Promise((resolve, reject) => {
|
|
@@ -2080,9 +2080,28 @@ var logger8 = chunkDSUCH44G_js.createLogger("TransactionValidator"), MAX_TRANSAC
|
|
|
2080
2080
|
return transactions.map((tx, index) => (logger8.debug(`Validating transaction ${index + 1}/${transactions.length}`), this.validate(tx, options)));
|
|
2081
2081
|
}
|
|
2082
2082
|
};
|
|
2083
|
-
|
|
2084
|
-
// src/lib/transaction/transaction-signer.ts
|
|
2085
2083
|
var logger9 = chunkDSUCH44G_js.createLogger("TransactionSigner");
|
|
2084
|
+
function signatureBytesToBase58(bytes) {
|
|
2085
|
+
if (bytes.length !== 64)
|
|
2086
|
+
throw new Error(`Invalid signature length: expected 64 bytes, got ${bytes.length}`);
|
|
2087
|
+
return codecs.getBase58Decoder().decode(bytes);
|
|
2088
|
+
}
|
|
2089
|
+
function extractSignatureString(result) {
|
|
2090
|
+
if (typeof result == "string")
|
|
2091
|
+
return result;
|
|
2092
|
+
if (result instanceof Uint8Array)
|
|
2093
|
+
return signatureBytesToBase58(result);
|
|
2094
|
+
if (Array.isArray(result) && result.length > 0)
|
|
2095
|
+
return extractSignatureString(result[0]);
|
|
2096
|
+
if (result && typeof result == "object") {
|
|
2097
|
+
let record = result;
|
|
2098
|
+
if ("signature" in record)
|
|
2099
|
+
return extractSignatureString(record.signature);
|
|
2100
|
+
if (Array.isArray(record.signatures) && record.signatures.length > 0)
|
|
2101
|
+
return extractSignatureString(record.signatures[0]);
|
|
2102
|
+
}
|
|
2103
|
+
throw new Error("Unexpected wallet response format for signAndSendTransaction");
|
|
2104
|
+
}
|
|
2086
2105
|
function createTransactionSigner(config) {
|
|
2087
2106
|
let { wallet, account, cluster, eventEmitter } = config;
|
|
2088
2107
|
if (!wallet || !account)
|
|
@@ -2242,7 +2261,7 @@ function createTransactionSigner(config) {
|
|
|
2242
2261
|
transaction: serialized
|
|
2243
2262
|
});
|
|
2244
2263
|
}
|
|
2245
|
-
let signature =
|
|
2264
|
+
let signature = extractSignatureString(result);
|
|
2246
2265
|
return eventEmitter && eventEmitter.emit({
|
|
2247
2266
|
type: "transaction:sent",
|
|
2248
2267
|
signature,
|
|
@@ -2320,6 +2339,29 @@ function decodeShortVecLength(data) {
|
|
|
2320
2339
|
}
|
|
2321
2340
|
return { length, bytesConsumed: size };
|
|
2322
2341
|
}
|
|
2342
|
+
function parseMessageSigners(messageBytes) {
|
|
2343
|
+
let offset = 0;
|
|
2344
|
+
if (messageBytes.length < 4)
|
|
2345
|
+
throw new Error("Invalid message: too short for header");
|
|
2346
|
+
if (messageBytes[0] === 128 && (offset = 1), offset + 3 > messageBytes.length)
|
|
2347
|
+
throw new Error("Invalid message: incomplete header");
|
|
2348
|
+
let numSignerAccounts = messageBytes[offset];
|
|
2349
|
+
if (offset += 3, offset >= messageBytes.length)
|
|
2350
|
+
throw new Error("Invalid message: no static accounts section");
|
|
2351
|
+
let { length: numStaticAccounts, bytesConsumed } = decodeShortVecLength(messageBytes.subarray(offset));
|
|
2352
|
+
offset += bytesConsumed;
|
|
2353
|
+
let staticAccounts = [], base58Decoder = codecs.getBase58Decoder();
|
|
2354
|
+
for (let i = 0; i < numStaticAccounts && i < numSignerAccounts; i++) {
|
|
2355
|
+
if (offset + 32 > messageBytes.length)
|
|
2356
|
+
throw new Error(`Invalid message: incomplete account ${i}`);
|
|
2357
|
+
let accountBytes = messageBytes.subarray(offset, offset + 32), accountAddress = base58Decoder.decode(accountBytes);
|
|
2358
|
+
staticAccounts.push(accountAddress), offset += 32;
|
|
2359
|
+
}
|
|
2360
|
+
return {
|
|
2361
|
+
numSigners: numSignerAccounts,
|
|
2362
|
+
staticAccounts
|
|
2363
|
+
};
|
|
2364
|
+
}
|
|
2323
2365
|
function createTransactionBytesForSigning(messageBytes, numSigners) {
|
|
2324
2366
|
let numSignaturesBytes = encodeShortVecLength(numSigners), signatureSlots = new Uint8Array(numSigners * 64), totalLength = numSignaturesBytes.length + signatureSlots.length + messageBytes.length, transactionBytes = new Uint8Array(totalLength), offset = 0;
|
|
2325
2367
|
return transactionBytes.set(numSignaturesBytes, offset), offset += numSignaturesBytes.length, transactionBytes.set(signatureSlots, offset), offset += signatureSlots.length, transactionBytes.set(messageBytes, offset), transactionBytes;
|
|
@@ -2351,7 +2393,7 @@ function createKitTransactionSigner(connectorSigner) {
|
|
|
2351
2393
|
address: signerAddress,
|
|
2352
2394
|
async modifyAndSignTransactions(transactions$1) {
|
|
2353
2395
|
let transactionData = transactions$1.map((tx) => {
|
|
2354
|
-
let messageBytes = new Uint8Array(tx.messageBytes), numSigners =
|
|
2396
|
+
let messageBytes = new Uint8Array(tx.messageBytes), { numSigners } = parseMessageSigners(messageBytes), wireFormat = createTransactionBytesForSigning(messageBytes, numSigners);
|
|
2355
2397
|
return logger10.debug("Preparing wire format for wallet", {
|
|
2356
2398
|
signerAddress,
|
|
2357
2399
|
messageBytesLength: messageBytes.length,
|
|
@@ -2481,5 +2523,5 @@ exports.ready = ready;
|
|
|
2481
2523
|
exports.toClusterId = toClusterId;
|
|
2482
2524
|
exports.truncate = truncate;
|
|
2483
2525
|
exports.withErrorBoundary = withErrorBoundary;
|
|
2484
|
-
//# sourceMappingURL=chunk-
|
|
2485
|
-
//# sourceMappingURL=chunk-
|
|
2526
|
+
//# sourceMappingURL=chunk-5HRJKCIL.js.map
|
|
2527
|
+
//# sourceMappingURL=chunk-5HRJKCIL.js.map
|