@solana/web3.js 1.41.4 → 1.41.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/lib/index.browser.cjs.js +6 -95
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +50 -140
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +9 -112
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +54 -158
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +3 -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/package.json +3 -3
- package/src/connection.ts +2 -2
- package/src/transaction.ts +4 -6
package/lib/index.browser.cjs.js
CHANGED
|
@@ -8,6 +8,7 @@ var BN = require('bn.js');
|
|
|
8
8
|
var bs58 = require('bs58');
|
|
9
9
|
var borsh = require('borsh');
|
|
10
10
|
var BufferLayout = require('@solana/buffer-layout');
|
|
11
|
+
var bufferLayoutUtils = require('@solana/buffer-layout-utils');
|
|
11
12
|
var superstruct = require('superstruct');
|
|
12
13
|
var rpcWebsockets = require('rpc-websockets');
|
|
13
14
|
var RpcClient = require('jayson/lib/client/browser');
|
|
@@ -2521,11 +2522,7 @@ class Transaction {
|
|
|
2521
2522
|
|
|
2522
2523
|
|
|
2523
2524
|
compileMessage() {
|
|
2524
|
-
if (this._message) {
|
|
2525
|
-
if (JSON.stringify(this.toJSON()) !== JSON.stringify(this._json)) {
|
|
2526
|
-
throw new Error('Transaction message mutated after being populated from Message');
|
|
2527
|
-
}
|
|
2528
|
-
|
|
2525
|
+
if (this._message && JSON.stringify(this.toJSON()) === JSON.stringify(this._json)) {
|
|
2529
2526
|
return this._message;
|
|
2530
2527
|
}
|
|
2531
2528
|
|
|
@@ -3099,92 +3096,6 @@ function sleep(ms) {
|
|
|
3099
3096
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
3100
3097
|
}
|
|
3101
3098
|
|
|
3102
|
-
const encodeDecode = (layout) => {
|
|
3103
|
-
const decode = layout.decode.bind(layout);
|
|
3104
|
-
const encode = layout.encode.bind(layout);
|
|
3105
|
-
return { decode, encode };
|
|
3106
|
-
};
|
|
3107
|
-
|
|
3108
|
-
var browser = {};
|
|
3109
|
-
|
|
3110
|
-
Object.defineProperty(browser, "__esModule", { value: true });
|
|
3111
|
-
/**
|
|
3112
|
-
* Convert a little-endian buffer into a BigInt.
|
|
3113
|
-
* @param buf The little-endian buffer to convert
|
|
3114
|
-
* @returns A BigInt with the little-endian representation of buf.
|
|
3115
|
-
*/
|
|
3116
|
-
function toBigIntLE(buf) {
|
|
3117
|
-
{
|
|
3118
|
-
const reversed = Buffer.from(buf);
|
|
3119
|
-
reversed.reverse();
|
|
3120
|
-
const hex = reversed.toString('hex');
|
|
3121
|
-
if (hex.length === 0) {
|
|
3122
|
-
return BigInt(0);
|
|
3123
|
-
}
|
|
3124
|
-
return BigInt(`0x${hex}`);
|
|
3125
|
-
}
|
|
3126
|
-
}
|
|
3127
|
-
var toBigIntLE_1 = browser.toBigIntLE = toBigIntLE;
|
|
3128
|
-
/**
|
|
3129
|
-
* Convert a big-endian buffer into a BigInt
|
|
3130
|
-
* @param buf The big-endian buffer to convert.
|
|
3131
|
-
* @returns A BigInt with the big-endian representation of buf.
|
|
3132
|
-
*/
|
|
3133
|
-
function toBigIntBE(buf) {
|
|
3134
|
-
{
|
|
3135
|
-
const hex = buf.toString('hex');
|
|
3136
|
-
if (hex.length === 0) {
|
|
3137
|
-
return BigInt(0);
|
|
3138
|
-
}
|
|
3139
|
-
return BigInt(`0x${hex}`);
|
|
3140
|
-
}
|
|
3141
|
-
}
|
|
3142
|
-
browser.toBigIntBE = toBigIntBE;
|
|
3143
|
-
/**
|
|
3144
|
-
* Convert a BigInt to a little-endian buffer.
|
|
3145
|
-
* @param num The BigInt to convert.
|
|
3146
|
-
* @param width The number of bytes that the resulting buffer should be.
|
|
3147
|
-
* @returns A little-endian buffer representation of num.
|
|
3148
|
-
*/
|
|
3149
|
-
function toBufferLE(num, width) {
|
|
3150
|
-
{
|
|
3151
|
-
const hex = num.toString(16);
|
|
3152
|
-
const buffer = Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex');
|
|
3153
|
-
buffer.reverse();
|
|
3154
|
-
return buffer;
|
|
3155
|
-
}
|
|
3156
|
-
}
|
|
3157
|
-
var toBufferLE_1 = browser.toBufferLE = toBufferLE;
|
|
3158
|
-
/**
|
|
3159
|
-
* Convert a BigInt to a big-endian buffer.
|
|
3160
|
-
* @param num The BigInt to convert.
|
|
3161
|
-
* @param width The number of bytes that the resulting buffer should be.
|
|
3162
|
-
* @returns A big-endian buffer representation of num.
|
|
3163
|
-
*/
|
|
3164
|
-
function toBufferBE(num, width) {
|
|
3165
|
-
{
|
|
3166
|
-
const hex = num.toString(16);
|
|
3167
|
-
return Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex');
|
|
3168
|
-
}
|
|
3169
|
-
}
|
|
3170
|
-
browser.toBufferBE = toBufferBE;
|
|
3171
|
-
|
|
3172
|
-
const bigInt = (length) => (property) => {
|
|
3173
|
-
const layout = BufferLayout.blob(length, property);
|
|
3174
|
-
const { encode, decode } = encodeDecode(layout);
|
|
3175
|
-
const bigIntLayout = layout;
|
|
3176
|
-
bigIntLayout.decode = (buffer, offset) => {
|
|
3177
|
-
const src = decode(buffer, offset);
|
|
3178
|
-
return toBigIntLE_1(Buffer.from(src));
|
|
3179
|
-
};
|
|
3180
|
-
bigIntLayout.encode = (bigInt, buffer, offset) => {
|
|
3181
|
-
const src = toBufferLE_1(bigInt, length);
|
|
3182
|
-
return encode(src, buffer, offset);
|
|
3183
|
-
};
|
|
3184
|
-
return bigIntLayout;
|
|
3185
|
-
};
|
|
3186
|
-
const u64 = bigInt(8);
|
|
3187
|
-
|
|
3188
3099
|
/**
|
|
3189
3100
|
* Populate a buffer of instruction data using an InstructionType
|
|
3190
3101
|
* @internal
|
|
@@ -3574,7 +3485,7 @@ const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze({
|
|
|
3574
3485
|
},
|
|
3575
3486
|
Transfer: {
|
|
3576
3487
|
index: 2,
|
|
3577
|
-
layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), u64('lamports')])
|
|
3488
|
+
layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), bufferLayoutUtils.u64('lamports')])
|
|
3578
3489
|
},
|
|
3579
3490
|
CreateWithSeed: {
|
|
3580
3491
|
index: 3,
|
|
@@ -3610,7 +3521,7 @@ const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze({
|
|
|
3610
3521
|
},
|
|
3611
3522
|
TransferWithSeed: {
|
|
3612
3523
|
index: 11,
|
|
3613
|
-
layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), u64('lamports'), rustString('seed'), publicKey('programId')])
|
|
3524
|
+
layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), bufferLayoutUtils.u64('lamports'), rustString('seed'), publicKey('programId')])
|
|
3614
3525
|
}
|
|
3615
3526
|
});
|
|
3616
3527
|
/**
|
|
@@ -8466,7 +8377,7 @@ class Connection {
|
|
|
8466
8377
|
|
|
8467
8378
|
try {
|
|
8468
8379
|
this.removeSignatureListener(clientSubscriptionId); // eslint-disable-next-line no-empty
|
|
8469
|
-
} catch {// Already removed.
|
|
8380
|
+
} catch (_err) {// Already removed.
|
|
8470
8381
|
}
|
|
8471
8382
|
}
|
|
8472
8383
|
},
|
|
@@ -8508,7 +8419,7 @@ class Connection {
|
|
|
8508
8419
|
|
|
8509
8420
|
try {
|
|
8510
8421
|
this.removeSignatureListener(clientSubscriptionId); // eslint-disable-next-line no-empty
|
|
8511
|
-
} catch {// Already removed.
|
|
8422
|
+
} catch (_err) {// Already removed.
|
|
8512
8423
|
}
|
|
8513
8424
|
},
|
|
8514
8425
|
method: 'signatureSubscribe',
|