@solana/web3.js 1.62.1 → 1.63.0
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/lib/index.browser.cjs.js +8 -0
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +8 -0
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +8 -0
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.esm.js +8 -0
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +8 -0
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +8 -0
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/transaction/versioned.ts +17 -0
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ import {SIGNATURE_LENGTH_IN_BYTES} from './constants';
|
|
|
7
7
|
import * as shortvec from '../utils/shortvec-encoding';
|
|
8
8
|
import * as Layout from '../layout';
|
|
9
9
|
import {sign} from '../utils/ed25519';
|
|
10
|
+
import {PublicKey} from '../publickey';
|
|
10
11
|
|
|
11
12
|
export type TransactionVersion = 'legacy' | 0;
|
|
12
13
|
|
|
@@ -106,4 +107,20 @@ export class VersionedTransaction {
|
|
|
106
107
|
this.signatures[signerIndex] = sign(messageData, signer.secretKey);
|
|
107
108
|
}
|
|
108
109
|
}
|
|
110
|
+
|
|
111
|
+
addSignature(publicKey: PublicKey, signature: Uint8Array) {
|
|
112
|
+
assert(signature.byteLength === 64, 'Signature must be 64 bytes long');
|
|
113
|
+
const signerPubkeys = this.message.staticAccountKeys.slice(
|
|
114
|
+
0,
|
|
115
|
+
this.message.header.numRequiredSignatures,
|
|
116
|
+
);
|
|
117
|
+
const signerIndex = signerPubkeys.findIndex(pubkey =>
|
|
118
|
+
pubkey.equals(publicKey),
|
|
119
|
+
);
|
|
120
|
+
assert(
|
|
121
|
+
signerIndex >= 0,
|
|
122
|
+
`Can not add signature; \`${publicKey.toBase58()}\` is not required to sign this transaction`,
|
|
123
|
+
);
|
|
124
|
+
this.signatures[signerIndex] = signature;
|
|
125
|
+
}
|
|
109
126
|
}
|