@solana/web3.js 1.41.5 → 1.41.8
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 +5 -90
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +49 -135
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +8 -107
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +53 -153
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +2 -2
- 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/package.json +1 -1
- package/src/connection.ts +2 -2
package/lib/index.cjs.js
CHANGED
|
@@ -8,7 +8,8 @@ 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
|
|
11
|
+
var bufferLayoutUtils = require('@solana/buffer-layout-utils');
|
|
12
|
+
var crossFetch = require('cross-fetch');
|
|
12
13
|
var superstruct = require('superstruct');
|
|
13
14
|
var rpcWebsockets = require('rpc-websockets');
|
|
14
15
|
var RpcClient = require('jayson/lib/client/browser');
|
|
@@ -41,7 +42,7 @@ var nacl__default = /*#__PURE__*/_interopDefaultLegacy(nacl);
|
|
|
41
42
|
var BN__default = /*#__PURE__*/_interopDefaultLegacy(BN);
|
|
42
43
|
var bs58__default = /*#__PURE__*/_interopDefaultLegacy(bs58);
|
|
43
44
|
var BufferLayout__namespace = /*#__PURE__*/_interopNamespace(BufferLayout);
|
|
44
|
-
var
|
|
45
|
+
var crossFetch__default = /*#__PURE__*/_interopDefaultLegacy(crossFetch);
|
|
45
46
|
var RpcClient__default = /*#__PURE__*/_interopDefaultLegacy(RpcClient);
|
|
46
47
|
var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
|
47
48
|
var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
|
|
@@ -3107,106 +3108,6 @@ function sleep(ms) {
|
|
|
3107
3108
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
3108
3109
|
}
|
|
3109
3110
|
|
|
3110
|
-
const encodeDecode = (layout) => {
|
|
3111
|
-
const decode = layout.decode.bind(layout);
|
|
3112
|
-
const encode = layout.encode.bind(layout);
|
|
3113
|
-
return { decode, encode };
|
|
3114
|
-
};
|
|
3115
|
-
|
|
3116
|
-
var node = {};
|
|
3117
|
-
|
|
3118
|
-
Object.defineProperty(node, "__esModule", { value: true });
|
|
3119
|
-
let converter;
|
|
3120
|
-
{
|
|
3121
|
-
try {
|
|
3122
|
-
converter = require('bindings')('bigint_buffer');
|
|
3123
|
-
}
|
|
3124
|
-
catch (e) {
|
|
3125
|
-
console.warn('bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)');
|
|
3126
|
-
}
|
|
3127
|
-
}
|
|
3128
|
-
/**
|
|
3129
|
-
* Convert a little-endian buffer into a BigInt.
|
|
3130
|
-
* @param buf The little-endian buffer to convert
|
|
3131
|
-
* @returns A BigInt with the little-endian representation of buf.
|
|
3132
|
-
*/
|
|
3133
|
-
function toBigIntLE(buf) {
|
|
3134
|
-
if (converter === undefined) {
|
|
3135
|
-
const reversed = Buffer.from(buf);
|
|
3136
|
-
reversed.reverse();
|
|
3137
|
-
const hex = reversed.toString('hex');
|
|
3138
|
-
if (hex.length === 0) {
|
|
3139
|
-
return BigInt(0);
|
|
3140
|
-
}
|
|
3141
|
-
return BigInt(`0x${hex}`);
|
|
3142
|
-
}
|
|
3143
|
-
return converter.toBigInt(buf, false);
|
|
3144
|
-
}
|
|
3145
|
-
var toBigIntLE_1 = node.toBigIntLE = toBigIntLE;
|
|
3146
|
-
/**
|
|
3147
|
-
* Convert a big-endian buffer into a BigInt
|
|
3148
|
-
* @param buf The big-endian buffer to convert.
|
|
3149
|
-
* @returns A BigInt with the big-endian representation of buf.
|
|
3150
|
-
*/
|
|
3151
|
-
function toBigIntBE(buf) {
|
|
3152
|
-
if (converter === undefined) {
|
|
3153
|
-
const hex = buf.toString('hex');
|
|
3154
|
-
if (hex.length === 0) {
|
|
3155
|
-
return BigInt(0);
|
|
3156
|
-
}
|
|
3157
|
-
return BigInt(`0x${hex}`);
|
|
3158
|
-
}
|
|
3159
|
-
return converter.toBigInt(buf, true);
|
|
3160
|
-
}
|
|
3161
|
-
node.toBigIntBE = toBigIntBE;
|
|
3162
|
-
/**
|
|
3163
|
-
* Convert a BigInt to a little-endian buffer.
|
|
3164
|
-
* @param num The BigInt to convert.
|
|
3165
|
-
* @param width The number of bytes that the resulting buffer should be.
|
|
3166
|
-
* @returns A little-endian buffer representation of num.
|
|
3167
|
-
*/
|
|
3168
|
-
function toBufferLE(num, width) {
|
|
3169
|
-
if (converter === undefined) {
|
|
3170
|
-
const hex = num.toString(16);
|
|
3171
|
-
const buffer = Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex');
|
|
3172
|
-
buffer.reverse();
|
|
3173
|
-
return buffer;
|
|
3174
|
-
}
|
|
3175
|
-
// Allocation is done here, since it is slower using napi in C
|
|
3176
|
-
return converter.fromBigInt(num, Buffer.allocUnsafe(width), false);
|
|
3177
|
-
}
|
|
3178
|
-
var toBufferLE_1 = node.toBufferLE = toBufferLE;
|
|
3179
|
-
/**
|
|
3180
|
-
* Convert a BigInt to a big-endian buffer.
|
|
3181
|
-
* @param num The BigInt to convert.
|
|
3182
|
-
* @param width The number of bytes that the resulting buffer should be.
|
|
3183
|
-
* @returns A big-endian buffer representation of num.
|
|
3184
|
-
*/
|
|
3185
|
-
function toBufferBE(num, width) {
|
|
3186
|
-
if (converter === undefined) {
|
|
3187
|
-
const hex = num.toString(16);
|
|
3188
|
-
return Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex');
|
|
3189
|
-
}
|
|
3190
|
-
return converter.fromBigInt(num, Buffer.allocUnsafe(width), true);
|
|
3191
|
-
}
|
|
3192
|
-
node.toBufferBE = toBufferBE;
|
|
3193
|
-
|
|
3194
|
-
const bigInt = (length) => (property) => {
|
|
3195
|
-
const layout = BufferLayout.blob(length, property);
|
|
3196
|
-
const { encode, decode } = encodeDecode(layout);
|
|
3197
|
-
const bigIntLayout = layout;
|
|
3198
|
-
bigIntLayout.decode = (buffer, offset) => {
|
|
3199
|
-
const src = decode(buffer, offset);
|
|
3200
|
-
return toBigIntLE_1(Buffer.from(src));
|
|
3201
|
-
};
|
|
3202
|
-
bigIntLayout.encode = (bigInt, buffer, offset) => {
|
|
3203
|
-
const src = toBufferLE_1(bigInt, length);
|
|
3204
|
-
return encode(src, buffer, offset);
|
|
3205
|
-
};
|
|
3206
|
-
return bigIntLayout;
|
|
3207
|
-
};
|
|
3208
|
-
const u64 = bigInt(8);
|
|
3209
|
-
|
|
3210
3111
|
/**
|
|
3211
3112
|
* Populate a buffer of instruction data using an InstructionType
|
|
3212
3113
|
* @internal
|
|
@@ -3596,7 +3497,7 @@ const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze({
|
|
|
3596
3497
|
},
|
|
3597
3498
|
Transfer: {
|
|
3598
3499
|
index: 2,
|
|
3599
|
-
layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), u64('lamports')])
|
|
3500
|
+
layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), bufferLayoutUtils.u64('lamports')])
|
|
3600
3501
|
},
|
|
3601
3502
|
CreateWithSeed: {
|
|
3602
3503
|
index: 3,
|
|
@@ -3632,7 +3533,7 @@ const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze({
|
|
|
3632
3533
|
},
|
|
3633
3534
|
TransferWithSeed: {
|
|
3634
3535
|
index: 11,
|
|
3635
|
-
layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), u64('lamports'), rustString('seed'), publicKey('programId')])
|
|
3536
|
+
layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), bufferLayoutUtils.u64('lamports'), rustString('seed'), publicKey('programId')])
|
|
3636
3537
|
}
|
|
3637
3538
|
});
|
|
3638
3539
|
/**
|
|
@@ -4807,7 +4708,7 @@ const BlockProductionResponseStruct = jsonRpcResultAndContext(superstruct.type({
|
|
|
4807
4708
|
*/
|
|
4808
4709
|
|
|
4809
4710
|
function createRpcClient(url, useHttps, httpHeaders, customFetch, fetchMiddleware, disableRetryOnRateLimit) {
|
|
4810
|
-
const fetch = customFetch ? customFetch :
|
|
4711
|
+
const fetch = customFetch ? customFetch : crossFetch__default["default"];
|
|
4811
4712
|
let agentManager;
|
|
4812
4713
|
|
|
4813
4714
|
{
|
|
@@ -7982,7 +7883,7 @@ class Connection {
|
|
|
7982
7883
|
|
|
7983
7884
|
try {
|
|
7984
7885
|
this.removeSignatureListener(clientSubscriptionId); // eslint-disable-next-line no-empty
|
|
7985
|
-
} catch {// Already removed.
|
|
7886
|
+
} catch (_err) {// Already removed.
|
|
7986
7887
|
}
|
|
7987
7888
|
}
|
|
7988
7889
|
},
|
|
@@ -8024,7 +7925,7 @@ class Connection {
|
|
|
8024
7925
|
|
|
8025
7926
|
try {
|
|
8026
7927
|
this.removeSignatureListener(clientSubscriptionId); // eslint-disable-next-line no-empty
|
|
8027
|
-
} catch {// Already removed.
|
|
7928
|
+
} catch (_err) {// Already removed.
|
|
8028
7929
|
}
|
|
8029
7930
|
},
|
|
8030
7931
|
method: 'signatureSubscribe',
|