@solana/web3.js 1.41.6 → 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.
@@ -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');
@@ -3095,92 +3096,6 @@ function sleep(ms) {
3095
3096
  return new Promise(resolve => setTimeout(resolve, ms));
3096
3097
  }
3097
3098
 
3098
- const encodeDecode = (layout) => {
3099
- const decode = layout.decode.bind(layout);
3100
- const encode = layout.encode.bind(layout);
3101
- return { decode, encode };
3102
- };
3103
-
3104
- var browser = {};
3105
-
3106
- Object.defineProperty(browser, "__esModule", { value: true });
3107
- /**
3108
- * Convert a little-endian buffer into a BigInt.
3109
- * @param buf The little-endian buffer to convert
3110
- * @returns A BigInt with the little-endian representation of buf.
3111
- */
3112
- function toBigIntLE(buf) {
3113
- {
3114
- const reversed = Buffer.from(buf);
3115
- reversed.reverse();
3116
- const hex = reversed.toString('hex');
3117
- if (hex.length === 0) {
3118
- return BigInt(0);
3119
- }
3120
- return BigInt(`0x${hex}`);
3121
- }
3122
- }
3123
- var toBigIntLE_1 = browser.toBigIntLE = toBigIntLE;
3124
- /**
3125
- * Convert a big-endian buffer into a BigInt
3126
- * @param buf The big-endian buffer to convert.
3127
- * @returns A BigInt with the big-endian representation of buf.
3128
- */
3129
- function toBigIntBE(buf) {
3130
- {
3131
- const hex = buf.toString('hex');
3132
- if (hex.length === 0) {
3133
- return BigInt(0);
3134
- }
3135
- return BigInt(`0x${hex}`);
3136
- }
3137
- }
3138
- browser.toBigIntBE = toBigIntBE;
3139
- /**
3140
- * Convert a BigInt to a little-endian buffer.
3141
- * @param num The BigInt to convert.
3142
- * @param width The number of bytes that the resulting buffer should be.
3143
- * @returns A little-endian buffer representation of num.
3144
- */
3145
- function toBufferLE(num, width) {
3146
- {
3147
- const hex = num.toString(16);
3148
- const buffer = Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex');
3149
- buffer.reverse();
3150
- return buffer;
3151
- }
3152
- }
3153
- var toBufferLE_1 = browser.toBufferLE = toBufferLE;
3154
- /**
3155
- * Convert a BigInt to a big-endian buffer.
3156
- * @param num The BigInt to convert.
3157
- * @param width The number of bytes that the resulting buffer should be.
3158
- * @returns A big-endian buffer representation of num.
3159
- */
3160
- function toBufferBE(num, width) {
3161
- {
3162
- const hex = num.toString(16);
3163
- return Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex');
3164
- }
3165
- }
3166
- browser.toBufferBE = toBufferBE;
3167
-
3168
- const bigInt = (length) => (property) => {
3169
- const layout = BufferLayout.blob(length, property);
3170
- const { encode, decode } = encodeDecode(layout);
3171
- const bigIntLayout = layout;
3172
- bigIntLayout.decode = (buffer, offset) => {
3173
- const src = decode(buffer, offset);
3174
- return toBigIntLE_1(Buffer.from(src));
3175
- };
3176
- bigIntLayout.encode = (bigInt, buffer, offset) => {
3177
- const src = toBufferLE_1(bigInt, length);
3178
- return encode(src, buffer, offset);
3179
- };
3180
- return bigIntLayout;
3181
- };
3182
- const u64 = bigInt(8);
3183
-
3184
3099
  /**
3185
3100
  * Populate a buffer of instruction data using an InstructionType
3186
3101
  * @internal
@@ -3570,7 +3485,7 @@ const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze({
3570
3485
  },
3571
3486
  Transfer: {
3572
3487
  index: 2,
3573
- layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), u64('lamports')])
3488
+ layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), bufferLayoutUtils.u64('lamports')])
3574
3489
  },
3575
3490
  CreateWithSeed: {
3576
3491
  index: 3,
@@ -3606,7 +3521,7 @@ const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze({
3606
3521
  },
3607
3522
  TransferWithSeed: {
3608
3523
  index: 11,
3609
- 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')])
3610
3525
  }
3611
3526
  });
3612
3527
  /**