@solana/web3.js 1.43.0 → 1.43.1

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.cjs.js CHANGED
@@ -8,7 +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
+ var bigintBuffer = require('bigint-buffer');
12
12
  var crossFetch = require('cross-fetch');
13
13
  var superstruct = require('superstruct');
14
14
  var rpcWebsockets = require('rpc-websockets');
@@ -3219,6 +3219,38 @@ class NonceAccount {
3219
3219
 
3220
3220
  }
3221
3221
 
3222
+ const encodeDecode = layout => {
3223
+ const decode = layout.decode.bind(layout);
3224
+ const encode = layout.encode.bind(layout);
3225
+ return {
3226
+ decode,
3227
+ encode
3228
+ };
3229
+ };
3230
+
3231
+ const bigInt = length => property => {
3232
+ const layout = BufferLayout.blob(length, property);
3233
+ const {
3234
+ encode,
3235
+ decode
3236
+ } = encodeDecode(layout);
3237
+ const bigIntLayout = layout;
3238
+
3239
+ bigIntLayout.decode = (buffer$1, offset) => {
3240
+ const src = decode(buffer$1, offset);
3241
+ return bigintBuffer.toBigIntLE(buffer.Buffer.from(src));
3242
+ };
3243
+
3244
+ bigIntLayout.encode = (bigInt, buffer, offset) => {
3245
+ const src = bigintBuffer.toBufferLE(bigInt, length);
3246
+ return encode(src, buffer, offset);
3247
+ };
3248
+
3249
+ return bigIntLayout;
3250
+ };
3251
+
3252
+ const u64 = bigInt(8);
3253
+
3222
3254
  /**
3223
3255
  * Create account system transaction params
3224
3256
  */
@@ -3520,7 +3552,7 @@ const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze({
3520
3552
  },
3521
3553
  Transfer: {
3522
3554
  index: 2,
3523
- layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), bufferLayoutUtils.u64('lamports')])
3555
+ layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), u64('lamports')])
3524
3556
  },
3525
3557
  CreateWithSeed: {
3526
3558
  index: 3,
@@ -3556,7 +3588,7 @@ const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze({
3556
3588
  },
3557
3589
  TransferWithSeed: {
3558
3590
  index: 11,
3559
- layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), bufferLayoutUtils.u64('lamports'), rustString('seed'), publicKey('programId')])
3591
+ layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), u64('lamports'), rustString('seed'), publicKey('programId')])
3560
3592
  }
3561
3593
  });
3562
3594
  /**
@@ -4260,7 +4292,7 @@ const COMPUTE_BUDGET_INSTRUCTION_LAYOUTS = Object.freeze({
4260
4292
  },
4261
4293
  SetComputeUnitPrice: {
4262
4294
  index: 3,
4263
- layout: BufferLayout__namespace.struct([BufferLayout__namespace.u8('instruction'), bufferLayoutUtils.u64('microLamports')])
4295
+ layout: BufferLayout__namespace.struct([BufferLayout__namespace.u8('instruction'), u64('microLamports')])
4264
4296
  }
4265
4297
  });
4266
4298
  /**