@moonbeam-network/mrl 4.0.4 → 4.0.5

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/build/index.mjs CHANGED
@@ -21,19 +21,19 @@ import {
21
21
  wormholeFactory
22
22
  } from "@moonbeam-network/xcm-builder";
23
23
 
24
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/index.js
24
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/index.js
25
25
  import { registerProtocol as registerProtocol2 } from "@wormhole-foundation/sdk-connect";
26
26
  import { _platform as _platform2 } from "@wormhole-foundation/sdk-evm";
27
27
 
28
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/tokenBridge.js
28
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/tokenBridge.js
29
29
  import { ErrNotWrapped, UniversalAddress, isNative, keccak256 as keccak2562, nativeChainIds as nativeChainIds2, serialize as serialize2, toChain, toChainId, toNative } from "@wormhole-foundation/sdk-connect";
30
30
  import { EvmAddress as EvmAddress2, EvmPlatform as EvmPlatform2, EvmUnsignedTransaction as EvmUnsignedTransaction2, EvmZeroAddress, addChainId as addChainId2, addFrom as addFrom2, unusedArbiterFee, unusedNonce, WETH_CONTRACTS } from "@wormhole-foundation/sdk-evm";
31
31
 
32
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-core@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-core/dist/esm/index.js
32
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-core@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-core/dist/esm/index.js
33
33
  import { registerProtocol } from "@wormhole-foundation/sdk-connect";
34
34
  import { _platform } from "@wormhole-foundation/sdk-evm";
35
35
 
36
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-core@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-core/dist/esm/core.js
36
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-core@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-core/dist/esm/core.js
37
37
  import { nativeChainIds, createVAA, isWormholeMessageId, encoding, serialize } from "@wormhole-foundation/sdk-connect";
38
38
  import { EvmAddress, EvmPlatform, EvmUnsignedTransaction, addChainId, addFrom } from "@wormhole-foundation/sdk-evm";
39
39
  var EvmWormholeCore = class _EvmWormholeCore {
@@ -150,16 +150,16 @@ var EvmWormholeCore = class _EvmWormholeCore {
150
150
  }
151
151
  };
152
152
 
153
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-core@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-core/dist/esm/ethers-contracts/index.js
153
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-core@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-core/dist/esm/ethers-contracts/index.js
154
154
  var ethers_contracts_exports = {};
155
155
  __export(ethers_contracts_exports, {
156
156
  Implementation__factory: () => Implementation__factory
157
157
  });
158
158
 
159
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/_version.js
160
- var version = "6.14.4";
159
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/_version.js
160
+ var version = "6.15.0";
161
161
 
162
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/properties.js
162
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/properties.js
163
163
  function checkType(value, type, name) {
164
164
  const types = type.split("|").map((t) => t.trim());
165
165
  for (let i = 0; i < types.length; i++) {
@@ -200,7 +200,7 @@ function defineProperties(target, values, types) {
200
200
  }
201
201
  }
202
202
 
203
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/errors.js
203
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/errors.js
204
204
  function stringify(value, seen) {
205
205
  if (value == null) {
206
206
  return "null";
@@ -359,7 +359,7 @@ function assertPrivate(givenGuard, guard, className) {
359
359
  }
360
360
  }
361
361
 
362
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/data.js
362
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/data.js
363
363
  function _getBytes(value, name, copy) {
364
364
  if (value instanceof Uint8Array) {
365
365
  if (copy) {
@@ -446,7 +446,7 @@ function zeroPadBytes(data, length) {
446
446
  return zeroPad(data, length, false);
447
447
  }
448
448
 
449
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/maths.js
449
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/maths.js
450
450
  var BN_0 = BigInt(0);
451
451
  var BN_1 = BigInt(1);
452
452
  var maxValue = 9007199254740991;
@@ -596,7 +596,7 @@ function toBeArray(_value) {
596
596
  return result;
597
597
  }
598
598
 
599
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/events.js
599
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/events.js
600
600
  var EventPayload = class {
601
601
  /**
602
602
  * The event filter.
@@ -626,7 +626,7 @@ var EventPayload = class {
626
626
  }
627
627
  };
628
628
 
629
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/utf8.js
629
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/utf8.js
630
630
  function errorFunc(reason, offset, bytes3, output2, badCodepoint) {
631
631
  assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes3);
632
632
  }
@@ -771,7 +771,7 @@ function toUtf8String(bytes3, onError) {
771
771
  return _toUtf8String(getUtf8CodePoints(bytes3, onError));
772
772
  }
773
773
 
774
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/rlp-encode.js
774
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/rlp-encode.js
775
775
  function arrayifyInteger(value) {
776
776
  const result = [];
777
777
  while (value) {
@@ -815,7 +815,7 @@ function encodeRlp(object) {
815
815
  return result;
816
816
  }
817
817
 
818
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/abstract-coder.js
818
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/abstract-coder.js
819
819
  var WordSize = 32;
820
820
  var Padding = new Uint8Array(WordSize);
821
821
  var passProperties = ["then"];
@@ -1488,7 +1488,7 @@ var genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts
1488
1488
  var shake128 = /* @__PURE__ */ genShake(31, 168, 128 / 8);
1489
1489
  var shake256 = /* @__PURE__ */ genShake(31, 136, 256 / 8);
1490
1490
 
1491
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/crypto/keccak.js
1491
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/crypto/keccak.js
1492
1492
  var locked = false;
1493
1493
  var _keccak256 = function(data) {
1494
1494
  return keccak_256(data);
@@ -1510,10 +1510,10 @@ keccak256.register = function(func) {
1510
1510
  };
1511
1511
  Object.freeze(keccak256);
1512
1512
 
1513
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/constants/addresses.js
1513
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/constants/addresses.js
1514
1514
  var ZeroAddress = "0x0000000000000000000000000000000000000000";
1515
1515
 
1516
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/address/address.js
1516
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/address/address.js
1517
1517
  var BN_02 = BigInt(0);
1518
1518
  var BN_36 = BigInt(36);
1519
1519
  function getChecksumAddress(address) {
@@ -1558,7 +1558,7 @@ function ibanChecksum(address) {
1558
1558
  }
1559
1559
  return checksum;
1560
1560
  }
1561
- var Base36 = function() {
1561
+ var Base36 = (function() {
1562
1562
  ;
1563
1563
  const result = {};
1564
1564
  for (let i = 0; i < 36; i++) {
@@ -1566,7 +1566,7 @@ var Base36 = function() {
1566
1566
  result[key] = BigInt(i);
1567
1567
  }
1568
1568
  return result;
1569
- }();
1569
+ })();
1570
1570
  function fromBase36(value) {
1571
1571
  value = value.toLowerCase();
1572
1572
  let result = BN_02;
@@ -1596,7 +1596,7 @@ function getAddress(address) {
1596
1596
  assertArgument(false, "invalid address", "address", address);
1597
1597
  }
1598
1598
 
1599
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/address/contract-address.js
1599
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/address/contract-address.js
1600
1600
  function getCreateAddress(tx) {
1601
1601
  const from = getAddress(tx.from);
1602
1602
  const nonce = getBigInt(tx.nonce, "tx.nonce");
@@ -1611,7 +1611,7 @@ function getCreateAddress(tx) {
1611
1611
  return getAddress(dataSlice(keccak256(encodeRlp([from, nonceHex])), 12));
1612
1612
  }
1613
1613
 
1614
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/address/checks.js
1614
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/address/checks.js
1615
1615
  function isAddressable(value) {
1616
1616
  return value && typeof value.getAddress === "function";
1617
1617
  }
@@ -1638,7 +1638,7 @@ function resolveAddress(target, resolver) {
1638
1638
  assertArgument(false, "unsupported addressable value", "target", target);
1639
1639
  }
1640
1640
 
1641
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/typed.js
1641
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/typed.js
1642
1642
  var _gaurd = {};
1643
1643
  function n(value, width) {
1644
1644
  let signed = false;
@@ -2419,7 +2419,7 @@ var Typed = class _Typed {
2419
2419
  }
2420
2420
  };
2421
2421
 
2422
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/address.js
2422
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/address.js
2423
2423
  var AddressCoder = class extends Coder {
2424
2424
  constructor(localName) {
2425
2425
  super("address", "address", localName, false);
@@ -2441,7 +2441,7 @@ var AddressCoder = class extends Coder {
2441
2441
  }
2442
2442
  };
2443
2443
 
2444
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/anonymous.js
2444
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/anonymous.js
2445
2445
  var AnonymousCoder = class extends Coder {
2446
2446
  coder;
2447
2447
  constructor(coder) {
@@ -2459,7 +2459,7 @@ var AnonymousCoder = class extends Coder {
2459
2459
  }
2460
2460
  };
2461
2461
 
2462
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/array.js
2462
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/array.js
2463
2463
  function pack(writer, coders, values) {
2464
2464
  let arrayValues = [];
2465
2465
  if (Array.isArray(values)) {
@@ -2589,7 +2589,7 @@ var ArrayCoder = class extends Coder {
2589
2589
  }
2590
2590
  };
2591
2591
 
2592
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/boolean.js
2592
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/boolean.js
2593
2593
  var BooleanCoder = class extends Coder {
2594
2594
  constructor(localName) {
2595
2595
  super("bool", "bool", localName, false);
@@ -2606,7 +2606,7 @@ var BooleanCoder = class extends Coder {
2606
2606
  }
2607
2607
  };
2608
2608
 
2609
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/bytes.js
2609
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/bytes.js
2610
2610
  var DynamicBytesCoder = class extends Coder {
2611
2611
  constructor(type, localName) {
2612
2612
  super(type, type, localName, true);
@@ -2633,7 +2633,7 @@ var BytesCoder = class extends DynamicBytesCoder {
2633
2633
  }
2634
2634
  };
2635
2635
 
2636
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.js
2636
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.js
2637
2637
  var FixedBytesCoder = class extends Coder {
2638
2638
  size;
2639
2639
  constructor(size, localName) {
@@ -2656,7 +2656,7 @@ var FixedBytesCoder = class extends Coder {
2656
2656
  }
2657
2657
  };
2658
2658
 
2659
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/null.js
2659
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/null.js
2660
2660
  var Empty = new Uint8Array([]);
2661
2661
  var NullCoder = class extends Coder {
2662
2662
  constructor(localName) {
@@ -2677,7 +2677,7 @@ var NullCoder = class extends Coder {
2677
2677
  }
2678
2678
  };
2679
2679
 
2680
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/number.js
2680
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/number.js
2681
2681
  var BN_03 = BigInt(0);
2682
2682
  var BN_12 = BigInt(1);
2683
2683
  var BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
@@ -2715,7 +2715,7 @@ var NumberCoder = class extends Coder {
2715
2715
  }
2716
2716
  };
2717
2717
 
2718
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/string.js
2718
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/string.js
2719
2719
  var StringCoder = class extends DynamicBytesCoder {
2720
2720
  constructor(localName) {
2721
2721
  super("string", localName);
@@ -2731,7 +2731,7 @@ var StringCoder = class extends DynamicBytesCoder {
2731
2731
  }
2732
2732
  };
2733
2733
 
2734
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/tuple.js
2734
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/tuple.js
2735
2735
  var TupleCoder = class extends Coder {
2736
2736
  coders;
2737
2737
  constructor(coders, localName) {
@@ -2786,7 +2786,7 @@ var TupleCoder = class extends Coder {
2786
2786
  }
2787
2787
  };
2788
2788
 
2789
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/transaction/accesslist.js
2789
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/transaction/accesslist.js
2790
2790
  function accessSetify(addr, storageKeys) {
2791
2791
  return {
2792
2792
  address: getAddress(addr),
@@ -2819,12 +2819,12 @@ function accessListify(value) {
2819
2819
  return result;
2820
2820
  }
2821
2821
 
2822
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/hash/id.js
2822
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/hash/id.js
2823
2823
  function id(value) {
2824
2824
  return keccak256(toUtf8Bytes(value));
2825
2825
  }
2826
2826
 
2827
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/fragments.js
2827
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/fragments.js
2828
2828
  function setify(items) {
2829
2829
  const result = /* @__PURE__ */ new Set();
2830
2830
  items.forEach((k) => result.add(k));
@@ -3372,9 +3372,9 @@ var ParamType = class _ParamType {
3372
3372
  }
3373
3373
  const result = process(this.type, value);
3374
3374
  if (result.then) {
3375
- promises.push(async function() {
3375
+ promises.push((async function() {
3376
3376
  setValue(await result);
3377
- }());
3377
+ })());
3378
3378
  } else {
3379
3379
  setValue(result);
3380
3380
  }
@@ -4072,7 +4072,7 @@ var StructFragment = class _StructFragment extends NamedFragment {
4072
4072
  }
4073
4073
  };
4074
4074
 
4075
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/abi-coder.js
4075
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/abi-coder.js
4076
4076
  var PanicReasons = /* @__PURE__ */ new Map();
4077
4077
  PanicReasons.set(0, "GENERIC_PANIC");
4078
4078
  PanicReasons.set(1, "ASSERT_FALSE");
@@ -4242,7 +4242,7 @@ var AbiCoder = class _AbiCoder {
4242
4242
  }
4243
4243
  };
4244
4244
 
4245
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/interface.js
4245
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/interface.js
4246
4246
  var LogDescription = class {
4247
4247
  /**
4248
4248
  * The matching fragment for the ``topic0``.
@@ -5250,7 +5250,7 @@ var Interface = class _Interface {
5250
5250
  }
5251
5251
  };
5252
5252
 
5253
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/providers/provider.js
5253
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/providers/provider.js
5254
5254
  var BN_04 = BigInt(0);
5255
5255
  function toJson(value) {
5256
5256
  if (value == null) {
@@ -6181,7 +6181,7 @@ function createRemovedLogFilter(log) {
6181
6181
  } };
6182
6182
  }
6183
6183
 
6184
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/contract/wrappers.js
6184
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/contract/wrappers.js
6185
6185
  var EventLog = class extends Log {
6186
6186
  /**
6187
6187
  * The Contract Interface.
@@ -6336,7 +6336,7 @@ var ContractEventPayload = class extends ContractUnknownEventPayload {
6336
6336
  }
6337
6337
  };
6338
6338
 
6339
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/contract/contract.js
6339
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/contract/contract.js
6340
6340
  var BN_05 = BigInt(0);
6341
6341
  function canCall(value) {
6342
6342
  return value && typeof value.call === "function";
@@ -6371,7 +6371,7 @@ var PreparedTopicFilter = class {
6371
6371
  }
6372
6372
  const runner = getRunner(contract.runner, "resolveName");
6373
6373
  const resolver = canResolve(runner) ? runner : null;
6374
- this.#filter = async function() {
6374
+ this.#filter = (async function() {
6375
6375
  const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => {
6376
6376
  const arg = args[index];
6377
6377
  if (arg == null) {
@@ -6388,7 +6388,7 @@ var PreparedTopicFilter = class {
6388
6388
  });
6389
6389
  }));
6390
6390
  return contract.interface.encodeFilterTopics(fragment, resolvedArgs);
6391
- }();
6391
+ })();
6392
6392
  }
6393
6393
  getTopicFilter() {
6394
6394
  return this.#filter;
@@ -7213,7 +7213,7 @@ function _ContractBase() {
7213
7213
  var Contract = class extends _ContractBase() {
7214
7214
  };
7215
7215
 
7216
- // ../../node_modules/.pnpm/ethers@6.14.4_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/contract/factory.js
7216
+ // ../../node_modules/.pnpm/ethers@6.15.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/contract/factory.js
7217
7217
  var ContractFactory = class _ContractFactory {
7218
7218
  /**
7219
7219
  * The Contract Interface.
@@ -7316,7 +7316,7 @@ var ContractFactory = class _ContractFactory {
7316
7316
  }
7317
7317
  };
7318
7318
 
7319
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-core@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-core/dist/esm/ethers-contracts/factories/Implementation__factory.js
7319
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-core@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-core/dist/esm/ethers-contracts/factories/Implementation__factory.js
7320
7320
  var _abi = [
7321
7321
  {
7322
7322
  anonymous: false,
@@ -8386,10 +8386,10 @@ var Implementation__factory = class extends ContractFactory {
8386
8386
  }
8387
8387
  };
8388
8388
 
8389
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-core@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-core/dist/esm/index.js
8389
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-core@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-core/dist/esm/index.js
8390
8390
  registerProtocol(_platform, "WormholeCore", EvmWormholeCore);
8391
8391
 
8392
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/tokenBridge.js
8392
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/tokenBridge.js
8393
8393
  var EvmTokenBridge = class _EvmTokenBridge {
8394
8394
  network;
8395
8395
  chain;
@@ -8527,7 +8527,7 @@ var EvmTokenBridge = class _EvmTokenBridge {
8527
8527
  }
8528
8528
  };
8529
8529
 
8530
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/automaticTokenBridge.js
8530
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/automaticTokenBridge.js
8531
8531
  import { isNative as isNative2, serialize as serialize3, toNative as toNative2, nativeChainIds as nativeChainIds3, toChainId as toChainId2 } from "@wormhole-foundation/sdk-connect";
8532
8532
  import { EvmAddress as EvmAddress3, EvmPlatform as EvmPlatform3, EvmUnsignedTransaction as EvmUnsignedTransaction3, WETH_CONTRACTS as WETH_CONTRACTS2, addChainId as addChainId3, addFrom as addFrom3 } from "@wormhole-foundation/sdk-evm";
8533
8533
  var EvmAutomaticTokenBridge = class _EvmAutomaticTokenBridge {
@@ -8635,16 +8635,16 @@ var EvmAutomaticTokenBridge = class _EvmAutomaticTokenBridge {
8635
8635
  }
8636
8636
  };
8637
8637
 
8638
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/executorTokenBridge.js
8638
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/executorTokenBridge.js
8639
8639
  import { nativeChainIds as nativeChainIds4, toChainId as toChainId3, signedQuoteLayout as signedQuoteLayout2, isNative as isNative4, serializeLayout, serialize as serialize5, contracts } from "@wormhole-foundation/sdk-connect";
8640
8640
  import { EvmAddress as EvmAddress4, EvmPlatform as EvmPlatform4, EvmUnsignedTransaction as EvmUnsignedTransaction4, addChainId as addChainId4, addFrom as addFrom4 } from "@wormhole-foundation/sdk-evm";
8641
8641
 
8642
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.2.0/node_modules/@wormhole-foundation/sdk-base/dist/esm/utils/array.js
8642
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.4.3/node_modules/@wormhole-foundation/sdk-base/dist/esm/utils/array.js
8643
8643
  var range = (length) => [...Array(length).keys()];
8644
8644
  var column = (tupArr, index) => tupArr.map((tuple) => tuple[index]);
8645
8645
  var zip = (arr) => range(arr[0].length).map((col) => range(arr.length).map((row) => arr[row][col]));
8646
8646
 
8647
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.2.0/node_modules/@wormhole-foundation/sdk-base/dist/esm/utils/mapping.js
8647
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.4.3/node_modules/@wormhole-foundation/sdk-base/dist/esm/utils/mapping.js
8648
8648
  function isMappableKey(key) {
8649
8649
  return ["string", "number", "symbol", "bigint", "boolean"].includes(typeof key);
8650
8650
  }
@@ -8710,7 +8710,7 @@ var toMapping = (mapping, shape) => {
8710
8710
  };
8711
8711
  function constMap(mappingEntries, shape) {
8712
8712
  const toConstMap = (mapping) => {
8713
- const genericMappingFunc = (...args) => args.reduce((subMapping, key) => subMapping ? subMapping[key.toString()] ?? void 0 : void 0, mapping);
8713
+ const genericMappingFunc = ((...args) => args.reduce((subMapping, key) => subMapping ? subMapping[key.toString()] ?? void 0 : void 0, mapping));
8714
8714
  return Object.assign(genericMappingFunc, {
8715
8715
  has: (...args) => genericMappingFunc(...args) !== void 0,
8716
8716
  get: (...args) => genericMappingFunc(...args),
@@ -8720,7 +8720,7 @@ function constMap(mappingEntries, shape) {
8720
8720
  return toConstMap(toMapping(mappingEntries, shape));
8721
8721
  }
8722
8722
 
8723
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.2.0/node_modules/@wormhole-foundation/sdk-base/dist/esm/utils/misc.js
8723
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.4.3/node_modules/@wormhole-foundation/sdk-base/dist/esm/utils/misc.js
8724
8724
  function lazyInstantiate(factory) {
8725
8725
  let instance = null;
8726
8726
  return () => {
@@ -8738,7 +8738,7 @@ function throws(fn) {
8738
8738
  }
8739
8739
  }
8740
8740
 
8741
- // ../../node_modules/.pnpm/binary-layout@1.2.2/node_modules/binary-layout/dist/index.mjs
8741
+ // ../../node_modules/.pnpm/binary-layout@1.3.1/node_modules/binary-layout/dist/index.mjs
8742
8742
  var binaryLiterals = ["int", "uint", "bytes", "array", "switch"];
8743
8743
  var defaultEndianness = "big";
8744
8744
  var numberMaxSize = 6;
@@ -9612,7 +9612,7 @@ function bitsetItem(bitnames, size) {
9612
9612
  };
9613
9613
  }
9614
9614
 
9615
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.2.0/node_modules/@wormhole-foundation/sdk-base/dist/esm/utils/encoding.js
9615
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.4.3/node_modules/@wormhole-foundation/sdk-base/dist/esm/utils/encoding.js
9616
9616
  var encoding_exports = {};
9617
9617
  __export(encoding_exports, {
9618
9618
  b58: () => b58,
@@ -9999,7 +9999,7 @@ function genBech32(encoding2) {
9999
9999
  }
10000
10000
  var bech32 = /* @__PURE__ */ genBech32("bech32");
10001
10001
 
10002
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.2.0/node_modules/@wormhole-foundation/sdk-base/dist/esm/utils/encoding.js
10002
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.4.3/node_modules/@wormhole-foundation/sdk-base/dist/esm/utils/encoding.js
10003
10003
  var stripPrefix = (prefix, str) => str.startsWith(prefix) ? str.slice(prefix.length) : str;
10004
10004
  var isHexRegex = /^(?:0x)?[0-9a-fA-F]+$/;
10005
10005
  var hex = {
@@ -10095,7 +10095,7 @@ var bytes2 = {
10095
10095
  }
10096
10096
  };
10097
10097
 
10098
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.2.0/node_modules/@wormhole-foundation/sdk-base/dist/esm/constants/chains.js
10098
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.4.3/node_modules/@wormhole-foundation/sdk-base/dist/esm/constants/chains.js
10099
10099
  var chainIdAndChainEntries = [
10100
10100
  //Unlike the old sdk, we are not including an "Unset" chain with chainId 0 here because:
10101
10101
  // * no other types would be associated with it (such as contracts or a platform)
@@ -10139,6 +10139,7 @@ var chainIdAndChainEntries = [
10139
10139
  [52, "Sonic"],
10140
10140
  [53, "Converge"],
10141
10141
  [55, "Plume"],
10142
+ [57, "XRPLEVM"],
10142
10143
  [3104, "Wormchain"],
10143
10144
  [4e3, "Cosmoshub"],
10144
10145
  [4001, "Evmos"],
@@ -10180,7 +10181,7 @@ var toChain2 = (chain2) => {
10180
10181
  throw Error(`Cannot convert to Chain: ${chain2}`);
10181
10182
  };
10182
10183
 
10183
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.2.0/node_modules/@wormhole-foundation/sdk-base/dist/esm/constants/platforms.js
10184
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.4.3/node_modules/@wormhole-foundation/sdk-base/dist/esm/constants/platforms.js
10184
10185
  var platformAndChainsEntries = [
10185
10186
  [
10186
10187
  "Evm",
@@ -10216,7 +10217,8 @@ var platformAndChainsEntries = [
10216
10217
  "Mezo",
10217
10218
  "Sonic",
10218
10219
  "Converge",
10219
- "Plume"
10220
+ "Plume",
10221
+ "XRPLEVM"
10220
10222
  ]
10221
10223
  ],
10222
10224
  [
@@ -10293,7 +10295,7 @@ var platformAddressFormatEntries = [
10293
10295
  ];
10294
10296
  var platformToAddressFormat = constMap(platformAddressFormatEntries);
10295
10297
 
10296
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.2.0/node_modules/@wormhole-foundation/sdk-base/dist/esm/constants/tbtc.js
10298
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-base@3.4.3/node_modules/@wormhole-foundation/sdk-base/dist/esm/constants/tbtc.js
10297
10299
  var tbtc_exports = {};
10298
10300
  __export(tbtc_exports, {
10299
10301
  tbtcTokens: () => tbtcTokens
@@ -11276,12 +11278,27 @@ var HMAC = class extends Hash2 {
11276
11278
  var hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
11277
11279
  hmac.create = (hash, key) => new HMAC(hash, key);
11278
11280
 
11279
- // ../../node_modules/.pnpm/@noble+curves@1.9.4/node_modules/@noble/curves/esm/utils.js
11281
+ // ../../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/utils.js
11280
11282
  var _0n3 = /* @__PURE__ */ BigInt(0);
11281
11283
  var _1n3 = /* @__PURE__ */ BigInt(1);
11282
- function abool(title, value) {
11283
- if (typeof value !== "boolean")
11284
- throw new Error(title + " boolean expected, got " + value);
11284
+ function _abool2(value, title = "") {
11285
+ if (typeof value !== "boolean") {
11286
+ const prefix = title && `"${title}"`;
11287
+ throw new Error(prefix + "expected boolean, got type=" + typeof value);
11288
+ }
11289
+ return value;
11290
+ }
11291
+ function _abytes2(value, length, title = "") {
11292
+ const bytes3 = isBytes2(value);
11293
+ const len = value?.length;
11294
+ const needsLen = length !== void 0;
11295
+ if (!bytes3 || needsLen && len !== length) {
11296
+ const prefix = title && `"${title}" `;
11297
+ const ofLen = needsLen ? ` of length ${length}` : "";
11298
+ const got = bytes3 ? `length=${len}` : `type=${typeof value}`;
11299
+ throw new Error(prefix + "expected Uint8Array" + ofLen + ", got " + got);
11300
+ }
11301
+ return value;
11285
11302
  }
11286
11303
  function numberToHexUnpadded(num) {
11287
11304
  const hex2 = num.toString(16);
@@ -11414,7 +11431,7 @@ function memoized(fn) {
11414
11431
  };
11415
11432
  }
11416
11433
 
11417
- // ../../node_modules/.pnpm/@noble+curves@1.9.4/node_modules/@noble/curves/esm/abstract/modular.js
11434
+ // ../../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/modular.js
11418
11435
  var _0n4 = BigInt(0);
11419
11436
  var _1n4 = BigInt(1);
11420
11437
  var _2n3 = /* @__PURE__ */ BigInt(2);
@@ -11646,7 +11663,7 @@ function Field(ORDER, bitLenOrOpts, isLE3 = false, opts = {}) {
11646
11663
  throw new Error("invalid field: expected ORDER > 0, got " + ORDER);
11647
11664
  let _nbitLength = void 0;
11648
11665
  let _sqrt = void 0;
11649
- let modOnDecode = false;
11666
+ let modFromBytes = false;
11650
11667
  let allowedLengths = void 0;
11651
11668
  if (typeof bitLenOrOpts === "object" && bitLenOrOpts != null) {
11652
11669
  if (opts.sqrt || isLE3)
@@ -11658,8 +11675,8 @@ function Field(ORDER, bitLenOrOpts, isLE3 = false, opts = {}) {
11658
11675
  _sqrt = _opts.sqrt;
11659
11676
  if (typeof _opts.isLE === "boolean")
11660
11677
  isLE3 = _opts.isLE;
11661
- if (typeof _opts.modOnDecode === "boolean")
11662
- modOnDecode = _opts.modOnDecode;
11678
+ if (typeof _opts.modFromBytes === "boolean")
11679
+ modFromBytes = _opts.modFromBytes;
11663
11680
  allowedLengths = _opts.allowedLengths;
11664
11681
  } else {
11665
11682
  if (typeof bitLenOrOpts === "number")
@@ -11722,7 +11739,7 @@ function Field(ORDER, bitLenOrOpts, isLE3 = false, opts = {}) {
11722
11739
  if (bytes3.length !== BYTES)
11723
11740
  throw new Error("Field.fromBytes: expected " + BYTES + " bytes, got " + bytes3.length);
11724
11741
  let scalar = isLE3 ? bytesToNumberLE(bytes3) : bytesToNumberBE(bytes3);
11725
- if (modOnDecode)
11742
+ if (modFromBytes)
11726
11743
  scalar = mod(scalar, ORDER);
11727
11744
  if (!skipValidation) {
11728
11745
  if (!f.isValid(scalar))
@@ -11759,7 +11776,7 @@ function mapHashToField(key, fieldOrder, isLE3 = false) {
11759
11776
  return isLE3 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
11760
11777
  }
11761
11778
 
11762
- // ../../node_modules/.pnpm/@noble+curves@1.9.4/node_modules/@noble/curves/esm/abstract/curve.js
11779
+ // ../../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/curve.js
11763
11780
  var _0n5 = BigInt(0);
11764
11781
  var _1n5 = BigInt(1);
11765
11782
  function negateCt(condition, item) {
@@ -12005,17 +12022,19 @@ function pippenger(c, fieldN, points, scalars) {
12005
12022
  }
12006
12023
  return sum;
12007
12024
  }
12008
- function createField(order, field) {
12025
+ function createField(order, field, isLE3) {
12009
12026
  if (field) {
12010
12027
  if (field.ORDER !== order)
12011
12028
  throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
12012
12029
  validateField(field);
12013
12030
  return field;
12014
12031
  } else {
12015
- return Field(order);
12032
+ return Field(order, { isLE: isLE3 });
12016
12033
  }
12017
12034
  }
12018
- function _createCurveFields(type, CURVE, curveOpts = {}) {
12035
+ function _createCurveFields(type, CURVE, curveOpts = {}, FpFnLE) {
12036
+ if (FpFnLE === void 0)
12037
+ FpFnLE = type === "edwards";
12019
12038
  if (!CURVE || typeof CURVE !== "object")
12020
12039
  throw new Error(`expected valid ${type} CURVE object`);
12021
12040
  for (const p of ["p", "n", "h"]) {
@@ -12023,18 +12042,19 @@ function _createCurveFields(type, CURVE, curveOpts = {}) {
12023
12042
  if (!(typeof val === "bigint" && val > _0n5))
12024
12043
  throw new Error(`CURVE.${p} must be positive bigint`);
12025
12044
  }
12026
- const Fp = createField(CURVE.p, curveOpts.Fp);
12027
- const Fn = createField(CURVE.n, curveOpts.Fn);
12045
+ const Fp = createField(CURVE.p, curveOpts.Fp, FpFnLE);
12046
+ const Fn = createField(CURVE.n, curveOpts.Fn, FpFnLE);
12028
12047
  const _b = type === "weierstrass" ? "b" : "d";
12029
12048
  const params = ["Gx", "Gy", "a", _b];
12030
12049
  for (const p of params) {
12031
12050
  if (!Fp.isValid(CURVE[p]))
12032
12051
  throw new Error(`CURVE.${p} must be valid field element of CURVE.Fp`);
12033
12052
  }
12034
- return { Fp, Fn };
12053
+ CURVE = Object.freeze(Object.assign({}, CURVE));
12054
+ return { CURVE, Fp, Fn };
12035
12055
  }
12036
12056
 
12037
- // ../../node_modules/.pnpm/@noble+curves@1.9.4/node_modules/@noble/curves/esm/abstract/weierstrass.js
12057
+ // ../../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/weierstrass.js
12038
12058
  var divNearest = (num, den) => (num + (num >= 0 ? den : -den) / _2n4) / den;
12039
12059
  function _splitEndoScalar(k, basis, n2) {
12040
12060
  const [[a1, b1], [a2, b2]] = basis;
@@ -12054,11 +12074,21 @@ function _splitEndoScalar(k, basis, n2) {
12054
12074
  }
12055
12075
  return { k1neg, k1, k2neg, k2 };
12056
12076
  }
12057
- function validateSigVerOpts(opts) {
12058
- if (opts.lowS !== void 0)
12059
- abool("lowS", opts.lowS);
12060
- if (opts.prehash !== void 0)
12061
- abool("prehash", opts.prehash);
12077
+ function validateSigFormat(format) {
12078
+ if (!["compact", "recovered", "der"].includes(format))
12079
+ throw new Error('Signature format must be "compact", "recovered", or "der"');
12080
+ return format;
12081
+ }
12082
+ function validateSigOpts(opts, def) {
12083
+ const optsn = {};
12084
+ for (let optName of Object.keys(def)) {
12085
+ optsn[optName] = opts[optName] === void 0 ? def[optName] : opts[optName];
12086
+ }
12087
+ _abool2(optsn.lowS, "lowS");
12088
+ _abool2(optsn.prehash, "prehash");
12089
+ if (optsn.format !== void 0)
12090
+ validateSigFormat(optsn.format);
12091
+ return optsn;
12062
12092
  }
12063
12093
  var DERErr = class extends Error {
12064
12094
  constructor(m = "") {
@@ -12170,14 +12200,6 @@ var _1n6 = BigInt(1);
12170
12200
  var _2n4 = BigInt(2);
12171
12201
  var _3n2 = BigInt(3);
12172
12202
  var _4n2 = BigInt(4);
12173
- function _legacyHelperEquat(Fp, a, b2) {
12174
- function weierstrassEquation(x) {
12175
- const x2 = Fp.sqr(x);
12176
- const x3 = Fp.mul(x2, x);
12177
- return Fp.add(Fp.add(x3, Fp.mul(x, a)), b2);
12178
- }
12179
- return weierstrassEquation;
12180
- }
12181
12203
  function _normFnElement(Fn, key) {
12182
12204
  const { BYTES: expected } = Fn;
12183
12205
  let num;
@@ -12195,10 +12217,12 @@ function _normFnElement(Fn, key) {
12195
12217
  throw new Error("invalid private key: out of range [1..N-1]");
12196
12218
  return num;
12197
12219
  }
12198
- function weierstrassN(CURVE, curveOpts = {}) {
12199
- const { Fp, Fn } = _createCurveFields("weierstrass", CURVE, curveOpts);
12220
+ function weierstrassN(params, extraOpts = {}) {
12221
+ const validated = _createCurveFields("weierstrass", params, extraOpts);
12222
+ const { Fp, Fn } = validated;
12223
+ let CURVE = validated.CURVE;
12200
12224
  const { h: cofactor, n: CURVE_ORDER } = CURVE;
12201
- _validateObject(curveOpts, {}, {
12225
+ _validateObject(extraOpts, {}, {
12202
12226
  allowInfinityPoint: "boolean",
12203
12227
  clearCofactor: "function",
12204
12228
  isTorsionFree: "function",
@@ -12207,12 +12231,13 @@ function weierstrassN(CURVE, curveOpts = {}) {
12207
12231
  endo: "object",
12208
12232
  wrapPrivateKey: "boolean"
12209
12233
  });
12210
- const { endo } = curveOpts;
12234
+ const { endo } = extraOpts;
12211
12235
  if (endo) {
12212
12236
  if (!Fp.is0(CURVE.a) || typeof endo.beta !== "bigint" || !Array.isArray(endo.basises)) {
12213
12237
  throw new Error('invalid endo: expected "beta": bigint and "basises": array');
12214
12238
  }
12215
12239
  }
12240
+ const lengths = getWLengths(Fp, Fn);
12216
12241
  function assertCompressionIsSupported() {
12217
12242
  if (!Fp.isOdd)
12218
12243
  throw new Error("compression is not supported: Field does not have .isOdd()");
@@ -12220,7 +12245,7 @@ function weierstrassN(CURVE, curveOpts = {}) {
12220
12245
  function pointToBytes(_c, point, isCompressed) {
12221
12246
  const { x, y } = point.toAffine();
12222
12247
  const bx = Fp.toBytes(x);
12223
- abool("isCompressed", isCompressed);
12248
+ _abool2(isCompressed, "isCompressed");
12224
12249
  if (isCompressed) {
12225
12250
  assertCompressionIsSupported();
12226
12251
  const hasEvenY = !Fp.isOdd(y);
@@ -12230,14 +12255,12 @@ function weierstrassN(CURVE, curveOpts = {}) {
12230
12255
  }
12231
12256
  }
12232
12257
  function pointFromBytes(bytes3) {
12233
- abytes2(bytes3);
12234
- const L = Fp.BYTES;
12235
- const LC = L + 1;
12236
- const LU = 2 * L + 1;
12258
+ _abytes2(bytes3, void 0, "Point");
12259
+ const { publicKey: comp, publicKeyUncompressed: uncomp } = lengths;
12237
12260
  const length = bytes3.length;
12238
12261
  const head = bytes3[0];
12239
12262
  const tail = bytes3.subarray(1);
12240
- if (length === LC && (head === 2 || head === 3)) {
12263
+ if (length === comp && (head === 2 || head === 3)) {
12241
12264
  const x = Fp.fromBytes(tail);
12242
12265
  if (!Fp.isValid(x))
12243
12266
  throw new Error("bad point: is not on curve, wrong x");
@@ -12255,19 +12278,24 @@ function weierstrassN(CURVE, curveOpts = {}) {
12255
12278
  if (isHeadOdd !== isYOdd)
12256
12279
  y = Fp.neg(y);
12257
12280
  return { x, y };
12258
- } else if (length === LU && head === 4) {
12259
- const x = Fp.fromBytes(tail.subarray(L * 0, L * 1));
12260
- const y = Fp.fromBytes(tail.subarray(L * 1, L * 2));
12281
+ } else if (length === uncomp && head === 4) {
12282
+ const L = Fp.BYTES;
12283
+ const x = Fp.fromBytes(tail.subarray(0, L));
12284
+ const y = Fp.fromBytes(tail.subarray(L, L * 2));
12261
12285
  if (!isValidXY(x, y))
12262
12286
  throw new Error("bad point: is not on curve");
12263
12287
  return { x, y };
12264
12288
  } else {
12265
- throw new Error(`bad point: got length ${length}, expected compressed=${LC} or uncompressed=${LU}`);
12289
+ throw new Error(`bad point: got length ${length}, expected compressed=${comp} or uncompressed=${uncomp}`);
12266
12290
  }
12267
12291
  }
12268
- const toBytes3 = curveOpts.toBytes || pointToBytes;
12269
- const fromBytes = curveOpts.fromBytes || pointFromBytes;
12270
- const weierstrassEquation = _legacyHelperEquat(Fp, CURVE.a, CURVE.b);
12292
+ const encodePoint = extraOpts.toBytes || pointToBytes;
12293
+ const decodePoint = extraOpts.fromBytes || pointFromBytes;
12294
+ function weierstrassEquation(x) {
12295
+ const x2 = Fp.sqr(x);
12296
+ const x3 = Fp.mul(x2, x);
12297
+ return Fp.add(Fp.add(x3, Fp.mul(x, CURVE.a)), CURVE.b);
12298
+ }
12271
12299
  function isValidXY(x, y) {
12272
12300
  const left = Fp.sqr(y);
12273
12301
  const right = weierstrassEquation(x);
@@ -12311,7 +12339,7 @@ function weierstrassN(CURVE, curveOpts = {}) {
12311
12339
  });
12312
12340
  const assertValidMemo = memoized((p) => {
12313
12341
  if (p.is0()) {
12314
- if (curveOpts.allowInfinityPoint && !Fp.is0(p.Y))
12342
+ if (extraOpts.allowInfinityPoint && !Fp.is0(p.Y))
12315
12343
  return;
12316
12344
  throw new Error("bad point: ZERO");
12317
12345
  }
@@ -12338,6 +12366,9 @@ function weierstrassN(CURVE, curveOpts = {}) {
12338
12366
  this.Z = acoord("z", Z);
12339
12367
  Object.freeze(this);
12340
12368
  }
12369
+ static CURVE() {
12370
+ return CURVE;
12371
+ }
12341
12372
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
12342
12373
  static fromAffine(p) {
12343
12374
  const { x, y } = p || {};
@@ -12349,45 +12380,19 @@ function weierstrassN(CURVE, curveOpts = {}) {
12349
12380
  return Point.ZERO;
12350
12381
  return new Point(x, y, Fp.ONE);
12351
12382
  }
12352
- get x() {
12353
- return this.toAffine().x;
12354
- }
12355
- get y() {
12356
- return this.toAffine().y;
12357
- }
12358
- // TODO: remove
12359
- get px() {
12360
- return this.X;
12361
- }
12362
- get py() {
12363
- return this.X;
12364
- }
12365
- get pz() {
12366
- return this.Z;
12367
- }
12368
- static normalizeZ(points) {
12369
- return normalizeZ(Point, points);
12370
- }
12371
12383
  static fromBytes(bytes3) {
12372
- abytes2(bytes3);
12373
- return Point.fromHex(bytes3);
12374
- }
12375
- /** Converts hash string or Uint8Array to Point. */
12376
- static fromHex(hex2) {
12377
- const P = Point.fromAffine(fromBytes(ensureBytes("pointHex", hex2)));
12384
+ const P = Point.fromAffine(decodePoint(_abytes2(bytes3, void 0, "point")));
12378
12385
  P.assertValidity();
12379
12386
  return P;
12380
12387
  }
12381
- /** Multiplies generator point by privateKey. */
12382
- static fromPrivateKey(privateKey) {
12383
- return Point.BASE.multiply(_normFnElement(Fn, privateKey));
12388
+ static fromHex(hex2) {
12389
+ return Point.fromBytes(ensureBytes("pointHex", hex2));
12384
12390
  }
12385
- // TODO: remove
12386
- static msm(points, scalars) {
12387
- return pippenger(Point, Fn, points, scalars);
12391
+ get x() {
12392
+ return this.toAffine().x;
12388
12393
  }
12389
- _setWindowSize(windowSize) {
12390
- this.precompute(windowSize);
12394
+ get y() {
12395
+ return this.toAffine().y;
12391
12396
  }
12392
12397
  /**
12393
12398
  *
@@ -12536,7 +12541,7 @@ function weierstrassN(CURVE, curveOpts = {}) {
12536
12541
  * @returns New point
12537
12542
  */
12538
12543
  multiply(scalar) {
12539
- const { endo: endo2 } = curveOpts;
12544
+ const { endo: endo2 } = extraOpts;
12540
12545
  if (!Fn.isValidNot0(scalar))
12541
12546
  throw new Error("invalid scalar: out of range");
12542
12547
  let point, fake;
@@ -12560,7 +12565,7 @@ function weierstrassN(CURVE, curveOpts = {}) {
12560
12565
  * an exposed secret key e.g. sig verification, which works over *public* keys.
12561
12566
  */
12562
12567
  multiplyUnsafe(sc) {
12563
- const { endo: endo2 } = curveOpts;
12568
+ const { endo: endo2 } = extraOpts;
12564
12569
  const p = this;
12565
12570
  if (!Fn.isValid(sc))
12566
12571
  throw new Error("invalid scalar: out of range");
@@ -12594,7 +12599,7 @@ function weierstrassN(CURVE, curveOpts = {}) {
12594
12599
  * Always torsion-free for cofactor=1 curves.
12595
12600
  */
12596
12601
  isTorsionFree() {
12597
- const { isTorsionFree } = curveOpts;
12602
+ const { isTorsionFree } = extraOpts;
12598
12603
  if (cofactor === _1n6)
12599
12604
  return true;
12600
12605
  if (isTorsionFree)
@@ -12602,7 +12607,7 @@ function weierstrassN(CURVE, curveOpts = {}) {
12602
12607
  return wnaf.unsafe(this, CURVE_ORDER).is0();
12603
12608
  }
12604
12609
  clearCofactor() {
12605
- const { clearCofactor } = curveOpts;
12610
+ const { clearCofactor } = extraOpts;
12606
12611
  if (cofactor === _1n6)
12607
12612
  return this;
12608
12613
  if (clearCofactor)
@@ -12613,13 +12618,9 @@ function weierstrassN(CURVE, curveOpts = {}) {
12613
12618
  return this.multiplyUnsafe(cofactor).is0();
12614
12619
  }
12615
12620
  toBytes(isCompressed = true) {
12616
- abool("isCompressed", isCompressed);
12621
+ _abool2(isCompressed, "isCompressed");
12617
12622
  this.assertValidity();
12618
- return toBytes3(Point, this, isCompressed);
12619
- }
12620
- /** @deprecated use `toBytes` */
12621
- toRawBytes(isCompressed = true) {
12622
- return this.toBytes(isCompressed);
12623
+ return encodePoint(Point, this, isCompressed);
12623
12624
  }
12624
12625
  toHex(isCompressed = true) {
12625
12626
  return bytesToHex(this.toBytes(isCompressed));
@@ -12627,18 +12628,121 @@ function weierstrassN(CURVE, curveOpts = {}) {
12627
12628
  toString() {
12628
12629
  return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
12629
12630
  }
12631
+ // TODO: remove
12632
+ get px() {
12633
+ return this.X;
12634
+ }
12635
+ get py() {
12636
+ return this.X;
12637
+ }
12638
+ get pz() {
12639
+ return this.Z;
12640
+ }
12641
+ toRawBytes(isCompressed = true) {
12642
+ return this.toBytes(isCompressed);
12643
+ }
12644
+ _setWindowSize(windowSize) {
12645
+ this.precompute(windowSize);
12646
+ }
12647
+ static normalizeZ(points) {
12648
+ return normalizeZ(Point, points);
12649
+ }
12650
+ static msm(points, scalars) {
12651
+ return pippenger(Point, Fn, points, scalars);
12652
+ }
12653
+ static fromPrivateKey(privateKey) {
12654
+ return Point.BASE.multiply(_normFnElement(Fn, privateKey));
12655
+ }
12630
12656
  }
12631
12657
  Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);
12632
12658
  Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO);
12633
12659
  Point.Fp = Fp;
12634
12660
  Point.Fn = Fn;
12635
12661
  const bits = Fn.BITS;
12636
- const wnaf = new wNAF(Point, curveOpts.endo ? Math.ceil(bits / 2) : bits);
12662
+ const wnaf = new wNAF(Point, extraOpts.endo ? Math.ceil(bits / 2) : bits);
12663
+ Point.BASE.precompute(8);
12637
12664
  return Point;
12638
12665
  }
12639
12666
  function pprefix(hasEvenY) {
12640
12667
  return Uint8Array.of(hasEvenY ? 2 : 3);
12641
12668
  }
12669
+ function getWLengths(Fp, Fn) {
12670
+ return {
12671
+ secretKey: Fn.BYTES,
12672
+ publicKey: 1 + Fp.BYTES,
12673
+ publicKeyUncompressed: 1 + 2 * Fp.BYTES,
12674
+ publicKeyHasPrefix: true,
12675
+ signature: 2 * Fn.BYTES
12676
+ };
12677
+ }
12678
+ function ecdh(Point, ecdhOpts = {}) {
12679
+ const { Fn } = Point;
12680
+ const randomBytes_ = ecdhOpts.randomBytes || randomBytes;
12681
+ const lengths = Object.assign(getWLengths(Point.Fp, Fn), { seed: getMinHashLength(Fn.ORDER) });
12682
+ function isValidSecretKey(secretKey) {
12683
+ try {
12684
+ return !!_normFnElement(Fn, secretKey);
12685
+ } catch (error) {
12686
+ return false;
12687
+ }
12688
+ }
12689
+ function isValidPublicKey(publicKey, isCompressed) {
12690
+ const { publicKey: comp, publicKeyUncompressed } = lengths;
12691
+ try {
12692
+ const l = publicKey.length;
12693
+ if (isCompressed === true && l !== comp)
12694
+ return false;
12695
+ if (isCompressed === false && l !== publicKeyUncompressed)
12696
+ return false;
12697
+ return !!Point.fromBytes(publicKey);
12698
+ } catch (error) {
12699
+ return false;
12700
+ }
12701
+ }
12702
+ function randomSecretKey(seed = randomBytes_(lengths.seed)) {
12703
+ return mapHashToField(_abytes2(seed, lengths.seed, "seed"), Fn.ORDER);
12704
+ }
12705
+ function getPublicKey(secretKey, isCompressed = true) {
12706
+ return Point.BASE.multiply(_normFnElement(Fn, secretKey)).toBytes(isCompressed);
12707
+ }
12708
+ function keygen(seed) {
12709
+ const secretKey = randomSecretKey(seed);
12710
+ return { secretKey, publicKey: getPublicKey(secretKey) };
12711
+ }
12712
+ function isProbPub(item) {
12713
+ if (typeof item === "bigint")
12714
+ return false;
12715
+ if (item instanceof Point)
12716
+ return true;
12717
+ const { secretKey, publicKey, publicKeyUncompressed } = lengths;
12718
+ if (Fn.allowedLengths || secretKey === publicKey)
12719
+ return void 0;
12720
+ const l = ensureBytes("key", item).length;
12721
+ return l === publicKey || l === publicKeyUncompressed;
12722
+ }
12723
+ function getSharedSecret(secretKeyA, publicKeyB, isCompressed = true) {
12724
+ if (isProbPub(secretKeyA) === true)
12725
+ throw new Error("first arg must be private key");
12726
+ if (isProbPub(publicKeyB) === false)
12727
+ throw new Error("second arg must be public key");
12728
+ const s = _normFnElement(Fn, secretKeyA);
12729
+ const b2 = Point.fromHex(publicKeyB);
12730
+ return b2.multiply(s).toBytes(isCompressed);
12731
+ }
12732
+ const utils = {
12733
+ isValidSecretKey,
12734
+ isValidPublicKey,
12735
+ randomSecretKey,
12736
+ // TODO: remove
12737
+ isValidPrivateKey: isValidSecretKey,
12738
+ randomPrivateKey: randomSecretKey,
12739
+ normPrivateKeyToScalar: (key) => _normFnElement(Fn, key),
12740
+ precompute(windowSize = 8, point = Point.BASE) {
12741
+ return point.precompute(windowSize, false);
12742
+ }
12743
+ };
12744
+ return Object.freeze({ getPublicKey, getSharedSecret, keygen, Point, utils, lengths });
12745
+ }
12642
12746
  function ecdsa(Point, hash, ecdsaOpts = {}) {
12643
12747
  ahash(hash);
12644
12748
  _validateObject(ecdsaOpts, {}, {
@@ -12648,53 +12752,58 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
12648
12752
  bits2int: "function",
12649
12753
  bits2int_modN: "function"
12650
12754
  });
12651
- const randomBytes_ = ecdsaOpts.randomBytes || randomBytes;
12652
- const hmac_ = ecdsaOpts.hmac || ((key, ...msgs) => hmac(hash, key, concatBytes(...msgs)));
12755
+ const randomBytes2 = ecdsaOpts.randomBytes || randomBytes;
12756
+ const hmac2 = ecdsaOpts.hmac || ((key, ...msgs) => hmac(hash, key, concatBytes(...msgs)));
12653
12757
  const { Fp, Fn } = Point;
12654
12758
  const { ORDER: CURVE_ORDER, BITS: fnBits } = Fn;
12655
- const seedLen = getMinHashLength(CURVE_ORDER);
12656
- const lengths = {
12657
- secret: Fn.BYTES,
12658
- public: 1 + Fp.BYTES,
12659
- publicUncompressed: 1 + 2 * Fp.BYTES,
12660
- signature: 2 * Fn.BYTES,
12661
- seed: seedLen
12759
+ const { keygen, getPublicKey, getSharedSecret, utils, lengths } = ecdh(Point, ecdsaOpts);
12760
+ const defaultSigOpts = {
12761
+ prehash: false,
12762
+ lowS: typeof ecdsaOpts.lowS === "boolean" ? ecdsaOpts.lowS : false,
12763
+ format: void 0,
12764
+ //'compact' as ECDSASigFormat,
12765
+ extraEntropy: false
12662
12766
  };
12767
+ const defaultSigOpts_format = "compact";
12663
12768
  function isBiggerThanHalfOrder(number2) {
12664
12769
  const HALF = CURVE_ORDER >> _1n6;
12665
12770
  return number2 > HALF;
12666
12771
  }
12667
- function normalizeS(s) {
12668
- return isBiggerThanHalfOrder(s) ? Fn.neg(s) : s;
12669
- }
12670
- function aValidRS(title, num) {
12772
+ function validateRS(title, num) {
12671
12773
  if (!Fn.isValidNot0(num))
12672
- throw new Error(`invalid signature ${title}: out of range 1..CURVE.n`);
12774
+ throw new Error(`invalid signature ${title}: out of range 1..Point.Fn.ORDER`);
12775
+ return num;
12776
+ }
12777
+ function validateSigLength(bytes3, format) {
12778
+ validateSigFormat(format);
12779
+ const size = lengths.signature;
12780
+ const sizer = format === "compact" ? size : format === "recovered" ? size + 1 : void 0;
12781
+ return _abytes2(bytes3, sizer, `${format} signature`);
12673
12782
  }
12674
12783
  class Signature2 {
12675
12784
  constructor(r, s, recovery) {
12676
- aValidRS("r", r);
12677
- aValidRS("s", s);
12678
- this.r = r;
12679
- this.s = s;
12785
+ this.r = validateRS("r", r);
12786
+ this.s = validateRS("s", s);
12680
12787
  if (recovery != null)
12681
12788
  this.recovery = recovery;
12682
12789
  Object.freeze(this);
12683
12790
  }
12684
- static fromBytes(bytes3, format = "compact") {
12685
- if (format === "compact") {
12686
- const L = Fn.BYTES;
12687
- abytes2(bytes3, L * 2);
12688
- const r = bytes3.subarray(0, L);
12689
- const s = bytes3.subarray(L, L * 2);
12690
- return new Signature2(Fn.fromBytes(r), Fn.fromBytes(s));
12691
- }
12791
+ static fromBytes(bytes3, format = defaultSigOpts_format) {
12792
+ validateSigLength(bytes3, format);
12793
+ let recid;
12692
12794
  if (format === "der") {
12693
- abytes2(bytes3);
12694
- const { r, s } = DER.toSig(bytes3);
12695
- return new Signature2(r, s);
12795
+ const { r: r2, s: s2 } = DER.toSig(_abytes2(bytes3));
12796
+ return new Signature2(r2, s2);
12797
+ }
12798
+ if (format === "recovered") {
12799
+ recid = bytes3[0];
12800
+ format = "compact";
12801
+ bytes3 = bytes3.subarray(1);
12696
12802
  }
12697
- throw new Error("invalid format");
12803
+ const L = Fn.BYTES;
12804
+ const r = bytes3.subarray(0, L);
12805
+ const s = bytes3.subarray(L, L * 2);
12806
+ return new Signature2(Fn.fromBytes(r), Fn.fromBytes(s), recid);
12698
12807
  }
12699
12808
  static fromHex(hex2, format) {
12700
12809
  return this.fromBytes(hexToBytes(hex2), format);
@@ -12702,8 +12811,7 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
12702
12811
  addRecoveryBit(recovery) {
12703
12812
  return new Signature2(this.r, this.s, recovery);
12704
12813
  }
12705
- // ProjPointType<bigint>
12706
- recoverPublicKey(msgHash) {
12814
+ recoverPublicKey(messageHash) {
12707
12815
  const FIELD_ORDER = Fp.ORDER;
12708
12816
  const { r, s, recovery: rec } = this;
12709
12817
  if (rec == null || ![0, 1, 2, 3].includes(rec))
@@ -12715,9 +12823,9 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
12715
12823
  if (!Fp.isValid(radj))
12716
12824
  throw new Error("recovery id 2 or 3 invalid");
12717
12825
  const x = Fp.toBytes(radj);
12718
- const R = Point.fromHex(concatBytes(pprefix((rec & 1) === 0), x));
12826
+ const R = Point.fromBytes(concatBytes(pprefix((rec & 1) === 0), x));
12719
12827
  const ir = Fn.inv(radj);
12720
- const h = bits2int_modN(ensureBytes("msgHash", msgHash));
12828
+ const h = bits2int_modN(ensureBytes("msgHash", messageHash));
12721
12829
  const u1 = Fn.create(-h * ir);
12722
12830
  const u2 = Fn.create(s * ir);
12723
12831
  const Q = Point.BASE.multiplyUnsafe(u1).add(R.multiplyUnsafe(u2));
@@ -12730,15 +12838,18 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
12730
12838
  hasHighS() {
12731
12839
  return isBiggerThanHalfOrder(this.s);
12732
12840
  }
12733
- normalizeS() {
12734
- return this.hasHighS() ? new Signature2(this.r, Fn.neg(this.s), this.recovery) : this;
12735
- }
12736
- toBytes(format = "compact") {
12737
- if (format === "compact")
12738
- return concatBytes(Fn.toBytes(this.r), Fn.toBytes(this.s));
12841
+ toBytes(format = defaultSigOpts_format) {
12842
+ validateSigFormat(format);
12739
12843
  if (format === "der")
12740
12844
  return hexToBytes(DER.hexFromSig(this));
12741
- throw new Error("invalid format");
12845
+ const r = Fn.toBytes(this.r);
12846
+ const s = Fn.toBytes(this.s);
12847
+ if (format === "recovered") {
12848
+ if (this.recovery == null)
12849
+ throw new Error("recovery bit must be present");
12850
+ return concatBytes(Uint8Array.of(this.recovery), r, s);
12851
+ }
12852
+ return concatBytes(r, s);
12742
12853
  }
12743
12854
  toHex(format) {
12744
12855
  return bytesToHex(this.toBytes(format));
@@ -12752,6 +12863,9 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
12752
12863
  static fromDER(hex2) {
12753
12864
  return Signature2.fromBytes(ensureBytes("sig", hex2), "der");
12754
12865
  }
12866
+ normalizeS() {
12867
+ return this.hasHighS() ? new Signature2(this.r, Fn.neg(this.s), this.recovery) : this;
12868
+ }
12755
12869
  toDERRawBytes() {
12756
12870
  return this.toBytes("der");
12757
12871
  }
@@ -12765,70 +12879,14 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
12765
12879
  return bytesToHex(this.toBytes("compact"));
12766
12880
  }
12767
12881
  }
12768
- function isValidSecretKey(privateKey) {
12769
- try {
12770
- return !!_normFnElement(Fn, privateKey);
12771
- } catch (error) {
12772
- return false;
12773
- }
12774
- }
12775
- function isValidPublicKey(publicKey, isCompressed) {
12776
- try {
12777
- const l = publicKey.length;
12778
- if (isCompressed === true && l !== lengths.public)
12779
- return false;
12780
- if (isCompressed === false && l !== lengths.publicUncompressed)
12781
- return false;
12782
- return !!Point.fromBytes(publicKey);
12783
- } catch (error) {
12784
- return false;
12785
- }
12786
- }
12787
- function randomSecretKey(seed = randomBytes_(seedLen)) {
12788
- return mapHashToField(seed, CURVE_ORDER);
12789
- }
12790
- const utils = {
12791
- isValidSecretKey,
12792
- isValidPublicKey,
12793
- randomSecretKey,
12794
- // TODO: remove
12795
- isValidPrivateKey: isValidSecretKey,
12796
- randomPrivateKey: randomSecretKey,
12797
- normPrivateKeyToScalar: (key) => _normFnElement(Fn, key),
12798
- precompute(windowSize = 8, point = Point.BASE) {
12799
- return point.precompute(windowSize, false);
12800
- }
12801
- };
12802
- function getPublicKey(secretKey, isCompressed = true) {
12803
- return Point.BASE.multiply(_normFnElement(Fn, secretKey)).toBytes(isCompressed);
12804
- }
12805
- function isProbPub(item) {
12806
- if (typeof item === "bigint")
12807
- return false;
12808
- if (item instanceof Point)
12809
- return true;
12810
- if (Fn.allowedLengths || lengths.secret === lengths.public)
12811
- return void 0;
12812
- const l = ensureBytes("key", item).length;
12813
- return l === lengths.public || l === lengths.publicUncompressed;
12814
- }
12815
- function getSharedSecret(secretKeyA, publicKeyB, isCompressed = true) {
12816
- if (isProbPub(secretKeyA) === true)
12817
- throw new Error("first arg must be private key");
12818
- if (isProbPub(publicKeyB) === false)
12819
- throw new Error("second arg must be public key");
12820
- const s = _normFnElement(Fn, secretKeyA);
12821
- const b2 = Point.fromHex(publicKeyB);
12822
- return b2.multiply(s).toBytes(isCompressed);
12823
- }
12824
- const bits2int = ecdsaOpts.bits2int || function(bytes3) {
12882
+ const bits2int = ecdsaOpts.bits2int || function bits2int_def(bytes3) {
12825
12883
  if (bytes3.length > 8192)
12826
12884
  throw new Error("input is too large");
12827
12885
  const num = bytesToNumberBE(bytes3);
12828
12886
  const delta = bytes3.length * 8 - fnBits;
12829
12887
  return delta > 0 ? num >> BigInt(delta) : num;
12830
12888
  };
12831
- const bits2int_modN = ecdsaOpts.bits2int_modN || function(bytes3) {
12889
+ const bits2int_modN = ecdsaOpts.bits2int_modN || function bits2int_modN_def(bytes3) {
12832
12890
  return Fn.create(bits2int(bytes3));
12833
12891
  };
12834
12892
  const ORDER_MASK = bitMask(fnBits);
@@ -12836,21 +12894,20 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
12836
12894
  aInRange("num < 2^" + fnBits, num, _0n6, ORDER_MASK);
12837
12895
  return Fn.toBytes(num);
12838
12896
  }
12839
- function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
12897
+ function validateMsgAndHash(message, prehash) {
12898
+ _abytes2(message, void 0, "message");
12899
+ return prehash ? _abytes2(hash(message), void 0, "prehashed message") : message;
12900
+ }
12901
+ function prepSig(message, privateKey, opts) {
12840
12902
  if (["recovered", "canonical"].some((k) => k in opts))
12841
12903
  throw new Error("sign() legacy options not supported");
12842
- let { lowS, prehash, extraEntropy: ent } = opts;
12843
- if (lowS == null)
12844
- lowS = true;
12845
- msgHash = ensureBytes("msgHash", msgHash);
12846
- validateSigVerOpts(opts);
12847
- if (prehash)
12848
- msgHash = ensureBytes("prehashed msgHash", hash(msgHash));
12849
- const h1int = bits2int_modN(msgHash);
12904
+ const { lowS, prehash, extraEntropy } = validateSigOpts(opts, defaultSigOpts);
12905
+ message = validateMsgAndHash(message, prehash);
12906
+ const h1int = bits2int_modN(message);
12850
12907
  const d = _normFnElement(Fn, privateKey);
12851
12908
  const seedArgs = [int2octets(d), int2octets(h1int)];
12852
- if (ent != null && ent !== false) {
12853
- const e = ent === true ? randomBytes_(lengths.secret) : ent;
12909
+ if (extraEntropy != null && extraEntropy !== false) {
12910
+ const e = extraEntropy === true ? randomBytes2(lengths.secretKey) : extraEntropy;
12854
12911
  seedArgs.push(ensureBytes("extraEntropy", e));
12855
12912
  }
12856
12913
  const seed = concatBytes(...seedArgs);
@@ -12870,76 +12927,62 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
12870
12927
  let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n6);
12871
12928
  let normS = s;
12872
12929
  if (lowS && isBiggerThanHalfOrder(s)) {
12873
- normS = normalizeS(s);
12930
+ normS = Fn.neg(s);
12874
12931
  recovery ^= 1;
12875
12932
  }
12876
12933
  return new Signature2(r, normS, recovery);
12877
12934
  }
12878
12935
  return { seed, k2sig };
12879
12936
  }
12880
- const defaultSigOpts = { lowS: ecdsaOpts.lowS, prehash: false };
12881
- const defaultVerOpts = { lowS: ecdsaOpts.lowS, prehash: false };
12882
- function sign(msgHash, secretKey, opts = defaultSigOpts) {
12883
- const { seed, k2sig } = prepSig(msgHash, secretKey, opts);
12884
- const drbg = createHmacDrbg(hash.outputLen, Fn.BYTES, hmac_);
12885
- return drbg(seed, k2sig);
12886
- }
12887
- Point.BASE.precompute(8);
12888
- function verify(signature, msgHash, publicKey, opts = defaultVerOpts) {
12889
- const sg = signature;
12890
- msgHash = ensureBytes("msgHash", msgHash);
12891
- publicKey = ensureBytes("publicKey", publicKey);
12892
- validateSigVerOpts(opts);
12893
- const { lowS, prehash, format } = opts;
12894
- if ("strict" in opts)
12895
- throw new Error("options.strict was renamed to lowS");
12896
- let _sig = void 0;
12897
- let P;
12898
- if (format === void 0) {
12899
- const isHex = typeof sg === "string" || isBytes2(sg);
12900
- const isObj = !isHex && sg !== null && typeof sg === "object" && typeof sg.r === "bigint" && typeof sg.s === "bigint";
12901
- if (!isHex && !isObj)
12902
- throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
12903
- if (isObj) {
12904
- _sig = new Signature2(sg.r, sg.s);
12905
- } else if (isHex) {
12937
+ function sign(message, secretKey, opts = {}) {
12938
+ message = ensureBytes("message", message);
12939
+ const { seed, k2sig } = prepSig(message, secretKey, opts);
12940
+ const drbg = createHmacDrbg(hash.outputLen, Fn.BYTES, hmac2);
12941
+ const sig = drbg(seed, k2sig);
12942
+ return sig;
12943
+ }
12944
+ function tryParsingSig(sg) {
12945
+ let sig = void 0;
12946
+ const isHex = typeof sg === "string" || isBytes2(sg);
12947
+ const isObj = !isHex && sg !== null && typeof sg === "object" && typeof sg.r === "bigint" && typeof sg.s === "bigint";
12948
+ if (!isHex && !isObj)
12949
+ throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
12950
+ if (isObj) {
12951
+ sig = new Signature2(sg.r, sg.s);
12952
+ } else if (isHex) {
12953
+ try {
12954
+ sig = Signature2.fromBytes(ensureBytes("sig", sg), "der");
12955
+ } catch (derError) {
12956
+ if (!(derError instanceof DER.Err))
12957
+ throw derError;
12958
+ }
12959
+ if (!sig) {
12906
12960
  try {
12907
- _sig = Signature2.fromDER(sg);
12908
- } catch (derError) {
12909
- if (!(derError instanceof DER.Err))
12910
- throw derError;
12911
- }
12912
- if (!_sig) {
12913
- try {
12914
- _sig = Signature2.fromCompact(sg);
12915
- } catch (error) {
12916
- return false;
12917
- }
12961
+ sig = Signature2.fromBytes(ensureBytes("sig", sg), "compact");
12962
+ } catch (error) {
12963
+ return false;
12918
12964
  }
12919
12965
  }
12920
- } else {
12921
- if (format === "compact" || format === "der") {
12922
- if (typeof sg !== "string" && !isBytes2(sg))
12923
- throw new Error('"der" / "compact" format expects Uint8Array signature');
12924
- _sig = Signature2.fromBytes(ensureBytes("sig", sg), format);
12925
- } else if (format === "js") {
12926
- if (!(sg instanceof Signature2))
12927
- throw new Error('"js" format expects Signature instance');
12928
- _sig = sg;
12929
- } else {
12930
- throw new Error('format must be "compact", "der" or "js"');
12931
- }
12932
12966
  }
12933
- if (!_sig)
12967
+ if (!sig)
12968
+ return false;
12969
+ return sig;
12970
+ }
12971
+ function verify(signature, message, publicKey, opts = {}) {
12972
+ const { lowS, prehash, format } = validateSigOpts(opts, defaultSigOpts);
12973
+ publicKey = ensureBytes("publicKey", publicKey);
12974
+ message = validateMsgAndHash(ensureBytes("message", message), prehash);
12975
+ if ("strict" in opts)
12976
+ throw new Error("options.strict was renamed to lowS");
12977
+ const sig = format === void 0 ? tryParsingSig(signature) : Signature2.fromBytes(ensureBytes("sig", signature), format);
12978
+ if (sig === false)
12934
12979
  return false;
12935
12980
  try {
12936
- P = Point.fromHex(publicKey);
12937
- if (lowS && _sig.hasHighS())
12981
+ const P = Point.fromBytes(publicKey);
12982
+ if (lowS && sig.hasHighS())
12938
12983
  return false;
12939
- if (prehash)
12940
- msgHash = hash(msgHash);
12941
- const { r, s } = _sig;
12942
- const h = bits2int_modN(msgHash);
12984
+ const { r, s } = sig;
12985
+ const h = bits2int_modN(message);
12943
12986
  const is = Fn.inv(s);
12944
12987
  const u1 = Fn.create(h * is);
12945
12988
  const u2 = Fn.create(r * is);
@@ -12952,20 +12995,23 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
12952
12995
  return false;
12953
12996
  }
12954
12997
  }
12955
- function keygen(seed) {
12956
- const secretKey = utils.randomSecretKey(seed);
12957
- return { secretKey, publicKey: getPublicKey(secretKey) };
12998
+ function recoverPublicKey(signature, message, opts = {}) {
12999
+ const { prehash } = validateSigOpts(opts, defaultSigOpts);
13000
+ message = validateMsgAndHash(message, prehash);
13001
+ return Signature2.fromBytes(signature, "recovered").recoverPublicKey(message).toBytes();
12958
13002
  }
12959
13003
  return Object.freeze({
12960
13004
  keygen,
12961
13005
  getPublicKey,
12962
- sign,
12963
- verify,
12964
13006
  getSharedSecret,
12965
13007
  utils,
13008
+ lengths,
12966
13009
  Point,
13010
+ sign,
13011
+ verify,
13012
+ recoverPublicKey,
12967
13013
  Signature: Signature2,
12968
- info: { type: "weierstrass", lengths, publicKeyHasPrefix: true }
13014
+ hash
12969
13015
  });
12970
13016
  }
12971
13017
  function _weierstrass_legacy_opts_to_new(c) {
@@ -12983,7 +13029,7 @@ function _weierstrass_legacy_opts_to_new(c) {
12983
13029
  const Fn = Field(CURVE.n, {
12984
13030
  BITS: c.nBitLength,
12985
13031
  allowedLengths,
12986
- modOnDecode: c.wrapPrivateKey
13032
+ modFromBytes: c.wrapPrivateKey
12987
13033
  });
12988
13034
  const curveOpts = {
12989
13035
  Fp,
@@ -13008,10 +13054,11 @@ function _ecdsa_legacy_opts_to_new(c) {
13008
13054
  };
13009
13055
  return { CURVE, curveOpts, hash: c.hash, ecdsaOpts };
13010
13056
  }
13011
- function _ecdsa_new_output_to_legacy(c, ecdsa2) {
13012
- return Object.assign({}, ecdsa2, {
13013
- ProjectivePoint: ecdsa2.Point,
13014
- CURVE: c
13057
+ function _ecdsa_new_output_to_legacy(c, _ecdsa) {
13058
+ const Point = _ecdsa.Point;
13059
+ return Object.assign({}, _ecdsa, {
13060
+ ProjectivePoint: Point,
13061
+ CURVE: Object.assign({}, c, nLength(Point.Fn.ORDER, Point.Fn.BITS))
13015
13062
  });
13016
13063
  }
13017
13064
  function weierstrass(c) {
@@ -13021,13 +13068,13 @@ function weierstrass(c) {
13021
13068
  return _ecdsa_new_output_to_legacy(c, signs);
13022
13069
  }
13023
13070
 
13024
- // ../../node_modules/.pnpm/@noble+curves@1.9.4/node_modules/@noble/curves/esm/_shortw_utils.js
13071
+ // ../../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/_shortw_utils.js
13025
13072
  function createCurve(curveDef, defHash) {
13026
13073
  const create2 = (hash) => weierstrass({ ...curveDef, hash });
13027
13074
  return { ...create2(defHash), create: create2 };
13028
13075
  }
13029
13076
 
13030
- // ../../node_modules/.pnpm/@noble+curves@1.9.4/node_modules/@noble/curves/esm/secp256k1.js
13077
+ // ../../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/secp256k1.js
13031
13078
  var secp256k1_CURVE = {
13032
13079
  p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),
13033
13080
  n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),
@@ -13067,10 +13114,10 @@ function sqrtMod(y) {
13067
13114
  throw new Error("Cannot find square root");
13068
13115
  return root;
13069
13116
  }
13070
- var Fpk1 = Field(secp256k1_CURVE.p, void 0, void 0, { sqrt: sqrtMod });
13117
+ var Fpk1 = Field(secp256k1_CURVE.p, { sqrt: sqrtMod });
13071
13118
  var secp256k1 = createCurve({ ...secp256k1_CURVE, Fp: Fpk1, lowS: true, endo: secp256k1_ENDO }, sha256);
13072
13119
 
13073
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/universalAddress.js
13120
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/universalAddress.js
13074
13121
  var algorandAppIdLayout = [
13075
13122
  { name: "appIdPrefix", binary: "bytes", custom: encoding_exports.bytes.encode("appID"), omit: true },
13076
13123
  { name: "appId", binary: "uint", size: 8 }
@@ -13130,7 +13177,7 @@ var UniversalAddress2 = class _UniversalAddress {
13130
13177
  }
13131
13178
  };
13132
13179
 
13133
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/address.js
13180
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/address.js
13134
13181
  function isChainSpecificAddress(thing) {
13135
13182
  return typeof thing === "object" && "setChain" in thing;
13136
13183
  }
@@ -13160,7 +13207,7 @@ function toUniversal(chain2, address) {
13160
13207
  return new UniversalAddress2(address, platformToAddressFormat.get(platform));
13161
13208
  }
13162
13209
 
13163
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/vaa/registration.js
13210
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/vaa/registration.js
13164
13211
  var composeLiteral = (protocol, payloadName) => protocol ? `${protocol}:${payloadName}` : payloadName;
13165
13212
  var payloadFactory = /* @__PURE__ */ new Map();
13166
13213
  function registerPayloadType(protocol, name, layout) {
@@ -13174,13 +13221,13 @@ function registerPayloadTypes(protocol, payloads) {
13174
13221
  registerPayloadType(protocol, name, layout);
13175
13222
  }
13176
13223
 
13177
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/amount.js
13224
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/amount.js
13178
13225
  var amountItem = {
13179
13226
  binary: "uint",
13180
13227
  size: 32
13181
13228
  };
13182
13229
 
13183
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/chain.js
13230
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/chain.js
13184
13231
  var chainItemBase = { binary: "uint", size: 2 };
13185
13232
  var chainItem = (opts) => ({
13186
13233
  ...chainItemBase,
@@ -13201,7 +13248,7 @@ var chainItem = (opts) => ({
13201
13248
  }
13202
13249
  });
13203
13250
 
13204
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/circle.js
13251
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/circle.js
13205
13252
  var circleDomainItem = {
13206
13253
  binary: "uint",
13207
13254
  size: 4
@@ -13211,19 +13258,19 @@ var circleNonceItem = {
13211
13258
  size: 8
13212
13259
  };
13213
13260
 
13214
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/date.js
13261
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/date.js
13215
13262
  var dateConversion = {
13216
13263
  to: (encoded) => new Date(Number(encoded * 1000n)),
13217
13264
  from: (decoded) => BigInt(decoded.getTime()) / 1000n
13218
13265
  };
13219
13266
 
13220
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/guardianSet.js
13267
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/guardianSet.js
13221
13268
  var guardianSetItem = {
13222
13269
  binary: "uint",
13223
13270
  size: 4
13224
13271
  };
13225
13272
 
13226
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/payloadId.js
13273
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/payloadId.js
13227
13274
  var payloadIdItem = (id2) => ({
13228
13275
  name: "payloadId",
13229
13276
  binary: "uint",
@@ -13232,13 +13279,13 @@ var payloadIdItem = (id2) => ({
13232
13279
  omit: true
13233
13280
  });
13234
13281
 
13235
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/sequence.js
13282
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/sequence.js
13236
13283
  var sequenceItem = {
13237
13284
  binary: "uint",
13238
13285
  size: 8
13239
13286
  };
13240
13287
 
13241
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/signature.js
13288
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/signature.js
13242
13289
  var Signature = class {
13243
13290
  r;
13244
13291
  s;
@@ -13282,7 +13329,7 @@ var SignatureUtils;
13282
13329
  SignatureUtils2.recover = recover;
13283
13330
  })(SignatureUtils || (SignatureUtils = {}));
13284
13331
 
13285
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/signature.js
13332
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/signature.js
13286
13333
  var signatureLayout = [
13287
13334
  { name: "r", binary: "uint", size: 32 },
13288
13335
  { name: "s", binary: "uint", size: 32 },
@@ -13297,7 +13344,7 @@ var signatureItem = {
13297
13344
  }
13298
13345
  };
13299
13346
 
13300
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/universalAddress.js
13347
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/universalAddress.js
13301
13348
  var universalAddressItem = {
13302
13349
  binary: "bytes",
13303
13350
  size: 32,
@@ -13307,7 +13354,7 @@ var universalAddressItem = {
13307
13354
  }
13308
13355
  };
13309
13356
 
13310
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/string.js
13357
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/layout-items/string.js
13311
13358
  var trimZeros = (arr) => {
13312
13359
  const i = arr.findIndex((x) => x !== 0);
13313
13360
  return -1 < i ? arr.slice(i) : new Uint8Array([]);
@@ -13325,7 +13372,7 @@ var fixedLengthStringItem = (size) => ({
13325
13372
  }
13326
13373
  });
13327
13374
 
13328
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/vaa/vaa.js
13375
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/vaa/vaa.js
13329
13376
  var guardianSignatureLayout = [
13330
13377
  { name: "guardianIndex", binary: "uint", size: 1 },
13331
13378
  { name: "signature", ...signatureItem }
@@ -13345,7 +13392,7 @@ var envelopeLayout = [
13345
13392
  ];
13346
13393
  var baseLayout = [...headerLayout, ...envelopeLayout];
13347
13394
 
13348
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/vaa/functions.js
13395
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/vaa/functions.js
13349
13396
  function getPayloadLayout(layoutLiteral) {
13350
13397
  const layout = payloadFactory.get(layoutLiteral);
13351
13398
  if (!layout)
@@ -13362,15 +13409,15 @@ function payloadDiscriminator(payloadLiterals, allowAmbiguous) {
13362
13409
  return payloadNames.map((name) => composeLiteral(protocol, name));
13363
13410
  })();
13364
13411
  const discriminator = buildDiscriminator(literals.map((literal) => getPayloadLayout(literal)), !!allowAmbiguous);
13365
- return (data) => {
13412
+ return ((data) => {
13366
13413
  if (typeof data === "string")
13367
13414
  data = encoding_exports.hex.decode(data);
13368
13415
  const cands = discriminator(data);
13369
13416
  return Array.isArray(cands) ? cands.map((c) => literals[c]) : cands !== null ? literals[cands] : null;
13370
- };
13417
+ });
13371
13418
  }
13372
13419
 
13373
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/circleBridge/automaticCircleBridgeLayout.js
13420
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/circleBridge/automaticCircleBridgeLayout.js
13374
13421
  var depositWithPayloadLayout = (customPayload) => [
13375
13422
  payloadIdItem(1),
13376
13423
  {
@@ -13400,7 +13447,7 @@ var automaticCircleBridgeNamedPayloads = [
13400
13447
  ];
13401
13448
  registerPayloadTypes("AutomaticCircleBridge", automaticCircleBridgeNamedPayloads);
13402
13449
 
13403
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/circleBridge/circleBridgeLayout.js
13450
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/circleBridge/circleBridgeLayout.js
13404
13451
  var messageVersionItem = { binary: "uint", size: 4, custom: 0, omit: true };
13405
13452
  var circleBurnMessageLayout = [
13406
13453
  // messageBodyVersion is:
@@ -13430,7 +13477,7 @@ var circleBridgeNamedPayloads = [
13430
13477
  ];
13431
13478
  registerPayloadTypes("CircleBridge", circleBridgeNamedPayloads);
13432
13479
 
13433
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/circleBridge/circleBridge.js
13480
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/circleBridge/circleBridge.js
13434
13481
  var CircleBridge;
13435
13482
  (function(CircleBridge2) {
13436
13483
  const _protocol = "CircleBridge";
@@ -13454,7 +13501,7 @@ var AutomaticCircleBridge;
13454
13501
  AutomaticCircleBridge2.getTransferDiscriminator = lazyInstantiate(() => payloadDiscriminator([_protocol, _payloads]));
13455
13502
  })(AutomaticCircleBridge || (AutomaticCircleBridge = {}));
13456
13503
 
13457
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/tokenBridge/tokenBridgeLayout.js
13504
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/tokenBridge/tokenBridgeLayout.js
13458
13505
  var fixedLengthStringItem2 = {
13459
13506
  binary: "bytes",
13460
13507
  size: 32,
@@ -13516,7 +13563,7 @@ var tokenBridgeNamedPayloads = [
13516
13563
  ];
13517
13564
  registerPayloadTypes("TokenBridge", tokenBridgeNamedPayloads);
13518
13565
 
13519
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/portico/porticoLayout.js
13566
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/portico/porticoLayout.js
13520
13567
  var flagsItem = bitsetItem(["shouldWrapNative", "shouldUnwrapNative"]);
13521
13568
  var porticoFlagSetLayout = [
13522
13569
  { name: "recipientChain", binary: "uint", endianness: "little", size: 2 },
@@ -13551,7 +13598,7 @@ var namedPayloads = [
13551
13598
  ];
13552
13599
  registerPayloadTypes("PorticoBridge", namedPayloads);
13553
13600
 
13554
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/portico/portico.js
13601
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/portico/portico.js
13555
13602
  var PorticoBridge;
13556
13603
  (function(PorticoBridge2) {
13557
13604
  const _protocol = "PorticoBridge";
@@ -13571,7 +13618,7 @@ var PorticoBridge;
13571
13618
  };
13572
13619
  })(PorticoBridge || (PorticoBridge = {}));
13573
13620
 
13574
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/relayer/relayerLayout.js
13621
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/relayer/relayerLayout.js
13575
13622
  var encodedExecutionInfoItem = {
13576
13623
  binary: "bytes",
13577
13624
  layout: [
@@ -13638,7 +13685,7 @@ var namedPayloads2 = [
13638
13685
  ];
13639
13686
  registerPayloadTypes("Relayer", namedPayloads2);
13640
13687
 
13641
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/tokenBridge/automaticTokenBridgeLayout.js
13688
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/tokenBridge/automaticTokenBridgeLayout.js
13642
13689
  var connectPayload = [
13643
13690
  payloadIdItem(1),
13644
13691
  { name: "targetRelayerFee", ...amountItem },
@@ -13650,7 +13697,7 @@ var automaticTokenBridgeNamedPayloads = [
13650
13697
  ];
13651
13698
  registerPayloadTypes("AutomaticTokenBridge", automaticTokenBridgeNamedPayloads);
13652
13699
 
13653
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/tokenBridge/tokenBridge.js
13700
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/tokenBridge/tokenBridge.js
13654
13701
  var TokenBridge;
13655
13702
  (function(TokenBridge2) {
13656
13703
  const _protocol = "TokenBridge";
@@ -13670,21 +13717,21 @@ var ExecutorTokenBridge;
13670
13717
  const _payloads = ["TransferWithExecutorRelay"];
13671
13718
  })(ExecutorTokenBridge || (ExecutorTokenBridge = {}));
13672
13719
 
13673
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/tokenBridge/executorTokenBridgeLayout.js
13720
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/tokenBridge/executorTokenBridgeLayout.js
13674
13721
  var payload = [{ name: "targetRecipient", ...universalAddressItem }];
13675
13722
  var executorTokenBridgeNamedPayloads = [
13676
13723
  ["TransferWithExecutorRelay", transferWithPayloadLayout(payload)]
13677
13724
  ];
13678
13725
  registerPayloadTypes("ExecutorTokenBridge", executorTokenBridgeNamedPayloads);
13679
13726
 
13680
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/governance/globalAccountant.js
13727
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/governance/globalAccountant.js
13681
13728
  var modificationKinds = [
13682
13729
  ["Add", 1],
13683
13730
  ["Subtract", 2],
13684
13731
  ["Unknown", 3]
13685
13732
  ];
13686
13733
 
13687
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/governance/layout.js
13734
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/governance/layout.js
13688
13735
  var rawEvmAddressItem = {
13689
13736
  binary: "bytes",
13690
13737
  size: 20,
@@ -13946,7 +13993,7 @@ registerPayloadTypes("GeneralPurposeGovernance", generalPurposeGovernancePayload
13946
13993
  registerPayloadTypes("WormchainGovernance", wormchainGovernancePayloads);
13947
13994
  registerPayloadTypes("GatewayGovernance", gatewayGovernancePayloads);
13948
13995
 
13949
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/tbtc/tbtc.js
13996
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/tbtc/tbtc.js
13950
13997
  var TBTCBridge;
13951
13998
  (function(TBTCBridge2) {
13952
13999
  const _protocol = "TBTCBridge";
@@ -13964,7 +14011,7 @@ var TBTCBridge;
13964
14011
  };
13965
14012
  })(TBTCBridge || (TBTCBridge = {}));
13966
14013
 
13967
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/tbtc/tbtcLayout.js
14014
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/tbtc/tbtcLayout.js
13968
14015
  var tbtcPayloadLayout = [
13969
14016
  { name: "recipient", ...universalAddressItem }
13970
14017
  ];
@@ -13977,7 +14024,7 @@ var namedPayloads3 = [
13977
14024
  ];
13978
14025
  registerPayloadTypes("TBTCBridge", namedPayloads3);
13979
14026
 
13980
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/executor/relayInstruction.js
14027
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/executor/relayInstruction.js
13981
14028
  var gasInstructionLayout = [
13982
14029
  { name: "gasLimit", binary: "uint", size: 16 },
13983
14030
  { name: "msgValue", binary: "uint", size: 16 }
@@ -14006,7 +14053,7 @@ var relayInstructionsLayout = [
14006
14053
  }
14007
14054
  ];
14008
14055
 
14009
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/executor/signedQuote.js
14056
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/executor/signedQuote.js
14010
14057
  var quoteLayout = [
14011
14058
  {
14012
14059
  name: "quote",
@@ -14049,7 +14096,7 @@ var signedQuoteLayout = [
14049
14096
  { name: "signature", binary: "bytes", size: 65 }
14050
14097
  ];
14051
14098
 
14052
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.2.0/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/executor/api.js
14099
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-definitions@3.4.3/node_modules/@wormhole-foundation/sdk-definitions/dist/esm/protocols/executor/api.js
14053
14100
  var RelayStatus;
14054
14101
  (function(RelayStatus2) {
14055
14102
  RelayStatus2["Pending"] = "pending";
@@ -14068,7 +14115,7 @@ var RequestPrefix;
14068
14115
  RequestPrefix2["ERC2"] = "ERC2";
14069
14116
  })(RequestPrefix || (RequestPrefix = {}));
14070
14117
 
14071
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/executorTokenBridge.js
14118
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/executorTokenBridge.js
14072
14119
  var RELAYER_ABI = [
14073
14120
  "function transferTokensWithRelay(address token, uint256 amount, uint16 targetChain, bytes32 targetRecipient, uint32 nonce, bytes32 dstTransferRecipient, bytes32 dstExecutionAddress, uint256 executionAmount, address refundAddr, bytes calldata signedQuoteBytes, bytes calldata relayInstructions) payable returns (uint64)",
14074
14121
  "function wrapAndTransferEthWithRelay(uint16 targetChain, bytes32 targetRecipient, uint32 nonce, bytes32 dstTransferRecipient, bytes32 dstExecutionAddress, uint256 executionAmount, address refundAddr, bytes calldata signedQuoteBytes, bytes calldata relayInstructions) payable returns (uint64)",
@@ -14187,14 +14234,14 @@ var EvmExecutorTokenBridge = class _EvmExecutorTokenBridge {
14187
14234
  }
14188
14235
  };
14189
14236
 
14190
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/ethers-contracts/index.js
14237
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/ethers-contracts/index.js
14191
14238
  var ethers_contracts_exports2 = {};
14192
14239
  __export(ethers_contracts_exports2, {
14193
14240
  Bridge__factory: () => Bridge__factory,
14194
14241
  TokenBridgeRelayer__factory: () => TokenBridgeRelayer__factory
14195
14242
  });
14196
14243
 
14197
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/ethers-contracts/factories/Bridge__factory.js
14244
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/ethers-contracts/factories/Bridge__factory.js
14198
14245
  var _abi2 = [
14199
14246
  {
14200
14247
  anonymous: false,
@@ -15434,7 +15481,7 @@ var Bridge__factory = class extends ContractFactory {
15434
15481
  }
15435
15482
  };
15436
15483
 
15437
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/ethers-contracts/factories/TokenBridgeRelayer__factory.js
15484
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/ethers-contracts/factories/TokenBridgeRelayer__factory.js
15438
15485
  var _abi3 = [
15439
15486
  {
15440
15487
  inputs: [
@@ -16505,7 +16552,7 @@ var TokenBridgeRelayer__factory = class extends ContractFactory {
16505
16552
  }
16506
16553
  };
16507
16554
 
16508
- // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.2.0_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/index.js
16555
+ // ../../node_modules/.pnpm/@wormhole-foundation+sdk-evm-tokenbridge@3.4.3_bufferutil@4.0.9_utf-8-validate@5.0.10/node_modules/@wormhole-foundation/sdk-evm-tokenbridge/dist/esm/index.js
16509
16556
  registerProtocol2(_platform2, "TokenBridge", EvmTokenBridge);
16510
16557
  registerProtocol2(_platform2, "AutomaticTokenBridge", EvmAutomaticTokenBridge);
16511
16558
  registerProtocol2(_platform2, "ExecutorTokenBridge", EvmExecutorTokenBridge);