@solana/web3.js 1.27.0 → 1.28.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.esm.js +57 -7
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +57 -7
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +26 -2
- package/lib/index.esm.js +57 -7
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +57 -7
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +2 -2
- package/lib/index.iife.min.js.map +1 -1
- package/module.flow.js +47 -3
- package/package.json +1 -1
- package/src/connection.ts +62 -4
- package/src/message.ts +27 -0
- package/src/transaction.ts +8 -4
package/lib/index.iife.js
CHANGED
|
@@ -12442,16 +12442,35 @@ var solanaWeb3 = (function (exports) {
|
|
|
12442
12442
|
|
|
12443
12443
|
_defineProperty(this, "instructions", void 0);
|
|
12444
12444
|
|
|
12445
|
+
_defineProperty(this, "indexToProgramIds", new Map());
|
|
12446
|
+
|
|
12445
12447
|
this.header = args.header;
|
|
12446
12448
|
this.accountKeys = args.accountKeys.map(account => new PublicKey(account));
|
|
12447
12449
|
this.recentBlockhash = args.recentBlockhash;
|
|
12448
12450
|
this.instructions = args.instructions;
|
|
12451
|
+
this.instructions.forEach(ix => this.indexToProgramIds.set(ix.programIdIndex, this.accountKeys[ix.programIdIndex]));
|
|
12452
|
+
}
|
|
12453
|
+
|
|
12454
|
+
isAccountSigner(index) {
|
|
12455
|
+
return index < this.header.numRequiredSignatures;
|
|
12449
12456
|
}
|
|
12450
12457
|
|
|
12451
12458
|
isAccountWritable(index) {
|
|
12452
12459
|
return index < this.header.numRequiredSignatures - this.header.numReadonlySignedAccounts || index >= this.header.numRequiredSignatures && index < this.accountKeys.length - this.header.numReadonlyUnsignedAccounts;
|
|
12453
12460
|
}
|
|
12454
12461
|
|
|
12462
|
+
isProgramId(index) {
|
|
12463
|
+
return this.indexToProgramIds.has(index);
|
|
12464
|
+
}
|
|
12465
|
+
|
|
12466
|
+
programIds() {
|
|
12467
|
+
return [...this.indexToProgramIds.values()];
|
|
12468
|
+
}
|
|
12469
|
+
|
|
12470
|
+
nonProgramIds() {
|
|
12471
|
+
return this.accountKeys.filter((_, index) => !this.isProgramId(index));
|
|
12472
|
+
}
|
|
12473
|
+
|
|
12455
12474
|
serialize() {
|
|
12456
12475
|
const numKeys = this.accountKeys.length;
|
|
12457
12476
|
let keyCount = [];
|
|
@@ -13166,7 +13185,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
13166
13185
|
*/
|
|
13167
13186
|
|
|
13168
13187
|
|
|
13169
|
-
static populate(message, signatures) {
|
|
13188
|
+
static populate(message, signatures = []) {
|
|
13170
13189
|
const transaction = new Transaction();
|
|
13171
13190
|
transaction.recentBlockhash = message.recentBlockhash;
|
|
13172
13191
|
|
|
@@ -13186,7 +13205,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
13186
13205
|
const pubkey = message.accountKeys[account];
|
|
13187
13206
|
return {
|
|
13188
13207
|
pubkey,
|
|
13189
|
-
isSigner: transaction.signatures.some(keyObj => keyObj.publicKey.toString() === pubkey.toString()),
|
|
13208
|
+
isSigner: transaction.signatures.some(keyObj => keyObj.publicKey.toString() === pubkey.toString()) || message.isAccountSigner(account),
|
|
13190
13209
|
isWritable: message.isAccountWritable(account)
|
|
13191
13210
|
};
|
|
13192
13211
|
});
|
|
@@ -18243,7 +18262,15 @@ var solanaWeb3 = (function (exports) {
|
|
|
18243
18262
|
});
|
|
18244
18263
|
const SimulatedTransactionResponseStruct = jsonRpcResultAndContext(type({
|
|
18245
18264
|
err: nullable(union([type({}), string()])),
|
|
18246
|
-
logs: nullable(array(string()))
|
|
18265
|
+
logs: nullable(array(string())),
|
|
18266
|
+
accounts: optional(nullable(array(type({
|
|
18267
|
+
executable: boolean(),
|
|
18268
|
+
owner: string(),
|
|
18269
|
+
lamports: number(),
|
|
18270
|
+
data: array(string()),
|
|
18271
|
+
rentEpoch: optional(number())
|
|
18272
|
+
})))),
|
|
18273
|
+
unitsConsumed: optional(number())
|
|
18247
18274
|
}));
|
|
18248
18275
|
|
|
18249
18276
|
function createRpcClient(url, useHttps, httpHeaders, fetchMiddleware, disableRetryOnRateLimit) {
|
|
@@ -18969,6 +18996,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
18969
18996
|
|
|
18970
18997
|
/** @internal */
|
|
18971
18998
|
|
|
18999
|
+
/** @internal */
|
|
19000
|
+
|
|
18972
19001
|
/**
|
|
18973
19002
|
* Establish a JSON RPC connection
|
|
18974
19003
|
*
|
|
@@ -18978,6 +19007,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
18978
19007
|
constructor(endpoint, commitmentOrConfig) {
|
|
18979
19008
|
_defineProperty(this, "_commitment", void 0);
|
|
18980
19009
|
|
|
19010
|
+
_defineProperty(this, "_confirmTransactionInitialTimeout", void 0);
|
|
19011
|
+
|
|
18981
19012
|
_defineProperty(this, "_rpcEndpoint", void 0);
|
|
18982
19013
|
|
|
18983
19014
|
_defineProperty(this, "_rpcWsEndpoint", void 0);
|
|
@@ -19046,6 +19077,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
19046
19077
|
this._commitment = commitmentOrConfig;
|
|
19047
19078
|
} else if (commitmentOrConfig) {
|
|
19048
19079
|
this._commitment = commitmentOrConfig.commitment;
|
|
19080
|
+
this._confirmTransactionInitialTimeout = commitmentOrConfig.confirmTransactionInitialTimeout;
|
|
19049
19081
|
wsEndpoint = commitmentOrConfig.wsEndpoint;
|
|
19050
19082
|
httpHeaders = commitmentOrConfig.httpHeaders;
|
|
19051
19083
|
fetchMiddleware = commitmentOrConfig.fetchMiddleware;
|
|
@@ -19505,7 +19537,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
19505
19537
|
reject(err);
|
|
19506
19538
|
}
|
|
19507
19539
|
});
|
|
19508
|
-
let timeoutMs = 60 * 1000;
|
|
19540
|
+
let timeoutMs = this._confirmTransactionInitialTimeout || 60 * 1000;
|
|
19509
19541
|
|
|
19510
19542
|
switch (subscriptionCommitment) {
|
|
19511
19543
|
case 'processed':
|
|
@@ -19514,7 +19546,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
19514
19546
|
case 'confirmed':
|
|
19515
19547
|
case 'singleGossip':
|
|
19516
19548
|
{
|
|
19517
|
-
timeoutMs = 30 * 1000;
|
|
19549
|
+
timeoutMs = this._confirmTransactionInitialTimeout || 30 * 1000;
|
|
19518
19550
|
break;
|
|
19519
19551
|
}
|
|
19520
19552
|
}
|
|
@@ -20301,7 +20333,15 @@ var solanaWeb3 = (function (exports) {
|
|
|
20301
20333
|
*/
|
|
20302
20334
|
|
|
20303
20335
|
|
|
20304
|
-
async simulateTransaction(
|
|
20336
|
+
async simulateTransaction(transactionOrMessage, signers, includeAccounts) {
|
|
20337
|
+
let transaction;
|
|
20338
|
+
|
|
20339
|
+
if (transactionOrMessage instanceof Transaction) {
|
|
20340
|
+
transaction = transactionOrMessage;
|
|
20341
|
+
} else {
|
|
20342
|
+
transaction = Transaction.populate(transactionOrMessage);
|
|
20343
|
+
}
|
|
20344
|
+
|
|
20305
20345
|
if (transaction.nonceInfo && signers) {
|
|
20306
20346
|
transaction.sign(...signers);
|
|
20307
20347
|
} else {
|
|
@@ -20334,7 +20374,9 @@ var solanaWeb3 = (function (exports) {
|
|
|
20334
20374
|
}
|
|
20335
20375
|
}
|
|
20336
20376
|
|
|
20337
|
-
const
|
|
20377
|
+
const message = transaction._compile();
|
|
20378
|
+
|
|
20379
|
+
const signData = message.serialize();
|
|
20338
20380
|
|
|
20339
20381
|
const wireTransaction = transaction._serialize(signData);
|
|
20340
20382
|
|
|
@@ -20344,6 +20386,14 @@ var solanaWeb3 = (function (exports) {
|
|
|
20344
20386
|
commitment: this.commitment
|
|
20345
20387
|
};
|
|
20346
20388
|
|
|
20389
|
+
if (includeAccounts) {
|
|
20390
|
+
const addresses = (Array.isArray(includeAccounts) ? includeAccounts : message.nonProgramIds()).map(key => key.toBase58());
|
|
20391
|
+
config['accounts'] = {
|
|
20392
|
+
encoding: 'base64',
|
|
20393
|
+
addresses
|
|
20394
|
+
};
|
|
20395
|
+
}
|
|
20396
|
+
|
|
20347
20397
|
if (signers) {
|
|
20348
20398
|
config.sigVerify = true;
|
|
20349
20399
|
}
|