@solana/web3.js 1.44.0 → 1.44.3
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 +29 -18
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +28 -19
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +29 -18
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +9 -0
- package/lib/index.esm.js +28 -19
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +29 -18
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +3 -3
- package/lib/index.iife.min.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +12 -3
- package/src/index.ts +1 -0
- package/src/transaction.ts +19 -12
package/package.json
CHANGED
package/src/connection.ts
CHANGED
|
@@ -191,9 +191,9 @@ type Subscription = BaseSubscription &
|
|
|
191
191
|
StatefulSubscription &
|
|
192
192
|
DistributiveOmit<SubscriptionConfig, 'callback'>;
|
|
193
193
|
|
|
194
|
-
type RpcRequest = (methodName: string, args: Array<any>) => any
|
|
194
|
+
type RpcRequest = (methodName: string, args: Array<any>) => Promise<any>;
|
|
195
195
|
|
|
196
|
-
type RpcBatchRequest = (requests: RpcParams[]) => any
|
|
196
|
+
type RpcBatchRequest = (requests: RpcParams[]) => Promise<any[]>;
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
199
|
* @internal
|
|
@@ -3566,7 +3566,16 @@ export class Connection {
|
|
|
3566
3566
|
if ('error' in res) {
|
|
3567
3567
|
throw new Error('failed to get transactions: ' + res.error.message);
|
|
3568
3568
|
}
|
|
3569
|
-
|
|
3569
|
+
const result = res.result;
|
|
3570
|
+
if (!result) return result;
|
|
3571
|
+
|
|
3572
|
+
return {
|
|
3573
|
+
...result,
|
|
3574
|
+
transaction: {
|
|
3575
|
+
...result.transaction,
|
|
3576
|
+
message: new Message(result.transaction.message),
|
|
3577
|
+
},
|
|
3578
|
+
};
|
|
3570
3579
|
});
|
|
3571
3580
|
|
|
3572
3581
|
return res;
|
package/src/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ export * from './errors';
|
|
|
25
25
|
export * from './util/borsh-schema';
|
|
26
26
|
export * from './util/send-and-confirm-transaction';
|
|
27
27
|
export * from './util/send-and-confirm-raw-transaction';
|
|
28
|
+
export * from './util/tx-expiry-custom-errors';
|
|
28
29
|
export * from './util/cluster';
|
|
29
30
|
|
|
30
31
|
/**
|
package/src/transaction.ts
CHANGED
|
@@ -327,17 +327,24 @@ export class Transaction {
|
|
|
327
327
|
return this._message;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
this.
|
|
330
|
+
let recentBlockhash;
|
|
331
|
+
let instructions: TransactionInstruction[];
|
|
332
|
+
if (this.nonceInfo) {
|
|
333
|
+
recentBlockhash = this.nonceInfo.nonce;
|
|
334
|
+
if (this.instructions[0] != this.nonceInfo.nonceInstruction) {
|
|
335
|
+
instructions = [this.nonceInfo.nonceInstruction, ...this.instructions];
|
|
336
|
+
} else {
|
|
337
|
+
instructions = this.instructions;
|
|
338
|
+
}
|
|
339
|
+
} else {
|
|
340
|
+
recentBlockhash = this.recentBlockhash;
|
|
341
|
+
instructions = this.instructions;
|
|
334
342
|
}
|
|
335
|
-
const {recentBlockhash} = this;
|
|
336
343
|
if (!recentBlockhash) {
|
|
337
344
|
throw new Error('Transaction recentBlockhash required');
|
|
338
345
|
}
|
|
339
346
|
|
|
340
|
-
if (
|
|
347
|
+
if (instructions.length < 1) {
|
|
341
348
|
console.warn('No instructions provided');
|
|
342
349
|
}
|
|
343
350
|
|
|
@@ -351,8 +358,8 @@ export class Transaction {
|
|
|
351
358
|
throw new Error('Transaction fee payer required');
|
|
352
359
|
}
|
|
353
360
|
|
|
354
|
-
for (let i = 0; i <
|
|
355
|
-
if (
|
|
361
|
+
for (let i = 0; i < instructions.length; i++) {
|
|
362
|
+
if (instructions[i].programId === undefined) {
|
|
356
363
|
throw new Error(
|
|
357
364
|
`Transaction instruction index ${i} has undefined program id`,
|
|
358
365
|
);
|
|
@@ -361,7 +368,7 @@ export class Transaction {
|
|
|
361
368
|
|
|
362
369
|
const programIds: string[] = [];
|
|
363
370
|
const accountMetas: AccountMeta[] = [];
|
|
364
|
-
|
|
371
|
+
instructions.forEach(instruction => {
|
|
365
372
|
instruction.keys.forEach(accountMeta => {
|
|
366
373
|
accountMetas.push({...accountMeta});
|
|
367
374
|
});
|
|
@@ -471,7 +478,7 @@ export class Transaction {
|
|
|
471
478
|
});
|
|
472
479
|
|
|
473
480
|
const accountKeys = signedKeys.concat(unsignedKeys);
|
|
474
|
-
const
|
|
481
|
+
const compiledInstructions: CompiledInstruction[] = instructions.map(
|
|
475
482
|
instruction => {
|
|
476
483
|
const {data, programId} = instruction;
|
|
477
484
|
return {
|
|
@@ -484,7 +491,7 @@ export class Transaction {
|
|
|
484
491
|
},
|
|
485
492
|
);
|
|
486
493
|
|
|
487
|
-
|
|
494
|
+
compiledInstructions.forEach(instruction => {
|
|
488
495
|
invariant(instruction.programIdIndex >= 0);
|
|
489
496
|
instruction.accounts.forEach(keyIndex => invariant(keyIndex >= 0));
|
|
490
497
|
});
|
|
@@ -497,7 +504,7 @@ export class Transaction {
|
|
|
497
504
|
},
|
|
498
505
|
accountKeys,
|
|
499
506
|
recentBlockhash,
|
|
500
|
-
instructions,
|
|
507
|
+
instructions: compiledInstructions,
|
|
501
508
|
});
|
|
502
509
|
}
|
|
503
510
|
|